ckeditor - 在ckeditor中创建可以应用于div的样式?

标签 ckeditor

我的 ckeditor WYSIWYG 可以选择创建 div。我正在尝试创建一种可以放在“样式”下拉列表中的样式:

enter image description here

我试过将以下内容添加到我的 config.js 中,但似乎没有效果。

CKEDITOR.stylesSet.add( 'default',
[
    // Inline styles
    { name : 'Titulo Explicacion Servicio', element : 'div', attributes : { 'class' : 'titulo_explicacion_servicio' } },
    { name : 'Texto Explicacion Servicio', element : 'div', attributes : { 'class' : 'texto_explicacion_servicio' } },
    { name : 'Texto Fondo Foto', element : 'div', attributes : { 'class' : 'intro_fondo_foto' } }
]); 

我怀疑这有什么不同,但这是针对 Drupal 站点的。

最佳答案

我在styles.js 中找到了我需要更改的内容

CKEDITOR.stylesSet.add( 'default', [


    { name: 'Italic Title',     element: 'h2', styles: { 'font-style': 'italic' } },
    { name: 'Subtitle',         element: 'h3', styles: { 'color': '#aaa', 'font-style': 'italic' } },
    {
        name: 'Image caption', //THESE NEXT 4 LINES I CHANGED 
        element: 'div',
        attributes: {
            class: 'caption-mine'
        }
    },

关于ckeditor - 在ckeditor中创建可以应用于div的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18210839/

相关文章:

javascript - 使用 ckeditor 内联编辑后无法保存数据

javascript - CKEditor 文件浏览器中的自定义按钮

java - docx4j 转换 html->docx->html

javascript - 无法使 CKEditor InsertHTML 在 IE 8 上工作

c# - 图像浏览器在 Razor View 的 CkEditor 中不工作

ckeditor - 如何将 Google 翻译与 CKEditor 结合使用?

javascript - 与 CKEditor 3 集成的 ASPNetSpell 拼写检查器不适用于 Chrome

php - 如何让 CKeditor 从 Hspace 和 Vspace 切换到正确的 CSS

ckeditor - 如何修复屏幕上的ckeditor工具栏?

javascript - 如何使用组合键使用 'key' 事件在 CK Editor 中调用自定义方法