-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
I'm using a editorjs-mention-tool plugin.
It will insert a <span contenteditable='false'>@user</span>
tag into a block inner html.
But if this span tag located at the first element of the block, when I tried to press the backspace
keyboard button to delete the whole span, I got this error.
Failed to execute 'setEnd' on 'Range': There is no child at offset 15.
IndexSizeError: Failed to execute 'setEnd' on 'Range': There is no child at offset 15.
situation:
<div class="ce-paragraph cdx-block" contenteditable="true" data-placeholder-active="Let's write an awesome story!" data-empty="false"><span href="kyleockford" contenteditable="false" class="mention_tool_at">[[kyleockford]]</span>|</div>
My caret is at the place of |
, then I press backspace and I got the error.
related to this function?
editor.js/src/components/utils/caret.ts
Line 10 in 6313409
export function getCaretNodeAndOffset(): [ Node | null, number ] { |
Metadata
Metadata
Assignees
Labels
No labels
Activity
neSpecc commentedon Oct 22, 2024
Yes, that is probably because browser returns incorrect selection
focusOffset
. We need to find a solution.amoydavid commentedon Oct 22, 2024
@neSpecc I've tried to make a pr #2853 for this. It seems fixed my bug.