我目前正在使用 CKEditor 5 在我的应用程序中拥有一个文本编辑器(用 nextjs 制作)。问题是,我希望我的编辑器输出是 HTML,而不是 markdown。
当前编辑器代码
<CKEditor
// @ts-ignore
editor={CKEditorCustomBuild}
onChange={(event: any, editor: any) => {
const data = editor.getData();
onChange(data);
}}
/>
data
函数内部onChange
的输出类似于:
Hello there, my _name_ is **John Doe**.
我想要以下格式:
Hello there, my <u>name</u> is <strong>John Doe</strong>.
我怎样才能实现这一目标?
与@endbermudas 的评论中的每个讨论:
CKEditor 5 默认以 HTML 格式输出内容。如果您将 Markdown 作为输出,则您可能正在使用 Markdown 插件或配置为输出 Markdown 的自定义构建。