当我使用配置的contentsCss属性指定自定义css然后单击样式下拉列表时,自定义css文件中的类将显示两次。我究竟做错了什么?
通过查看Chrome的“网络”选项卡,当我加载包含CKEditor实例的页面时,我注意到该文件已加载一次并由ckeditor.js启动。但是当我单击样式下拉列表时,我看到另一个请求是对css文件。我不确定这是否与两次看课有关。
我已经确认编辑器正在被替换一次。此外,外部css文件的内容确实具有一次定义的类。
editor = CKEDITOR.replace("designerEditor", {
extraPlugins: "widget,div,stylesheetparser",
ignoreEmptyParagraph: false,
autoParagraph: false,
allowedContent: true,
stylesSet: [],
contentsCss: "/css/style.css",
toolbar: [
{
name: 'document', groups: ['mode', 'document', 'doctools'], items: ['CmsDesignerSourceModeButton'] },
{ name: 'clipboard', groups: ['clipboard', 'undo'], items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
{ name: 'editing', groups: ['find', 'selection'], items: ['Find', 'Replace', '-', 'SelectAll'] },
'/',
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'], items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'], items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language'] },
{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
{ name: 'insert', items: ['Paragraph', 'Image', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak', 'Iframe'] },
'/',
{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
{ name: 'colors', items: ['TextColor', 'BGColor'] },
{ name: 'tools', items: ['Maximize', 'ShowBlocks'] }
],
toolbarGroups: [
{ name: 'document', groups: ['mode', 'document', 'doctools'] },
{ name: 'clipboard', groups: ['clipboard', 'undo'] },
{ name: 'editing', groups: ['find', 'selection'] },
'/',
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'] },
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi'] },
{ name: 'links' },
{ name: 'insert' },
'/',
{ name: 'styles' },
{ name: 'colors' },
{ name: 'tools' }
]
});
好的,所以我使用了v 4.11.2并使用了“stylesheetparser”插件而不是“stylesheetparser-fixed”插件。使用“固定”版本可能会修复一些缓存问题。