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
fix: mark selection should remove after some commands execute (#3467)
ybzky1e9cc47306ed
diff --git a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.tsindex 183ad98286..d652e62536 100644--- a/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts+++ b/packages/sheets-ui/src/controllers/clipboard/clipboard.controller.ts@@ -59,6 +59,7 @@ import { takeUntil } from 'rxjs';import type {ICellData,+ ICommandInfo,IDocumentData,IMutationInfo,IObjectArrayPrimitiveType,@@ -76,6 +77,7 @@ import type {ISetWorksheetColWidthMutationParams,ISetWorksheetRowHeightMutationParams,} from '@univerjs/sheets';+import { AddWorksheetMergeCommand } from '../../commands/commands/add-worksheet-merge.command';import {SheetCopyCommand,SheetCutCommand,@@ -124,6 +126,7 @@ export class SheetClipboardController extends RxDisposable {) {super();this._init();+ this._initCommandListener();const docSelectionRenderService = this._renderManagerService.getRenderById(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)?.with(DocSelectionRenderService);@@ -848,4 +851,14 @@ export class SheetClipboardController extends RxDisposable {return worksheet;}++ private _initCommandListener() {+ this.disposeWithMe(+ this._commandService.onCommandExecuted((command: ICommandInfo) => {+ if (command.id === AddWorksheetMergeCommand.id) {+ this._sheetClipboardService.removeMarkSelection();+ }+ })+ );+ }}diff --git a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts b/packages/sheets-ui/src/services/clipboard/clipboard.service.tsindex 57cd7c4e5c..ac93b15abf 100644--- a/packages/sheets-ui/src/services/clipboard/clipboard.service.ts+++ b/packages/sheets-ui/src/services/clipboard/clipboard.service.ts@@ -103,6 +103,8 @@ export interface ISheetClipboardService {copyContentCache(): CopyContentCache; // return the cache content for inner copy/cut/paste.addClipboardHook(hook: ISheetClipboardHook): IDisposable; // add a hook to the clipboard servicegetClipboardHooks(): ISheetClipboardHook[]; // get all hooks++ removeMarkSelection(): void;}export const ISheetClipboardService = createIdentifier<ISheetClipboardService>('sheet.clipboard-service');@@ -1066,6 +1068,13 @@ export class SheetClipboardService extends Disposable implements ISheetClipboardreturn !isRowAcross && !isColAcross;}++ removeMarkSelection() {+ if (this._copyMarkId) {+ this._markSelectionService.removeShape(this._copyMarkId);+ this._copyMarkId = null;+ }+ }}// #region copy generation