如何允许CKEditor自定义构建中的所有内容,我想进行内联样式,但未授权
这是我的ckeditor.js文件,
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
//..
export default class ClassicEditor extends ClassicEditorBase {}
// Plugins to include in the build.
ClassicEditor.builtinPlugins = [
Essentials,
UploadAdapter,
Autoformat,
Bold,
//..
PluginProcedure,
InsertTable
];
// Editor configuration.
ClassicEditor.defaultConfig = {
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'link',
'table',
'essentials',
'procedurePlugin',
'insertTable'
]
},
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'toggleImageCaption',
'imageTextAlternative'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
},
// This value must be kept in sync with the language defined in webpack.config.js.
language: 'en'
};
我想使用setData()在自定义插件中添加inline css 但是内联样式或类不起作用
的是我的插件代码:
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
import { getPosition, insertData } from './utils';
import TableIcon from './icons/table-icon.svg';
import { data } from './data-procedure';
export default class PluginProcedure extends Plugin {
init() {
const editor = this.editor;
editor.ui.componentFactory.add( 'procedurePlugin', locale => {
const view = new ButtonView( locale );
view.set( {
label: 'Procédure prélèvements ',
withText: false,
tooltip: true,
icon: TableIcon
} );
// Callback executed once the image is clicked.
view.on( 'execute', () => {
editor.model.change( writer => {
editor.setData(" <h1 style="color:red"> <h1>")
//not works
} );
} );
return view;
} );
}
}
我Google它,我发现需要配置以允许内容
allowedContent: true
extraAllowedContent: "* [*]",
它仍然无法工作,因为我不知道如何添加配置规则, 我从事自定义构建工作,请提供帮助! 或者如果有榜样。
this is my ckeditor.js file
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
//..
export default class ClassicEditor extends ClassicEditorBase {}
// Plugins to include in the build.
ClassicEditor.builtinPlugins = [
Essentials,
UploadAdapter,
Autoformat,
Bold,
//..
PluginProcedure,
InsertTable
];
// Editor configuration.
ClassicEditor.defaultConfig = {
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'link',
'table',
'essentials',
'procedurePlugin',
'insertTable'
]
},
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'toggleImageCaption',
'imageTextAlternative'
]
},
table: {
contentToolbar: [
'tableColumn',
'tableRow',
'mergeTableCells'
]
},
// This value must be kept in sync with the language defined in webpack.config.js.
language: 'en'
};
i want to add inline css in my custom plugin using setData()
but inline styling or classes not works
this is my plugin code :
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
import { getPosition, insertData } from './utils';
import TableIcon from './icons/table-icon.svg';
import { data } from './data-procedure';
export default class PluginProcedure extends Plugin {
init() {
const editor = this.editor;
editor.ui.componentFactory.add( 'procedurePlugin', locale => {
const view = new ButtonView( locale );
view.set( {
label: 'Procédure prélèvements ',
withText: false,
tooltip: true,
icon: TableIcon
} );
// Callback executed once the image is clicked.
view.on( 'execute', () => {
editor.model.change( writer => {
editor.setData(" <h1 style="color:red"> <h1>")
//not works
} );
} );
return view;
} );
}
}
i google it and i find that require a configuration to allow content
allowedContent: true
extraAllowedContent: "* [*]",
it still not works because i don't know how to add configuration rules ,
i work on custom build , please help !
or if there is exemples .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)