如何在 React Ckeditor5 中允许 id 属性?

问题描述

我有@ckeditor/ckeditor5-reactckeditor5 加载初始数据,其中 id 属性。但是 ckeditor 删除了 id 属性。我想在文本中允许 id 属性

const value = "<p id="b-1">Oops</p>";

return <CKEditor
        editor={Editor}
        data={value}
        onChange={onArticleChange}
        config={editorConfiguration}
        
        onReady={(editor) => {         
          
          // doesn't work
          editor.model.schema.extend('paragraph',{
             allowAttributes: ['id'],})

           // it doesn't work too 
           editor.model.schema.extend('$text',{
            allowAttributes: ['id'],})  
        }}
      />

当我在 console.log editor.getData() 或 Chrome 中点击 Inspect 时,我总是看到 <p>Oops</p>

如何在文本中允许 id 属性

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)