【发布时间】:2021-02-01 04:18:33
【问题描述】:
在 CKEDITOR 4.0 中非常简单,禁用内容过滤
config.allowedContent = true
近一个星期以来,我一次又一次地阅读这些文档。文档中明确提到 CKEditor 5 实现了自定义数据模型。这意味着加载到编辑器中的每一条内容都需要转换为该模型,然后再渲染回视图。。我仍然不确定如何实现支持所有样式和标签的自定义数据模型。
我正在使用解耦编辑器和下面的 react js
import React from "react";
import CKEditor from "@ckeditor/ckeditor5-react";
import DecoupledcEditor from "@ckeditor/ckeditor5-build-decoupled-document";
export default function App() {
return (
<div className="App">
<CKEditor
editor={DecoupledcEditor}
data={this.state.data}
onInit={(editor) => {
console.log("Editor is ready to use!");
console.log(editor.ui.getEditableElement());
editor.ui
.getEditableElement()
.parentElement.append(editor.ui.view.toolbar.element);
}}
onChange={this.handleChange}
config={{
allowedContent:true
}}
/>
</div>
);
}
对于允许所有 html 标签和样式的新插件的任何帮助或代码片段将非常棒
【问题讨论】:
-
似乎没有允许所有样式/标签的构建,但请尝试使用这个github.com/TMH-SE/ckeditor5-build-full,如果您不断过滤掉内容,则必须编写自己的构建允许该内容,由于学习曲线长,我认为这很困难:/您可能应该考虑回到 CKEDITOR 4
标签: reactjs ckeditor ckeditor5