Thank you for your reply. By examining the source code, I discovered the widget.type.spec.raw property. Setting it to true allowed me to remove the contenteditable attribute.
After removing contenteditable, it fixes: #1520. I’m not sure if other issues exist.

const cursor = document.createElement("span");
cursor.classList.add('caret')
return DecorationSet.create(state.doc, [
Decoration.widget(from, () => cursor, {side: -1, ignoreSelection: true, raw: true})
]);