perf(editor): avoid redundant dom query when editing single block (#11732)

This commit is contained in:
Yifeng Wang
2025-04-16 17:52:22 +08:00
committed by GitHub
parent 71114e8935
commit 16f7be7f0b

View File

@@ -40,6 +40,13 @@ export const getInlineRangeProvider: (
return null;
}
if (
textSelection.isInSameBlock() &&
textSelection.from.blockId !== element.blockId
) {
return null;
}
const elementRange = rangeManager.textSelectionToRange(
selectionManager.create(TextSelection, {
from: {
@@ -98,6 +105,7 @@ export const getInlineRangeProvider: (
inlineRange$.value = null;
return;
}
const inlineRange = calculateInlineRange(range, textSelection);
inlineRange$.value = inlineRange;
})