From 6c9ecaa1a1cf070605f63cb9cc6e440e1c6009f6 Mon Sep 17 00:00:00 2001 From: DR-Univer Date: Thu, 28 Mar 2024 23:06:20 +0800 Subject: [PATCH 1/2] fix(sheet): range selector drag row --- .../sheets/src/commands/commands/utils/selection-utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sheets/src/commands/commands/utils/selection-utils.ts b/packages/sheets/src/commands/commands/utils/selection-utils.ts index 5ffa47175d1..96bf3339eb0 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; From b109fb05e5efcc0a11e542b30ada2751c86a6e4d Mon Sep 17 00:00:00 2001 From: DR-Univer Date: Mon, 1 Apr 2024 22:43:54 +0800 Subject: [PATCH 2/2] fix(sheet): range selector drag and selection border --- .../docs-ui/src/controllers/doc-editor-bridge.controller.ts | 4 +++- .../sheets-ui/src/controllers/editor-bridge.controller.ts | 6 ++++++ .../sheets-ui/src/controllers/shortcuts/editor.shortcut.ts | 2 +- .../sheets-ui/src/services/selection/selection-shape.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) 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 2dcdd963b43..b80822cf1fe 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 43f17294732..26d7ea7f909 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 d21b03b34b9..a1da9903e95 100644 --- a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts +++ b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts @@ -101,7 +101,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 4c5435d8500..9df772fafc8 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 {