@univerjs/docs-drawing-ui 1.0.0-alpha.8 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -227,7 +227,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
227
227
  const scaleHeight = _univerjs_drawing.DRAWING_IMAGE_HEIGHT_LIMIT / height;
228
228
  scale = Math.min(scaleWidth, scaleHeight);
229
229
  }
230
- const imagePosition = insertPosition !== null && insertPosition !== void 0 ? insertPosition : this._getCurrentImageInsertPosition();
230
+ const imagePosition = insertPosition ?? this._getCurrentImageInsertPosition();
231
231
  const docTransform = this._getImagePosition(width * scale, height * scale, imagePosition);
232
232
  if (docTransform == null) return;
233
233
  const transform = (0, _univerjs_docs.docDrawingPositionToTransform)(docTransform);
@@ -270,8 +270,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
270
270
  return editArea === _univerjs_engine_render.DocumentEditArea.HEADER || editArea === _univerjs_engine_render.DocumentEditArea.FOOTER;
271
271
  }
272
272
  _getImagePosition(imageWidth, imageHeight, insertPosition) {
273
- var _ref;
274
- return (0, _univerjs_docs.buildDocTransform)(imageWidth, imageHeight, { left: ((_ref = insertPosition !== null && insertPosition !== void 0 ? insertPosition : this._getCurrentImageInsertPosition()) !== null && _ref !== void 0 ? _ref : {
273
+ return (0, _univerjs_docs.buildDocTransform)(imageWidth, imageHeight, { left: (insertPosition ?? this._getCurrentImageInsertPosition() ?? {
275
274
  left: 0,
276
275
  top: 0
277
276
  }).left });
@@ -325,8 +324,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
325
324
  }
326
325
  _focusDrawingListener() {
327
326
  this.disposeWithMe(this._drawingManagerService.focus$.subscribe((params) => {
328
- var _this$_getCurrentScen;
329
- const { transformer, docsLeft, docsTop } = (_this$_getCurrentScen = this._getCurrentSceneAndTransformer()) !== null && _this$_getCurrentScen !== void 0 ? _this$_getCurrentScen : {};
327
+ const { transformer, docsLeft, docsTop } = this._getCurrentSceneAndTransformer() ?? {};
330
328
  if (params == null || params.length === 0) {
331
329
  this._contextService.setContextValue(_univerjs_core.FOCUSING_COMMON_DRAWINGS, false);
332
330
  this._docDrawingService.focusDrawing([]);
@@ -350,10 +348,9 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
350
348
  }));
351
349
  }
352
350
  _findSegmentIdByDrawingId(drawingId) {
353
- var _body$customBlocks;
354
351
  const { unit: DocDataModel } = this._context;
355
352
  const { body, headers = {}, footers = {} } = DocDataModel.getSnapshot();
356
- if (((_body$customBlocks = body === null || body === void 0 ? void 0 : body.customBlocks) !== null && _body$customBlocks !== void 0 ? _body$customBlocks : []).some((b) => b.blockId === drawingId)) return "";
353
+ if (((body === null || body === void 0 ? void 0 : body.customBlocks) ?? []).some((b) => b.blockId === drawingId)) return "";
357
354
  for (const headerId of Object.keys(headers)) {
358
355
  var _headers$headerId$bod;
359
356
  if ((_headers$headerId$bod = headers[headerId].body.customBlocks) === null || _headers$headerId$bod === void 0 ? void 0 : _headers$headerId$bod.some((b) => b.blockId === drawingId)) return headerId;
@@ -427,9 +424,9 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
427
424
  }));
428
425
  }
429
426
  _setDrawingSelections(params) {
430
- var _unit$getSnapshot$bod, _unit$getSnapshot$bod2;
427
+ var _unit$getSnapshot$bod;
431
428
  const { unit } = this._context;
432
- const customBlocks = (_unit$getSnapshot$bod = (_unit$getSnapshot$bod2 = unit.getSnapshot().body) === null || _unit$getSnapshot$bod2 === void 0 ? void 0 : _unit$getSnapshot$bod2.customBlocks) !== null && _unit$getSnapshot$bod !== void 0 ? _unit$getSnapshot$bod : [];
429
+ const customBlocks = ((_unit$getSnapshot$bod = unit.getSnapshot().body) === null || _unit$getSnapshot$bod === void 0 ? void 0 : _unit$getSnapshot$bod.customBlocks) ?? [];
433
430
  const ranges = params.map((item) => {
434
431
  const id = item.drawingId;
435
432
  const block = customBlocks.find((b) => b.blockId === id);
@@ -463,10 +460,10 @@ const InsertDocImageCommand = {
463
460
  id: "doc.command.insert-float-image",
464
461
  type: _univerjs_core.CommandType.COMMAND,
465
462
  handler: (accessor) => {
466
- var _getCurrentTypeOfRend, _getCurrentTypeOfRend2;
463
+ var _getCurrentTypeOfRend;
467
464
  const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
468
465
  const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
469
- return (_getCurrentTypeOfRend = (_getCurrentTypeOfRend2 = (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_DOC, univerInstanceService, renderManagerService)) === null || _getCurrentTypeOfRend2 === void 0 ? void 0 : _getCurrentTypeOfRend2.with(DocDrawingUpdateRenderController).insertDocImage()) !== null && _getCurrentTypeOfRend !== void 0 ? _getCurrentTypeOfRend : false;
466
+ return ((_getCurrentTypeOfRend = (0, _univerjs_engine_render.getCurrentTypeOfRenderer)(_univerjs_core.UniverInstanceType.UNIVER_DOC, univerInstanceService, renderManagerService)) === null || _getCurrentTypeOfRend === void 0 ? void 0 : _getCurrentTypeOfRend.with(DocDrawingUpdateRenderController).insertDocImage()) ?? false;
470
467
  }
471
468
  };
472
469
 
@@ -543,19 +540,10 @@ const MoveDocDrawingsCommand = {
543
540
  const { positionH, positionV } = drawingData.docTransform;
544
541
  const newPositionH = { ...positionH };
545
542
  const newPositionV = { ...positionV };
546
- if (direction === _univerjs_core.Direction.UP) {
547
- var _newPositionV$posOffs;
548
- newPositionV.posOffset = ((_newPositionV$posOffs = newPositionV.posOffset) !== null && _newPositionV$posOffs !== void 0 ? _newPositionV$posOffs : 0) - 2;
549
- } else if (direction === _univerjs_core.Direction.DOWN) {
550
- var _newPositionV$posOffs2;
551
- newPositionV.posOffset = ((_newPositionV$posOffs2 = newPositionV.posOffset) !== null && _newPositionV$posOffs2 !== void 0 ? _newPositionV$posOffs2 : 0) + 2;
552
- } else if (direction === _univerjs_core.Direction.LEFT) {
553
- var _newPositionH$posOffs;
554
- newPositionH.posOffset = ((_newPositionH$posOffs = newPositionH.posOffset) !== null && _newPositionH$posOffs !== void 0 ? _newPositionH$posOffs : 0) - 2;
555
- } else if (direction === _univerjs_core.Direction.RIGHT) {
556
- var _newPositionH$posOffs2;
557
- newPositionH.posOffset = ((_newPositionH$posOffs2 = newPositionH.posOffset) !== null && _newPositionH$posOffs2 !== void 0 ? _newPositionH$posOffs2 : 0) + 2;
558
- }
543
+ if (direction === _univerjs_core.Direction.UP) newPositionV.posOffset = (newPositionV.posOffset ?? 0) - 2;
544
+ else if (direction === _univerjs_core.Direction.DOWN) newPositionV.posOffset = (newPositionV.posOffset ?? 0) + 2;
545
+ else if (direction === _univerjs_core.Direction.LEFT) newPositionH.posOffset = (newPositionH.posOffset ?? 0) - 2;
546
+ else if (direction === _univerjs_core.Direction.RIGHT) newPositionH.posOffset = (newPositionH.posOffset ?? 0) + 2;
559
547
  return {
560
548
  drawingId,
561
549
  key: direction === _univerjs_core.Direction.UP || direction === _univerjs_core.Direction.DOWN ? "positionV" : "positionH",
@@ -670,7 +658,7 @@ function calcDocFloatDomPositionByRect(rect, scene, opacity = 1, angle = 0) {
670
658
  left: false,
671
659
  top: false
672
660
  },
673
- opacity: opacity !== null && opacity !== void 0 ? opacity : 1
661
+ opacity: opacity ?? 1
674
662
  };
675
663
  }
676
664
  function calcDocFloatDomPosition(object, renderUnit) {
@@ -697,6 +685,9 @@ function pickValidCustomBlockRenderViewport(viewport) {
697
685
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.contentHeight)) result.contentHeight = viewport.contentHeight;
698
686
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.contentWidth)) result.contentWidth = viewport.contentWidth;
699
687
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.height)) result.height = viewport.height;
688
+ if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.pageContentWidth)) result.pageContentWidth = viewport.pageContentWidth;
689
+ const viewScale = viewport === null || viewport === void 0 ? void 0 : viewport.viewScale;
690
+ if (isPositiveNumber(viewScale)) result.viewScale = viewScale;
700
691
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.viewportHeight)) result.viewportHeight = viewport.viewportHeight;
701
692
  return Object.keys(result).length ? result : void 0;
