Open PramodK2807 opened 5 months ago
Please, show example please
`let editorRef; const editor = useRef(null);
const addSomeTextToEditor = () => { let textContainer = document.createElement("span"); textContainer.innerHTML = "add custom text to the editor on click"; editorRef.selection.insertNode(textContainer); };
<button onClick={addSomeTextToEditor }>Add Text </button>
`
this is working fine, but the text is added on start of content
When the click event occurs, the cursor leaves the editor. Try to handle pointerdown rather than click and do preventDefault() to avoid losing the cursor
Adding the content from the outside of editor (like, on button click), content is not added at the cursor position,