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(sheets-drawing): drawing snapshot error (#3230)
zhangwf5f52bf767e9
diff --git a/packages/sheets-drawing-ui/src/controllers/render-controllers/sheet-drawing.render-controller.ts b/packages/sheets-drawing-ui/src/controllers/render-controllers/sheet-drawing.render-controller.tsindex 67024c32eb..cb6bf4745e 100644--- a/packages/sheets-drawing-ui/src/controllers/render-controllers/sheet-drawing.render-controller.ts+++ b/packages/sheets-drawing-ui/src/controllers/render-controllers/sheet-drawing.render-controller.ts@@ -15,6 +15,7 @@*/import { Disposable, Inject, LifecycleService, LifecycleStages, UniverInstanceType } from '@univerjs/core';+import { IDrawingManagerService } from '@univerjs/drawing';import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';import { ISheetDrawingService } from '@univerjs/sheets-drawing';import { filter, first } from 'rxjs';@@ -23,6 +24,7 @@ export class SheetsDrawingRenderController extends Disposable implements IRenderconstructor(private _context: IRenderContext,@ISheetDrawingService private readonly _sheetDrawingService: ISheetDrawingService,+ @IDrawingManagerService private readonly _drawingManagerService: IDrawingManagerService,@Inject(LifecycleService) private _lifecycleService: LifecycleService) {super();@@ -38,6 +40,7 @@ export class SheetsDrawingRenderController extends Disposable implements IRenderthis._lifecycleService.lifecycle$.pipe(filter((e) => e === LifecycleStages.Steady), first()).subscribe(() => {if (this._context.type === UniverInstanceType.UNIVER_SHEET) {this._sheetDrawingService.initializeNotification(this._context.unitId);+ this._drawingManagerService.initializeNotification(this._context.unitId);}});}diff --git a/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.ts b/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.tsindex 91dd62e371..275159da32 100644--- a/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.ts+++ b/packages/sheets-drawing-ui/src/controllers/sheet-drawing-update.controller.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import type { ICommandInfo, IDrawingSearch, IRange, Nullable, Workbook } from '@univerjs/core';+import type { ICommandInfo, IRange, Nullable, Workbook } from '@univerjs/core';import { Disposable, FOCUSING_COMMON_DRAWINGS, ICommandService, IContextService, Inject, LocaleService } from '@univerjs/core';import type { IImageData, IImageIoServiceParam } from '@univerjs/drawing';import { DRAWING_IMAGE_ALLOW_SIZE, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, DrawingTypeEnum, getImageSize, IDrawingManagerService, IImageIoService, ImageUploadStatusType } from '@univerjs/drawing';@@ -61,7 +61,6 @@ export class SheetDrawingUpdateController extends Disposable implements IRenderMthis._updateOrderListener();this._groupDrawingListener();this._focusDrawingListener();- this._drawingAddListener();}/**@@ -355,31 +354,4 @@ export class SheetDrawingUpdateController extends Disposable implements IRenderM}));}-- private _drawingAddListener() {- this.disposeWithMe(- this._sheetDrawingService.add$.subscribe((params) => {- this._registerDrawing(params);- })- );- }-- private _registerDrawing(params: IDrawingSearch[]) {- (params).forEach((param) => {- const drawingParam = this._sheetDrawingService.getDrawingByParam(param) as ISheetDrawing;-- if (drawingParam == null || drawingParam.unitId !== this._context.unitId) {- return;- }-- const { sheetTransform } = drawingParam;-- drawingParam.transform = drawingPositionToTransform(sheetTransform, this._selectionRenderService, this._skeletonManagerService);- });-- const unitId = params[0].unitId;-- this._drawingManagerService.registerDrawingData(unitId, this._sheetDrawingService.getDrawingDataForUnit(unitId));- this._drawingManagerService.initializeNotification(unitId);- }}diff --git a/packages/sheets-drawing/src/controllers/sheet-drawing.controller.ts b/packages/sheets-drawing/src/controllers/sheet-drawing.controller.tsindex d25228576e..01d89f92d5 100644--- a/packages/sheets-drawing/src/controllers/sheet-drawing.controller.ts+++ b/packages/sheets-drawing/src/controllers/sheet-drawing.controller.ts@@ -66,6 +66,7 @@ export class SheetsDrawingLoadController extends Disposable {},onLoad: (unitId, value) => {this._sheetDrawingService.registerDrawingData(unitId, value);+ this._drawingManagerService.registerDrawingData(unitId, value);},}));