【发布时间】:2013-11-19 05:38:24
【问题描述】:
我们正在使用最新的 TinyMCE 版本 v 4.0.10
我们需要加载 content_css 并在 styleselect 菜单中查看样式下拉菜单。
根据 TinyMCE 4.x 的文档,我们尝试使用 importcss 插件来实现这一点。
但我们无法在 styleselect 菜单中看到样式下拉菜单。
下面是相同的代码 sn-p:
theme: "modern",
menubar : false,
statusbar: false,
plugins: [
"advlist autolink lists autoresize link image charmap print preview hr anchor",
"searchreplace wordcount visualblocks visualchars code fullscreen pagebreak",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons paste textcolor spellchecker template noneditable importcss"
],
contextmenu: "cut copy paste | image inserttable",
toolbar1: button1,
toolbar2: button2,
toolbar_items_size: 'small',
content_css: "/CSS/user.css",
style_formats: [{title: 'Example 1', inline: 'span', classes: 'example1'}],
importcss_append: true
这里button1,button2在运行时获取值,正确呈现工具栏菜单。
下面是 user.css :
body {
background-color: #FFFFFF;
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 11px;
}
td {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 10px;
}
pre {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 10px;
}
.example1 {
font-size: 14px;
font-weight: bold;
}
.example2 {
color: #FF0000;
font-size: 12px;
font-weight: bold;
}
.tablerow1 {
background-color: #BBBBBB;
}
我们期待的是:
类 example1、example2、tablerow1 应该动态加载到 styleselect/Formats 下拉菜单中,而不是硬编码(通过在 style_formats 配置选项中定义它们)
如果我们遗漏了什么,请告诉我们。
提前致谢。
【问题讨论】:
标签: javascript jquery tinymce tinymce-4