就我而言,我想跟踪编辑器上的所有更改,除了检查 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 上的代码。