Skip to content

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

Open
@amoydavid

Description

@amoydavid

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 ] {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions