【问题标题】:Formatting In TinyMCE Editor在 TinyMCE 编辑器中格式化
【发布时间】:2013-03-01 05:13:34
【问题描述】:

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

如果有人知道这方面的相关解决方案,那将非常有助于解决这个问题。

据我了解,此中断标记的生成取决于editors,text,words, strings and space between words

【问题讨论】:

  • 你用的是什么浏览器?
  • Safari、Chrome 和 Internet Explorer...
  • 使用enter 应该创建一个新段落<p>,而不是双换行符,shit+enter 应该使用单行换行符<br />
  • 你能提供一个活生生的例子吗?还是 tinymce.fiddle?

标签: tinymce editor text-editor


【解决方案1】:

查看以下对您有帮助的链接,

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

【讨论】:

    【解决方案2】:

    有几个solutions,先尝试设置为 convert_newlines_to_brs: 假 不带引号为 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"
    });
    

    【讨论】:

    • 我想在保存到数据库之前进行这种格式化。因为只有用户知道它在反射页面中的显示方式。
    猜你喜欢
    • 1970-01-01
    • 2020-03-20
    • 1970-01-01
    • 1970-01-01
    • 2012-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多