mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
perf(editor): avoid redundant dom query when editing single block (#11732)
This commit is contained in:
@@ -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;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user