diff --git a/packages/sheets-drawing-ui/src/services/canvas-float-dom-manager.service.ts b/packages/sheets-drawing-ui/src/services/canvas-float-dom-manager.service.ts index 92e53cb232f..6d39a81216a 100644 --- a/packages/sheets-drawing-ui/src/services/canvas-float-dom-manager.service.ts +++ b/packages/sheets-drawing-ui/src/services/canvas-float-dom-manager.service.ts @@ -492,7 +492,7 @@ export class SheetCanvasFloatDomManagerService extends Disposable { ); } - addFloatDomToPosition(layer: ICanvasFloatDom, propId?: string) { + addFloatDomToPosition(layer: ICanvasFloatDom, propId?: string, executeCommand = true) { const target = getSheetCommandTarget(this._univerInstanceService, { unitId: layer.unitId, subUnitId: layer.subUnitId, @@ -528,17 +528,18 @@ export class SheetCanvasFloatDomManagerService extends Disposable { data, allowTransform, }; - - this._commandService.executeCommand(InsertSheetDrawingCommand.id, { - unitId, - drawings: [sheetDrawingParam], - } as IInsertDrawingCommandParams); - + if (executeCommand) { + this._commandService.executeCommand(InsertSheetDrawingCommand.id, { + unitId, + drawings: [sheetDrawingParam], + } as IInsertDrawingCommandParams); + } return { id, dispose: () => { this._removeDom(id, true); }, + sheetDrawingParam, }; }