In order to define custom StyleSet in CKEditor with styles from an external stylesheet, configured the following settings:
config.extraPlugins = 'stylesheetparser';
config.contentsCss = '/css/externalStyleSheet.css';
config.stylesSet = [ { name : window.parent.getResource('editor.style.normal'), element : 'span', attributes: { 'class': 'formatnormal' } }, { name : window.parent.getResource('editor.style.small'), element : 'span', attributes: { 'class': 'formatsmall' } }, { name : window.parent.getResource('editor.style.large'), element : 'span', attributes: { 'class': 'formatlarge' } }, { name : window.parent.getResource('editor.style.bold'), element : 'span', attributes: { 'class': 'formatbold' } }, { name : window.parent.getResource('editor.style.smallBold'), element : 'span', attributes: { 'class': 'formatsmallbold' } }, { name : window.parent.getResource('editor.style.largeBold'), element : 'span', attributes: { 'class': 'formatlargebold' } }, { name : window.parent.getResource('editor.style.red'), element : 'span', attributes: { 'class': 'formatred' } }, { name : window.parent.getResource('editor.style.code'), element : 'span', attributes: { 'class': 'formatcode' } }, ];
config.fullPage = true;
config.resize_enabled = false;
config.removePlugins = 'resize,autogrow,elementspath';
Expected result The styleset should show the list of custom styles. Once a text is selected, and a style is selected from the drop-down, the style should get applied.
Actual result The styleset is showing the list of custom styles with the styles applied to the labels themselves. But, when a text is selected inside the editor (which is in an iframe) and a style is selected from the drop-down, the style is applied to the "span" tag but the corresponding CSS is not present in context of the iframe.
Other details When config.fullPage = false, then there is no issue, probably because the editor is not in a different iframe and the CSS is available to it. The issue is with config.fullPage = true, which is required in our case in order to have a vertical scrollbar.
Browser: Chrome Version 66.0.3359.181
OS: Windows 10
CKEditor version: 4.9.2
Installed CKEditor plugins: none, other than the configuration mentioned above.