TinyMCE中自己的默认表格样式

TinyMCE中自己的默认表格样式,tinymce,default,moodle,Tinymce,Default,Moodle,我想在TinyMCE编辑器中将自己的表格样式设置为默认样式(Moodle 2.2.3中的版本3.4.9)。 现在,我的新样式显示在下拉列表中,但我无法将其作为默认表格样式。默认值始终为“-not set--”,这意味着不会使用任何表样式 目前情况是这样的: 这就是它在结尾的样子(“Tircia样式”应该是默认的): 图片来自Tinymcefrom。在tables.js中添加以下代码: function init() { settings = tinyMCE.settings;

我想在TinyMCE编辑器中将自己的表格样式设置为默认样式(Moodle 2.2.3中的版本3.4.9)。 现在,我的新样式显示在下拉列表中,但我无法将其作为默认表格样式。默认值始终为“-not set--”,这意味着不会使用任何表样式

目前情况是这样的:

这就是它在结尾的样子(“Tircia样式”应该是默认的):


图片来自Tinymcefrom。

在tables.js中添加以下代码:

 function init() {
   settings = tinyMCE.settings;       
   settings["table_styles"] =  "default1=red;default2=blue;" + settings["table_styles"];
   tinyMCE.settings["table_styles"] = settings["table_styles"];

我也有同样的问题,我试图通过传递配置或更改库JavaScript文件来解决它。我开始做
table.js
()的逆向工程。但是,没有运气

所以,我转到了
table.htm
(),这是table插件的模态对话框的模板文件。从select控件中注释掉预设选项
{not_set}

<tr id="styleSelectRow">
    <td><label id="classlabel" for="class">{#class_name}</label></td>
    <td colspan="3">
        <select id="class" name="class" class="mceEditableSelect">
            <!--<option value="" selected="selected">{#not_set}</option>-->
        </select>
    </td>
</tr>
这不是一个理想的解决方案,但目前它仍然有效。我希望TinyMCE developer在未来的版本中提供配置选项来控制select control。

如果您使用未声明的TinyMCE.js,您可以编辑plugin.js(\TinyMCE\js\TinyMCE\plugins\table\plugin.js)。在当前版本中,它是第1872行。我添加了使默认表格样式具有响应性

html = '<div class="table-responsive"><table class="table"><tbody>';  // line 1882 or 1916
html += '</tbody></table></div>'; // line 1884 or 1928
html='';//第1882行或第1916行
html+='';//第1884行或第1928行

不要修改核心文件。我意识到以前没有选择,但在TinyMCE 4.x中,现在有一种方法可以使用
table\u default\u styles
设置默认表格样式


初始化tinymce时,请将路径添加到新css文件,该文件将定义编辑器中使用的样式

tinymce.init({
        content_css: [
        '/css/innerLayout.css'
      ]
});
表格innerLayout.css的一些示例样式-

.mce-content-body table{width:100%;border-spacing:0;border-collapse:separate;border:0}
.mce-content-body table tr:nth-child(even){background:#FAFAFA}
.mce-content-body table caption,.mce-content-body table td,.mce-content-body table th{padding:15px 7px;border:0;font:inherit}
.mce-content-body table th{font-weight:400;color:#6E6E6E;border-bottom:2px solid #B9B9B9!important;

其他样式可以在这里找到-

谢谢您的回复,但是我在哪里可以找到tables.js?在table plugin目录中只有一个table.js(没有“s”),在那里我找不到上面的代码:(你的图片链接没有用,它们在登录后。请将图片放在公共图片托管网站上并编辑你的问题。
.mce-content-body table{width:100%;border-spacing:0;border-collapse:separate;border:0}
.mce-content-body table tr:nth-child(even){background:#FAFAFA}
.mce-content-body table caption,.mce-content-body table td,.mce-content-body table th{padding:15px 7px;border:0;font:inherit}
.mce-content-body table th{font-weight:400;color:#6E6E6E;border-bottom:2px solid #B9B9B9!important;