Skip to content

fix(caret): Improve getCaretNodeAndOffset to handle non-editable element#2853

Open
amoydavid wants to merge 1 commit intocodex-team:nextfrom
amoydavid:next
Open

fix(caret): Improve getCaretNodeAndOffset to handle non-editable element#2853
amoydavid wants to merge 1 commit intocodex-team:nextfrom
amoydavid:next

Conversation

@amoydavid
Copy link

fix #2852

  • Add handling for contenteditable='false' elements
  • Implement findFirstEditableTextNode helper function

…ents

- Add handling for contenteditable='false' elements
- Implement findFirstEditableTextNode helper function
Comment on lines +79 to +88
if (focusNode.nodeType !== Node.TEXT_NODE) {
const textNode = findFirstEditableTextNode(focusNode);
if (textNode) {
focusNode = textNode;
focusOffset = 0;
} else {
// If no editable text node found, return null
return [null, 0];
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, write tests for both cases

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 this pull request may close these issues.

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

2 participants