我有以下内容来自服务器,该服务器显示在与tinymce相连的textarea下
<p>Test1</p>
<p>Test2</p>
我在浏览器中看到以下p标签
<p>Test1</p> <p>Test2</p>
应该把它显示为
Test1
Test2
我不确定我在这里想念什么吗?我在萤火虫控制台中看不到任何错误。当我从萤火虫检查文本区域时,
它的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>
代替
<p>Test1</p>
<p>Test2</p>
正确显示在tinymce i,e中
Test1
Test2
最佳答案
<p>
被视为编辑器的字符串onInit。如果希望将其作为标签进行评估,则需要在初始化编辑器之前将<p>
替换为<
等。