Hi, I have a custom tool that adds an html element inside the editor's body at the cursor position.
This works great but I wish this element to be unique so that if a user clicks the tool again, it deletes the existing element and then add it again at selection (Cursor position).
My problem is that editing the editor's value also resets the selection.
I tried saving the selection and range into a temporary variable and re-assign them or to copy the editor's selectionRestorePoint but to no avail.
Is there a way to edit the editor's content and also keep the cursor position ?
Thanks
This works great but I wish this element to be unique so that if a user clicks the tool again, it deletes the existing element and then add it again at selection (Cursor position).
My problem is that editing the editor's value also resets the selection.
I tried saving the selection and range into a temporary variable and re-assign them or to copy the editor's selectionRestorePoint but to no avail.
Is there a way to edit the editor's content and also keep the cursor position ?
Thanks