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 embed selection issues #4464

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

Conversation

mnordlindh
Copy link

@mnordlindh mnordlindh commented Oct 27, 2024

This update fixes an issue when the selection ends on or the cursor is at the innermost part (offset 0) of the right guard of an embed blot.

<left guard><embed content node>|cursor|<right guard>

Two common cases that this solves:

  • selecting from the left guard to the right guard offset 0 will not select the embed
  • when having the cursor at right guard offset 0 and then hitting enter the line break will be inserted before the embed and not after

The implementation suggestion is to let the leaf blot (as embed inherits from leaf) calculate the index offset even if it is at offset 0. Looking at the base implementation for the leaf and text blots is seems safe to change the order here. Another option is to add an extra check specifically for embed blots but that seems redundant if I am not missing something.

@mnordlindh
Copy link
Author

@luin what do you think? Would be great if you could have a look.

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.

1 participant