CKEditor 5-添加建议后自动接受建议
在我的例子中,我希望跟踪编辑器上的所有更改,除了检查TodoList插件。我们试图根据建议自动接受它。但我们有一个错误\CKEditor 5-添加建议后自动接受建议,ckeditor,ckeditor5,ckeditor5-react,ckeditor5-plugin,Ckeditor,Ckeditor5,Ckeditor5 React,Ckeditor5 Plugin,在我的例子中,我希望跟踪编辑器上的所有更改,除了检查TodoList插件。我们试图根据建议自动接受它。但我们有一个错误\ addSuggestion: (suggestionData) => { console.log("Suggestion added", suggestionData); props.setSuggestions({ ...suggestionData, authorId: props.use
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上的代码