When moving the selection programmatically, the formatting and style does not seem to be updated for its new position.
Lexical version: 0.44+ (possibly even earlier)
Steps To Reproduce
- Select some text with some formatting (e.g. "bold" via
dispatchCommand) or style (e.g. via $patchStyleText).
- Trigger a
getRoot().selectStart(), getRoot().selectEnd() or similar programmatic movement of the selection.
Link to code example:
https://stackblitz.com/edit/github-zdwwiaov?file=src%2Fmain.ts
The current behavior
The values in $getSelection().hasFormat(...) or $getSelectionStyle($getSelection(), ...) still report the values for the formatting/style from step 1.
The expected behavior
The formatting/style should reflect the new position of the selection from step 2. That would align with its behavior if the selection was moved with a mouse click or a keyboard command.
When moving the selection programmatically, the formatting and style does not seem to be updated for its new position.
Lexical version: 0.44+ (possibly even earlier)
Steps To Reproduce
dispatchCommand) or style (e.g. via$patchStyleText).getRoot().selectStart(),getRoot().selectEnd()or similar programmatic movement of the selection.Link to code example:
https://stackblitz.com/edit/github-zdwwiaov?file=src%2Fmain.ts
The current behavior
The values in
$getSelection().hasFormat(...)or$getSelectionStyle($getSelection(), ...)still report the values for the formatting/style from step 1.The expected behavior
The formatting/style should reflect the new position of the selection from step 2. That would align with its behavior if the selection was moved with a mouse click or a keyboard command.