bri*_*ker 5 javascript ckeditor
当切换到/从源视图切换时,CKEditor正在剥离div CLASS属性.
这是配置:
$('.cke-editor-restrictive').ckeditor({
extraAllowedContent: [
"*[class,id]",
"a[*]",
"img[*]",
"strong", "em", "small",
"u", "s", "i", "b",
"p", "blockquote[class,id]",
"div[class,id,data-href]",
"ul", "ol", "li",
"br", "hr",
"h1", "h2", "h3", "h4", "h5", "h6",
"script[src,charset,async]",
"iframe[*]", "embed[*]", "object[*]",
"cite", "mark", "time",
"dd", "dl", "dt",
"table", "th", "tr", "td", "tbody", "thead", "tfoot"
].join("; ")
})
Run Code Online (Sandbox Code Playgroud)
和全局CKEditor配置:
CKEDITOR.editorConfig = function(config) {
config.extraPlugins = 'mediaembed,codemirror,autosave';
config.codemirror = { ... };
config.toolbar = [['Bold', 'Italic', 'Underline', "RemoveFormat"], ['NumberedList', 'BulletedList', 'Blockquote'], ['Link', 'Unlink', 'Image', 'MediaEmbed'], ['Find', 'Paste'], ['Source', 'Maximize']];
config.bodyClass = 'ckeditor-body';
config.contentsCss = "/assets/application.css";
config.baseHref = "http://www.website.org/";
config.forcePasteAsPlainText = true;
};
Run Code Online (Sandbox Code Playgroud)
我错过了什么?我一直在阅读允许内容规则的文档,看起来我做错了什么.即使我改变了div[*]它的规则,也剥离了课程.
Rei*_*mar 23
类和样式不与其他属性一起处理.他们在ACF规则中有自己的位置.要启用您要编写的所有样式:
'div{*}'
Run Code Online (Sandbox Code Playgroud)
并启用所有类:
'div(*)'
Run Code Online (Sandbox Code Playgroud)
并启用一切:
'div(*){*}[*]'
Run Code Online (Sandbox Code Playgroud)