【问题标题】:Tinymce and removeformat optionTinymce 和 removeformat 选项
【发布时间】:2017-09-08 01:27:18
【问题描述】:

我正在使用 tinymce 4 和 removeformat 按钮。它工作得很好。 现在我只需要删除特定格式(b,强)。我找到了

removeformat: [
                {selector: 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand: true, deep : true},
                {selector: 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true},                    
                {selector: '*', attributes : ['style', 'class'], split : false, expand : false, deep : true}
            ],

关于它的文档在哪里?我需要了解每个参数(展开、深入...)

如果我选择图像并单击删除格式,我将失去课程。我怎样才能避免这种行为?我试图删除 * 选择器行,但它不起作用。

我还尝试将原始 js 附加到调试中。我看到我的 removeformat 行没有被考虑。它只考虑其默认的 removeformat。

谢谢

【问题讨论】:

    标签: tinymce tinymce-4


    【解决方案1】:

    官方文档中的例子(https://www.tinymce.com/docs/configure/content-formatting/#removingaformat)是错误的。应该是:

    tinymce.init({
      selector: 'textarea',  // change this value according to your HTML
      format: {
          removeformat: [
            {selector: 'b,strong,em,i,font,u,strike', remove : 'all', split : true, expand : false, block_expand: true, deep : true},
            {selector: 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true},
            {selector: '*', attributes : ['style', 'class'], split : false, expand : false, deep : true}
          ]
      }
    });
    

    【讨论】:

    • 是的,我已经找到了。谢谢。你能纠正格式吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多