首页 文章

Indentblock CKEditor(4)插件导致包含margin属性的样式不会出现在Styles组合中

提问于
浏览
0

如果stylesSet中的样式使用margin属性,则无法将其添加到样式组合 .

删除 Indent Block 插件可解决此问题 .

但为什么?这是插件中的错误,还是编辑器库中的其他地方或我的配置?

其他样式 - 不使用margin属性 - 出现在组合中 .

我正在使用CKEditor 4.10.0 .

EDIT :更多信息:我追溯到Indent Block正在应用过滤器转换这一事实,该过滤器转换将保证金属性扩展到margin-left,margin-top,margin-right和margin-bottom,但只增加了margin-left和margin-right允许内容(属性) . 结果是margin-top和margin-bottom属性被认为是不允许的,它没有通过过滤器检查,Styles组合隐藏了样式 .

var config = {
  "stylesSet": [{
      "name": "H1 with margin",
      "element": "h1",
      "styles": {
        "margin": "0"
      }
    },
    {
      "name": "H1 without margin",
      "element": "h1",
      "styles": {
        "font-weight": "bold"
      }
    }
  ],
  "extraPlugins": "indentblock"
};

CKEDITOR.replace("editor", config);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.10.0/ckeditor.js"></script>
<div id="editor"></div>

如果上面的代码片不起作用,这里有一个JSFiddle:https://jsfiddle.net/DandyAndy/xpvt214o/729425/

结果是“没有边缘的H1 " style appears in the Styles combo but the " H1带边距”样式没有 .

加载的插件列表(所有标准)是:'dialogui,dialog,a11yhelp,dialogadvtab,basicstyles,blockquote,notification,button,toolbar,clipboard,panelbutton,panel,floatpanel,colorbutton,colordialog,templates,menu,contextmenu,copyformatting, DIV,elementspath,enterkey,实体发现,listblock,richcombo,字体,了HorizontalRule,的HTMLWriter,wysiwygarea,缩进,indentblock,indentlist,笑脸,证明,列表,liststyle,最大化,pastetext,pastefromword,打印,removeformat,全选,showblocks, showborders,sourcearea,specialchar,stylescombo,制表符,表,tabletools,tableselection,撤消” . JSFiddle上的CDN似乎没有加载indentblock插件,因此配置包含在extraPlugins中(否则问题不会发生,因为该插件不加载) .

2 回答

相关问题