-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[lexical-markdown] Bug Fix: standardise selection to move to start after markdown toggle #6220
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
@@ -189,7 +189,6 @@ export default function ActionsPlugin({ | |||
$createCodeNode('markdown').append($createTextNode(markdown)), | |||
); | |||
} | |||
root.selectEnd(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after removing this, we expose the selection behavior of $convertFromMarkdownString
and $convertToMarkdownString
.
$convertToMarkdownString
moves the selector (aka cursor) to the start after the markdown -> string conversion.
demo:
Screen.Recording.2024-06-05.at.3.34.06.PM.mov
in this PR adjust $convertFromMarkdownString
to do the same. Also the attached issue has raised a preference for having the cursor at the start instead of the end
Description
standardise the cursor behavior after toggling markdown, it is observed that
$convertToMarkdownString
moves cursor to the start, so make$convertFromMarkdownString
follow suit. see #6220 (comment)also, executing @etrepum 's suggestion to add documentation to highlight that the selection (aka cursor) moves after the markdown operation, since it may not be an expected behavior
Closes #6177
Test plan
Before
see video in
https://github.com/facebook/lexical/pull/6220/files#r1627137045
After
Screen.Recording.2024-06-05.at.3.26.41.PM.mov