gpt4 book ai didi

javascript - Tinymce 没有正确显示 html?

转载 作者:行者123 更新时间:2023-11-29 22:16:42 25 4
gpt4 key购买 nike

我有以下来自服务器的内容,我在 tinymce 附带的文本区域下显示

<p>Test1</p>
<p>Test2</p>

我在浏览器中看到下面的 p 标签

<p>Test1</p> <p>Test2</p>

应该显示为

Test1

Test2

我不确定我在这里缺少什么?我在 Firebug 控制台中没有看到任何错误。当我从 Firebug 检查我的文本区域时,它的 textarea 与 tinymce 正确连接,但不知何故没有以正确的格式显示 html 内容? 我正在使用 struts 2 textArea 即

这是我的 tinymce 配置:-

function attachTinyMCE() {
tinyMCE.init({
mode: "textareas",
theme: "advanced",
plugins: "preview",
readonly: true,
theme_advanced_buttons1: "forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,|,formatselect,fontselect,fontsizeselect,sub,sup,|,bold,italic,underline,strikethrough",
theme_advanced_buttons2: "",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_path: false,
theme_advanced_resizing: true,
entity_encoding: "raw"
});
}

更新:-如果我从服务器发送以下内容,即

 <p>Test1</p>

<p>Test2</p>

代替

&lt;p&gt;Test1&lt;/p&gt;
&lt;p&gt;Test2&lt;/p&gt;

在tinymce i,e中正确显示

Test1

Test2

最佳答案

&lt;p&gt;被视为编辑器的 onInit 字符串。如果你想让它被评估为一个标签,你需要替换 &lt;p&gt;<等等...在你初始化编辑器之前。

关于javascript - Tinymce 没有正确显示 html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14754907/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com