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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
textSelection.isInSameBlock() &&
|
||||||
|
textSelection.from.blockId !== element.blockId
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const elementRange = rangeManager.textSelectionToRange(
|
const elementRange = rangeManager.textSelectionToRange(
|
||||||
selectionManager.create(TextSelection, {
|
selectionManager.create(TextSelection, {
|
||||||
from: {
|
from: {
|
||||||
@@ -98,6 +105,7 @@ export const getInlineRangeProvider: (
|
|||||||
inlineRange$.value = null;
|
inlineRange$.value = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const inlineRange = calculateInlineRange(range, textSelection);
|
const inlineRange = calculateInlineRange(range, textSelection);
|
||||||
inlineRange$.value = inlineRange;
|
inlineRange$.value = inlineRange;
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user