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

Selection's range.index is incorrect on navigation to right side of an embed #4168

Open
ryan-wheatley opened this issue May 2, 2024 · 0 comments

Comments

@ryan-wheatley
Copy link

ryan-wheatley commented May 2, 2024

See a short video

https://www.youtube.com/watch?v=Hlu5Z5wTwdc

To reproduce

  • Go to https://quilljs.com/playground/snow and add the 'formula' embed to the toolbar.
  • Create an embed formula blot with the word 'example'.
  • Ensure there is text before, after, and on the line below the embed.
  • Navigate the the cursor line below, just under the right-hand side of the embed.
  • Use the arrow up key to move the cursor to the end of the embed.
  • Press the right arrow key, or insert a character. Observe the behavior.
  • This can also be replicated by using the mouse to put the cursor at the end of the embed.

Expected Behavior

When navigating to the end of an embed in this way,

  • The right arrow should move the cursor forward one.
  • The inserted character should have the cursor after it.

Actual Behavior

  • The right arrow key does noting on the first keypress, then works as normal.
  • If instead you insert text, when the first character is inserted the cursor remains at the end of the embed.

On investigation

The 'selection-change' event cause by arrowing up to the end of the embed returns a range.index that is equal to the start of the embed, not the end. When you press the right arrow key, the cursor wont move, but 'selection-change' will then return the correct range.index.

If you use the arrow keys while staying on the same line, this bug wont happen (and range.index is correct as you go left and right of the embed).

The bug behaviour is quite frustrating for users when navigating, any help would be greatly appreciated!

Platform MacOS
Quill Version 2.0.0-rc.5

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

No branches or pull requests

1 participant