【问题标题】:How to use importcss plugin in TinyMCE Version 4.0.10 ? (Unable to load content_css and see a dropdown of styles)如何在 TinyMCE 版本 4.0.10 中使用 importcss 插件? (无法加载 content_css 并查看样式下拉列表)
【发布时间】: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


    【解决方案1】:

    代码对我来说看起来不错。 除了 fot CSS 文件路径。 试试这个

    content_css: "CSS/user.css" instead of content_css: "/CSS/user.css"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-07
      • 1970-01-01
      • 1970-01-01
      • 2015-09-19
      相关资源
      最近更新 更多