hi,bros!I have implemented a replacement plug-in, and the implementation code is as follows。
replaceAllword() {
console.log("click and replace All!");
let decorations_length = decorations_from.length;
if (decorations_length > 0) {
for (let i = 0; i < decorations_length; i++) {
view.dispatch(
view.state.tr.insertText(
replaceWords,
decorations_from[0],
decorations_to[0]
)
);
}
} else {
console.log("nothing to replace!");
}
},
The function has been implemented, but I found that because it is a circular call, it can’t withdraw all the replacements in the editor at one time