mirror of
https://github.com/facebook/lexical.git
synced 2025-05-21 17:17:16 +08:00
Allow code highlighting to run without active selection (#2891)
This commit is contained in:

committed by
GitHub

parent
364abd43b4
commit
4f99705555
@ -310,7 +310,10 @@ function updateAndRetainSelection(
|
||||
updateFn: () => boolean,
|
||||
): void {
|
||||
const selection = $getSelection();
|
||||
if (!$isRangeSelection(selection) || !selection.anchor) {
|
||||
// If it's not range selection (or null selection) there's no need to change it,
|
||||
// but we can still run highlighting logic
|
||||
if (!$isRangeSelection(selection)) {
|
||||
updateFn();
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user