702
693
  }
@@ -783,6 +774,10 @@ let DocFloatDomController = class DocFloatDomController extends _univerjs_core.D
783
774
  position$,
784
775
  id: rectParam.drawingId,
785
776
  componentKey: rectParam.componentKey,
777
+ contentBox: isSheetLikeEmbedFloatDomRuntimeParam(runtimeParam) ? {
778
+ contentInset: 0,
779
+ wrapperInset: 0
780
+ } : void 0,
786
781
  eventPassThrough: preserveRuntimeGeometry ? false : void 0,
787
782
  preserveOnFocusChange: preserveRuntimeGeometry,
788
783
  onPointerDown: (evt) => {
@@ -820,7 +815,7 @@ let DocFloatDomController = class DocFloatDomController extends _univerjs_core.D
820
815
  params.forEach((param) => {
821
816
  var _this$_canvasFloatDom;
822
817
  const floatDomInfo = this._domLayerInfoMap.get(param.drawingId);
823
- if (!floatDomInfo) return;
818
+ if (!floatDomInfo || floatDomInfo.unitId !== param.unitId) return;
824
819
  const runtimeParam = param;
825
820
  const runtimeViewport = pickValidCustomBlockRenderViewport(runtimeParam.customBlockRenderViewport);
826
821
  if (runtimeViewport) floatDomInfo.runtimeViewport = runtimeViewport;
@@ -877,12 +872,14 @@ let DocFloatDomController = class DocFloatDomController extends _univerjs_core.D
877
872
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
878
873
  if (commandInfo.id === _univerjs_docs_ui.SetDocZoomRatioOperation.id) {
879
874
  const { unitId } = commandInfo.params;
880
- updateDoc(unitId);
875
+ globalThis.queueMicrotask(() => {
876
+ if (!this._disposed) updateDoc(unitId);
877
+ });
881
878
  }
882
879
  }));
883
880
  }
