Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: selection is wrong when select table (#2953)

Ran Luob15b46ba67ad
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 4511300329..19ab50022e 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
@@ -186,6 +186,11 @@ export function getRangeListFromSelection(
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) {
+ continue;
+ }
+
textRanges.push(new TextRange(scene, document, skeleton, ap, fp, style, segmentId));
}
}