簡體   English   中英

如何在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版本v 4.0.10

我們需要加載content_css並在styleselect菜單中看到樣式的下拉列表。

根據TinyMCE 4.x的文檔,我們嘗試使用importcss插件實現此功能。

但是我們無法在styleselect菜單中看到樣式的下拉列表。

以下是相同的代碼段:

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 config選項中定義)

如果我們缺少任何東西,請告訴我們。

提前致謝。

代碼對我來說看起來不錯。 除了CSS文件路徑。 嘗試這個

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM