在某些场景下,我们可能需要用到编辑器的只读模式,方便还原 html 的样式或者格式等。
方案 1: 在初始化时,通过传入 editable:false 参数进行设置:
new LinwitDocEditor({
element: "#aiEditor",
placeholder: "点击输入内容...",
content: 'LinwitDocEditor 是一个面向 AI 的开源富文本编辑器。 ',
editable:false,
})
方案 2: 通过调用 aiEditor.setEditable(false) 进行设置:
const aiEditor = new LinwitDocEditor({
element: "#aiEditor",
placeholder: "点击输入内容...",
content: 'LinwitDocEditor 是一个面向 AI 的开源富文本编辑器。 ',
})
aiEditor.setEditable(false)