TinyMCE 正在添加 \n
以及我的文本的段落标签。不管apply_source_formatting
设置值。
IE。
源文本:
<blockquote><div class="cite">Person said:</div><div class="message"><p>ffgfgf</p></div></blockquote>
TinyMCE 将其重新格式化为:
<blockquote>\n<div class=\"cite\">Person said:</div>\n<div class=\"message\">\n<p>ffgfgf</p>\n</div>\n</blockquote>\n<p id=\"mce_1\"> </p>
我怎样才能让 TimyMCE 停止添加这样的换行符?提交文本时,它确实与另一端的格式混淆。
最佳答案
调查我发现的 TinyMce 的源代码,在 Writer.js
(现在是 Writer.ts
)类,在插入 \n
之前检查的设置被称为 indent
.
/**
* Writes the a end element such as </p>.
*
* @method end
* @param {String} name Name of the element.
*/
end: function(name) {
var value;
html.push('</', name, '>');
if (indent && indentAfter[name] && html.length > 0) {
value = html[html.length - 1];
if (value.length > 0 && value !== '\n') {
html.push('\n');
}
}
},
所以添加
indent: false
到设置对象似乎修复它。tinymce.init({
selector: 'textarea', // change this value according to your HTML
indent: false,
});
我仍然会将其归类为
indent
的相当骇人听闻的修复。 -设置不是documented任何地方。
关于javascript - TinyMCE 正在添加新行 ("\n")而不管 apply_source_formatting,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37205014/