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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat(sheet): add short to clear range values (#105)
Wenzhao Hu53c9ec366d9e
diff --git a/packages/base-sheets/src/Commands/Commands/clear-selection-content.command.ts b/packages/base-sheets/src/Commands/Commands/clear-selection-content.command.tsindex c05d265b6c..64b046ae9c 100644--- a/packages/base-sheets/src/Commands/Commands/clear-selection-content.command.ts+++ b/packages/base-sheets/src/Commands/Commands/clear-selection-content.command.ts@@ -23,9 +23,8 @@ export const ClearSelectionContentCommand: ICommand = {return false;}- const range = selections[0];const clearMutationParams: ISetRangeValuesMutationParams = {- rangeData: range,+ rangeData: selections,worksheetId: worksheet.getSheetId(),};const undoClearMutationParams: ISetRangeValuesMutationParams = SetRangeValuesUndoMutationFactory(accessor, clearMutationParams);diff --git a/packages/base-sheets/src/Commands/Mutations/set-range-values.mutation.ts b/packages/base-sheets/src/Commands/Mutations/set-range-values.mutation.tsindex 711b7812a4..15428c5620 100644--- a/packages/base-sheets/src/Commands/Mutations/set-range-values.mutation.ts+++ b/packages/base-sheets/src/Commands/Mutations/set-range-values.mutation.ts@@ -1,14 +1,14 @@import {- IMutation,CommandType,- ICurrentUniverService,+ createRowColIter,ICellData,- ObjectMatrix,- Tools,- ObjectMatrixPrimitiveType,ICopyToOptionsData,+ ICurrentUniverService,+ IMutation,IRangeData,- createRowColIter,+ ObjectMatrix,+ ObjectMatrixPrimitiveType,+ Tools,} from '@univerjs/core';import { IAccessor } from '@wendellhu/redi';diff --git a/packages/ui-plugin-sheets/src/Controller/shortcut.controller.ts b/packages/ui-plugin-sheets/src/Controller/shortcut.controller.tsindex 4d57ff1a7f..7ffd0beb9d 100644--- a/packages/ui-plugin-sheets/src/Controller/shortcut.controller.ts+++ b/packages/ui-plugin-sheets/src/Controller/shortcut.controller.ts@@ -10,6 +10,7 @@ import {} from '@univerjs/base-sheets';import { IShortcutService } from '@univerjs/base-ui';import { Disposable, ICommandService } from '@univerjs/core';+import {ExpandSelectionDownShortcutItem,ExpandSelectionEndDownShortcutItem,@@ -29,6 +30,7 @@ import {MoveSelectionUpShortcutItem,} from './shortcuts/selection.shortcut';import { SetBoldShortcutItem, SetItalicShortcutItem, SetStrikeThroughShortcutItem, SetUnderlineShortcutItem } from './shortcuts/style.shortcut';+import { ClearSelectionValueShortcutItem } from './shortcuts/value.shortcut';export class DesktopSheetShortcutController extends Disposable {constructor(@IShortcutService private readonly _shortcutService: IShortcutService, @ICommandService private readonly _commandService: ICommandService) {@@ -69,6 +71,8 @@ export class DesktopSheetShortcutController extends Disposable {SetItalicShortcutItem,SetUnderlineShortcutItem,SetStrikeThroughShortcutItem,++ ClearSelectionValueShortcutItem,].forEach((item) => {this.disposeWithMe(this._shortcutService.registerShortcut(item));});diff --git a/packages/ui-plugin-sheets/src/Controller/shortcuts/value.shortcut.ts b/packages/ui-plugin-sheets/src/Controller/shortcuts/value.shortcut.tsnew file mode 100644index 0000000000..3b42a5c9a3--- /dev/null+++ b/packages/ui-plugin-sheets/src/Controller/shortcuts/value.shortcut.ts@@ -0,0 +1,7 @@+import { ClearSelectionContentCommand } from '@univerjs/base-sheets';+import { IShortcutItem, KeyCode } from '@univerjs/base-ui';++export const ClearSelectionValueShortcutItem: IShortcutItem = {+ id: ClearSelectionContentCommand.id,+ binding: KeyCode.BACKSPACE,+};