mirror of
https://github.com/facebook/lexical.git
synced 2025-08-06 08:30:33 +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,
|
updateFn: () => boolean,
|
||||||
): void {
|
): void {
|
||||||
const selection = $getSelection();
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user