将 html 渲染到 ckEditor5 中不会读取它的内联 css 并且 allowedContent 选项不起作用?

Rendering html into the ckEditor5 doesn't read it's inline css and allowedContent option doesn't work?

提问人:A_7097 提问时间:6/26/2023 最后编辑:Jose Manuel de FrutosA_7097 更新时间:6/26/2023 访问量:177

问:

我有一个完整的 html 页面,我需要使用 ckeditor 5 进行编辑,但它删除了 html 文件中提供的所有类和样式。如何禁用这些过滤器: allowedContent: true 不起作用。

`

import { CKEditor } from "@ckeditor/ckeditor5-react"; ``
`// import ClassicEditor from "@ckeditor/ckeditor5-build-classic";`
`import  FullPage  from '@ckeditor/ckeditor5-html-support/src/fullpage';`

`<CKEditor`
`editor={InlineEditor}`
`data={formattedText}`
`onReady={(editor) => {`
`const fontFamily = editor.commands.get("fontFamily");`
`fontFamily?.execute({ value: "Poppins" });`
`editorRef.current = editor;`
`}}`
`onChange={handleEditorChange}`
`config={{`
`allowedContent: true, // Disable content filters`
`// Add other configuration options as needed`
`}}`
`` />`

这样做可以: 这:

<span style="           color: #000000;           font-weight: 400;           text-decoration: none;           vertical-align: baseline;           font-size: 1.63rem;           font-family: 'Merriweather';           font-style: normal;         "         ><a           href="#h.2bn6wsx"           style="\n        color: inherit; text-decoration: inherit;margin-left: 0;margin-right: 10px;\n      "           >Schedule 1 Confidential           information&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&bsp;&nbsp;&nbsp;13</a         ></span>

变成这样:<p><a href="#h.wnyagw">Schedule 1 Confidential information13</a></p>

javascript reactjs html 解析 quill ckeditor5

评论


答: 暂无答案