在TinyMCE编辑器中格式化

时间:2013-03-01 05:13:35

标签: tinymce editor text-editor

TinyMce编辑器中,我们遇到了break (<br/>)个标签的问题。如果按 Enter ,有时会生成单个中断标记,有时会生成双重中断标记。

如果有人知道相关的解决方案,解决此问题将非常有帮助。

据我所知,这个中断标记的生成取决于editors,text,words, strings and space between words

2 个答案:

答案 0 :(得分:1)

有几个solutions,首先尝试设置为     convert_newlines_to_brs:false 没有引号包含false。

如果这没有用,你可以使用这个清理功能

function CustomCleanup(type, content) {
  switch (type) {
   // gets passed when user submits the form
   case "get_from_editor":
    content = content.replace(/<br \/>/gi, "\n"); // would be nice if this replace only replaces the brs in a pre block. bur for the moment it is ok.
    break;
   // gets passed when new content is inserted into the editor
   case "insert_to_editor":
    break;
  }
return content;
}

tinyMCE.init({
    ...
    cleanup_callback : "myCustomCleanup"
});

答案 1 :(得分:1)

查看下面可以帮助您的链接,

  1. TinyMCE Fiddle
  2. Full featured example
  3. HTML5 formats