-
Notifications
You must be signed in to change notification settings - Fork 58
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 position after inline paste - is broken #903
Comments
Sorry, it's not very clear to me what the issue is, so it's hard to prioritize. Can you edit the description in terms of what is broken and adding steps to reproduce and screenshot/gif/video (if it makes sense)? |
Moving to next milestone. |
After inline paste, the caret position should be "incremented" by the length of the inserted text. This is set explicitly during the paste handling via the |
As @mkevins reported :
After inline paste, the caret position should be "incremented" by the length of the inserted text. This is set explicitly during the paste handling via the forceSelectionUpdate method. A safety check was added to the render method to prevent an out of bounds exception that can occur when the caret is moved to a position that is larger than the text buffer, which may happen as a result of Aztec trimming spaces in the content.
For the purpose of checking this condition, the willTrimSpaces method https://github.com/WordPress/gutenberg/pull/15021/files#diff-4828a21853e899e5a36faecfa96d83e8R631 was introduced, which tries to evaluate whether Aztec will trim spaces, and if so, prevents setting the caret position. The regex that looks for outer spaces (that will be trimmed) also matches on any spaces adjacent to html tags (including inner tags). The result is that whenever the html contains inner tags adjacent to spaces (e.g. a bold word), the caret will not be in the correct position after paste.
The text was updated successfully, but these errors were encountered: