2016-09-07 449 views
0

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

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行不被考虑。它只考虑它的默认删除格式。

感谢

回答

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} 
     ] 
    } 
}); 
+1

是的,我已经找到它了。谢谢。你能修改格式吗? – Emanuele

+0

thx ..“格式”与s!为我工作。小4.5.1 –