Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I tried to delete the first <span contenteditable='false'> tag of a block, it raised an error #2852

Open
amoydavid opened this issue Oct 22, 2024 · 2 comments · May be fixed by #2853
Open

Comments

@amoydavid
Copy link

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?

export function getCaretNodeAndOffset(): [ Node | null, number ] {

@neSpecc
Copy link
Member

neSpecc commented Oct 22, 2024

Yes, that is probably because browser returns incorrect selection focusOffset. We need to find a solution.

@amoydavid
Copy link
Author

@neSpecc I've tried to make a pr #2853 for this. It seems fixed my bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants