@univerjs/docs-drawing-ui 1.0.0-alpha.7 → 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/es/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { AlignTypeH, AlignTypeV, BooleanNumber, COLORS, CommandType, DOC_DRAWING_PRINTING_COMPONENT_KEY, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, DrawingTypeEnum, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, ICommandService, IConfigService, IContextService, IImageIoService, IUniverInstanceService, ImageSourceType, ImageUploadStatusType, Inject, Injector, JSONX, LifecycleService, LifecycleStages, LocaleService, ObjectRelativeFromH, ObjectRelativeFromV, Plugin, PositionedObjectLayoutType, RedoCommand, RxDisposable, TextX, TextXActionType, Tools, UndoCommand, UniverInstanceType, WrapTextType, fromEventSubject, generateRandomId, getRichTextEditPath, isInternalEditorID, merge, throttle, toDisposable } from "@univerjs/core";
2
2
  import { IDocDrawingAdapterService, IDocDrawingService, InsertDocDrawingCommand, RemoveDocDrawingCommand, SetDocDrawingArrangeCommand, TextWrappingStyle, UniverDocsDrawingPlugin, UpdateDocDrawingWrappingStyleCommand, UpdateDrawingDocTransformCommand, getDocDrawingRenderOrder } from "@univerjs/docs-drawing";
3
- import { CURSOR_TYPE, DocumentEditArea, DocumentSkeletonPageType, IRenderManagerService, Liquid, PageLayoutType, Rect, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Vector2, getColor, getCurrentTypeOfRenderer, getDocsTableRenderViewport, getTableIdAndSliceIndex } from "@univerjs/engine-render";
3
+ import { CURSOR_TYPE, DocumentEditArea, DocumentSkeletonPageType, IRenderManagerService, Liquid, PageLayoutType, Rect, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, getColor, getCurrentTypeOfRenderer, getDocsTableRenderViewport, getTableIdAndSliceIndex } from "@univerjs/engine-render";
4
4
  import { Checkbox, InputNumber, MessageType, Radio, RadioGroup, Select, clsx, render, unmount } from "@univerjs/design";
5
- import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, buildDocTransform, docDrawingPositionToTransform } from "@univerjs/docs";
6
- import { DOC_CONTENT_INSERT_MENU_ID, DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID, DOC_PARAGRAPH_T_INSERT_MENU_ID, DocCanvasPopManagerService, DocPrintInterceptorService, DocSelectionRenderService, EMPTY_PARAGRAPH_MENU_ID, IEditorService, INSERT_BELLOW_MENU_ID, NodePositionConvertToCursor, SetDocZoomRatioOperation, TEXT_RANGE_LAYER_INDEX, VIEWPORT_KEY, getAnchorBounding, getDocObject, getOneTextSelectionRange } from "@univerjs/docs-ui";
5
+ import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, UniverDocsPlugin, buildDocTransform, docDrawingPositionToTransform, isSheetLikeDocsCustomBlockChildType } from "@univerjs/docs";
6
+ import { DOC_CONTENT_INSERT_MENU_ID, DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID, DOC_PARAGRAPH_T_INSERT_MENU_ID, DocCanvasPopManagerService, DocPrintInterceptorService, DocSelectionRenderService, EMPTY_PARAGRAPH_MENU_ID, IEditorService, INSERT_BELLOW_MENU_ID, NodePositionConvertToCursor, SetDocZoomRatioOperation, TEXT_RANGE_LAYER_INDEX, UniverDocsUIPlugin, VIEWPORT_KEY, getAnchorBounding, getOneTextSelectionRange, neoGetDocObject } from "@univerjs/docs-ui";
7
7
  import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, IDrawingManagerService, UniverDrawingPlugin, getDrawingImageAllowSize, getDrawingShapeKeyByDrawingSearch, getImageSize } from "@univerjs/drawing";
8
- import { CanvasFloatDomService, ComponentManager, ContextMenuGroup, ContextMenuPosition, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonInsertGroup, UniverUIPlugin, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
9
- import { BehaviorSubject, Observable, debounceTime, filter, map, of, switchMap, takeUntil } from "rxjs";
8
+ import { CanvasFloatDomService, ComponentManager, ContextMenuGroup, ContextMenuPosition, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonInsertGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
9
+ import { BehaviorSubject, Observable, debounceTime, filter, map, merge as merge$1, of, switchMap, takeUntil } from "rxjs";
10
10
  import { COMPONENT_IMAGE_POPUP_MENU, DrawingCommonPanel, DrawingRenderService, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
11
11
  import { useEffect, useMemo, useState } from "react";
12
12
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -73,7 +73,7 @@ const UngroupDocDrawingCommand = {
73
73
  };
74
74
 
75
75
  //#endregion
76
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
76
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
77
77
  function _typeof(o) {
78
78
  "@babel/helpers - typeof";
79
79
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -84,7 +84,7 @@ function _typeof(o) {
84
84
  }
85
85
 
86
86
  //#endregion
87
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
87
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
88
88
  function toPrimitive(t, r) {
89
89
  if ("object" != _typeof(t) || !t) return t;
90
90
  var e = t[Symbol.toPrimitive];
@@ -97,14 +97,14 @@ function toPrimitive(t, r) {
97
97
  }
98
98
 
99
99
  //#endregion
100
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
100
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
101
101
  function toPropertyKey(t) {
102
102
  var i = toPrimitive(t, "string");
103
103
  return "symbol" == _typeof(i) ? i : i + "";
104
104
  }
105
105
 
106
106
  //#endregion
107
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
107
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
108
108
  function _defineProperty(e, r, t) {
109
109
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
110
110
  value: t,
@@ -127,7 +127,7 @@ var DocRefreshDrawingsService = class {
127
127
  };
128
128
 
129
129
  //#endregion
130
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
130
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
131
131
  function __decorateParam(paramIndex, decorator) {
132
132
  return function(target, key) {
133
133
  decorator(target, key, paramIndex);
@@ -135,7 +135,7 @@ function __decorateParam(paramIndex, decorator) {
135
135
  }
136
136
 
137
137
  //#endregion
138
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
138
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
139
139
  function __decorate(decorators, target, key, desc) {
140
140
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
141
141
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -226,7 +226,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
226
226
  const scaleHeight = DRAWING_IMAGE_HEIGHT_LIMIT / height;
227
227
  scale = Math.min(scaleWidth, scaleHeight);
228
228
  }
229
- const imagePosition = insertPosition !== null && insertPosition !== void 0 ? insertPosition : this._getCurrentImageInsertPosition();
229
+ const imagePosition = insertPosition ?? this._getCurrentImageInsertPosition();
230
230
  const docTransform = this._getImagePosition(width * scale, height * scale, imagePosition);
231
231
  if (docTransform == null) return;
232
232
  const transform = docDrawingPositionToTransform(docTransform);
@@ -264,13 +264,12 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
264
264
  _isInsertInHeaderFooter() {
265
265
  var _this$_renderManagerS;
266
266
  const { unitId } = this._context;
267
- const viewModel = (_this$_renderManagerS = this._renderManagerSrv.getRenderById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getViewModel();
267
+ const viewModel = (_this$_renderManagerS = this._renderManagerSrv.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSkeletonManagerService).getViewModel();
268
268
  const editArea = viewModel === null || viewModel === void 0 ? void 0 : viewModel.getEditArea();
269
269
  return editArea === DocumentEditArea.HEADER || editArea === DocumentEditArea.FOOTER;
270
270
  }
271
271
  _getImagePosition(imageWidth, imageHeight, insertPosition) {
272
- var _ref;
273
- return buildDocTransform(imageWidth, imageHeight, { left: ((_ref = insertPosition !== null && insertPosition !== void 0 ? insertPosition : this._getCurrentImageInsertPosition()) !== null && _ref !== void 0 ? _ref : {
272
+ return buildDocTransform(imageWidth, imageHeight, { left: (insertPosition ?? this._getCurrentImageInsertPosition() ?? {
274
273
  left: 0,
275
274
  top: 0
276
275
  }).left });
@@ -324,8 +323,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
324
323
  }
325
324
  _focusDrawingListener() {
326
325
  this.disposeWithMe(this._drawingManagerService.focus$.subscribe((params) => {
327
- var _this$_getCurrentScen;
328
- const { transformer, docsLeft, docsTop } = (_this$_getCurrentScen = this._getCurrentSceneAndTransformer()) !== null && _this$_getCurrentScen !== void 0 ? _this$_getCurrentScen : {};
326
+ const { transformer, docsLeft, docsTop } = this._getCurrentSceneAndTransformer() ?? {};
329
327
  if (params == null || params.length === 0) {
330
328
  this._contextService.setContextValue(FOCUSING_COMMON_DRAWINGS, false);
331
329
  this._docDrawingService.focusDrawing([]);
@@ -349,10 +347,9 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
349
347
  }));
350
348
  }
351
349
  _findSegmentIdByDrawingId(drawingId) {
352
- var _body$customBlocks;
353
350
  const { unit: DocDataModel } = this._context;
354
351
  const { body, headers = {}, footers = {} } = DocDataModel.getSnapshot();
355
- 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 "";
352
+ if (((body === null || body === void 0 ? void 0 : body.customBlocks) ?? []).some((b) => b.blockId === drawingId)) return "";
356
353
  for (const headerId of Object.keys(headers)) {
357
354
  var _headers$headerId$bod;
358
355
  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;
@@ -367,7 +364,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
367
364
  var _this$_renderManagerS2;
368
365
  if (!this._context) return;
369
366
  const { unit: docDataModel, scene, unitId } = this._context;
370
- const viewModel = (_this$_renderManagerS2 = this._renderManagerSrv.getRenderById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSkeletonManagerService).getViewModel();
367
+ const viewModel = (_this$_renderManagerS2 = this._renderManagerSrv.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSkeletonManagerService).getViewModel();
371
368
  if (viewModel == null || docDataModel == null) return;
372
369
  const { drawings = {} } = docDataModel.getSnapshot();
373
370
  const isEditBody = viewModel.getEditArea() === DocumentEditArea.BODY;
@@ -398,7 +395,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
398
395
  _editAreaChangeListener() {
399
396
  var _this$_renderManagerS3;
400
397
  const { unitId } = this._context;
401
- const viewModel = (_this$_renderManagerS3 = this._renderManagerSrv.getRenderById(unitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(DocSkeletonManagerService).getViewModel();
398
+ const viewModel = (_this$_renderManagerS3 = this._renderManagerSrv.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.with(DocSkeletonManagerService).getViewModel();
402
399
  if (viewModel == null) return;
403
400
  this._updateDrawingsEditStatus();
404
401
  this.disposeWithMe(viewModel.editAreaChange$.subscribe(() => {
@@ -426,9 +423,9 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
426
423
  }));
427
424
  }
428
425
  _setDrawingSelections(params) {
429
- var _unit$getSnapshot$bod, _unit$getSnapshot$bod2;
426
+ var _unit$getSnapshot$bod;
430
427
  const { unit } = this._context;
431
- 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 : [];
428
+ const customBlocks = ((_unit$getSnapshot$bod = unit.getSnapshot().body) === null || _unit$getSnapshot$bod === void 0 ? void 0 : _unit$getSnapshot$bod.customBlocks) ?? [];
432
429
  const ranges = params.map((item) => {
433
430
  const id = item.drawingId;
434
431
  const block = customBlocks.find((b) => b.blockId === id);
@@ -462,10 +459,10 @@ const InsertDocImageCommand = {
462
459
  id: "doc.command.insert-float-image",
463
460
  type: CommandType.COMMAND,
464
461
  handler: (accessor) => {
465
- var _getCurrentTypeOfRend, _getCurrentTypeOfRend2;
462
+ var _getCurrentTypeOfRend;
466
463
  const univerInstanceService = accessor.get(IUniverInstanceService);
467
464
  const renderManagerService = accessor.get(IRenderManagerService);
468
- return (_getCurrentTypeOfRend = (_getCurrentTypeOfRend2 = getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC, univerInstanceService, renderManagerService)) === null || _getCurrentTypeOfRend2 === void 0 ? void 0 : _getCurrentTypeOfRend2.with(DocDrawingUpdateRenderController).insertDocImage()) !== null && _getCurrentTypeOfRend !== void 0 ? _getCurrentTypeOfRend : false;
465
+ return ((_getCurrentTypeOfRend = getCurrentTypeOfRenderer(UniverInstanceType.UNIVER_DOC, univerInstanceService, renderManagerService)) === null || _getCurrentTypeOfRend === void 0 ? void 0 : _getCurrentTypeOfRend.with(DocDrawingUpdateRenderController).insertDocImage()) ?? false;
469
466
  }
470
467
  };
471
468
 
@@ -529,7 +526,7 @@ const MoveDocDrawingsCommand = {
529
526
  const drawings = docDrawingService.getFocusDrawings();
530
527
  if (drawings.length === 0) return false;
531
528
  const unitId = drawings[0].unitId;
532
- const renderObject = renderManagerService.getRenderById(unitId);
529
+ const renderObject = renderManagerService.getRenderUnitById(unitId);
533
530
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
534
531
  if (scene == null) return false;
535
532
  const transformer = scene.getTransformerByCreate();
@@ -542,19 +539,10 @@ const MoveDocDrawingsCommand = {
542
539
  const { positionH, positionV } = drawingData.docTransform;
543
540
  const newPositionH = { ...positionH };
544
541
  const newPositionV = { ...positionV };
545
- if (direction === Direction.UP) {
546
- var _newPositionV$posOffs;
547
- newPositionV.posOffset = ((_newPositionV$posOffs = newPositionV.posOffset) !== null && _newPositionV$posOffs !== void 0 ? _newPositionV$posOffs : 0) - 2;
548
- } else if (direction === Direction.DOWN) {
549
- var _newPositionV$posOffs2;
550
- newPositionV.posOffset = ((_newPositionV$posOffs2 = newPositionV.posOffset) !== null && _newPositionV$posOffs2 !== void 0 ? _newPositionV$posOffs2 : 0) + 2;
551
- } else if (direction === Direction.LEFT) {
552
- var _newPositionH$posOffs;
553
- newPositionH.posOffset = ((_newPositionH$posOffs = newPositionH.posOffset) !== null && _newPositionH$posOffs !== void 0 ? _newPositionH$posOffs : 0) - 2;
554
- } else if (direction === Direction.RIGHT) {
555
- var _newPositionH$posOffs2;
556
- newPositionH.posOffset = ((_newPositionH$posOffs2 = newPositionH.posOffset) !== null && _newPositionH$posOffs2 !== void 0 ? _newPositionH$posOffs2 : 0) + 2;
557
- }
542
+ if (direction === Direction.UP) newPositionV.posOffset = (newPositionV.posOffset ?? 0) - 2;
543
+ else if (direction === Direction.DOWN) newPositionV.posOffset = (newPositionV.posOffset ?? 0) + 2;
544
+ else if (direction === Direction.LEFT) newPositionH.posOffset = (newPositionH.posOffset ?? 0) - 2;
545
+ else if (direction === Direction.RIGHT) newPositionH.posOffset = (newPositionH.posOffset ?? 0) + 2;
558
546
  return {
559
547
  drawingId,
560
548
  key: direction === Direction.UP || direction === Direction.DOWN ? "positionV" : "positionH",
@@ -581,7 +569,7 @@ const ClearDocDrawingTransformerOperation = {
581
569
  const renderManagerService = accessor.get(IRenderManagerService);
582
570
  params.forEach((unitId) => {
583
571
  var _renderManagerService;
584
- (_renderManagerService = renderManagerService.getRenderById(unitId)) === null || _renderManagerService === void 0 || (_renderManagerService = _renderManagerService.scene.getTransformer()) === null || _renderManagerService === void 0 || _renderManagerService.debounceRefreshControls();
572
+ (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 || (_renderManagerService = _renderManagerService.scene.getTransformer()) === null || _renderManagerService === void 0 || _renderManagerService.debounceRefreshControls();
585
573
  });
586
574
  return true;
587
575
  }
@@ -669,7 +657,7 @@ function calcDocFloatDomPositionByRect(rect, scene, opacity = 1, angle = 0) {
669
657
  left: false,
670
658
  top: false
671
659
  },
672
- opacity: opacity !== null && opacity !== void 0 ? opacity : 1
660
+ opacity: opacity ?? 1
673
661
  };
674
662
  }
675
663
  function calcDocFloatDomPosition(object, renderUnit) {
@@ -696,6 +684,9 @@ function pickValidCustomBlockRenderViewport(viewport) {
696
684
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.contentHeight)) result.contentHeight = viewport.contentHeight;
697
685
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.contentWidth)) result.contentWidth = viewport.contentWidth;
698
686
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.height)) result.height = viewport.height;
687
+ if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.pageContentWidth)) result.pageContentWidth = viewport.pageContentWidth;
688
+ const viewScale = viewport === null || viewport === void 0 ? void 0 : viewport.viewScale;
689
+ if (isPositiveNumber(viewScale)) result.viewScale = viewScale;
699
690
  if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.viewportHeight)) result.viewportHeight = viewport.viewportHeight;
700
691
  return Object.keys(result).length ? result : void 0;
701
692
  }
@@ -727,7 +718,7 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
727
718
  }
728
719
  _getSceneAndTransformerByDrawingSearch(unitId) {
729
720
  if (unitId == null) return;
730
- const renderObject = this._renderManagerService.getRenderById(unitId);
721
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
731
722
  if (renderObject == null) return null;
732
723
  const scene = renderObject.scene;
733
724
  return {
@@ -782,6 +773,10 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
782
773
  position$,
783
774
  id: rectParam.drawingId,
784
775
  componentKey: rectParam.componentKey,
776
+ contentBox: isSheetLikeEmbedFloatDomRuntimeParam(runtimeParam) ? {
777
+ contentInset: 0,
778
+ wrapperInset: 0
779
+ } : void 0,
785
780
  eventPassThrough: preserveRuntimeGeometry ? false : void 0,
786
781
  preserveOnFocusChange: preserveRuntimeGeometry,
787
782
  onPointerDown: (evt) => {
@@ -819,7 +814,7 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
819
814
  params.forEach((param) => {
820
815
  var _this$_canvasFloatDom;
821
816
  const floatDomInfo = this._domLayerInfoMap.get(param.drawingId);
822
- if (!floatDomInfo) return;
817
+ if (!floatDomInfo || floatDomInfo.unitId !== param.unitId) return;
823
818
  const runtimeParam = param;
824
819
  const runtimeViewport = pickValidCustomBlockRenderViewport(runtimeParam.customBlockRenderViewport);
825
820
  if (runtimeViewport) floatDomInfo.runtimeViewport = runtimeViewport;
@@ -863,7 +858,7 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
863
858
  this.disposeWithMe(this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC).pipe(map((documentDataModel) => {
864
859
  if (!documentDataModel) return null;
865
860
  const unitId = documentDataModel.getUnitId();
866
- const render = this._renderManagerService.getRenderById(unitId);
861
+ const render = this._renderManagerService.getRenderUnitById(unitId);
867
862
  return render ? {
868
863
  render,
869
864
  unitId
@@ -876,12 +871,14 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
876
871
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
877
872
  if (commandInfo.id === SetDocZoomRatioOperation.id) {
878
873
  const { unitId } = commandInfo.params;
879
- updateDoc(unitId);
874
+ globalThis.queueMicrotask(() => {
875
+ if (!this._disposed) updateDoc(unitId);
876
+ });
880
877
  }
881
878
  }));
882
879
  }
883
880
  insertFloatDom(floatDom, opts) {
884
- var _skeleton$getSkeleton, _opts$width, _opts$drawingId;
881
+ var _skeleton$getSkeleton;
885
882
  const currentDoc = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
886
883
  if (!currentDoc) return false;
887
884
  const render = this._getSceneAndTransformerByDrawingSearch(currentDoc.getUnitId());
@@ -892,7 +889,7 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
892
889
  const width = pageWidth - marginLeft - marginRight;
893
890
  const docTransform = {
894
891
  size: {
895
- width: (_opts$width = opts.width) !== null && _opts$width !== void 0 ? _opts$width : width,
892
+ width: opts.width ?? width,
896
893
  height: opts.height
897
894
  },
898
895
  positionH: {
@@ -905,7 +902,7 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
905
902
  },
906
903
  angle: 0
907
904
  };
908
- const drawingId = (_opts$drawingId = opts.drawingId) !== null && _opts$drawingId !== void 0 ? _opts$drawingId : generateRandomId();
905
+ const drawingId = opts.drawingId ?? generateRandomId();
909
906
  const params = {
910
907
  unitId: currentDoc.getUnitId(),
911
908
  drawings: [{
@@ -940,20 +937,16 @@ function syncRectWithRuntimeParam(rect, param, fallbackViewport, fallbackTransfo
940
937
  return true;
941
938
  }
942
939
  function getRuntimeTransform(param, rect, fallbackViewport, fallbackTransform, preserveRuntimeGeometry) {
943
- var _param$transform, _param$transforms, _param$customBlockRen, _runtimeViewport$heig2;
944
- 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];
945
- const runtimeViewport = (_param$customBlockRen = param.customBlockRenderViewport) !== null && _param$customBlockRen !== void 0 ? _param$customBlockRen : fallbackViewport;
946
- if (!param.customBlockRenderViewport && preserveRuntimeGeometry && fallbackTransform && transform) {
947
- var _fallbackTransform$wi, _fallbackTransform$he;
948
- return {
949
- ...transform,
950
- width: (_fallbackTransform$wi = fallbackTransform.width) !== null && _fallbackTransform$wi !== void 0 ? _fallbackTransform$wi : transform.width,
951
- height: (_fallbackTransform$he = fallbackTransform.height) !== null && _fallbackTransform$he !== void 0 ? _fallbackTransform$he : transform.height
952
- };
953
- }
940
+ var _param$transforms;
941
+ const transform = param.transform ?? ((_param$transforms = param.transforms) === null || _param$transforms === void 0 ? void 0 : _param$transforms[0]);
942
+ const runtimeViewport = param.customBlockRenderViewport ?? fallbackViewport;
943
+ if (!param.customBlockRenderViewport && preserveRuntimeGeometry && fallbackTransform && transform) return {
944
+ ...transform,
945
+ width: fallbackTransform.width ?? transform.width,
946
+ height: fallbackTransform.height ?? transform.height
947
+ };
954
948
  if (!transform) {
955
- var _runtimeViewport$heig;
956
- 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;
949
+ const height = (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.height) ?? (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.contentHeight);
957
950
  if (!isPositiveNumber(height)) return;
958
951
  return {
959
952
  left: rect.left,
@@ -963,7 +956,7 @@ function getRuntimeTransform(param, rect, fallbackViewport, fallbackTransform, p
963
956
  angle: rect.angle
964
957
  };
965
958
  }
966
- 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;
959
+ const height = (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.height) ?? (runtimeViewport === null || runtimeViewport === void 0 ? void 0 : runtimeViewport.contentHeight);
967
960
  if (!isPositiveNumber(height)) return transform;
968
961
  return {
969
962
  ...transform,
@@ -976,6 +969,11 @@ function isEmbedFloatDomRuntimeParam(param) {
976
969
  const candidate = data;
977
970
  return candidate.version === 1 && typeof candidate.embedId === "string" && typeof candidate.hostAnchorId === "string";
978
971
  }
972
+ function isSheetLikeEmbedFloatDomRuntimeParam(param) {
973
+ if (!isEmbedFloatDomRuntimeParam(param)) return false;
974
+ const data = param.data;
975
+ return !!data && typeof data === "object" && "childType" in data && typeof data.childType === "number" && isSheetLikeDocsCustomBlockChildType(data.childType);
976
+ }
979
977
  function createTransformFromRect(rect) {
980
978
  return {
981
979
  angle: rect.angle,
@@ -1196,7 +1194,7 @@ const menuSchema = {
1196
1194
  //#endregion
1197
1195
  //#region package.json
1198
1196
  var name = "@univerjs/docs-drawing-ui";
1199
- var version = "1.0.0-alpha.7";
1197
+ var version = "1.0.0-beta.0";
1200
1198
 
1201
1199
  //#endregion
1202
1200
  //#region src/config/config.ts
@@ -1227,7 +1225,7 @@ const DocDrawingPosition = (props) => {
1227
1225
  var _renderManagerService;
1228
1226
  const renderManagerService = useDependency(IRenderManagerService);
1229
1227
  const drawingParam = props.drawings[0];
1230
- const scene = drawingParam ? (_renderManagerService = renderManagerService.getRenderById(drawingParam.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.scene : void 0;
1228
+ const scene = drawingParam ? (_renderManagerService = renderManagerService.getRenderUnitById(drawingParam.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.scene : void 0;
1231
1229
  return drawingParam && scene ? /* @__PURE__ */ jsx(DocDrawingPositionContent, { ...props }) : null;
1232
1230
  };
1233
1231
  function DocDrawingPositionContent(props) {
@@ -1240,7 +1238,7 @@ function DocDrawingPositionContent(props) {
1240
1238
  const { unitId } = drawings[0];
1241
1239
  const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1242
1240
  const documentFlavor = documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getSnapshot().documentStyle.documentFlavor;
1243
- const transformer = renderManagerService.getRenderById(unitId).scene.getTransformerByCreate();
1241
+ const transformer = renderManagerService.getRenderUnitById(unitId).scene.getTransformerByCreate();
1244
1242
  const HORIZONTAL_RELATIVE_FROM = [
1245
1243
  {
1246
1244
  label: localeService.t("docs-drawing-ui.image-position.column"),
@@ -1309,7 +1307,7 @@ function DocDrawingPositionContent(props) {
1309
1307
  value
1310
1308
  }))
1311
1309
  });
1312
- const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
1310
+ const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
1313
1311
  if (docSelectionRenderService) docSelectionRenderService.blur();
1314
1312
  transformer.refreshControls();
1315
1313
  }
@@ -1325,7 +1323,7 @@ function DocDrawingPositionContent(props) {
1325
1323
  const unitId = focusDrawings[0].unitId;
1326
1324
  let drawing = null;
1327
1325
  let pageMarginLeft = 0;
1328
- const skeleton = (_renderManagerService3 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService).getSkeleton();
1326
+ const skeleton = (_renderManagerService3 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService).getSkeleton();
1329
1327
  const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
1330
1328
  if (skeletonData == null) return;
1331
1329
  const { pages, skeHeaders, skeFooters } = skeletonData;
@@ -1359,7 +1357,7 @@ function DocDrawingPositionContent(props) {
1359
1357
  else if (relativeFrom === ObjectRelativeFromH.PAGE) {}
1360
1358
  handlePositionChange("positionH", {
1361
1359
  relativeFrom,
1362
- posOffset: (prevPosOffset !== null && prevPosOffset !== void 0 ? prevPosOffset : 0) - delta
1360
+ posOffset: (prevPosOffset ?? 0) - delta
1363
1361
  });
1364
1362
  }
1365
1363
  function handleVerticalRelativeFromChange(value) {
@@ -1394,7 +1392,7 @@ function DocDrawingPositionContent(props) {
1394
1392
  else if (relativeFrom === ObjectRelativeFromV.PAGE) delta -= page.marginTop;
1395
1393
  handlePositionChange("positionV", {
1396
1394
  relativeFrom,
1397
- posOffset: (prevPosOffset !== null && prevPosOffset !== void 0 ? prevPosOffset : 0) - delta
1395
+ posOffset: (prevPosOffset ?? 0) - delta
1398
1396
  });
1399
1397
  }
1400
1398
  function updateState(drawingParam) {
@@ -1706,7 +1704,7 @@ const IMoveInlineDrawingCommand = {
1706
1704
  id: "doc.command.move-inline-drawing",
1707
1705
  type: CommandType.COMMAND,
1708
1706
  handler: (accessor, params) => {
1709
- var _renderManagerService, _docSelectionRenderSe;
1707
+ var _renderManagerService;
1710
1708
  if (params == null) return false;
1711
1709
  const { drawing, unitId, offset, segmentId: newSegmentId, segmentPage, needRefreshDrawings } = params;
1712
1710
  const renderManagerService = accessor.get(IRenderManagerService);
@@ -1727,7 +1725,7 @@ const IMoveInlineDrawingCommand = {
1727
1725
  }
1728
1726
  const rawActions = [];
1729
1727
  const { drawingId } = drawing;
1730
- const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, (_docSelectionRenderSe = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe !== void 0 ? _docSelectionRenderSe : "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1728
+ const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, docSelectionRenderService.getSegment() ?? "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1731
1729
  if (actions == null || actions.length === 0) {
1732
1730
  docRefreshDrawingsService.refreshDrawings(skeleton);
1733
1731
  transformer.refreshControls();
@@ -1757,7 +1755,7 @@ const ITransformNonInlineDrawingCommand = {
1757
1755
  id: "doc.command.transform-non-inline-drawing",
1758
1756
  type: CommandType.COMMAND,
1759
1757
  handler: (accessor, params) => {
1760
- var _renderManagerService2, _docSelectionRenderSe2;
1758
+ var _renderManagerService2;
1761
1759
  if (params == null) return false;
1762
1760
  const { drawing, unitId, offset, docTransform, segmentId: newSegmentId, segmentPage } = params;
1763
1761
  const renderManagerService = accessor.get(IRenderManagerService);
@@ -1771,7 +1769,7 @@ const ITransformNonInlineDrawingCommand = {
1771
1769
  if (documentDataModel == null) return false;
1772
1770
  const rawActions = [];
1773
1771
  const { drawingId } = drawing;
1774
- const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, (_docSelectionRenderSe2 = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe2 !== void 0 ? _docSelectionRenderSe2 : "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1772
+ const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, docSelectionRenderService.getSegment() ?? "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
1775
1773
  if (actions == null) return false;
1776
1774
  if (actions.length > 0) rawActions.push(...actions);
1777
1775
  const jsonX = JSONX.getInstance();
@@ -1901,10 +1899,11 @@ function DocDrawingTextWrapContent(props) {
1901
1899
  }
1902
1900
  function handleDistToTextChange(value, direction) {
1903
1901
  if (value == null) return;
1904
- setDistToText({
1902
+ const newDistToText = {
1905
1903
  ...distToText,
1906
1904
  [direction]: value
1907
- });
1905
+ };
1906
+ setDistToText(newDistToText);
1908
1907
  const focusDrawings = drawingManagerService.getFocusDrawings();
1909
1908
  if (focusDrawings.length === 0) return;
1910
1909
  const drawings = focusDrawings.map((drawing) => {
@@ -2266,7 +2265,7 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
2266
2265
  this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
2267
2266
  if (command.id !== UpdateDrawingDocTransformCommand.id && command.id !== UpdateDocDrawingWrappingStyleCommand.id) return;
2268
2267
  const { unitId } = command.params;
2269
- const renderObject = this._renderManagerService.getRenderById(unitId);
2268
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2270
2269
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2271
2270
  if (renderObject == null || scene == null) return;
2272
2271
  this._docRefreshDrawingsService.refreshDrawings(renderObject.with(DocSkeletonManagerService).getSkeleton());
@@ -2280,23 +2279,23 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
2280
2279
  if (unitId == null || focusedDrawings.length === 0) return;
2281
2280
  const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2282
2281
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2283
- if (scene == null) return false;
2282
+ if (renderObject == null || scene == null) return false;
2283
+ this._docRefreshDrawingsService.refreshDrawings(renderObject.with(DocSkeletonManagerService).getSkeleton());
2284
2284
  scene.getTransformerByCreate().refreshControls();
2285
2285
  }));
2286
2286
  }
2287
2287
  _preserveWrappingStylePosition(params) {
2288
- var _documentDataModel$ge;
2289
2288
  if (params.wrappingStyle === TextWrappingStyle.INLINE) return;
2290
2289
  const { unitId } = params;
2291
2290
  const documentDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
2292
- const renderObject = this._renderManagerService.getRenderById(unitId);
2291
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2293
2292
  const skeletonManager = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService);
2294
2293
  const skeletonData = skeletonManager === null || skeletonManager === void 0 ? void 0 : skeletonManager.getSkeleton().getSkeletonData();
2295
2294
  const viewModel = skeletonManager === null || skeletonManager === void 0 ? void 0 : skeletonManager.getViewModel();
2296
2295
  if (!documentDataModel || !skeletonData || !viewModel) return;
2297
2296
  const editArea = viewModel.getEditArea();
2298
2297
  const { pages, skeHeaders, skeFooters } = skeletonData;
2299
- const oldDrawings = (_documentDataModel$ge = documentDataModel.getDrawings()) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : {};
2298
+ const oldDrawings = documentDataModel.getDrawings() ?? {};
2300
2299
  params.drawings = params.drawings.map((drawing) => {
2301
2300
  const oldDrawing = oldDrawings[drawing.drawingId];
2302
2301
  if (!oldDrawing) return drawing;
@@ -2594,8 +2593,7 @@ function getDocsTableCellDrawingOffset(unitId, table, row, cell) {
2594
2593
  };
2595
2594
  }
2596
2595
  function hasHorizontalTableViewport(viewport) {
2597
- var _viewport$leadingInse, _viewport$trailingIns;
2598
- 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;
2596
+ return viewport != null && (viewport.leadingInsetLeft ?? 0) + viewport.contentWidth + (viewport.trailingInsetRight ?? 0) > viewport.viewportWidth;
2599
2597
  }
2600
2598
  let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateController extends Disposable {
2601
2599
  constructor(_context, _docSkeletonManagerService, _commandService, _editorService, _drawingManagerService, _docRefreshDrawingsService, _univerInstanceService, _lifecycleService) {
@@ -2615,7 +2613,7 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2615
2613
  _initialize() {
2616
2614
  this._initialRenderRefresh();
2617
2615
  this._drawingInitializeListener();
2618
- this._initResize();
2616
+ this._initTransformRefresh();
2619
2617
  }
2620
2618
  _initialRenderRefresh() {
2621
2619
  this.disposeWithMe(this._docSkeletonManagerService.currentSkeleton$.subscribe((documentSkeleton) => {
@@ -2644,8 +2642,8 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2644
2642
  }
2645
2643
  }));
2646
2644
  }
2647
- _initResize() {
2648
- this.disposeWithMe(fromEventSubject(this._context.engine.onTransformChange$).pipe(filter((evt) => evt.type === TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize), debounceTime(16)).subscribe(() => {
2645
+ _initTransformRefresh() {
2646
+ this.disposeWithMe(merge$1(fromEventSubject(this._context.engine.onTransformChange$).pipe(filter((evt) => evt.type === TRANSFORM_CHANGE_OBSERVABLE_TYPE.resize)), fromEventSubject(this._context.scene.onTransformChange$).pipe(filter((evt) => evt.type === TRANSFORM_CHANGE_OBSERVABLE_TYPE.scale))).pipe(debounceTime(16)).subscribe(() => {
2649
2647
  var _scene$getTransformer;
2650
2648
  const skeleton = this._docSkeletonManagerService.getSkeleton();
2651
2649
  const { scene } = this._context;
@@ -2699,21 +2697,17 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2699
2697
  this._handleMultiDrawingsTransform(multiDrawings);
2700
2698
  }
2701
2699
  _getStaleNonMultiDrawings(unitId, updateDrawingMap) {
2702
- var _this$_drawingManager;
2703
- const drawingData = (_this$_drawingManager = this._drawingManagerService.getDrawingData(unitId, unitId)) !== null && _this$_drawingManager !== void 0 ? _this$_drawingManager : {};
2704
- return Object.values(drawingData).filter((drawing) => drawing.isMultiTransform !== BooleanNumber.TRUE).filter((drawing) => updateDrawingMap[drawing.drawingId] == null).map((drawing) => {
2705
- var _drawing$transforms, _drawing$isMultiTrans;
2706
- return {
2707
- unitId,
2708
- subUnitId: unitId,
2709
- drawingId: drawing.drawingId,
2710
- behindText: false,
2711
- hidden: true,
2712
- transform: drawing.transform,
2713
- transforms: (_drawing$transforms = drawing.transforms) !== null && _drawing$transforms !== void 0 ? _drawing$transforms : [],
2714
- isMultiTransform: (_drawing$isMultiTrans = drawing.isMultiTransform) !== null && _drawing$isMultiTrans !== void 0 ? _drawing$isMultiTrans : BooleanNumber.FALSE
2715
- };
2716
- });
2700
+ const drawingData = this._drawingManagerService.getDrawingData(unitId, unitId) ?? {};
2701
+ return Object.values(drawingData).filter((drawing) => drawing.isMultiTransform !== BooleanNumber.TRUE).filter((drawing) => updateDrawingMap[drawing.drawingId] == null).map((drawing) => ({
2702
+ unitId,
2703
+ subUnitId: unitId,
2704
+ drawingId: drawing.drawingId,
2705
+ behindText: false,
2706
+ hidden: true,
2707
+ transform: drawing.transform,
2708
+ transforms: drawing.transforms ?? [],
2709
+ isMultiTransform: drawing.isMultiTransform ?? BooleanNumber.FALSE
2710
+ }));
2717
2711
  }
2718
2712
  _handleMultiDrawingsTransform(multiDrawings) {
2719
2713
  const { scene, unitId } = this._context;
@@ -2785,8 +2779,8 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2785
2779
  height
2786
2780
  }) : void 0;
2787
2781
  const transform = {
2788
- left: (pageRelativeLeft !== null && pageRelativeLeft !== void 0 ? pageRelativeLeft : aLeft) + docsLeft + (pageRelativeLeft == null ? this._liquid.x : pageOffsetLeft),
2789
- top: (pageRelativeTop !== null && pageRelativeTop !== void 0 ? pageRelativeTop : aTop) + docsTop + (pageRelativeTop == null ? this._liquid.y : pageOffsetTop),
2782
+ left: (pageRelativeLeft ?? aLeft) + docsLeft + (pageRelativeLeft == null ? this._liquid.x : pageOffsetLeft),
2783
+ top: (pageRelativeTop ?? aTop) + docsTop + (pageRelativeTop == null ? this._liquid.y : pageOffsetTop),
2790
2784
  width,
2791
2785
  height,
2792
2786
  angle,
@@ -2867,6 +2861,28 @@ function getDocsTableCellAnchorContext(unitId, cell) {
2867
2861
  table
2868
2862
  };
2869
2863
  }
2864
+ function shouldUseDocsDrawingOuterPageOrigin(config) {
2865
+ const { drawing, height, hostPage, page, width } = config;
2866
+ if (drawing.layoutType !== PositionedObjectLayoutType.WRAP_NONE) return false;
2867
+ return getDocsPageRelativeDrawingAnchorPage({
2868
+ page,
2869
+ clipPage: getDocsDrawingClipPage({
2870
+ drawing: {
2871
+ behindText: getDocsDrawingBehindText({
2872
+ drawingOrigin: drawing,
2873
+ hostPage
2874
+ }),
2875
+ transform: {
2876
+ width,
2877
+ height
2878
+ }
2879
+ },
2880
+ hostPage,
2881
+ page
2882
+ }),
2883
+ hostPage
2884
+ }) != null;
2885
+ }
2870
2886
  let DocDrawingTransformerController = class DocDrawingTransformerController extends Disposable {
2871
2887
  constructor(_commandService, _univerInstanceService, _drawingManagerService, _renderManagerService) {
2872
2888
  super();
@@ -2923,7 +2939,6 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
2923
2939
  }
2924
2940
  })));
2925
2941
  const throttleMultipleDrawingUpdate = throttle(this._updateMultipleDrawingDocTransform.bind(this), 50);
2926
- throttle(this._nonInlineDrawingTransform.bind(this), 50);
2927
2942
  this.disposeWithMe(toDisposable(transformer.changing$.subscribe((state) => {
2928
2943
  const { objects, offsetX, offsetY } = state;
2929
2944
  if (objects.size > 1) throttleMultipleDrawingUpdate(objects);
@@ -2931,7 +2946,6 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
2931
2946
  const drawingCache = this._transformerCache.values().next().value;
2932
2947
  const { width, height, top, left, angle } = objects.values().next().value;
2933
2948
  if (drawingCache && width === drawingCache.width && height === drawingCache.height && top === drawingCache.top && left === drawingCache.left && angle === drawingCache.angle) return;
2934
- if (drawingCache && drawingCache.drawing.layoutType !== PositionedObjectLayoutType.INLINE) {}
2935
2949
  if (drawingCache && drawingCache.drawing.layoutType === PositionedObjectLayoutType.INLINE && offsetX != null && offsetY != null) this._updateInlineDrawingAnchor(drawingCache.drawing, offsetX, offsetY);
2936
2950
  }
2937
2951
  })));
@@ -3025,15 +3039,14 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3025
3039
  this._getDrawingAnchor(drawingCache.drawing, object);
3026
3040
  }
3027
3041
  _updateInlineDrawingAnchor(drawing, offsetX, offsetY) {
3028
- var _this$_getInlineDrawi;
3029
3042
  if (this._transformerCache.size !== 1) return;
3030
- const { contentBoxPointGroup } = (_this$_getInlineDrawi = this._getInlineDrawingAnchor(drawing, offsetX, offsetY)) !== null && _this$_getInlineDrawi !== void 0 ? _this$_getInlineDrawi : {};
3043
+ const { contentBoxPointGroup } = this._getInlineDrawingAnchor(drawing, offsetX, offsetY) ?? {};
3031
3044
  if (contentBoxPointGroup == null) return;
3032
3045
  this._createOrUpdateInlineAnchor(drawing.unitId, contentBoxPointGroup);
3033
3046
  }
3034
3047
  _getInlineDrawingAnchor(drawing, offsetX, offsetY) {
3035
- var _this$_renderManagerS, _getOneTextSelectionR;
3036
- const currentRender = this._renderManagerService.getRenderById(drawing.unitId);
3048
+ var _this$_renderManagerS;
3049
+ const currentRender = this._renderManagerService.getRenderUnitById(drawing.unitId);
3037
3050
  const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
3038
3051
  if (currentRender == null) return;
3039
3052
  const { mainComponent, scene } = currentRender;
@@ -3047,7 +3060,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3047
3060
  const HALF = .5;
3048
3061
  const coord = this._getTransformCoordForDocumentOffset(documentComponent, activeViewport, offsetX, offsetY);
3049
3062
  if (coord == null) return;
3050
- const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderById(drawing.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSelectionRenderService);
3063
+ const docSelectionRenderService = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(drawing.unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(DocSelectionRenderService);
3051
3064
  if (docSelectionRenderService == null) return;
3052
3065
  const nodeInfo = skeleton === null || skeleton === void 0 ? void 0 : skeleton.findNodeByCoord(coord, pageLayoutType, pageMarginLeft, pageMarginTop, {
3053
3066
  strict: false,
@@ -3063,14 +3076,14 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3063
3076
  }
3064
3077
  if (glyphAnchor == null) return;
3065
3078
  const nodePosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.findPositionByGlyph(glyphAnchor, segmentPageIndex);
3066
- const docObject = this._getDocObject();
3067
- if (nodePosition == null || skeleton == null || docObject == null) return;
3079
+ const docObject = neoGetDocObject(currentRender);
3080
+ if (nodePosition == null || skeleton == null) return;
3068
3081
  const positionWithIsBack = {
3069
3082
  ...nodePosition,
3070
3083
  isBack
3071
3084
  };
3072
3085
  const { cursorList, contentBoxPointGroup } = new NodePositionConvertToCursor(docObject.document.getOffsetConfig(), skeleton).getRangePointData(positionWithIsBack, positionWithIsBack);
3073
- const { startOffset } = (_getOneTextSelectionR = getOneTextSelectionRange(cursorList)) !== null && _getOneTextSelectionR !== void 0 ? _getOneTextSelectionR : {};
3086
+ const { startOffset } = getOneTextSelectionRange(cursorList) ?? {};
3074
3087
  if (startOffset == null) return;
3075
3088
  return {
3076
3089
  offset: startOffset,
@@ -3080,8 +3093,8 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3080
3093
  };
3081
3094
  }
3082
3095
  _getDrawingAnchor(drawing, object) {
3083
- var _this$_renderManagerS2, _glyphAnchor$parent, _column$parent$top, _column$parent, _column$lines$find, _column$parent2, _tableCellContext$hos, _getOneTextSelectionR2;
3084
- const currentRender = this._renderManagerService.getRenderById(drawing.unitId);
3096
+ var _this$_renderManagerS2, _glyphAnchor$parent, _column$parent, _column$parent2;
3097
+ const currentRender = this._renderManagerService.getRenderUnitById(drawing.unitId);
3085
3098
  const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
3086
3099
  const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
3087
3100
  if (skeletonData == null || currentRender == null) return;
@@ -3111,7 +3124,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3111
3124
  const { x, y } = scene.getViewportScrollXY(activeViewport);
3112
3125
  const coord = this._getTransformCoordForDocumentOffset(documentComponent, activeViewport, left - x, top - y);
3113
3126
  if (coord == null) return;
3114
- const docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.getRenderById(drawing.unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
3127
+ const docSelectionRenderService = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(drawing.unitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.with(DocSelectionRenderService);
3115
3128
  if (docSelectionRenderService == null) return;
3116
3129
  const nodeInfo = skeleton === null || skeleton === void 0 ? void 0 : skeleton.findNodeByCoord(coord, pageLayoutType, pageMarginLeft, pageMarginTop, {
3117
3130
  strict: false,
@@ -3127,18 +3140,30 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3127
3140
  if (glyphAnchor == null) return;
3128
3141
  const line = (_glyphAnchor$parent = glyphAnchor.parent) === null || _glyphAnchor$parent === void 0 ? void 0 : _glyphAnchor$parent.parent;
3129
3142
  const column = line === null || line === void 0 ? void 0 : line.parent;
3130
- 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;
3131
- 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];
3143
+ const sectionTop = (column === null || column === void 0 || (_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : _column$parent.top) ?? 0;
3144
+ 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]);
3132
3145
  const page = column === null || column === void 0 || (_column$parent2 = column.parent) === null || _column$parent2 === void 0 ? void 0 : _column$parent2.parent;
3133
3146
  if (line == null || column == null || paragraphStartLine == null || page == null) return;
3134
3147
  this._liquid.reset();
3135
3148
  const tableCellContext = page.type === DocumentSkeletonPageType.CELL ? getDocsTableCellAnchorContext(drawing.unitId, page) : null;
3136
- const anchorPage = (_tableCellContext$hos = tableCellContext === null || tableCellContext === void 0 ? void 0 : tableCellContext.hostPage) !== null && _tableCellContext$hos !== void 0 ? _tableCellContext$hos : page;
3149
+ const anchorPage = (tableCellContext === null || tableCellContext === void 0 ? void 0 : tableCellContext.hostPage) ?? page;
3137
3150
  const pageType = anchorPage.type;
3151
+ const drawingHostPage = (page.type === DocumentSkeletonPageType.HEADER || page.type === DocumentSkeletonPageType.FOOTER) && segmentPage > -1 ? pages[segmentPage] : void 0;
3152
+ const useOuterPageOrigin = shouldUseDocsDrawingOuterPageOrigin({
3153
+ drawing,
3154
+ height: object.height,
3155
+ hostPage: drawingHostPage,
3156
+ page,
3157
+ width: object.width
3158
+ });
3159
+ let pageOffsetLeft = this._liquid.x;
3160
+ let pageOffsetTop = this._liquid.y;
3138
3161
  for (const p of pages) {
3139
3162
  const { headerId, footerId, pageHeight, pageWidth, marginLeft, marginBottom } = p;
3140
3163
  const pIndex = pages.indexOf(p);
3141
3164
  if (segmentPage > -1 && pIndex === segmentPage) {
3165
+ pageOffsetLeft = this._liquid.x;
3166
+ pageOffsetTop = this._liquid.y;
3142
3167
  switch (pageType) {
3143
3168
  case DocumentSkeletonPageType.HEADER: {
3144
3169
  var _skeHeaders$get;
@@ -3166,6 +3191,10 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3166
3191
  }
3167
3192
  break;
3168
3193
  }
3194
+ if (p === anchorPage) {
3195
+ pageOffsetLeft = this._liquid.x;
3196
+ pageOffsetTop = this._liquid.y;
3197
+ }
3169
3198
  this._liquid.translatePagePadding(p);
3170
3199
  if (p === anchorPage) break;
3171
3200
  this._liquid.restorePagePadding(p);
@@ -3174,14 +3203,17 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3174
3203
  if (tableCellContext) this._liquid.translate(tableCellContext.offset.left, tableCellContext.offset.top);
3175
3204
  if (positionV.relativeFrom === ObjectRelativeFromV.LINE) glyphAnchor = line.divides[0].glyphGroup[0];
3176
3205
  else {
3177
- var _paragraphStartLine$d, _paragraphStartLine$d2;
3178
- 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;
3206
+ var _paragraphStartLine$d;
3207
+ 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;
3179
3208
  }
3180
3209
  docTransform.positionH = {
3181
3210
  relativeFrom: positionH.relativeFrom,
3182
3211
  posOffset: left - this._liquid.x - docsLeft
3183
3212
  };
3184
3213
  switch (positionH.relativeFrom) {
3214
+ case ObjectRelativeFromH.PAGE:
3215
+ if (useOuterPageOrigin) docTransform.positionH.posOffset = left - pageOffsetLeft - docsLeft;
3216
+ break;
3185
3217
  case ObjectRelativeFromH.MARGIN:
3186
3218
  docTransform.positionH.posOffset = left - this._liquid.x - docsLeft - page.marginLeft;
3187
3219
  break;
@@ -3195,7 +3227,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3195
3227
  };
3196
3228
  switch (positionV.relativeFrom) {
3197
3229
  case ObjectRelativeFromV.PAGE:
3198
- docTransform.positionV.posOffset = top - this._liquid.y - docsTop - page.marginTop;
3230
+ docTransform.positionV.posOffset = useOuterPageOrigin ? top - pageOffsetTop - docsTop : top - this._liquid.y - docsTop + page.marginTop;
3199
3231
  break;
3200
3232
  case ObjectRelativeFromV.LINE:
3201
3233
  docTransform.positionV.posOffset = top - this._liquid.y - docsTop - sectionTop - line.top;
@@ -3206,14 +3238,14 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3206
3238
  }
3207
3239
  if (glyphAnchor == null) return;
3208
3240
  const nodePosition = skeleton === null || skeleton === void 0 ? void 0 : skeleton.findPositionByGlyph(glyphAnchor, segmentPage);
3209
- const docObject = this._getDocObject();
3210
- if (nodePosition == null || skeleton == null || docObject == null) return;
3241
+ const docObject = neoGetDocObject(currentRender);
3242
+ if (nodePosition == null || skeleton == null) return;
3211
3243
  const positionWithIsBack = {
3212
3244
  ...nodePosition,
3213
3245
  isBack
3214
3246
  };
3215
3247
  const { cursorList } = new NodePositionConvertToCursor(docObject.document.getOffsetConfig(), skeleton).getRangePointData(positionWithIsBack, positionWithIsBack);
3216
- const { startOffset } = (_getOneTextSelectionR2 = getOneTextSelectionRange(cursorList)) !== null && _getOneTextSelectionR2 !== void 0 ? _getOneTextSelectionR2 : {};
3248
+ const { startOffset } = getOneTextSelectionRange(cursorList) ?? {};
3217
3249
  if (startOffset == null) return;
3218
3250
  return {
3219
3251
  offset: startOffset,
@@ -3250,8 +3282,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3250
3282
  });
3251
3283
  }
3252
3284
  _moveInlineDrawing(drawing, offsetX, offsetY) {
3253
- const anchor = this._getInlineDrawingAnchor(drawing, offsetX, offsetY);
3254
- const { offset, segmentId, segmentPage } = anchor !== null && anchor !== void 0 ? anchor : {};
3285
+ const { offset, segmentId, segmentPage } = this._getInlineDrawingAnchor(drawing, offsetX, offsetY) ?? {};
3255
3286
  return this._commandService.executeCommand(IMoveInlineDrawingCommand.id, {
3256
3287
  unitId: drawing.unitId,
3257
3288
  subUnitId: drawing.unitId,
@@ -3263,11 +3294,11 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3263
3294
  });
3264
3295
  }
3265
3296
  _limitDrawingInPage(drawing, object) {
3266
- const currentRender = this._renderManagerService.getRenderById(drawing.unitId);
3297
+ const currentRender = this._renderManagerService.getRenderUnitById(drawing.unitId);
3267
3298
  const { left, top, width, height, angle } = object;
3268
3299
  const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
3269
3300
  const skeletonData = skeleton === null || skeleton === void 0 ? void 0 : skeleton.getSkeletonData();
3270
- const { pages } = skeletonData !== null && skeletonData !== void 0 ? skeletonData : {};
3301
+ const { pages } = skeletonData ?? {};
3271
3302
  if (skeletonData == null || currentRender == null || pages == null) return {
3272
3303
  left,
3273
3304
  top,
@@ -3298,8 +3329,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3298
3329
  _nonInlineDrawingTransform(drawing, object, isMoving = false) {
3299
3330
  const objectPosition = drawing.isMultiTransform === BooleanNumber.TRUE ? object : this._limitDrawingInPage(drawing, object);
3300
3331
  if (isMoving && objectPosition.top !== object.top) return;
3301
- const anchor = this._getDrawingAnchor(drawing, objectPosition);
3302
- const { offset, docTransform, segmentId, segmentPage } = anchor !== null && anchor !== void 0 ? anchor : {};
3332
+ const { offset, docTransform, segmentId, segmentPage } = this._getDrawingAnchor(drawing, objectPosition) ?? {};
3303
3333
  if (offset == null || docTransform == null) return this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[drawing.drawingId, object]]));
3304
3334
  return this._commandService.executeCommand(ITransformNonInlineDrawingCommand.id, {
3305
3335
  unitId: drawing.unitId,
@@ -3313,7 +3343,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3313
3343
  }
3314
3344
  _getSceneAndTransformerByDrawingSearch(unitId) {
3315
3345
  if (unitId == null) return;
3316
- const renderObject = this._renderManagerService.getRenderById(unitId);
3346
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
3317
3347
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
3318
3348
  if (scene == null) return;
3319
3349
  return {
@@ -3328,7 +3358,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3328
3358
  return documentTransform.clone().invert().applyPoint(originCoord);
3329
3359
  }
3330
3360
  _createOrUpdateInlineAnchor(unitId, pointsGroup) {
3331
- const currentRender = this._renderManagerService.getRenderById(unitId);
3361
+ const currentRender = this._renderManagerService.getRenderUnitById(unitId);
3332
3362
  if (currentRender == null) return;
3333
3363
  const { mainComponent, scene } = currentRender;
3334
3364
  const { docsLeft, docsTop } = mainComponent.getOffsetConfig();
@@ -3355,11 +3385,8 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3355
3385
  this._anchorShape = anchor;
3356
3386
  scene.addObject(anchor, TEXT_RANGE_LAYER_INDEX);
3357
3387
  }
3358
- _getDocObject() {
3359
- return getDocObject(this._univerInstanceService, this._renderManagerService);
3360
- }
3361
3388
  _getPageContentSize(drawing) {
3362
- const currentRender = this._renderManagerService.getRenderById(drawing.unitId);
3389
+ const currentRender = this._renderManagerService.getRenderUnitById(drawing.unitId);
3363
3390
  const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(DocSkeletonManagerService).getSkeleton();
3364
3391
  const MAX_WIDTH = 500;
3365
3392
  const MAX_HEIGHT = 500;
@@ -3606,7 +3633,7 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
3606
3633
  }
3607
3634
  _popupMenuListener(unitId) {
3608
3635
  var _this$_renderManagerS;
3609
- const scene = (_this$_renderManagerS = this._renderManagerService.getRenderById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
3636
+ const scene = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.scene;
3610
3637
  if (!scene) return;
3611
3638
  const transformer = scene.getTransformerByCreate();
3612
3639
  if (!transformer) return;
@@ -3662,7 +3689,6 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
3662
3689
  }));
3663
3690
  }
3664
3691
  _getDrawingPopupMenuItems(unitId, subUnitId, drawingId, drawingType) {
3665
- var _editCommandInfo$labe, _editCommandInfo$comm, _editCommandInfo$comm2, _editCommandInfo$disa;
3666
3692
  const drawing = this._drawingManagerService.getDrawingByParam({
3667
3693
  unitId,
3668
3694
  subUnitId,
@@ -3681,15 +3707,15 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
3681
3707
  }) : null;
3682
3708
  return [
3683
3709
  {
3684
- 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",
3710
+ label: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.label) ?? "docs-drawing-ui.image-popup.edit",
3685
3711
  index: 0,
3686
- commandId: (_editCommandInfo$comm = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandId) !== null && _editCommandInfo$comm !== void 0 ? _editCommandInfo$comm : EditDocDrawingOperation.id,
3687
- commandParams: (_editCommandInfo$comm2 = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandParams) !== null && _editCommandInfo$comm2 !== void 0 ? _editCommandInfo$comm2 : {
3712
+ commandId: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandId) ?? EditDocDrawingOperation.id,
3713
+ commandParams: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandParams) ?? {
3688
3714
  unitId,
3689
3715
  subUnitId,
3690
3716
  drawingId
3691
3717
  },
3692
- disable: (_editCommandInfo$disa = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.disable) !== null && _editCommandInfo$disa !== void 0 ? _editCommandInfo$disa : drawingType === DrawingTypeEnum.DRAWING_DOM,
3718
+ disable: (editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.disable) ?? drawingType === DrawingTypeEnum.DRAWING_DOM,
3693
3719
  hideOnClick: true,
3694
3720
  icon: "DrawingEditIcon"
3695
3721
  },
@@ -3788,7 +3814,7 @@ _defineProperty(UniverDocsDrawingUIPlugin, "pluginName", "DOC_DRAWING_UI_PLUGIN"
3788
3814
  _defineProperty(UniverDocsDrawingUIPlugin, "packageName", name);
3789
3815
  _defineProperty(UniverDocsDrawingUIPlugin, "version", version);
3790
3816
  UniverDocsDrawingUIPlugin = __decorate([
3791
- DependentOn(UniverDrawingUIPlugin, UniverDrawingPlugin, UniverDocsDrawingPlugin, UniverUIPlugin),
3817
+ DependentOn(UniverDocsPlugin, UniverDrawingPlugin, UniverRenderEnginePlugin, UniverDocsDrawingPlugin, UniverDocsUIPlugin, UniverDrawingUIPlugin),
3792
3818
  __decorateParam(1, Inject(Injector)),
3793
3819
  __decorateParam(2, IRenderManagerService),
3794
3820
  __decorateParam(3, IConfigService)