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.

feat(sheets-ui): add Shift + Backspace shortcut for deleting left (#5037)

ZhangWei17f3b267cbf2
diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
index daa3baec14..b7a7208065 100644
--- a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
+++ b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts
@@ -119,6 +119,7 @@ import {
EditorDeleteLeftShortcut,
EditorDeleteLeftShortcutInActive,
generateArrowSelectionShortCutItem,
+ ShiftEditorDeleteLeftShortcut,
StartEditWithF2Shortcut,
} from './shortcuts/editor.shortcut';
import { SetColHiddenShortcutItem, SetRowHiddenShortcutItem } from './shortcuts/operation.shortcut';
@@ -341,6 +342,7 @@ export class SheetUIController extends Disposable {
EditorDeleteLeftShortcutInActive,
EditorCursorEscShortcut,
EditorCursorCtrlEnterShortcut,
+ ShiftEditorDeleteLeftShortcut,
// operation shortcuts
SetRowHiddenShortcutItem,
diff --git a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
index 63fe078f86..c6a8d31eac 100644
--- a/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
+++ b/packages/sheets-ui/src/controllers/shortcuts/editor.shortcut.ts
@@ -150,6 +150,13 @@ export const EditorDeleteLeftShortcut: IShortcutItem = {
binding: KeyCode.BACKSPACE,
};
+export const ShiftEditorDeleteLeftShortcut: IShortcutItem = {
+ id: DeleteLeftCommand.id,
+ preconditions: (contextService) =>
+ whenEditorActivated(contextService) || whenFormulaEditorFocused(contextService),
+ binding: KeyCode.BACKSPACE | MetaKeys.SHIFT,
+};
+
export const EditorDeleteLeftShortcutInActive: IShortcutItem = {
id: SetCellEditVisibleOperation.id,
description: 'shortcut.sheet.delete-and-start-editing',