fix: Search backward and forward for leaf nodes in non contenteditable elements#5936
Conversation
🦋 Changeset detectedLatest commit: 835b1d8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
How shall we proceed here @12joan ? |
Apologies if I gave you the wrong impression in the other threads where we've talked, but I'm not actually a Slate maintainer. I just comment on issues and PRs from time to time when I feel my input could be helpful. 😃 @dylans is the maintainer of Slate, and will likely review this PR in due course. |
I am sorry, there was probably some desperation involved, tagging you 🙈 Thx for the reply though @12joan and thx for proceeding @dylans ! |
Description
This PR change the
toSlatePointfunction in a way, that if the selection is within acontentEditable={false}node, it will search backward and forward for valid slate leafs. Before it was only looking backward by default.Issue
Fixes: #5932
Example

You can find a GIF and a codesandbox link in the linked issue. Here you can see how it behaves after the fix:
Context
I am aware, that this is a very sensible spot to make changes. Help appreciated!
Checks
yarn test.yarn lint. (Fix errors withyarn fix.)yarn start.)yarn changeset add.)