微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CKEditor 5 - 添加后自动接受建议

如何解决CKEditor 5 - 添加后自动接受建议

就我而言,我想跟踪编辑器上的所有更改,除了检查 TodoList 插件。我们尝试在 addSuggestion 上自动接受它。但是我们遇到了错误。 \

addSuggestion: (suggestionData) => {
    console.log("Suggestion added",suggestionData);

    props.setSuggestions({
      ...suggestionData,authorId:
        props.user.role === "admin" ? "Metarail" : user.id.toString(),});

    if (suggestionData.data.commandName === "checkTodoList") {
      const suggestion = trackChangesPlugin.getSuggestion(
        suggestionData.id
      );

      console.log(suggestion.accept);
    }

    // Write a request to your database here.
    // The returned `Promise` should be resolved when the request
    // has finished. When the promise resolves with the suggestion data
    // object,it will update the editor suggestion using the provided data.
    return Promise.resolve({
      createdAt: new Date(),// Should be set on the server side.
    });
  },

这是我在 trackChangesPlugin.adapter 上的代码

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。