【问题标题】:Copy and Paste rich text editor adds extra markup and large fonts with tinymce复制和粘贴富文本编辑器使用 tinymce 添加额外的标记和大字体
【发布时间】:2014-08-28 21:20:41
【问题描述】:

有没有办法防止在tinymce中粘贴样式和大字体?我在下面的注释部分显示了内容,但标签仍然显示增加的字体。我想要简单的 HTML,比如粗体、项目符号和链接。

.notes {
    font-size: 14px !important;
}

【问题讨论】:

    标签: javascript css tinymce copy-paste rich-text-editor


    【解决方案1】:

    像 TinyMCE 这样的编辑器总是在粘贴 html 代码时遇到问题。您可以随心所欲地摆弄设置,但仍然存在问题。但调整 TinyMCE 的设置仍然是我的第一个建议。之后,您可以使用另一个 HTML 过滤器,例如:

    http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed

    毕竟,最好不要在您的页面中包含恶意代码。

    【讨论】:

      【解决方案2】:

      打开 tinyMCE.init 并添加以下代码:

      content_css : "css/custom_content.css",
      theme_advanced_font_sizes: "10px,12px,13px,14px,16px,18px,20px",
      font_size_style_values : "10px,12px,13px,14px,16px,18px,20px",
      

      然后你就可以使用 custom_content.css

      来自TinyMCE page(请务必阅读以获取更多信息和示例)

      Note: updating the actual content.css will have no effect. You need to create a copy and reference it in tinyMCE.init().
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-09-30
        • 2011-01-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多