如何在TinyMCE 4.0.10版本中使用importcss插件?(无法加载content_css并查看样式下拉列表)
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 版本
我们需要加载content_css,并在styleselect菜单中看到样式的下拉列表。
根据TinyMCE 4.x的文档,我们尝试使用importcss插件来实现这一点。
但我们无法在样式选择菜单中看到样式的下拉列表。
以下是相同的代码片段:
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配置选项中定义它们)
如果我们遗漏了什么,请告诉我们。
提前谢谢。
代码对我来说很好。除了CSS文件路径。试试这个
content_css: "CSS/user.css" instead of content_css: "/CSS/user.css"
相关文章:
- 如何使用url加载程序在webpack中导入多个图像
- 如何在生成下载文件时显示加载动画
- 有没有任何方法可以将控制器从文件加载到ui路由器$stateProvider中
- 无法在通过jQuery的ajax加载的页面中执行javascript
- Emberjs应用程序加载在除Index之外的所有路由上
- 在chrome.tabs.onCreated之后加载HTML页面
- 单击F5时如何停止页面加载
- HTML5音频加载和播放获胜'我不能在iPad上工作
- 跟踪在页面加载时应用内联样式的JavaScript
- 在使用Polymer'加载所有json文件后执行方法;s的核心ajax
- jQuery Lazy加载动画滚动
- Html页面上的多个Base64图像和平滑加载
- jQuery UI不会加载到.button的$(“#content”).load页面上
- 如何在内容具有content-Disposition附件时实现窗口加载回调
- 为什么content.js在使用chrome扩展的facebook.com中加载两次或两次以上
- 如何正确检测iframe加载了响应204 No Content
- 仅当设置了首选项时才在content-script中加载jQuery
- Jquery ('#iframeid').load()在加载Iframe CONTENT (text,
- 使用Content-Security-Policy加载maps.googleapis.com,如何
- 在modal中加载iframe时,. mode -content被替换