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

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

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

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