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(sheet): range selector drag row (#1729)

Univer530a85297072
diff --git a/packages/docs-ui/src/controllers/doc-editor-bridge.controller.ts b/packages/docs-ui/src/controllers/doc-editor-bridge.controller.ts
index 190a62114c..823bb38618 100644
--- a/packages/docs-ui/src/controllers/doc-editor-bridge.controller.ts
+++ b/packages/docs-ui/src/controllers/doc-editor-bridge.controller.ts
@@ -173,7 +173,9 @@ export class DocEditorBridgeController extends Disposable {
const editor = this._editorService.getEditor(unitId);
- if (editor == null || editor.isSheetEditor()) {
+ const focusEditor = this._editorService.getFocusEditor();
+
+ if (editor == null || editor.isSheetEditor() || (focusEditor && focusEditor.editorUnitId === unitId)) {
return;
}
diff --git a/packages/sheets-ui/src/controllers/editor-bridge.controller.ts b/packages/sheets-ui/src/controllers/editor-bridge.controller.ts
index f5b4e130c3..6b260b574e 100644
--- a/packages/sheets-ui/src/controllers/editor-bridge.controller.ts
+++ b/packages/sheets-ui/src/controllers/editor-bridge.controller.ts
@@ -133,6 +133,12 @@ export class EditorBridgeController extends RxDisposable {
if (evt.button === 2) {
return;
}
+
+ const current = this._selectionManagerService.getCurrent();
+ if (current?.pluginName !== NORMAL_SELECTION_PLUGIN_NAME) {
+ return;
+ }
+
// this._editorBridgeService.show(DeviceInputEventType.Dblclick);
this._commandService.executeCommand(SetCellEditVisibleOperation.id, {
visible: true,
diff --git a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
index effa526f7c..aea5d698c2 100644
--- a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
+++ b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
@@ -115,7 +115,7 @@ export const EditorCursorEscShortcut: IShortcutItem = {
binding: KeyCode.ESC,
description: 'shortcut.sheet.abort-editing',
group: '4_sheet-edit',
- preconditions: (contextService) => whenSheetEditorActivated(contextService),
+ preconditions: (contextService) => whenEditorDidNotInputFormulaActivated(contextService),
staticParameters: {
visible: false,
eventType: DeviceInputEventType.Keyboard,
diff --git a/packages/sheets-ui/src/services/selection/selection-shape.ts b/packages/sheets-ui/src/services/selection/selection-shape.ts
index e14549c026..cf096e16e8 100644
--- a/packages/sheets-ui/src/services/selection/selection-shape.ts
+++ b/packages/sheets-ui/src/services/selection/selection-shape.ts
@@ -478,7 +478,7 @@ export class SelectionShape extends Disposable {
stroke: SELECTION_CONTROL_BORDER_BUFFER_COLOR,
});
- if (strokeDash == null) {
+ if (strokeDash == null || endY - startY > 1000000 || endX - startX > 100000) {
this.dashRect.hide();
this._stopAntLineAnimation();
} else {
diff --git a/packages/sheets/src/commands/commands/utils/selection-utils.ts b/packages/sheets/src/commands/commands/utils/selection-utils.ts
index 5ffa47175d..96bf3339eb 100644
--- a/packages/sheets/src/commands/commands/utils/selection-utils.ts
+++ b/packages/sheets/src/commands/commands/utils/selection-utils.ts
@@ -106,7 +106,7 @@ export function setEndForRange(range: IRange, rowCount: number, columnCount: num
}
if (Number.isNaN(endRow)) {
- range.endRow = rowCount;
+ range.endRow = rowCount - 1;
}
if (Number.isNaN(startColumn)) {
@@ -114,7 +114,7 @@ export function setEndForRange(range: IRange, rowCount: number, columnCount: num
}
if (Number.isNaN(endColumn)) {
- range.endColumn = columnCount;
+ range.endColumn = columnCount - 1;
}
return range;