From 97842a0fbace4f083011c864a27c26c7ca9a751a Mon Sep 17 00:00:00 2001 From: Ran Luo Date: Fri, 16 Aug 2024 14:45:57 +0800 Subject: [PATCH] fix(docs): delete list between tables (#3041) --- .../components/docs/text-selection/selection-utils.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/engine-render/src/components/docs/text-selection/selection-utils.ts b/packages/engine-render/src/components/docs/text-selection/selection-utils.ts index fd6bef343e5..fe31ef3a9f7 100644 --- a/packages/engine-render/src/components/docs/text-selection/selection-utils.ts +++ b/packages/engine-render/src/components/docs/text-selection/selection-utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { Nullable } from '@univerjs/core'; +import { type Nullable, Tools } from '@univerjs/core'; import type { IDocumentSkeletonGlyph, INodePosition, ITextSelectionStyle } from '../../../basics'; import { RANGE_DIRECTION } from '../../../basics'; import { getOffsetRectForDom } from '../../../basics/position'; @@ -193,9 +193,9 @@ export function getRangeListFromSelection( tableStartPosition = skeleton.findNodePositionByCharIndex(tableStart + 3, true, segmentId, segmentPage); tableEndPosition = skeleton.findNodePositionByCharIndex(tableEnd - 4, true, segmentId, segmentPage); - if (start < tableStart - 1) { + if (start <= tableStart - 1) { const sp = skeleton.findNodePositionByCharIndex(start, true, segmentId, segmentPage); - const ep = skeleton.findNodePositionByCharIndex(tableStart - 1, true, segmentId, segmentPage); + const ep = skeleton.findNodePositionByCharIndex(tableStart - 1, false, segmentId, segmentPage); const ap = direction ? sp : ep; const fp = direction ? ep : sp; @@ -222,12 +222,12 @@ export function getRangeListFromSelection( if ((end >= startIndex && end <= endIndex) || endInTable) { const sp = skeleton.findNodePositionByCharIndex(start, true, segmentId, segmentPage); - const ep = skeleton.findNodePositionByCharIndex(end, true, segmentId, segmentPage); + const ep = skeleton.findNodePositionByCharIndex(end, !endInTable, segmentId, segmentPage); const ap = direction ? sp : ep; const fp = direction ? ep : sp; // Can not create cursor(startOffset === endOffset) and rect range at the same time. - if (rectRanges.length && start === end) { + if (rectRanges.length && Tools.diffValue(ap, fp)) { continue; }