If a style in stylesSet uses the margin property it fails to be added to the Styles combo.
Removing the Indent Block plugin resolves the problem.
But why? Is this a bug in the plugin, or elsewhere in the editor library, or with my configuration?
Other styles - not using the margin property - appear in the combo.
I am using CKEditor 4.10.0.
EDIT: More info: I tracked it down to the fact that Indent Block is applying filter transformations which expand margin property into margin-left, margin-top, margin-right and margin-bottom, but only adds margin-left and margin-right to allowed content (properties). The result is that the margin-top and margin-bottom properties are deemed not allowed, it fails the filter check, and the Styles combo hides the style.
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>
In case the above snippet doesn't work, there is a JSFiddle here: https://jsfiddle.net/DandyAndy/xpvt214o/729425/
The result is that the "H1 without margin" style appears in the Styles combo but the "H1 with margin" style does not.
The list of plugins loaded (all standard) are: 'dialogui,dialog,a11yhelp,dialogadvtab,basicstyles,blockquote,notification,button,toolbar,clipboard,panelbutton,panel,floatpanel,colorbutton,colordialog,templates,menu,contextmenu,copyformatting,div,elementspath,enterkey,entities,find,listblock,richcombo,font,horizontalrule,htmlwriter,wysiwygarea,indent,indentblock,indentlist,smiley,justify,list,liststyle,maximize,pastetext,pastefromword,print,removeformat,selectall,showblocks,showborders,sourcearea,specialchar,stylescombo,tab,table,tabletools,tableselection,undo'. The CDN on JSFiddle seems to not load the indentblock plugin, so the config has that included in extraPlugins (otherwise the problem doesn't occur because that plugin doesn't load).