Allow code highlighting to run without active selection (#2891)

This commit is contained in:
Maksim Horbachevsky
2022-08-25 12:28:08 -04:00
committed by GitHub
parent 364abd43b4
commit 4f99705555

View File

@ -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;
}