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(drawing): add optional param to contrl popup (#3935)
VicKun95bee3e6c89c
diff --git a/packages/drawing/src/services/drawing-manager.service.ts b/packages/drawing/src/services/drawing-manager.service.tsindex d7e7ec8f91..ee4862ff86 100644--- a/packages/drawing/src/services/drawing-manager.service.ts+++ b/packages/drawing/src/services/drawing-manager.service.ts@@ -15,9 +15,9 @@*/import type { BooleanNumber, IDisposable, Nullable } from '@univerjs/core';-import { createIdentifier } from '@univerjs/core';import type { Observable } from 'rxjs';import type { ITransformState } from './interface';+import { createIdentifier } from '@univerjs/core';export const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = '__default_document_sub_component_id20231101__';diff --git a/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.ts b/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.tsindex 6c8c61b52b..3598f5d856 100644--- a/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.ts+++ b/packages/sheets-drawing-ui/src/controllers/drawing-popup-menu.controller.ts@@ -16,14 +16,15 @@import type { IDisposable, Nullable, Workbook } from '@univerjs/core';import type { BaseObject, Scene } from '@univerjs/engine-render';+import type { ISheetFloatDom } from '@univerjs/sheets-drawing';import { connectInjector, FOCUSING_COMMON_DRAWINGS, IContextService, Inject, Injector, IUniverInstanceService, RxDisposable, toDisposable, UniverInstanceType } from '@univerjs/core';import { DrawingTypeEnum, IDrawingManagerService } from '@univerjs/drawing';import { COMPONENT_IMAGE_POPUP_MENU, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation } from '@univerjs/drawing-ui';import { IRenderManagerService } from '@univerjs/engine-render';import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';import { BuiltInUIPart, IUIPartsService } from '@univerjs/ui';-import { takeUntil } from 'rxjs';+import { takeUntil } from 'rxjs';import { RemoveSheetDrawingCommand } from '../commands/commands/remove-sheet-drawing.command';import { EditSheetDrawingOperation } from '../commands/operations/edit-sheet-drawing.operation';import { UploadLoading } from '../views/upload-loading/UploadLoading';@@ -119,6 +120,12 @@ export class DrawingPopupMenuController extends RxDisposable {}const { unitId, subUnitId, drawingId, drawingType } = drawingParam;+ // drawingParam should be ICanvasFloatDom, use for disable popup dialog+ const data = (drawingParam as ISheetFloatDom).data as Record<string, boolean>;+ if (data && data.disablePopup) {+ return;+ }+singletonPopupDisposer?.dispose();singletonPopupDisposer = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(object, {componentKey: COMPONENT_IMAGE_POPUP_MENU,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.tsindex 458eb540f5..a594f60632 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@@ -275,6 +275,13 @@ export class SheetCanvasFloatDomManagerService extends Disposable {const target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId });const floatDomParam = this._drawingManagerService.getDrawingByParam(param) as IFloatDomData;+ const workbook = this._univerInstanceService.getUnit<Workbook>(unitId)!;+ if (!workbook) {+ return;+ }++ const activeSheetId = workbook.getActiveSheet().getSheetId();+if (!floatDomParam || !target) {return;}@@ -301,6 +308,10 @@ export class SheetCanvasFloatDomManagerService extends Disposable {return true;}+ if (activeSheetId !== subUnitId) {+ return;+ }+const { left, top, width, height, angle, flipX, flipY, skewX, skewY } = transform;const rectShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId });