我在表上添加类时遇到一些问题。
我想这段代码



<table></table>





单击tinymce中的一个按钮即可成为此代码。



<table class="try-class"></table>





我有添加按钮,仍然无法解决如何在tinymce表插件上添加代码。
谢谢... :)

最佳答案

查看TinyMCE配置文件的style_formats选项:

https://www.tinymce.com/docs/configure/content-formatting/#style_formats

您可以将某个标签定位为与您要添加的样式相关的标签。例如:

style_formats: [
    {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
    {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
    {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
]


...将允许您在编辑器中的tablerow1标记中添加类<tr>

关于javascript - 如何在tinymce中使用javascript在表上添加类?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39568434/

10-14 18:57
查看更多