884
881
  insertFloatDom(floatDom, opts) {
885
- var _skeleton$getSkeleton, _opts$width, _opts$drawingId;
882
+ var _skeleton$getSkeleton;
886
883
  const currentDoc = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
887
884
  if (!currentDoc) return false;
888
885
  const render = this._getSceneAndTransformerByDrawingSearch(currentDoc.getUnitId());
@@ -893,7 +890,7 @@ let DocFloatDomController = class DocFloatDomController extends _univerjs_core.D
893
890
  const width = pageWidth - marginLeft - marginRight;
894
891
  const docTransform = {
895
892
  size: {
896
- width: (_opts$width = opts.width) !== null && _opts$width !== void 0 ? _opts$width : width,
893
+ width: opts.width ?? width,
897
894
  height: opts.height
898
895
  },
899
896
  positionH: {
@@ -906,7 +903,7 @@ let DocFloatDomController = class DocFloatDomController extends _univerjs_core.D
906
903
  },
907
904
  angle: 0
908
905
  };
909
- const drawingId = (_opts$drawingId = opts.drawingId) !== null && _opts$drawingId !== void 0 ? _opts$drawingId : (0, _univerjs_core.generateRandomId)();
906
+ const drawingId = opts.drawingId ?? (0, _univerjs_core.generateRandomId)();
910
907
  const params = {
911
908
  unitId: currentDoc.getUnitId(),
912
909
  drawings: [{
@@ -941,20 +938,16 @@ function syncRectWithRuntimeParam(rect, param, fallbackViewport, fallbackTransfo
941
938
  return true;
942
939
  }
943
940
  function getRuntimeTransform(param, rect, fallbackViewport, fallbackTransform, preserveRuntimeGeometry) {
944
- var _param$transform, _param$transforms, _param$customBlockRen, _runtimeViewport$heig2;
945
- const transform = (_param$transform = param.transform) !== null && _param$transform !== void 0 ? _param$transform : (_param$transforms = param.transforms) === null || _param$transforms === void 0 ? void 0 : _param$transforms[0];
946
- const runtimeViewport = (_param$customBlockRen = param.customBlockRenderViewport) !== null && _param$customBlockRen !== void 0 ? _param$customBlockRen : fallbackViewport;
947
- if (!param.customBlockRenderViewport && preserveRuntimeGeometry && fallbackTransform && transform) {
948
- var _fallbackTransform$wi, _fallbackTransform$he;
949
- return {
950
- ...transform,
951
- width: (_fallbackTransform$wi = fallbackTransform.width) !== null && _fallbackTransform$wi !== void 0 ? _fallbackTransform$wi : transform.width,
952
- height: (_fallbackTransform$he = fallbackTransform.height) !== null && _fallbackTransform$he !== void 0 ? _fallbackTransform$he : transform.height
953
- };
954
- }
941
+ var _param$transforms;
942
+ const transform = param.transform ?? ((_param$transforms = param.transforms) === null || _param$transforms === void 0 ? void 0 : _param$transforms[0]);
943
+ const runtimeViewport = param.customBlockRenderViewport ?? fallbackViewport;
944
+ if (!param.customBlockRenderViewport && preserveRuntimeGeometry && fallbackTransform && transform) return {
945
+ ...transform,
946
+ width: fallbackTransform.width ?? transform.width,
947
+ height: fallbackTransform.height ?? transform.height
948
+ };
955
949
  if (!transform) {
956
- var _runtimeViewport$heig;
957
- const height = (_runtimeViewport$heig = runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.height) !== null && _runtimeViewport$heig !== void 0 ? _runtimeViewport$heig : runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.contentHeight;
950
+ const height = (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.height) ?? (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.contentHeight);
958
951
  if (!isPositiveNumber(height)) return;
959
952
  return {
960
953
  left: rect.left,
@@ -964,7 +957,7 @@ function getRuntimeTransform(param, rect, fallbackViewport, fallbackTransform, p
964
957
  angle: rect.angle
965
958
  };
966
959
  }
967
- const height = (_runtimeViewport$heig2 = runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.height) !== null && _runtimeViewport$heig2 !== void 0 ? _runtimeViewport$heig2 : runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.contentHeight;
960
+ const height = (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.height) ?? (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.contentHeight);
968
961
  if (!isPositiveNumber(height)) return transform;
969
962
  return {
970
963
  ...transform,
@@ -977,6 +970,11 @@ function isEmbedFloatDomRuntimeParam(param) {
977
970
  const candidate = data;
978
971
  return candidate.version === 1 && typeof candidate.embedId === "string" && typeof candidate.hostAnchorId === "string";
979
972
  }
973
+ function isSheetLikeEmbedFloatDomRuntimeParam(param) {
974
+ if (!isEmbedFloatDomRuntimeParam(param)) return false;
975
+ const data = param.data;
976
+ return !!data && typeof data === "object" && "childType" in data && typeof data.childType === "number" && (0, _univerjs_docs.isSheetLikeDocsCustomBlockChildType)(data.childType);
977
+ }
980
978
  function createTransformFromRect(rect) {
981
979
  return {
982
980
  angle: rect.angle,
@@ -1197,7 +1195,7 @@ const menuSchema = {
1197
1195
  //#endregion
1198
1196
  //#region package.json
1199
1197
  var name = "@univerjs/docs-drawing-ui";
1200
- var version = "1.0.0-alpha.8";
1198
+ var version = "1.0.0-beta.0";
1201
1199
 
1202
1200
  //#endregion
1203
1201
  //#region src/config/config.ts
@@ -1360,7 +1358,7 @@ function DocDrawingPositionContent(props) {
1360
1358
  else if (relativeFrom === _univerjs_core.ObjectRelativeFromH.PAGE) {}
1361
1359
  handlePositionChange("positionH", {
1362
1360
  relativeFrom,
1363
- posOffset: (prevPosOffset !== null && prevPosOffset !== void 0 ? prevPosOffset : 0) - delta
1361
+ posOffset: (prevPosOffset ?? 0) - delta
1364
1362
  });
1365
1363
  }
1366
1364
  function handleVerticalRelativeFromChange(value) {
@@ -1395,7 +1393,7 @@ function DocDrawingPositionContent(props) {
1395
1393
  else if (relativeFrom === _univerjs_core.ObjectRelativeFromV.PAGE) delta -= page.marginTop;
1396
1394
  handlePositionChange("positionV", {
1397
1395
  relativeFrom,
1398
- posOffset: (prevPosOffset !== null && prevPosOffset !== void 0 ? prevPosOffset : 0) - delta
1396
+ posOffset: (prevPosOffset ?? 0) - delta
1399
1397
  });
1400
1398
  }
1401
1399
  function updateState(drawingParam) {
@@ -1707,7 +1705,7 @@ const IMoveInlineDrawingCommand = {
1707
1705
  id: "doc.command.move-inline-drawing",
1708
1706
  type: _univerjs_core.CommandType.COMMAND,
1709
1707
  handler: (accessor, params) => {
1710
- var _renderManagerService, _docSelectionRenderSe;
1708
+ var _renderManagerService;
1711
1709
  if (params == null) return false;
1712
1710
  const { drawing, unitId, offset, segmentId: newSegmentId, segmentPage, needRefreshDrawings } = params;
1713
1711
  const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
@@ -1728,7 +1726,7 @@ const IMoveInlineDrawingCommand = {
1728
1726
  }
1729
1727
  const rawActions = [];
1730
1728
  const { drawingId } = drawing;
1731
- const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, (_docSelectionRenderSe = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe !== void 0 ? _docSelectionRenderSe : "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1729
+ const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, docSelectionRenderService.getSegment() ?? "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1732
1730
  if (actions == null || actions.length === 0) {
1733
1731
  docRefreshDrawingsService.refreshDrawings(skeleton);
1734
1732
  transformer.refreshControls();
@@ -1758,7 +1756,7 @@ const ITransformNonInlineDrawingCommand = {
1758
1756
  id: "doc.command.transform-non-inline-drawing",
1759
1757
  type: _univerjs_core.CommandType.COMMAND,
1760
1758
  handler: (accessor, params) => {
1761
- var _renderManagerService2, _docSelectionRenderSe2;
1759
+ var _renderManagerService2;
1762
1760
  if (params == null) return false;
1763
1761
  const { drawing, unitId, offset, docTransform, segmentId: newSegmentId, segmentPage } = params;
1764
1762
  const renderManagerService = accessor.get(_univerjs_engine_render.IRenderManagerService);
@@ -1772,7 +1770,7 @@ const ITransformNonInlineDrawingCommand = {
1772
1770
  if (documentDataModel == null) return false;
1773
1771
  const rawActions = [];
1774
1772
  const { drawingId } = drawing;
1775
- const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, (_docSelectionRenderSe2 = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe2 !== void 0 ? _docSelectionRenderSe2 : "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1773
+ const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, docSelectionRenderService.getSegment() ?? "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1776
1774
  if (actions == null) return false;
1777
1775
  if (actions.length > 0) rawActions.push(...actions);
1778
1776
  const jsonX = _univerjs_core.JSONX.getInstance();
@@ -2282,12 +2280,12 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
2282
2280
  if (unitId == null || focusedDrawings.length === 0) return;
2283
2281
  const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2284
2282
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2285
- if (scene == null) return false;
2283
+ if (renderObject == null || scene == null) return false;
2284
+ this._docRefreshDrawingsService.refreshDrawings(renderObject.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton());
2286
2285
  scene.getTransformerByCreate().refreshControls();
2287
2286
  }));
2288
2287
  }
2289
2288
  _preserveWrappingStylePosition(params) {
2290
- var _documentDataModel$ge;
2291
2289
  if (params.wrappingStyle === _univerjs_docs_drawing.TextWrappingStyle.INLINE) return;
2292
2290
  const { unitId } = params;
2293
2291
  const documentDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
@@ -2298,7 +2296,7 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
2298
2296
  if (!documentDataModel || !skeletonData || !viewModel) return;
2299
2297
  const editArea = viewModel.getEditArea();
2300
2298
  const { pages, skeHeaders, skeFooters } = skeletonData;
2301
- const oldDrawings = (_documentDataModel$ge = documentDataModel.getDrawings()) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : {};
2299
+ const oldDrawings = documentDataModel.getDrawings() ?? {};
2302
2300
  params.drawings = params.drawings.map((drawing) => {
2303
2301
  const oldDrawing = oldDrawings[drawing.drawingId];
2304
2302
  if (!oldDrawing) return drawing;
@@ -2596,8 +2594,7 @@ function getDocsTableCellDrawingOffset(unitId, table, row, cell) {
2596
2594
  };
2597
2595
  }
2598
2596
  function hasHorizontalTableViewport(viewport) {
2599
- var _viewport$leadingInse, _viewport$trailingIns;
2600
- return viewport != null && ((_viewport$leadingInse = viewport.leadingInsetLeft) !== null && _viewport$leadingInse !== void 0 ? _viewport$leadingInse : 0) + viewport.contentWidth + ((_viewport$trailingIns = viewport.trailingInsetRight) !== null && _viewport$trailingIns !== void 0 ? _viewport$trailingIns : 0) > viewport.viewportWidth;
2597
+ return viewport != null && (viewport.leadingInsetLeft ?? 0) + viewport.contentWidth + (viewport.trailingInsetRight ?? 0) > viewport.viewportWidth;
2601
2598
  }
2602
2599
  let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateController extends _univerjs_core.Disposable {
2603
2600
  constructor(_context, _docSkeletonManagerService, _commandService, _editorService, _drawingManagerService, _docRefreshDrawingsService, _univerInstanceService, _lifecycleService) {
@@ -2617,7 +2614,7 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2617
2614
  _initialize() {
2618
2615
  this._initialRenderRefresh();
2619
2616
  this._drawingInitializeListener();
2620
- this._initResize();
2617
+ this._initTransformRefresh();
2621
2618
  }
2622
2619
  _initialRenderRefresh() {
2623
2620
  this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe((documentSkeleton) => {
@@ -2646,8 +2643,8 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2646
2643
  }
2647
2644
  }));
2648
2645
  }
2649
- _initResize() {
2650
- this.disposeWithMe((0, _univerjs_core.fromEventSubject)(this._context.engine.onTransformChange$).pipe((0, rxjs.filter)((evt) => evt.type === _univerjs_engine_render.TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize), (0, rxjs.debounceTime)(16)).subscribe(() => {
2646
+ _initTransformRefresh() {
2647
+ this.disposeWithMe((0, rxjs.merge)((0, _univerjs_core.fromEventSubject)(this._context.engine.onTransformChange$).pipe((0, rxjs.filter)((evt) => evt.type === _univerjs_engine_render.TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize)), (0, _univerjs_core.fromEventSubject)(this._context.scene.onTransformChange$).pipe((0, rxjs.filter)((evt) => evt.type === _univerjs_engine_render.TRANSFORM_CHANGE_OBSERVABLE_TYPE.scale))).pipe((0, rxjs.debounceTime)(16)).subscribe(() => {
2651
2648
  var _scene$getTransformer;
2652
2649
  const skeleton = this._docSkeletonManagerService.getSkeleton();
2653
2650
  const { scene } = this._context;
@@ -2701,21 +2698,17 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2701
2698
  this._handleMultiDrawingsTransform(multiDrawings);
2702
2699
  }
2703
2700
  _getStaleNonMultiDrawings(unitId, updateDrawingMap) {
2704
- var _this$_drawingManager;
2705
- const drawingData = (_this$_drawingManager = this._drawingManagerService.getDrawingData(unitId, unitId)) !== null && _this$_drawingManager !== void 0 ? _this$_drawingManager : {};
2706
- return Object.values(drawingData).filter((drawing) => drawing.isMultiTransform !== _univerjs_core.BooleanNumber.TRUE).filter((drawing) => updateDrawingMap[drawing.drawingId] == null).map((drawing) => {
2707
- var _drawing$transforms, _drawing$isMultiTrans;
2708
- return {
2709
- unitId,
2710
- subUnitId: unitId,
2711
- drawingId: drawing.drawingId,
2712
- behindText: false,
2713
- hidden: true,
2714
- transform: drawing.transform,
2715
- transforms: (_drawing$transforms = drawing.transforms) !== null && _drawing$transforms !== void 0 ? _drawing$transforms : [],
2716
- isMultiTransform: (_drawing$isMultiTrans = drawing.isMultiTransform) !== null && _drawing$isMultiTrans !== void 0 ? _drawing$isMultiTrans : _univerjs_core.BooleanNumber.FALSE
2717
- };
2718
- });
2701
+ const drawingData = this._drawingManagerService.getDrawingData(unitId, unitId) ?? {};
2702
+ return Object.values(drawingData).filter((drawing) => drawing.isMultiTransform !== _univerjs_core.BooleanNumber.TRUE).filter((drawing) => updateDrawingMap[drawing.drawingId] == null).map((drawing) => ({
2703
+ unitId,
2704
+ subUnitId: unitId,
2705
+ drawingId: drawing.drawingId,
2706
+ behindText: false,
2707
+ hidden: true,
2708
+ transform: drawing.transform,
2709
+ transforms: drawing.transforms ?? [],
2710
+ isMultiTransform: drawing.isMultiTransform ?? _univerjs_core.BooleanNumber.FALSE
2711
+ }));
2719
2712
  }
2720
2713
  _handleMultiDrawingsTransform(multiDrawings) {
2721
2714
  const { scene, unitId } = this._context;
@@ -2787,8 +2780,8 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2787
2780
  height
2788
2781
  }) : void 0;
2789
2782
  const transform = {
2790
- left: (pageRelativeLeft !== null && pageRelativeLeft !== void 0 ? pageRelativeLeft : aLeft) + docsLeft + (pageRelativeLeft == null ? this._liquid.x : pageOffsetLeft),
2791
- top: (pageRelativeTop !== null && pageRelativeTop !== void 0 ? pageRelativeTop : aTop) + docsTop + (pageRelativeTop == null ? this._liquid.y : pageOffsetTop),
2783
+ left: (pageRelativeLeft ?? aLeft) + docsLeft + (pageRelativeLeft == null ? this._liquid.x : pageOffsetLeft),
2784
+ top: (pageRelativeTop ?? aTop) + docsTop + (pageRelativeTop == null ? this._liquid.y : pageOffsetTop),
2792
2785
  width,
2793
2786
  height,
2794
2787
  angle,
@@ -2869,6 +2862,28 @@ function getDocsTableCellAnchorContext(unitId, cell) {
2869
2862
  table
2870
2863
  };
2871
2864
  }
2865
+ function shouldUseDocsDrawingOuterPageOrigin(config) {
2866
+ const { drawing, height, hostPage, page, width } = config;
2867
+ if (drawing.layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_NONE) return false;
2868
+ return getDocsPageRelativeDrawingAnchorPage({
2869
+ page,
2870
+ clipPage: getDocsDrawingClipPage({
2871
+ drawing: {
2872
+ behindText: getDocsDrawingBehindText({
2873
+ drawingOrigin: drawing,
2874
+ hostPage
2875
+ }),
2876
+ transform: {
2877
+ width,
2878
+ height
2879
+ }
2880
+ },
2881
+ hostPage,
2882
+ page
2883
+ }),
2884
+ hostPage
2885
+ }) != null;
2886
+ }
2872
2887
  let DocDrawingTransformerController = class DocDrawingTransformerController extends _univerjs_core.Disposable {
2873
2888
  constructor(_commandService, _univerInstanceService, _drawingManagerService, _renderManagerService) {
2874
2889
  super();
@@ -2925,7 +2940,6 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
2925
2940
  }
2926
2941
  })));
2927
2942
  const throttleMultipleDrawingUpdate = (0, _univerjs_core.throttle)(this._updateMultipleDrawingDocTransform.bind(this), 50);
2928
- (0, _univerjs_core.throttle)(this._nonInlineDrawingTransform.bind(this), 50);
2929
2943
  this.disposeWithMe((0, _univerjs_core.toDisposable)(transformer.changing$.subscribe((state) => {
2930
2944
  const { objects, offsetX, offsetY } = state;
2931
2945
  if (objects.size > 1) throttleMultipleDrawingUpdate(objects);
@@ -2933,7 +2947,6 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
2933
2947
  const drawingCache = this._transformerCache.values().next().value;
2934
2948
  const { width, height, top, left, angle } = objects.values().next().value;
2935
2949
  if (drawingCache && width === drawingCache.width && height === drawingCache.height && top === drawingCache.top && left === drawingCache.left && angle === drawingCache.angle) return;
2936
- if (drawingCache && drawingCache.drawing.layoutType !== _univerjs_core.PositionedObjectLayoutType.INLINE) {}
2937
2950
  if (drawingCache && drawingCache.drawing.layoutType === _univerjs_core.PositionedObjectLayoutType.INLINE && offsetX != null && offsetY != null) this._updateInlineDrawingAnchor(drawingCache.drawing, offsetX, offsetY);
2938
2951
  }
2939
2952
  })));
@@ -3027,14 +3040,13 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3027
3040
  this._getDrawingAnchor(drawingCache.drawing, object);
3028
3041
  }
3029
3042
  _updateInlineDrawingAnchor(drawing, offsetX, offsetY) {
3030
- var _this$_getInlineDrawi;
3031
3043
  if (this._transformerCache.size !== 1) return;
3032
- const { contentBoxPointGroup } = (_this$_getInlineDrawi = this._getInlineDrawingAnchor(drawing, offsetX, offsetY)) !== null && _this$_getInlineDrawi !== void 0 ? _this$_getInlineDrawi : {};
3044
+ const { contentBoxPointGroup } = this._getInlineDrawingAnchor(drawing, offsetX, offsetY) ?? {};
3033
3045
  if (contentBoxPointGroup == null) return;
3034
3046
  this._createOrUpdateInlineAnchor(drawing.unitId, contentBoxPointGroup);
3035
3047
  }
3036
3048
  _getInlineDrawingAnchor(drawing, offsetX, offsetY) {
3037
- var _this$_renderManagerS, _getOneTextSelectionR;
3049
+ var _this$_renderManagerS;
3038
3050
  const currentRender = this._renderManagerService.getRenderUnitById(drawing.unitId);
3039
3051
  const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
3040
3052
  if (currentRender == null) return;
@@ -3072,7 +3084,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3072
3084
  isBack
3073
3085
  };
3074
3086
  const { cursorList, contentBoxPointGroup } = new _univerjs_docs_ui.NodePositionConvertToCursor(docObject.document.getOffsetConfig(), skeleton).getRangePointData(positionWithIsBack, positionWithIsBack);
3075
- const { startOffset } = (_getOneTextSelectionR = (0, _univerjs_docs_ui.getOneTextSelectionRange)(cursorList)) !== null && _getOneTextSelectionR !== void 0 ? _getOneTextSelectionR : {};
3087
+ const { startOffset } = (0, _univerjs_docs_ui.getOneTextSelectionRange)(cursorList) ?? {};
3076
3088
  if (startOffset == null) return;
3077
3089
  return {
3078
3090
  offset: startOffset,
@@ -3082,7 +3094,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3082
3094
  };
3083
3095
  }
3084
3096
  _getDrawingAnchor(drawing, object) {
3085
- var _this$_renderManagerS2, _glyphAnchor$parent, _column$parent$top, _column$parent, _column$lines$find, _column$parent2, _tableCellContext$hos, _getOneTextSelectionR2;
3097
+ var _this$_renderManagerS2, _glyphAnchor$parent, _column$parent, _column$parent2;
3086
3098
  const currentRender = this._renderManagerService.getRenderUnitById(drawing.unitId);
3087
3099
  const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
3088
3100
  const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
@@ -3129,18 +3141,30 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3129
3141
  if (glyphAnchor == null) return;
3130
3142
  const line = (_glyphAnchor$parent = glyphAnchor.parent) === null || _glyphAnchor$parent === void 0 ? void 0 : _glyphAnchor$parent.parent;
3131
3143
  const column = line === null || line === void 0 ? void 0 : line.parent;
3132
- const sectionTop = (_column$parent$top = column === null || column === void 0 || (_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : _column$parent.top) !== null && _column$parent$top !== void 0 ? _column$parent$top : 0;
3133
- const paragraphStartLine = (_column$lines$find = column === null || column === void 0 ? void 0 : column.lines.find((l) => l.paragraphIndex === (line === null || line === void 0 ? void 0 : line.paragraphIndex) && l.paragraphStart)) !== null && _column$lines$find !== void 0 ? _column$lines$find : column === null || column === void 0 ? void 0 : column.lines[0];
3144
+ const sectionTop = (column === null || column === void 0 || (_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : _column$parent.top) ?? 0;
3145
+ const paragraphStartLine = (column === null || column === void 0 ? void 0 : column.lines.find((l) => l.paragraphIndex === (line === null || line === void 0 ? void 0 : line.paragraphIndex) && l.paragraphStart)) ?? (column === null || column === void 0 ? void 0 : column.lines[0]);
3134
3146
  const page = column === null || column === void 0 || (_column$parent2 = column.parent) === null || _column$parent2 === void 0 ? void 0 : _column$parent2.parent;
3135
3147
  if (line == null || column == null || paragraphStartLine == null || page == null) return;
3136
3148
  this._liquid.reset();
3137
3149
  const tableCellContext = page.type === _univerjs_engine_render.DocumentSkeletonPageType.CELL ? getDocsTableCellAnchorContext(drawing.unitId, page) : null;
3138
- const anchorPage = (_tableCellContext$hos = tableCellContext === null || tableCellContext === void 0 ? void 0 : tableCellContext.hostPage) !== null && _tableCellContext$hos !== void 0 ? _tableCellContext$hos : page;
3150
+ const anchorPage = (tableCellContext === null || tableCellContext === void 0 ? void 0 : tableCellContext.hostPage) ?? page;
3139
3151
  const pageType = anchorPage.type;
3152
+ const drawingHostPage = (page.type === _univerjs_engine_render.DocumentSkeletonPageType.HEADER || page.type === _univerjs_engine_render.DocumentSkeletonPageType.FOOTER) && segmentPage > -1 ? pages[segmentPage] : void 0;
3153
+ const useOuterPageOrigin = shouldUseDocsDrawingOuterPageOrigin({
3154
+ drawing,
3155
+ height: object.height,
3156
+ hostPage: drawingHostPage,
3157
+ page,
3158
+ width: object.width
3159
+ });
3160
+ let pageOffsetLeft = this._liquid.x;
3161
+ let pageOffsetTop = this._liquid.y;
3140
3162
  for (const p of pages) {
3141
3163
  const { headerId, footerId, pageHeight, pageWidth, marginLeft, marginBottom } = p;
3142
3164
  const pIndex = pages.indexOf(p);
3143
3165
  if (segmentPage > -1 && pIndex === segmentPage) {
3166
+ pageOffsetLeft = this._liquid.x;
3167
+ pageOffsetTop = this._liquid.y;
3144
3168
  switch (pageType) {
3145
3169
  case _univerjs_engine_render.DocumentSkeletonPageType.HEADER: {
3146
3170
  var _skeHeaders$get;
@@ -3168,6 +3192,10 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3168
3192
  }
3169
3193
  break;
3170
3194
  }
3195
+ if (p === anchorPage) {
3196
+ pageOffsetLeft = this._liquid.x;
3197
+ pageOffsetTop = this._liquid.y;
3198
+ }
3171
3199
  this._liquid.translatePagePadding(p);
3172
3200
  if (p === anchorPage) break;
3173
3201
  this._liquid.restorePagePadding(p);
@@ -3176,14 +3204,17 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3176
3204
  if (tableCellContext) this._liquid.translate(tableCellContext.offset.left, tableCellContext.offset.top);
3177
3205
  if (positionV.relativeFrom === _univerjs_core.ObjectRelativeFromV.LINE) glyphAnchor = line.divides[0].glyphGroup[0];
3178
3206
  else {
3179
- var _paragraphStartLine$d, _paragraphStartLine$d2;
3180
- glyphAnchor = (_paragraphStartLine$d = (_paragraphStartLine$d2 = paragraphStartLine.divides) === null || _paragraphStartLine$d2 === void 0 || (_paragraphStartLine$d2 = _paragraphStartLine$d2[0]) === null || _paragraphStartLine$d2 === void 0 || (_paragraphStartLine$d2 = _paragraphStartLine$d2.glyphGroup) === null || _paragraphStartLine$d2 === void 0 ? void 0 : _paragraphStartLine$d2[0]) !== null && _paragraphStartLine$d !== void 0 ? _paragraphStartLine$d : glyphAnchor;
3207
+ var _paragraphStartLine$d;
3208
+ glyphAnchor = ((_paragraphStartLine$d = paragraphStartLine.divides) === null || _paragraphStartLine$d === void 0 || (_paragraphStartLine$d = _paragraphStartLine$d[0]) === null || _paragraphStartLine$d === void 0 || (_paragraphStartLine$d = _paragraphStartLine$d.glyphGroup) === null || _paragraphStartLine$d === void 0 ? void 0 : _paragraphStartLine$d[0]) ?? glyphAnchor;
3181
3209
  }
3182
3210
  docTransform.positionH = {
3183
3211
  relativeFrom: positionH.relativeFrom,
3184
3212
  posOffset: left - this._liquid.x - docsLeft
3185
3213
  };
3186
3214
  switch (positionH.relativeFrom) {
3215
+ case _univerjs_core.ObjectRelativeFromH.PAGE:
3216
+ if (useOuterPageOrigin) docTransform.positionH.posOffset = left - pageOffsetLeft - docsLeft;
3217
+ break;
3187
3218
  case _univerjs_core.ObjectRelativeFromH.MARGIN:
3188
3219
  docTransform.positionH.posOffset = left - this._liquid.x - docsLeft - page.marginLeft;
3189
3220
  break;
@@ -3197,7 +3228,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3197
3228
  };
3198
3229
  switch (positionV.relativeFrom) {
3199
3230
  case _univerjs_core.ObjectRelativeFromV.PAGE:
3200
- docTransform.positionV.posOffset = top - this._liquid.y - docsTop - page.marginTop;
3231
+ docTransform.positionV.posOffset = useOuterPageOrigin ? top - pageOffsetTop - docsTop : top - this._liquid.y - docsTop + page.marginTop;
3201
3232
  break;
3202
3233
  case _univerjs_core.ObjectRelativeFromV.LINE:
3203
3234
  docTransform.positionV.posOffset = top - this._liquid.y - docsTop - sectionTop - line.top;
@@ -3215,7 +3246,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3215
3246
  isBack
3216
3247
  };
3217
3248
  const { cursorList } = new _univerjs_docs_ui.NodePositionConvertToCursor(docObject.document.getOffsetConfig(), skeleton).getRangePointData(positionWithIsBack, positionWithIsBack);
3218
- const { startOffset } = (_getOneTextSelectionR2 = (0, _univerjs_docs_ui.getOneTextSelectionRange)(cursorList)) !== null && _getOneTextSelectionR2 !== void 0 ? _getOneTextSelectionR2 : {};
3249
+ const { startOffset } = (0, _univerjs_docs_ui.getOneTextSelectionRange)(cursorList) ?? {};
3219
3250
  if (startOffset == null) return;
3220
3251
  return {
3221
3252
  offset: startOffset,
@@ -3252,8 +3283,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3252
3283
  });
3253
3284
  }
3254
3285
  _moveInlineDrawing(drawing, offsetX, offsetY) {
3255
- const anchor = this._getInlineDrawingAnchor(drawing, offsetX, offsetY);
3256
- const { offset, segmentId, segmentPage } = anchor !== null && anchor !== void 0 ? anchor : {};
3286
+ const { offset, segmentId, segmentPage } = this._getInlineDrawingAnchor(drawing, offsetX, offsetY) ?? {};
3257
3287
  return this._commandService.executeCommand(IMoveInlineDrawingCommand.id, {
3258
3288
  unitId: drawing.unitId,
3259
3289
  subUnitId: drawing.unitId,
@@ -3269,7 +3299,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3269
3299
  const { left, top, width, height, angle } = object;
3270
3300
  const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
3271
3301
  const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
3272
- const { pages } = skeletonData !== null && skeletonData !== void 0 ? skeletonData : {};
3302
+ const { pages } = skeletonData ?? {};
3273
3303
  if (skeletonData == null || currentRender == null || pages == null) return {
3274
3304
  left,
3275
3305
  top,
@@ -3300,8 +3330,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3300
3330
  _nonInlineDrawingTransform(drawing, object, isMoving = false) {
3301
3331
  const objectPosition = drawing.isMultiTransform === _univerjs_core.BooleanNumber.TRUE ? object : this._limitDrawingInPage(drawing, object);
3302
3332
  if (isMoving && objectPosition.top !== object.top) return;
3303
- const anchor = this._getDrawingAnchor(drawing, objectPosition);
3304
- const { offset, docTransform, segmentId, segmentPage } = anchor !== null && anchor !== void 0 ? anchor : {};
3333
+ const { offset, docTransform, segmentId, segmentPage } = this._getDrawingAnchor(drawing, objectPosition) ?? {};
3305
3334
  if (offset == null || docTransform == null) return this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[drawing.drawingId, object]]));
3306
3335
  return this._commandService.executeCommand(ITransformNonInlineDrawingCommand.id, {
3307
3336
  unitId: drawing.unitId,
@@ -3661,7 +3690,6 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
3661
3690
  }));
3662
3691
  }
3663
3692
  _getDrawingPopupMenuItems(unitId, subUnitId, drawingId, drawingType) {
3664
- var _editCommandInfo$labe, _editCommandInfo$comm, _editCommandInfo$comm2, _editCommandInfo$disa;
3665
3693
  const drawing = this._drawingManagerService.getDrawingByParam({
3666
3694
  unitId,
3667
3695
  subUnitId,
@@ -3680,15 +3708,15 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
3680
3708
  }) : null;
3681
3709
  return [
3682
3710
  {
3683
- label: (_editCommandInfo$labe = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.label) !== null && _editCommandInfo$labe !== void 0 ? _editCommandInfo$labe : "docs-drawing-ui.image-popup.edit",
3711
+ label: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.label) ?? "docs-drawing-ui.image-popup.edit",
3684
3712
  index: 0,
3685
- commandId: (_editCommandInfo$comm = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandId) !== null && _editCommandInfo$comm !== void 0 ? _editCommandInfo$comm : EditDocDrawingOperation.id,
3686
- commandParams: (_editCommandInfo$comm2 = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandParams) !== null && _editCommandInfo$comm2 !== void 0 ? _editCommandInfo$comm2 : {
3713
+ commandId: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandId) ?? EditDocDrawingOperation.id,
3714
+ commandParams: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandParams) ?? {
3687
3715
  unitId,
3688
3716
  subUnitId,
3689
3717
  drawingId
3690
3718
  },
3691
- disable: (_editCommandInfo$disa = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.disable) !== null && _editCommandInfo$disa !== void 0 ? _editCommandInfo$disa : drawingType === _univerjs_core.DrawingTypeEnum.DRAWING_DOM,
3719
+ disable: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.disable) ?? drawingType === _univerjs_core.DrawingTypeEnum.DRAWING_DOM,
3692
3720
  hideOnClick: true,
3693
3721
  icon: "DrawingEditIcon"
3694
3722
  },
@@ -3787,7 +3815,7 @@ _defineProperty(UniverDocsDrawingUIPlugin, "pluginName", "DOC_DRAWING_UI_PLUGIN"
3787
3815
  _defineProperty(UniverDocsDrawingUIPlugin, "packageName", name);
3788
3816
  _defineProperty(UniverDocsDrawingUIPlugin, "version", version);
3789
3817
  UniverDocsDrawingUIPlugin = __decorate([
3790
- (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_drawing.UniverDrawingPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_docs_drawing.UniverDocsDrawingPlugin, _univerjs_ui.UniverUIPlugin, _univerjs_docs_ui.UniverDocsUIPlugin, _univerjs_drawing_ui.UniverDrawingUIPlugin),
3818
+ (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_drawing.UniverDrawingPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_docs_drawing.UniverDocsDrawingPlugin, _univerjs_docs_ui.UniverDocsUIPlugin, _univerjs_drawing_ui.UniverDrawingUIPlugin),
3791
3819
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
3792
3820
  __decorateParam(2, _univerjs_engine_render.IRenderManagerService),
3793
3821
  __decorateParam(3, _univerjs_core.IConfigService)