如何扩展 tinyMCE table 插件
How to extend tinyMCE table plugin
有没有办法扩展 tinyMCE table 插件,使模板 table 的第一列默认宽度为 200 像素?我正在使用 inlite 主题,我希望默认的 table 模板默认如下所示:
<table>
<tr>
<td width='200px'>First columns will have 200px width by default</td>
<td></td>
</tr>
</table>
对于可能遇到此问题的任何人,BeforeSetContent 事件可用于获取插入的 table。 [https://www.tinymce.com/docs/advanced/events/#beforesetcontent][1]
tinymce.init({
selector: '.tinymce' ,
theme: 'inlite',
plugins: 'table',
insert_toolbar: 'quicktable',
table_appearance_options: true,
selection_toolbar: 'bold italic underline',
nonbreaking_force_tab: true,
inline: true,
init_instance_callback: function (editor) {
editor.on('BeforeSetContent', function (e) {
if(e.content.indexOf('<td>')){
e.content = e.content.replace(/<td>/, "<td width='200'>");
}
});
}
});
有没有办法扩展 tinyMCE table 插件,使模板 table 的第一列默认宽度为 200 像素?我正在使用 inlite 主题,我希望默认的 table 模板默认如下所示:
<table>
<tr>
<td width='200px'>First columns will have 200px width by default</td>
<td></td>
</tr>
</table>
对于可能遇到此问题的任何人,BeforeSetContent 事件可用于获取插入的 table。 [https://www.tinymce.com/docs/advanced/events/#beforesetcontent][1]
tinymce.init({
selector: '.tinymce' ,
theme: 'inlite',
plugins: 'table',
insert_toolbar: 'quicktable',
table_appearance_options: true,
selection_toolbar: 'bold italic underline',
nonbreaking_force_tab: true,
inline: true,
init_instance_callback: function (editor) {
editor.on('BeforeSetContent', function (e) {
if(e.content.indexOf('<td>')){
e.content = e.content.replace(/<td>/, "<td width='200'>");
}
});
}
});