@univerjs/docs-drawing-ui 1.0.0-alpha.1 → 1.0.0-alpha.3

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,10 +1,10 @@
1
- import { AlignTypeH, AlignTypeV, ArrangeTypeEnum, BooleanNumber, BuildTextUtils, COLORS, CommandType, DOC_DRAWING_PRINTING_COMPONENT_KEY, DependentOn, Direction, Disposable, DisposableCollection, DocumentFlavor, DrawingTypeEnum, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, ICommandService, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, JSONX, LifecycleService, LifecycleStages, LocaleService, MemoryCursor, ObjectRelativeFromH, ObjectRelativeFromV, Plugin, PositionedObjectLayoutType, RedoCommand, RxDisposable, TextX, TextXActionType, Tools, UndoCommand, UniverInstanceType, WrapTextType, fromEventSubject, generateRandomId, getRichTextEditPath, isInternalEditorID, merge, throttle, toDisposable } from "@univerjs/core";
2
- import { IDocDrawingService, UniverDocsDrawingPlugin, getDocDrawingRenderOrder } from "@univerjs/docs-drawing";
1
+ import { AlignTypeH, AlignTypeV, ArrangeTypeEnum, BooleanNumber, BuildTextUtils, 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, IUndoRedoService, IUniverInstanceService, ImageSourceType, ImageUploadStatusType, Inject, Injector, JSONX, LifecycleService, LifecycleStages, LocaleService, MemoryCursor, ObjectRelativeFromH, ObjectRelativeFromV, Plugin, PositionedObjectLayoutType, RedoCommand, RxDisposable, TextX, TextXActionType, Tools, UndoCommand, UniverInstanceType, WrapTextType, fromEventSubject, generateRandomId, getRichTextEditPath, isInternalEditorID, merge, throttle, toDisposable } from "@univerjs/core";
2
+ import { IDocDrawingAdapterService, IDocDrawingService, UniverDocsDrawingPlugin, getDocDrawingRenderOrder } from "@univerjs/docs-drawing";
3
3
  import { DocContentInsertService, DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation } from "@univerjs/docs";
4
4
  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, docDrawingPositionToTransform, getAnchorBounding, getCustomBlockIdsInSelections, getDocObject, getOneTextSelectionRange } from "@univerjs/docs-ui";
5
5
  import { CURSOR_TYPE, DocumentEditArea, DocumentSkeletonPageType, IRenderManagerService, Liquid, PageLayoutType, Rect, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Vector2, getColor, getCurrentTypeOfRenderer, getDocsTableRenderViewport, getTableIdAndSliceIndex } from "@univerjs/engine-render";
6
6
  import { Checkbox, InputNumber, MessageType, Radio, RadioGroup, Select, clsx, render, unmount } from "@univerjs/design";
7
- import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, IDrawingManagerService, IImageIoService, ImageSourceType, ImageUploadStatusType, UniverDrawingPlugin, getDrawingImageAllowSize, getDrawingShapeKeyByDrawingSearch, getImageSize } from "@univerjs/drawing";
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
8
  import { CanvasFloatDomService, ComponentManager, ContextMenuGroup, ContextMenuPosition, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonInsertGroup, UniverUIPlugin, connectInjector, getMenuHiddenObservable, useDependency } from "@univerjs/ui";
9
9
  import { BehaviorSubject, Observable, debounceTime, filter, map, of, switchMap, takeUntil } from "rxjs";
10
10
  import { COMPONENT_IMAGE_POPUP_MENU, DrawingCommonPanel, DrawingRenderService, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
@@ -19,20 +19,58 @@ const RemoveDocDrawingCommand = {
19
19
  id: "doc.command.remove-doc-image",
20
20
  type: CommandType.COMMAND,
21
21
  handler: (accessor, params) => {
22
- var _docSelectionRenderSe, _documentDataModel$ge, _documentDataModel$ge2;
22
+ var _docSelectionRenderSe, _documentDataModel$ge, _documentDataModel$ge2, _removeDrawings$, _documentDataModel$ge3;
23
23
  const commandService = accessor.get(ICommandService);
24
+ const undoRedoService = accessor.get(IUndoRedoService);
25
+ const drawingAdapterService = accessor.get(IDocDrawingAdapterService);
24
26
  const univerInstanceService = accessor.get(IUniverInstanceService);
25
27
  const renderManagerService = accessor.get(IRenderManagerService);
26
- const documentDataModel = univerInstanceService.getCurrentUniverDocInstance();
28
+ const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
27
29
  if (params == null || documentDataModel == null) return false;
28
30
  const docSelectionRenderService = renderManagerService.getRenderById(params.unitId).with(DocSelectionRenderService);
29
31
  const { drawings: removeDrawings } = params;
30
32
  const segmentId = (_docSelectionRenderSe = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe !== void 0 ? _docSelectionRenderSe : "";
31
33
  const textX = new TextX();
32
34
  const jsonX = JSONX.getInstance();
33
- const customBlocks = (_documentDataModel$ge = (_documentDataModel$ge2 = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.customBlocks) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : [];
35
+ const customBlocks = (_documentDataModel$ge = (_documentDataModel$ge2 = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge2 === void 0 || (_documentDataModel$ge2 = _documentDataModel$ge2.getBody()) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.customBlocks) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : [];
34
36
  const removeCustomBlocks = removeDrawings.map((drawing) => customBlocks.find((customBlock) => customBlock.blockId === drawing.drawingId)).filter((block) => !!block).sort((a, b) => a.startIndex > b.startIndex ? 1 : -1);
35
- const unitId = removeDrawings[0].unitId;
37
+ const unitId = (_removeDrawings$ = removeDrawings[0]) === null || _removeDrawings$ === void 0 ? void 0 : _removeDrawings$.unitId;
38
+ if (unitId == null || removeCustomBlocks.length === 0) return false;
39
+ const drawings = (_documentDataModel$ge3 = documentDataModel.getDrawings()) !== null && _documentDataModel$ge3 !== void 0 ? _documentDataModel$ge3 : {};
40
+ const removeDrawingParamById = new Map(removeDrawings.map((drawing) => [drawing.drawingId, drawing]));
41
+ const removeDrawingSnapshots = removeCustomBlocks.map((block) => drawings[block.blockId]).filter((drawing) => drawing != null);
42
+ const resourceRedoMutations = [];
43
+ const resourceUndoMutations = [];
44
+ const resourceMutationGroups = [];
45
+ for (const block of removeCustomBlocks) {
46
+ var _removeDrawingParam$s;
47
+ const { blockId } = block;
48
+ const drawing = drawings[blockId];
49
+ if (drawing == null) continue;
50
+ const removeDrawingParam = removeDrawingParamById.get(blockId);
51
+ const mutationInfos = drawingAdapterService.getRemoveDrawingMutationInfos({
52
+ unitId,
53
+ subUnitId: (_removeDrawingParam$s = removeDrawingParam === null || removeDrawingParam === void 0 ? void 0 : removeDrawingParam.subUnitId) !== null && _removeDrawingParam$s !== void 0 ? _removeDrawingParam$s : unitId,
54
+ drawing,
55
+ removeDrawings: removeDrawingSnapshots
56
+ });
57
+ if (mutationInfos.redoMutations.length === 0 && mutationInfos.undoMutations.length === 0) continue;
58
+ resourceRedoMutations.push(...mutationInfos.redoMutations);
59
+ resourceUndoMutations.push(...mutationInfos.undoMutations);
60
+ resourceMutationGroups.push(mutationInfos);
61
+ }
62
+ if (!executeResourceMutationGroups(resourceMutationGroups, commandService)) return false;
63
+ const historyId = `doc-drawing-remove-resource:${unitId}:${removeCustomBlocks.map((block) => block.blockId).join(",")}`;
64
+ let batchingDisposable = null;
65
+ if (resourceRedoMutations.length > 0 || resourceUndoMutations.length > 0) {
66
+ batchingDisposable = undoRedoService.__tempBatchingUndoRedo(unitId);
67
+ undoRedoService.pushUndoRedo({
68
+ unitID: unitId,
69
+ redoMutations: resourceRedoMutations,
70
+ undoMutations: resourceUndoMutations,
71
+ id: historyId
72
+ });
73
+ }
36
74
  const memoryCursor = new MemoryCursor();
37
75
  memoryCursor.reset();
38
76
  const cursorIndex = removeCustomBlocks[0].startIndex;
@@ -64,11 +102,9 @@ const RemoveDocDrawingCommand = {
64
102
  const path = getRichTextEditPath(documentDataModel, segmentId);
65
103
  rawActions.push(jsonX.editOp(textX.serialize(), path));
66
104
  for (const block of removeCustomBlocks) {
67
- var _documentDataModel$ge3;
68
105
  const { blockId } = block;
69
- const drawing = ((_documentDataModel$ge3 = documentDataModel.getDrawings()) !== null && _documentDataModel$ge3 !== void 0 ? _documentDataModel$ge3 : {})[blockId];
70
106
  const drawingIndex = documentDataModel.getDrawingsOrder().indexOf(blockId);
71
- const removeDrawingAction = jsonX.removeOp(["drawings", blockId], drawing);
107
+ const removeDrawingAction = jsonX.removeOp(["drawings", blockId], drawings[blockId]);
72
108
  const removeDrawingOrderAction = jsonX.removeOp(["drawingsOrder", drawingIndex], blockId);
73
109
  rawActions.push(removeDrawingAction);
74
110
  rawActions.push(removeDrawingOrderAction);
@@ -77,9 +113,35 @@ const RemoveDocDrawingCommand = {
77
113
  return JSONX.compose(acc, cur);
78
114
  }, null);
79
115
  const result = commandService.syncExecuteCommand(doMutation.id, doMutation.params);
116
+ if (!result && batchingDisposable != null) {
117
+ batchingDisposable.dispose();
118
+ undoRedoService.rollback(historyId, unitId);
119
+ return false;
120
+ }
121
+ batchingDisposable === null || batchingDisposable === void 0 || batchingDisposable.dispose();
80
122
  return Boolean(result);
81
123
  }
82
124
  };
125
+ function executeResourceMutationGroups(mutationGroups, commandService) {
126
+ const executedUndoGroups = [];
127
+ for (const mutationGroup of mutationGroups) {
128
+ if (!executeMutations(mutationGroup.redoMutations, commandService)) {
129
+ executeMutationGroups([...executedUndoGroups].reverse(), commandService);
130
+ return false;
131
+ }
132
+ executedUndoGroups.push(mutationGroup.undoMutations);
133
+ }
134
+ return true;
135
+ }
136
+ function executeMutationGroups(mutationGroups, commandService) {
137
+ mutationGroups.forEach((mutations) => {
138
+ executeMutations(mutations, commandService);
139
+ });
140
+ }
141
+ function executeMutations(mutations, commandService) {
142
+ for (const mutation of mutations) if (!commandService.syncExecuteCommand(mutation.id, mutation.params)) return false;
143
+ return true;
144
+ }
83
145
 
84
146
  //#endregion
85
147
  //#region src/commands/commands/delete-doc-drawing.command.ts
@@ -129,16 +191,17 @@ const InsertDocDrawingCommand = {
129
191
  id: "doc.command.insert-doc-image",
130
192
  type: CommandType.COMMAND,
131
193
  handler: (accessor, params) => {
132
- var _ref, _contentInsertRange$s, _documentDataModel$ge, _documentDataModel$ge2;
194
+ var _ref, _contentInsertRange$s, _documentDataModel$ge, _documentDataModel$ge2, _documentDataModel$ge3;
133
195
  if (params == null) return false;
134
196
  const commandService = accessor.get(ICommandService);
135
197
  const docSelectionManagerService = accessor.get(DocSelectionManagerService);
136
198
  const univerInstanceService = accessor.get(IUniverInstanceService);
137
199
  const activeTextRange = docSelectionManagerService.getActiveTextRange();
138
- const documentDataModel = univerInstanceService.getCurrentUniverDocInstance();
200
+ const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
139
201
  if (documentDataModel == null) return false;
140
202
  const unitId = documentDataModel.getUnitId();
141
- const contentInsertRange = getContentInsertRange(accessor, unitId);
203
+ const explicitTextRange = params.textRange == null ? null : normalizeTextRange(params.textRange);
204
+ const contentInsertRange = explicitTextRange !== null && explicitTextRange !== void 0 ? explicitTextRange : getContentInsertRange(accessor, unitId);
142
205
  const targetTextRange = contentInsertRange ? {
143
206
  ...activeTextRange,
144
207
  startOffset: contentInsertRange.startOffset,
@@ -149,12 +212,12 @@ const InsertDocDrawingCommand = {
149
212
  if (targetTextRange == null) return false;
150
213
  const { drawings } = params;
151
214
  const { collapsed, startOffset, segmentId = "" } = targetTextRange;
152
- const body = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
215
+ const body = (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.getBody();
153
216
  if (body == null) return false;
154
217
  const textX = new TextX();
155
218
  const jsonX = JSONX.getInstance();
156
219
  const rawActions = [];
157
- const drawingOrderLength = (_documentDataModel$ge = (_documentDataModel$ge2 = documentDataModel.getSnapshot().drawingsOrder) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.length) !== null && _documentDataModel$ge !== void 0 ? _documentDataModel$ge : 0;
220
+ const drawingOrderLength = (_documentDataModel$ge2 = (_documentDataModel$ge3 = documentDataModel.getSnapshot().drawingsOrder) === null || _documentDataModel$ge3 === void 0 ? void 0 : _documentDataModel$ge3.length) !== null && _documentDataModel$ge2 !== void 0 ? _documentDataModel$ge2 : 0;
158
221
  let removeDrawingLen = 0;
159
222
  if (collapsed) {
160
223
  if (startOffset > 0) textX.push({
@@ -162,12 +225,12 @@ const InsertDocDrawingCommand = {
162
225
  len: startOffset
163
226
  });
164
227
  } else {
165
- var _documentDataModel$ge3, _documentDataModel$ge4;
228
+ var _documentDataModel$ge4, _documentDataModel$ge5;
166
229
  const dos = BuildTextUtils.selection.delete([targetTextRange], body, 0, null, false);
167
230
  textX.push(...dos);
168
231
  const removedCustomBlockIds = getCustomBlockIdsInSelections(body, [targetTextRange]);
169
- const drawings = (_documentDataModel$ge3 = documentDataModel.getDrawings()) !== null && _documentDataModel$ge3 !== void 0 ? _documentDataModel$ge3 : {};
170
- const drawingOrder = (_documentDataModel$ge4 = documentDataModel.getDrawingsOrder()) !== null && _documentDataModel$ge4 !== void 0 ? _documentDataModel$ge4 : [];
232
+ const drawings = (_documentDataModel$ge4 = documentDataModel.getDrawings()) !== null && _documentDataModel$ge4 !== void 0 ? _documentDataModel$ge4 : {};
233
+ const drawingOrder = (_documentDataModel$ge5 = documentDataModel.getDrawingsOrder()) !== null && _documentDataModel$ge5 !== void 0 ? _documentDataModel$ge5 : [];
171
234
  const sortedRemovedCustomBlockIds = removedCustomBlockIds.sort((a, b) => {
172
235
  if (drawingOrder.indexOf(a) > drawingOrder.indexOf(b)) return -1;
173
236
  else if (drawingOrder.indexOf(a) < drawingOrder.indexOf(b)) return 1;
@@ -234,6 +297,16 @@ function getContentInsertRange(accessor, unitId) {
234
297
  return null;
235
298
  }
236
299
  }
300
+ function normalizeTextRange(textRange) {
301
+ var _textRange$endOffset, _textRange$collapsed, _textRange$segmentId;
302
+ const endOffset = (_textRange$endOffset = textRange.endOffset) !== null && _textRange$endOffset !== void 0 ? _textRange$endOffset : textRange.startOffset;
303
+ return {
304
+ ...textRange,
305
+ endOffset,
306
+ collapsed: (_textRange$collapsed = textRange.collapsed) !== null && _textRange$collapsed !== void 0 ? _textRange$collapsed : textRange.startOffset === endOffset,
307
+ segmentId: (_textRange$segmentId = textRange.segmentId) !== null && _textRange$segmentId !== void 0 ? _textRange$segmentId : ""
308
+ };
309
+ }
237
310
 
238
311
  //#endregion
239
312
  //#region src/commands/commands/set-drawing-arrange.command.ts
@@ -665,7 +738,10 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
665
738
  });
666
739
  }));
667
740
  this.disposeWithMe(this._commandService.onCommandExecuted(async (command) => {
668
- if (command.id === RichTextEditingMutation.id) queueMicrotask(() => {
741
+ if (command.id !== RichTextEditingMutation.id) return;
742
+ const params = command.params;
743
+ if ((params === null || params === void 0 ? void 0 : params.unitId) && params.unitId !== this._context.unitId) return;
744
+ queueMicrotask(() => {
669
745
  this._updateDrawingsEditStatus();
670
746
  });
671
747
  }));
@@ -800,12 +876,12 @@ function findDrawingAnchorInPage(page, drawingId, pageMarginTop, pageMarginLeft)
800
876
  return null;
801
877
  }
802
878
  function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPage, offset, drawingId, documentDataModel, docSelectionRenderManager) {
803
- var _oldBody$customBlocks;
879
+ var _documentDataModel$ge, _documentDataModel$ge2, _oldBody$customBlocks;
804
880
  const textX = new TextX();
805
881
  const jsonX = JSONX.getInstance();
806
882
  const rawActions = [];
807
- const oldBody = documentDataModel.getSelfOrHeaderFooterModel(oldSegmentId).getBody();
808
- const body = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
883
+ const oldBody = (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(oldSegmentId)) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.getBody();
884
+ const body = (_documentDataModel$ge2 = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge2 === void 0 ? void 0 : _documentDataModel$ge2.getBody();
809
885
  if (oldBody == null || body == null) return;
810
886
  const oldOffset = (_oldBody$customBlocks = oldBody.customBlocks) === null || _oldBody$customBlocks === void 0 || (_oldBody$customBlocks = _oldBody$customBlocks.find((block) => block.blockId === drawingId)) === null || _oldBody$customBlocks === void 0 ? void 0 : _oldBody$customBlocks.startIndex;
811
887
  if (oldOffset == null) return;
@@ -916,7 +992,7 @@ const UpdateDocDrawingWrappingStyleCommand = {
916
992
  const skeletonData = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getSkeleton().getSkeletonData();
917
993
  const viewModel = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getViewModel();
918
994
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
919
- const documentDataModel = univerInstanceService.getCurrentUniverDocInstance();
995
+ const documentDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
920
996
  if (documentDataModel == null || skeletonData == null || scene == null || viewModel == null) return false;
921
997
  const editArea = viewModel.getEditArea();
922
998
  const transformer = scene.getTransformerByCreate();
@@ -1036,9 +1112,10 @@ const UpdateDocDrawingDistanceCommand = {
1036
1112
  handler: (accessor, params) => {
1037
1113
  if (params == null) return false;
1038
1114
  const commandService = accessor.get(ICommandService);
1039
- const documentDataModel = accessor.get(IUniverInstanceService).getCurrentUniverDocInstance();
1040
- if (documentDataModel == null) return false;
1115
+ const univerInstanceService = accessor.get(IUniverInstanceService);
1041
1116
  const { drawings, dist, unitId } = params;
1117
+ const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1118
+ if (documentDataModel == null) return false;
1042
1119
  const jsonX = JSONX.getInstance();
1043
1120
  const rawActions = [];
1044
1121
  const { drawings: oldDrawings = {} } = documentDataModel.getSnapshot();
@@ -1080,9 +1157,10 @@ const UpdateDocDrawingWrapTextCommand = {
1080
1157
  handler: (accessor, params) => {
1081
1158
  if (params == null) return false;
1082
1159
  const commandService = accessor.get(ICommandService);
1083
- const documentDataModel = accessor.get(IUniverInstanceService).getCurrentUniverDocInstance();
1084
- if (documentDataModel == null) return false;
1160
+ const univerInstanceService = accessor.get(IUniverInstanceService);
1085
1161
  const { drawings, wrapText, unitId } = params;
1162
+ const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1163
+ if (documentDataModel == null) return false;
1086
1164
  const jsonX = JSONX.getInstance();
1087
1165
  const rawActions = [];
1088
1166
  const { drawings: oldDrawings = {} } = documentDataModel.getSnapshot();
@@ -1123,13 +1201,14 @@ const UpdateDrawingDocTransformCommand = {
1123
1201
  if (params == null) return false;
1124
1202
  const commandService = accessor.get(ICommandService);
1125
1203
  const univerInstanceService = accessor.get(IUniverInstanceService);
1126
- const renderObject = accessor.get(IRenderManagerService).getRenderById(params.unitId);
1204
+ const renderManagerService = accessor.get(IRenderManagerService);
1205
+ const { drawings, unitId } = params;
1206
+ const renderObject = renderManagerService.getRenderUnitById(unitId);
1127
1207
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1128
1208
  if (scene == null) return false;
1129
1209
  const transformer = scene.getTransformerByCreate();
1130
- const documentDataModel = univerInstanceService.getCurrentUniverDocInstance();
1210
+ const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1131
1211
  if (documentDataModel == null) return false;
1132
- const { drawings, unitId } = params;
1133
1212
  const jsonX = JSONX.getInstance();
1134
1213
  const rawActions = [];
1135
1214
  const { drawings: oldDrawings = {} } = documentDataModel.getSnapshot();
@@ -1159,6 +1238,11 @@ const UpdateDrawingDocTransformCommand = {
1159
1238
  return JSONX.compose(acc, cur);
1160
1239
  }, null);
1161
1240
  const result = commandService.syncExecuteCommand(doMutation.id, doMutation.params);
1241
+ if (accessor.has(DocRefreshDrawingsService)) {
1242
+ var _renderObject$with$ge;
1243
+ const skeleton = (_renderObject$with$ge = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getSkeleton()) !== null && _renderObject$with$ge !== void 0 ? _renderObject$with$ge : null;
1244
+ accessor.get(DocRefreshDrawingsService).refreshDrawings(skeleton);
1245
+ }
1162
1246
  transformer.refreshControls();
1163
1247
  return Boolean(result);
1164
1248
  }
@@ -1172,18 +1256,18 @@ const IMoveInlineDrawingCommand = {
1172
1256
  handler: (accessor, params) => {
1173
1257
  var _renderManagerService, _docSelectionRenderSe;
1174
1258
  if (params == null) return false;
1259
+ const { drawing, unitId, offset, segmentId: newSegmentId, segmentPage, needRefreshDrawings } = params;
1175
1260
  const renderManagerService = accessor.get(IRenderManagerService);
1176
- const docSelectionRenderService = (_renderManagerService = renderManagerService.getRenderById(params.unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService);
1261
+ const docSelectionRenderService = (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService);
1177
1262
  const docRefreshDrawingsService = accessor.get(DocRefreshDrawingsService);
1178
- const renderObject = renderManagerService.getRenderById(params.unitId);
1263
+ const renderObject = renderManagerService.getRenderUnitById(unitId);
1179
1264
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1180
1265
  const skeleton = renderObject === null || renderObject === void 0 ? void 0 : renderObject.with(DocSkeletonManagerService).getSkeleton();
1181
1266
  if (scene == null || docSelectionRenderService == null) return false;
1182
1267
  const transformer = scene.getTransformerByCreate();
1183
1268
  const commandService = accessor.get(ICommandService);
1184
- const documentDataModel = accessor.get(IUniverInstanceService).getCurrentUniverDocInstance();
1269
+ const documentDataModel = accessor.get(IUniverInstanceService).getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1185
1270
  if (documentDataModel == null) return false;
1186
- const { drawing, unitId, offset, segmentId: newSegmentId, segmentPage, needRefreshDrawings } = params;
1187
1271
  if (needRefreshDrawings) {
1188
1272
  docRefreshDrawingsService.refreshDrawings(skeleton);
1189
1273
  transformer.refreshControls();
@@ -1223,16 +1307,16 @@ const ITransformNonInlineDrawingCommand = {
1223
1307
  handler: (accessor, params) => {
1224
1308
  var _renderManagerService2, _docSelectionRenderSe2;
1225
1309
  if (params == null) return false;
1310
+ const { drawing, unitId, offset, docTransform, segmentId: newSegmentId, segmentPage } = params;
1226
1311
  const renderManagerService = accessor.get(IRenderManagerService);
1227
- const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderById(params.unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
1228
- const renderObject = renderManagerService.getRenderById(params.unitId);
1312
+ const docSelectionRenderService = (_renderManagerService2 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService2 === void 0 ? void 0 : _renderManagerService2.with(DocSelectionRenderService);
1313
+ const renderObject = renderManagerService.getRenderUnitById(unitId);
1229
1314
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1230
1315
  if (scene == null || docSelectionRenderService == null) return false;
1231
1316
  const transformer = scene.getTransformerByCreate();
1232
1317
  const commandService = accessor.get(ICommandService);
1233
- const documentDataModel = accessor.get(IUniverInstanceService).getCurrentUniverDocInstance();
1318
+ const documentDataModel = accessor.get(IUniverInstanceService).getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1234
1319
  if (documentDataModel == null) return false;
1235
- const { drawing, unitId, offset, docTransform, segmentId: newSegmentId, segmentPage } = params;
1236
1320
  const rawActions = [];
1237
1321
  const { drawingId } = drawing;
1238
1322
  const actions = getDeleteAndInsertCustomBlockActions(newSegmentId, (_docSelectionRenderSe2 = docSelectionRenderService.getSegment()) !== null && _docSelectionRenderSe2 !== void 0 ? _docSelectionRenderSe2 : "", segmentPage, offset, drawingId, documentDataModel, docSelectionRenderService);
@@ -1313,7 +1397,7 @@ const MoveDocDrawingsCommand = {
1313
1397
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
1314
1398
  if (scene == null) return false;
1315
1399
  const transformer = scene.getTransformerByCreate();
1316
- const documentDataModel = univerInstanceService.getUniverDocInstance(unitId);
1400
+ const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1317
1401
  const newDrawings = drawings.map((drawing) => {
1318
1402
  var _documentDataModel$ge;
1319
1403
  const { drawingId } = drawing;
@@ -1461,6 +1545,30 @@ function calcDocFloatDomPosition(object, renderUnit) {
1461
1545
  right: left + width
1462
1546
  }, renderUnit.scene, opacity, angle);
1463
1547
  }
1548
+ function mergeDocFloatDomRuntimeProps(existingProps, param) {
1549
+ const customBlockRenderViewport = pickValidCustomBlockRenderViewport(param.customBlockRenderViewport);
1550
+ if (!customBlockRenderViewport) return existingProps;
1551
+ return {
1552
+ ...existingProps,
1553
+ customBlockRenderViewport
1554
+ };
1555
+ }
1556
+ function pickValidCustomBlockRenderViewport(viewport) {
1557
+ const result = {};
1558
+ if (isNonNegativeNumber(viewport === null || viewport === void 0 ? void 0 : viewport.bleedLeft)) result.bleedLeft = viewport.bleedLeft;
1559
+ if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.bleedWidth)) result.bleedWidth = viewport.bleedWidth;
1560
+ if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.contentHeight)) result.contentHeight = viewport.contentHeight;
1561
+ if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.contentWidth)) result.contentWidth = viewport.contentWidth;
1562
+ if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.height)) result.height = viewport.height;
1563
+ if (isPositiveNumber(viewport === null || viewport === void 0 ? void 0 : viewport.viewportHeight)) result.viewportHeight = viewport.viewportHeight;
1564
+ return Object.keys(result).length ? result : void 0;
1565
+ }
1566
+ function isPositiveNumber(value) {
1567
+ return typeof value === "number" && Number.isFinite(value) && value > 0;
1568
+ }
1569
+ function isNonNegativeNumber(value) {
1570
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
1571
+ }
1464
1572
  let DocFloatDomController = class DocFloatDomController extends Disposable {
1465
1573
  constructor(_renderManagerService, _drawingManagerService, _drawingRenderService, _canvasFloatDomService, _univerInstanceService, _commandService) {
1466
1574
  super();
@@ -1478,6 +1586,7 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
1478
1586
  }
1479
1587
  _initialize() {
1480
1588
  this._drawingAddRemoveListener();
1589
+ this._drawingRuntimePropsListener();
1481
1590
  this._initScrollAndZoomEvent();
1482
1591
  }
1483
1592
  _getSceneAndTransformerByDrawingSearch(unitId) {
@@ -1513,6 +1622,12 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
1513
1622
  const rects = await this._drawingRenderService.renderFloatDom(rectParam, renderObject.scene);
1514
1623
  if (rects == null || rects.length === 0) return;
1515
1624
  for (const rect of rects) {
1625
+ var _renderObject$scene$g;
1626
+ const runtimeParam = rectParam;
1627
+ const runtimeViewport = pickValidCustomBlockRenderViewport(runtimeParam.customBlockRenderViewport);
1628
+ const preserveRuntimeGeometry = isEmbedFloatDomRuntimeParam(runtimeParam);
1629
+ syncRectWithRuntimeParam(rect, runtimeParam, runtimeViewport, void 0, preserveRuntimeGeometry);
1630
+ const runtimeTransform = runtimeViewport || preserveRuntimeGeometry ? createTransformFromRect(rect) : void 0;
1516
1631
  this._addHoverForRect(rect);
1517
1632
  const disposableCollection = new DisposableCollection();
1518
1633
  const position$ = new BehaviorSubject(calcDocFloatDomPosition(rect, renderObject.renderUnit));
@@ -1520,7 +1635,10 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
1520
1635
  const data = rectParam.data;
1521
1636
  const info = {
1522
1637
  dispose: disposableCollection,
1638
+ preserveRuntimeGeometry,
1523
1639
  rect,
1640
+ runtimeTransform,
1641
+ runtimeViewport,
1524
1642
  position$,
1525
1643
  unitId
1526
1644
  };
@@ -1528,6 +1646,8 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
1528
1646
  position$,
1529
1647
  id: rectParam.drawingId,
1530
1648
  componentKey: rectParam.componentKey,
1649
+ eventPassThrough: preserveRuntimeGeometry ? false : void 0,
1650
+ preserveOnFocusChange: preserveRuntimeGeometry,
1531
1651
  onPointerDown: (evt) => {
1532
1652
  canvas.dispatchEvent(new PointerEvent(evt.type, evt));
1533
1653
  },
@@ -1541,20 +1661,42 @@ let DocFloatDomController = class DocFloatDomController extends Disposable {
1541
1661
  canvas.dispatchEvent(new WheelEvent(evt.type, evt));
1542
1662
  },
1543
1663
  data,
1664
+ props: mergeDocFloatDomRuntimeProps(void 0, rectParam),
1544
1665
  unitId
1545
1666
  });
1546
1667
  const listener = rect.onTransformChange$.subscribeEvent(() => {
1547
1668
  const newPosition = calcDocFloatDomPosition(rect, renderObject.renderUnit);
1548
1669
  position$.next(newPosition);
1549
1670
  });
1671
+ const scrollListener = subscribeViewportScrollAfter((_renderObject$scene$g = renderObject.scene.getViewport(VIEWPORT_KEY.VIEW_MAIN)) === null || _renderObject$scene$g === void 0 ? void 0 : _renderObject$scene$g.onScrollAfter$, () => position$.next(calcDocFloatDomPosition(rect, renderObject.renderUnit)));
1550
1672
  disposableCollection.add(() => {
1551
1673
  this._canvasFloatDomService.removeFloatDom(rectParam.drawingId);
1552
1674
  });
1553
1675
  listener && disposableCollection.add(listener);
1676
+ scrollListener && disposableCollection.add(scrollListener);
1554
1677
  this._domLayerInfoMap.set(rectParam.drawingId, info);
1555
1678
  }
1556
1679
  });
1557
1680
  }
1681
+ _drawingRuntimePropsListener() {
1682
+ this.disposeWithMe(this._drawingManagerService.refreshTransform$.subscribe((params) => {
1683
+ params.forEach((param) => {
1684
+ var _this$_canvasFloatDom;
1685
+ const floatDomInfo = this._domLayerInfoMap.get(param.drawingId);
1686
+ if (!floatDomInfo) return;
1687
+ const runtimeParam = param;
1688
+ const runtimeViewport = pickValidCustomBlockRenderViewport(runtimeParam.customBlockRenderViewport);
1689
+ if (runtimeViewport) floatDomInfo.runtimeViewport = runtimeViewport;
1690
+ if (syncRectWithRuntimeParam(floatDomInfo.rect, runtimeParam, floatDomInfo.runtimeViewport, floatDomInfo.runtimeTransform, floatDomInfo.preserveRuntimeGeometry)) {
1691
+ if (runtimeViewport || floatDomInfo.preserveRuntimeGeometry) floatDomInfo.runtimeTransform = createTransformFromRect(floatDomInfo.rect);
1692
+ const renderObject = this._getSceneAndTransformerByDrawingSearch(floatDomInfo.unitId);
1693
+ if (renderObject) floatDomInfo.position$.next(calcDocFloatDomPosition(floatDomInfo.rect, renderObject.renderUnit));
1694
+ }
1695
+ const currentProps = (_this$_canvasFloatDom = this._canvasFloatDomService.domLayers.find(([id]) => id === param.drawingId)) === null || _this$_canvasFloatDom === void 0 ? void 0 : _this$_canvasFloatDom[1].props;
1696
+ this._canvasFloatDomService.updateFloatDom(param.drawingId, { props: mergeDocFloatDomRuntimeProps(currentProps, param) });
1697
+ });
1698
+ }));
1699
+ }
1558
1700
  _addHoverForRect(o) {
1559
1701
  this.disposeWithMe(toDisposable(o.onPointerEnter$.subscribeEvent(() => {
1560
1702
  o.cursor = CURSOR_TYPE.GRAB;
@@ -1655,6 +1797,71 @@ DocFloatDomController = __decorate([
1655
1797
  __decorateParam(4, IUniverInstanceService),
1656
1798
  __decorateParam(5, ICommandService)
1657
1799
  ], DocFloatDomController);
1800
+ function syncRectWithRuntimeParam(rect, param, fallbackViewport, fallbackTransform, preserveRuntimeGeometry) {
1801
+ const transform = getRuntimeTransform(param, rect, fallbackViewport, fallbackTransform, preserveRuntimeGeometry);
1802
+ if (!transform) return false;
1803
+ rect.transformByState(transform);
1804
+ return true;
1805
+ }
1806
+ function getRuntimeTransform(param, rect, fallbackViewport, fallbackTransform, preserveRuntimeGeometry) {
1807
+ var _param$transform, _param$transforms, _param$customBlockRen, _runtimeViewport$heig2;
1808
+ 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];
1809
+ const runtimeViewport = (_param$customBlockRen = param.customBlockRenderViewport) !== null && _param$customBlockRen !== void 0 ? _param$customBlockRen : fallbackViewport;
1810
+ if (!param.customBlockRenderViewport && preserveRuntimeGeometry && fallbackTransform && transform) {
1811
+ var _fallbackTransform$wi, _fallbackTransform$he;
1812
+ return {
1813
+ ...transform,
1814
+ width: (_fallbackTransform$wi = fallbackTransform.width) !== null && _fallbackTransform$wi !== void 0 ? _fallbackTransform$wi : transform.width,
1815
+ height: (_fallbackTransform$he = fallbackTransform.height) !== null && _fallbackTransform$he !== void 0 ? _fallbackTransform$he : transform.height
1816
+ };
1817
+ }
1818
+ if (!transform) {
1819
+ var _runtimeViewport$heig;
1820
+ 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;
1821
+ if (!isPositiveNumber(height)) return;
1822
+ return {
1823
+ left: rect.left,
1824
+ top: rect.top,
1825
+ width: rect.width,
1826
+ height,
1827
+ angle: rect.angle
1828
+ };
1829
+ }
1830
+ 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;
1831
+ if (!isPositiveNumber(height)) return transform;
1832
+ return {
1833
+ ...transform,
1834
+ height
1835
+ };
1836
+ }
1837
+ function isEmbedFloatDomRuntimeParam(param) {
1838
+ const data = param.data;
1839
+ if (!data || typeof data !== "object") return false;
1840
+ const candidate = data;
1841
+ return candidate.version === 1 && typeof candidate.embedId === "string" && typeof candidate.hostAnchorId === "string";
1842
+ }
1843
+ function createTransformFromRect(rect) {
1844
+ return {
1845
+ angle: rect.angle,
1846
+ height: rect.height,
1847
+ left: rect.left,
1848
+ top: rect.top,
1849
+ width: rect.width
1850
+ };
1851
+ }
1852
+ function subscribeViewportScrollAfter(scrollEvent, callback) {
1853
+ if (!scrollEvent || typeof scrollEvent !== "object") return;
1854
+ const eventSubject = scrollEvent;
1855
+ if (typeof eventSubject.subscribeEvent === "function") return eventSubject.subscribeEvent(callback);
1856
+ const observable = scrollEvent;
1857
+ if (typeof observable.subscribe === "function") {
1858
+ const subscription = observable.subscribe(callback);
1859
+ return toDisposable(() => {
1860
+ var _subscription$unsubsc;
1861
+ return (_subscription$unsubsc = subscription.unsubscribe) === null || _subscription$unsubsc === void 0 ? void 0 : _subscription$unsubsc.call(subscription);
1862
+ });
1863
+ }
1864
+ }
1658
1865
 
1659
1866
  //#endregion
1660
1867
  //#region src/menu/image.menu.ts
@@ -1669,8 +1876,8 @@ const getDisableWhenSelectionInTableObservable = (accessor) => {
1669
1876
  if (activeRange) {
1670
1877
  var _docDataModel$getSelf;
1671
1878
  const { segmentId, startOffset, endOffset } = activeRange;
1672
- const docDataModel = univerInstanceService.getCurrentUniverDocInstance();
1673
- const tables = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.tables;
1879
+ const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
1880
+ const tables = docDataModel === null || docDataModel === void 0 || (_docDataModel$getSelf = docDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _docDataModel$getSelf === void 0 || (_docDataModel$getSelf = _docDataModel$getSelf.getBody()) === null || _docDataModel$getSelf === void 0 ? void 0 : _docDataModel$getSelf.tables;
1674
1881
  if (tables && tables.length) {
1675
1882
  if (tables.some((table) => {
1676
1883
  const { startIndex, endIndex } = table;
@@ -1781,10 +1988,79 @@ function InsertEllipseShapeBelowMenuFactory(accessor) {
1781
1988
  };
1782
1989
  }
1783
1990
 
1991
+ //#endregion
1992
+ //#region src/menu/schema.ts
1993
+ const menuSchema = {
1994
+ [RibbonInsertGroup.MEDIA]: { [DOCS_IMAGE_MENU_ID]: {
1995
+ order: 0,
1996
+ menuItemFactory: ImageMenuFactory,
1997
+ [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
1998
+ order: 0,
1999
+ menuItemFactory: UploadFloatImageMenuFactory
2000
+ }
2001
+ } },
2002
+ [ContextMenuPosition.PARAGRAPH]: {
2003
+ [ContextMenuGroup.LAYOUT]: { [INSERT_BELLOW_MENU_ID]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
2004
+ order: 5,
2005
+ menuItemFactory: UploadFloatImageMenuFactory
2006
+ } } },
2007
+ [EMPTY_PARAGRAPH_MENU_ID]: { [ContextMenuGroup.LAYOUT]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
2008
+ order: 5,
2009
+ menuItemFactory: UploadFloatImageMenuFactory
2010
+ } } },
2011
+ [DOC_CONTENT_INSERT_MENU_ID]: { [ContextMenuGroup.LAYOUT]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
2012
+ order: 5,
2013
+ menuItemFactory: UploadFloatImageMenuFactory
2014
+ } } },
2015
+ [DOC_PARAGRAPH_T_INSERT_MENU_ID]: { insert: {
2016
+ [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
2017
+ order: 1,
2018
+ menuItemFactory: UploadFloatImageMenuFactory
2019
+ },
2020
+ [DOCS_SHAPE_MENU_ID]: {
2021
+ order: 2,
2022
+ menuItemFactory: ShapeMenuFactory
2023
+ }
2024
+ } },
2025
+ [DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID]: { insert: {
2026
+ [`${IMAGE_MENU_UPLOAD_FLOAT_ID}.below`]: {
2027
+ order: 1,
2028
+ menuItemFactory: UploadFloatImageBelowMenuFactory
2029
+ },
2030
+ [DOCS_SHAPE_BELOW_MENU_ID]: {
2031
+ order: 2,
2032
+ menuItemFactory: ShapeBelowMenuFactory
2033
+ }
2034
+ } },
2035
+ [DOCS_SHAPE_MENU_ID]: { shapes: {
2036
+ order: 0,
2037
+ [InsertDocRectangleShapeCommand.id]: {
2038
+ order: 0,
2039
+ menuItemFactory: InsertRectangleShapeMenuFactory
2040
+ },
2041
+ [InsertDocEllipseShapeCommand.id]: {
2042
+ order: 1,
2043
+ menuItemFactory: InsertEllipseShapeMenuFactory
2044
+ }
2045
+ } },
2046
+ [DOCS_SHAPE_BELOW_MENU_ID]: { shapes: {
2047
+ order: 0,
2048
+ [`${InsertDocRectangleShapeCommand.id}.below`]: {
2049
+ order: 0,
2050
+ menuItemFactory: InsertRectangleShapeBelowMenuFactory
2051
+ },
2052
+ [`${InsertDocEllipseShapeCommand.id}.below`]: {
2053
+ order: 1,
2054
+ menuItemFactory: InsertEllipseShapeBelowMenuFactory
2055
+ }
2056
+ } }
2057
+ }
2058
+ };
2059
+
1784
2060
  //#endregion
1785
2061
  //#region package.json
1786
2062
  var name = "@univerjs/docs-drawing-ui";
1787
- var version = "1.0.0-alpha.1";
2063
+ var version = "1.0.0-alpha.3";
1788
2064
 
1789
2065
  //#endregion
1790
2066
  //#region src/config/config.ts
@@ -1821,7 +2097,7 @@ const DocDrawingPosition = (props) => {
1821
2097
  const drawingParam = drawings[0];
1822
2098
  if (drawingParam == null) return;
1823
2099
  const { unitId } = drawingParam;
1824
- const documentDataModel = univerInstanceService.getUniverDocInstance(unitId);
2100
+ const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
1825
2101
  const documentFlavor = documentDataModel === null || documentDataModel === void 0 ? void 0 : documentDataModel.getSnapshot().documentStyle.documentFlavor;
1826
2102
  const renderObject = renderManagerService.getRenderById(unitId);
1827
2103
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
@@ -1957,12 +2233,12 @@ const DocDrawingPosition = (props) => {
1957
2233
  const focusDrawings = drawingManagerService.getFocusDrawings();
1958
2234
  if (focusDrawings.length === 0) return;
1959
2235
  const { drawingId, unitId } = focusDrawings[0];
1960
- const documentDataModel = univerInstanceService.getUniverDocInstance(unitId);
1961
- const skeleton = (_renderManagerService3 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService).getSkeleton();
1962
- const docSelectionRenderService = (_renderManagerService4 = renderManagerService.getRenderById(unitId)) === null || _renderManagerService4 === void 0 ? void 0 : _renderManagerService4.with(DocSelectionRenderService);
2236
+ const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
2237
+ const skeleton = (_renderManagerService3 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService3 === void 0 ? void 0 : _renderManagerService3.with(DocSkeletonManagerService).getSkeleton();
2238
+ const docSelectionRenderService = (_renderManagerService4 = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService4 === void 0 ? void 0 : _renderManagerService4.with(DocSelectionRenderService);
1963
2239
  const segmentId = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegment();
1964
2240
  const segmentPage = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.getSegmentPage();
1965
- const drawing = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody()) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.customBlocks) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.find((c) => c.blockId === drawingId);
2241
+ const drawing = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSelfOrHeaderFooterModel(segmentId)) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.getBody()) === null || _documentDataModel$ge === void 0 || (_documentDataModel$ge = _documentDataModel$ge.customBlocks) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge.find((c) => c.blockId === drawingId);
1966
2242
  if (drawing == null || skeleton == null || docSelectionRenderService == null) return;
1967
2243
  const { startIndex } = drawing;
1968
2244
  const glyph = skeleton.findNodeByCharIndex(startIndex, segmentId, segmentPage);
@@ -2107,8 +2383,8 @@ const DocDrawingTextWrap = (props) => {
2107
2383
  const drawingParam = drawings[0];
2108
2384
  if (drawingParam == null) return null;
2109
2385
  const { unitId } = drawingParam;
2110
- const documentDataModel = univerInstanceService.getUniverDocInstance(unitId);
2111
- const renderObject = renderManagerService.getRenderById(unitId);
2386
+ const documentDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
2387
+ const renderObject = renderManagerService.getRenderUnitById(unitId);
2112
2388
  if ((renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene) == null) return null;
2113
2389
  const [disableWrapText, setDisableWrapText] = useState(true);
2114
2390
  const [disableDistTB, setDisableDistTB] = useState(true);
@@ -2447,6 +2723,24 @@ function getReOrderedDrawings(actions) {
2447
2723
  }
2448
2724
  return drawingIndexes;
2449
2725
  }
2726
+ function collectUpdatedDrawingIds(actions, drawingIds = /* @__PURE__ */ new Set()) {
2727
+ if (JSONX.isNoop(actions) || !Array.isArray(actions)) return drawingIds;
2728
+ if (actions[0] === "drawings") {
2729
+ const drawingKeyOrOps = actions[1];
2730
+ if (typeof drawingKeyOrOps === "string") {
2731
+ drawingIds.add(drawingKeyOrOps);
2732
+ return drawingIds;
2733
+ }
2734
+ actions.slice(1).forEach((action) => {
2735
+ if (Array.isArray(action) && typeof action[0] === "string") drawingIds.add(action[0]);
2736
+ });
2737
+ return drawingIds;
2738
+ }
2739
+ actions.forEach((action) => {
2740
+ if (Array.isArray(action)) collectUpdatedDrawingIds(action, drawingIds);
2741
+ });
2742
+ return drawingIds;
2743
+ }
2450
2744
  let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends Disposable {
2451
2745
  constructor(_univerInstanceService, _commandService, _drawingManagerService, _docDrawingService, _renderManagerService) {
2452
2746
  super();
@@ -2475,14 +2769,16 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
2475
2769
  if (command.id !== RichTextEditingMutation.id) return;
2476
2770
  const { unitId, actions } = command.params;
2477
2771
  if (getReOrderedDrawings(actions).length > 0) this._updateDrawingsOrder(unitId);
2772
+ const updatedDrawingIds = [...collectUpdatedDrawingIds(actions)];
2773
+ if (updatedDrawingIds.length > 0) this._syncDrawingDataFromSnapshot(unitId, updatedDrawingIds);
2478
2774
  }));
2479
2775
  this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
2480
2776
  var _this$_univerInstance;
2481
2777
  if (command.id !== UndoCommand.id && command.id !== RedoCommand.id) return;
2482
- const unitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUniverDocInstance()) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
2778
+ const unitId = (_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId();
2483
2779
  const focusedDrawings = this._drawingManagerService.getFocusDrawings();
2484
2780
  if (unitId == null || focusedDrawings.length === 0) return;
2485
- const renderObject = this._renderManagerService.getRenderById(unitId);
2781
+ const renderObject = this._renderManagerService.getRenderUnitById(unitId);
2486
2782
  const scene = renderObject === null || renderObject === void 0 ? void 0 : renderObject.scene;
2487
2783
  if (scene == null) return false;
2488
2784
  scene.getTransformerByCreate().refreshControls();
@@ -2513,7 +2809,7 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
2513
2809
  docDrawingService.removeNotification(objects);
2514
2810
  }
2515
2811
  _updateDrawingsOrder(unitId) {
2516
- const documentDataModel = this._univerInstanceService.getUniverDocInstance(unitId);
2812
+ const documentDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
2517
2813
  if (documentDataModel == null) return;
2518
2814
  const { drawings, drawingsOrder } = documentDataModel.getSnapshot();
2519
2815
  if (drawingsOrder == null) return;
@@ -2534,6 +2830,25 @@ let DocDrawingAddRemoveController = class DocDrawingAddRemoveController extends
2534
2830
  drawingIds: drawingsOrder
2535
2831
  });
2536
2832
  }
2833
+ _syncDrawingDataFromSnapshot(unitId, drawingIds) {
2834
+ const documentDataModel = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
2835
+ if (documentDataModel == null) return;
2836
+ const { drawings = {}, drawingsOrder = [] } = documentDataModel.getSnapshot();
2837
+ const drawingData = drawings;
2838
+ const renderOrder = getDocDrawingRenderOrder(drawingsOrder, drawings);
2839
+ this._docDrawingService.setDrawingData(unitId, unitId, drawingData);
2840
+ this._drawingManagerService.setDrawingData(unitId, unitId, drawingData);
2841
+ this._docDrawingService.setDrawingOrder(unitId, unitId, drawingsOrder);
2842
+ this._drawingManagerService.setDrawingOrder(unitId, unitId, renderOrder);
2843
+ const objects = drawingIds.filter((drawingId) => drawingData[drawingId] != null).map((drawingId) => ({
2844
+ unitId,
2845
+ subUnitId: unitId,
2846
+ drawingId
2847
+ }));
2848
+ if (objects.length === 0) return;
2849
+ this._docDrawingService.updateNotification(objects);
2850
+ this._drawingManagerService.updateNotification(objects);
2851
+ }
2537
2852
  };
2538
2853
  DocDrawingAddRemoveController = __decorate([
2539
2854
  __decorateParam(0, IUniverInstanceService),
@@ -2924,6 +3239,7 @@ let DocDrawingTransformUpdateController = class DocDrawingTransformUpdateControl
2924
3239
  behindText,
2925
3240
  transform,
2926
3241
  transforms: [transform],
3242
+ customBlockRenderViewport: drawing.customBlockRenderViewport,
2927
3243
  isMultiTransform
2928
3244
  };
2929
3245
  else if (isMultiTransform === BooleanNumber.TRUE) updateDrawingMap[drawingId].transforms.push(transform);
@@ -3029,7 +3345,7 @@ let DocDrawingTransformerController = class DocDrawingTransformerController exte
3029
3345
  const { oKey, width, height, left, top, angle } = object;
3030
3346
  const drawing = this._drawingManagerService.getDrawingOKey(oKey);
3031
3347
  if (drawing == null) continue;
3032
- const documentDataModel = this._univerInstanceService.getUniverDocInstance(drawing.unitId);
3348
+ const documentDataModel = this._univerInstanceService.getUnit(drawing.unitId, UniverInstanceType.UNIVER_DOC);
3033
3349
  const drawingData = documentDataModel === null || documentDataModel === void 0 || (_documentDataModel$ge = documentDataModel.getSnapshot().drawings) === null || _documentDataModel$ge === void 0 ? void 0 : _documentDataModel$ge[drawing.drawingId];
3034
3350
  if ((drawingData === null || drawingData === void 0 ? void 0 : drawingData.layoutType) === PositionedObjectLayoutType.INLINE) try {
3035
3351
  object.setOpacity(.2);
@@ -3517,75 +3833,6 @@ DocDrawingTransformerController = __decorate([
3517
3833
  __decorateParam(3, IRenderManagerService)
3518
3834
  ], DocDrawingTransformerController);
3519
3835
 
3520
- //#endregion
3521
- //#region src/menu/schema.ts
3522
- const menuSchema = {
3523
- [RibbonInsertGroup.MEDIA]: { [DOCS_IMAGE_MENU_ID]: {
3524
- order: 0,
3525
- menuItemFactory: ImageMenuFactory,
3526
- [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
3527
- order: 0,
3528
- menuItemFactory: UploadFloatImageMenuFactory
3529
- }
3530
- } },
3531
- [ContextMenuPosition.PARAGRAPH]: {
3532
- [ContextMenuGroup.LAYOUT]: { [INSERT_BELLOW_MENU_ID]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
3533
- order: 5,
3534
- menuItemFactory: UploadFloatImageMenuFactory
3535
- } } },
3536
- [EMPTY_PARAGRAPH_MENU_ID]: { [ContextMenuGroup.LAYOUT]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
3537
- order: 5,
3538
- menuItemFactory: UploadFloatImageMenuFactory
3539
- } } },
3540
- [DOC_CONTENT_INSERT_MENU_ID]: { [ContextMenuGroup.LAYOUT]: { [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
3541
- order: 5,
3542
- menuItemFactory: UploadFloatImageMenuFactory
3543
- } } },
3544
- [DOC_PARAGRAPH_T_INSERT_MENU_ID]: { insert: {
3545
- [IMAGE_MENU_UPLOAD_FLOAT_ID]: {
3546
- order: 1,
3547
- menuItemFactory: UploadFloatImageMenuFactory
3548
- },
3549
- [DOCS_SHAPE_MENU_ID]: {
3550
- order: 2,
3551
- menuItemFactory: ShapeMenuFactory
3552
- }
3553
- } },
3554
- [DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID]: { insert: {
3555
- [`${IMAGE_MENU_UPLOAD_FLOAT_ID}.below`]: {
3556
- order: 1,
3557
- menuItemFactory: UploadFloatImageBelowMenuFactory
3558
- },
3559
- [DOCS_SHAPE_BELOW_MENU_ID]: {
3560
- order: 2,
3561
- menuItemFactory: ShapeBelowMenuFactory
3562
- }
3563
- } },
3564
- [DOCS_SHAPE_MENU_ID]: { shapes: {
3565
- order: 0,
3566
- [InsertDocRectangleShapeCommand.id]: {
3567
- order: 0,
3568
- menuItemFactory: InsertRectangleShapeMenuFactory
3569
- },
3570
- [InsertDocEllipseShapeCommand.id]: {
3571
- order: 1,
3572
- menuItemFactory: InsertEllipseShapeMenuFactory
3573
- }
3574
- } },
3575
- [DOCS_SHAPE_BELOW_MENU_ID]: { shapes: {
3576
- order: 0,
3577
- [`${InsertDocRectangleShapeCommand.id}.below`]: {
3578
- order: 0,
3579
- menuItemFactory: InsertRectangleShapeBelowMenuFactory
3580
- },
3581
- [`${InsertDocEllipseShapeCommand.id}.below`]: {
3582
- order: 1,
3583
- menuItemFactory: InsertEllipseShapeBelowMenuFactory
3584
- }
3585
- } }
3586
- }
3587
- };
3588
-
3589
3836
  //#endregion
3590
3837
  //#region src/controllers/shortcuts/drawing.shortcut.ts
3591
3838
  function whenDocDrawingFocused(contextService) {
@@ -3717,16 +3964,40 @@ DocDrawingUIController = __decorate([
3717
3964
  __decorateParam(2, IShortcutService)
3718
3965
  ], DocDrawingUIController);
3719
3966
 
3967
+ //#endregion
3968
+ //#region src/services/doc-drawing-floating-toolbar-adapter.service.ts
3969
+ var DocDrawingFloatingToolbarAdapterService = class {
3970
+ constructor() {
3971
+ _defineProperty(this, "_adapters", []);
3972
+ }
3973
+ registerAdapter(adapter) {
3974
+ this._adapters.push(adapter);
3975
+ return toDisposable(() => {
3976
+ const index = this._adapters.indexOf(adapter);
3977
+ if (index >= 0) this._adapters.splice(index, 1);
3978
+ });
3979
+ }
3980
+ getItems(params) {
3981
+ for (const adapter of this._adapters) {
3982
+ const items = adapter.getItems(params);
3983
+ if (items) return [...items].sort((a, b) => a.index - b.index);
3984
+ }
3985
+ return null;
3986
+ }
3987
+ };
3988
+
3720
3989
  //#endregion
3721
3990
  //#region src/menu/drawing-popup-menu.controller.ts
3722
3991
  let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends RxDisposable {
3723
- constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _commandService) {
3992
+ constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _drawingAdapterService, _floatingToolbarAdapterService, _commandService) {
3724
3993
  super();
3725
3994
  this._drawingManagerService = _drawingManagerService;
3726
3995
  this._canvasPopManagerService = _canvasPopManagerService;
3727
3996
  this._renderManagerService = _renderManagerService;
3728
3997
  this._univerInstanceService = _univerInstanceService;
3729
3998
  this._contextService = _contextService;
3999
+ this._drawingAdapterService = _drawingAdapterService;
4000
+ this._floatingToolbarAdapterService = _floatingToolbarAdapterService;
3730
4001
  this._commandService = _commandService;
3731
4002
  _defineProperty(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
3732
4003
  _defineProperty(this, "_disposePopups", []);
@@ -3796,13 +4067,14 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
3796
4067
  if (!drawingParam || drawingParam.drawingType === DrawingTypeEnum.DRAWING_DOM || drawingParam.drawingType === DrawingTypeEnum.DRAWING_SHAPE) return;
3797
4068
  const { unitId, subUnitId, drawingId, drawingType } = drawingParam;
3798
4069
  const isImage = drawingType === DrawingTypeEnum.DRAWING_IMAGE;
4070
+ const isChart = drawingType === DrawingTypeEnum.DRAWING_CHART;
3799
4071
  const popup = this._canvasPopManagerService.attachPopupToObject(object, {
3800
4072
  componentKey: COMPONENT_IMAGE_POPUP_MENU,
3801
- direction: isImage ? "top-center" : "horizontal",
3802
- offset: isImage ? [0, 8] : [2, 0],
4073
+ direction: isImage || isChart ? "top-center" : "horizontal",
4074
+ offset: isImage || isChart ? [0, 8] : [2, 0],
3803
4075
  extraProps: {
3804
- menuItems: this._getImageMenuItems(unitId, subUnitId, drawingId, drawingType),
3805
- variant: isImage ? "doc-floating-toolbar" : void 0,
4076
+ menuItems: this._getDrawingPopupMenuItems(unitId, subUnitId, drawingId, drawingType),
4077
+ variant: isImage ? "doc-floating-toolbar" : isChart ? "doc-chart-floating-toolbar" : void 0,
3806
4078
  unitId,
3807
4079
  subUnitId,
3808
4080
  drawingId
@@ -3831,18 +4103,35 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
3831
4103
  disposePopups.length = 0;
3832
4104
  }));
3833
4105
  }
3834
- _getImageMenuItems(unitId, subUnitId, drawingId, drawingType) {
4106
+ _getDrawingPopupMenuItems(unitId, subUnitId, drawingId, drawingType) {
4107
+ var _editCommandInfo$labe, _editCommandInfo$comm, _editCommandInfo$comm2, _editCommandInfo$disa;
4108
+ const drawing = this._drawingManagerService.getDrawingByParam({
4109
+ unitId,
4110
+ subUnitId,
4111
+ drawingId
4112
+ });
4113
+ const floatingToolbarMenuItems = drawing ? this._floatingToolbarAdapterService.getItems({
4114
+ unitId,
4115
+ subUnitId,
4116
+ drawing
4117
+ }) : null;
4118
+ if (floatingToolbarMenuItems) return floatingToolbarMenuItems;
4119
+ const editCommandInfo = drawing ? this._drawingAdapterService.getEditDrawingCommandInfo({
4120
+ unitId,
4121
+ subUnitId,
4122
+ drawing
4123
+ }) : null;
3835
4124
  return [
3836
4125
  {
3837
- label: "docs-drawing-ui.image-popup.edit",
4126
+ 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",
3838
4127
  index: 0,
3839
- commandId: EditDocDrawingOperation.id,
3840
- commandParams: {
4128
+ commandId: (_editCommandInfo$comm = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandId) !== null && _editCommandInfo$comm !== void 0 ? _editCommandInfo$comm : EditDocDrawingOperation.id,
4129
+ commandParams: (_editCommandInfo$comm2 = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.commandParams) !== null && _editCommandInfo$comm2 !== void 0 ? _editCommandInfo$comm2 : {
3841
4130
  unitId,
3842
4131
  subUnitId,
3843
4132
  drawingId
3844
4133
  },
3845
- disable: drawingType === DrawingTypeEnum.DRAWING_DOM
4134
+ disable: (_editCommandInfo$disa = editCommandInfo === null || editCommandInfo === void 0 ? void 0 : editCommandInfo.disable) !== null && _editCommandInfo$disa !== void 0 ? _editCommandInfo$disa : drawingType === DrawingTypeEnum.DRAWING_DOM
3846
4135
  },
3847
4136
  {
3848
4137
  label: "docs-drawing-ui.image-popup.delete",
@@ -3889,7 +4178,9 @@ DocDrawingPopupMenuController = __decorate([
3889
4178
  __decorateParam(2, IRenderManagerService),
3890
4179
  __decorateParam(3, IUniverInstanceService),
3891
4180
  __decorateParam(4, IContextService),
3892
- __decorateParam(5, ICommandService)
4181
+ __decorateParam(5, IDocDrawingAdapterService),
4182
+ __decorateParam(6, Inject(DocDrawingFloatingToolbarAdapterService)),
4183
+ __decorateParam(7, ICommandService)
3893
4184
  ], DocDrawingPopupMenuController);
3894
4185
 
3895
4186
  //#endregion
@@ -3912,6 +4203,7 @@ let UniverDocsDrawingUIPlugin = class UniverDocsDrawingUIPlugin extends Plugin {
3912
4203
  [DocDrawingTransformerController],
3913
4204
  [DocDrawingAddRemoveController],
3914
4205
  [DocRefreshDrawingsService],
4206
+ [DocDrawingFloatingToolbarAdapterService],
3915
4207
  [DocFloatDomController],
3916
4208
  [DocDrawingPrintingController]
3917
4209
  ].forEach((dependency) => this._injector.add(dependency));
@@ -3941,4 +4233,4 @@ UniverDocsDrawingUIPlugin = __decorate([
3941
4233
  ], UniverDocsDrawingUIPlugin);
3942
4234
 
3943
4235
  //#endregion
3944
- export { ClearDocDrawingTransformerOperation, DOCS_IMAGE_MENU_ID, DOCS_SHAPE_BELOW_MENU_ID, DOCS_SHAPE_MENU_ID, DeleteDocDrawingsCommand, DocDrawingPosition, DocDrawingTextWrap, DocFloatDomController, EditDocDrawingOperation, GroupDocDrawingCommand, InsertDocDrawingCommand, InsertDocEllipseShapeCommand, InsertDocImageCommand, InsertDocRectangleShapeCommand, MoveDocDrawingsCommand, RemoveDocDrawingCommand, SetDocDrawingArrangeCommand, SidebarDocDrawingOperation, UngroupDocDrawingCommand, UniverDocsDrawingUIPlugin };
4236
+ export { ClearDocDrawingTransformerOperation, DOCS_IMAGE_MENU_ID, DOCS_SHAPE_BELOW_MENU_ID, DOCS_SHAPE_MENU_ID, DeleteDocDrawingsCommand, DocDrawingFloatingToolbarAdapterService, DocDrawingPosition, DocDrawingTextWrap, DocFloatDomController, menuSchema as DocsDrawingUIMenuSchema, EditDocDrawingOperation, GroupDocDrawingCommand, InsertDocDrawingCommand, InsertDocEllipseShapeCommand, InsertDocImageCommand, InsertDocRectangleShapeCommand, MoveDocDrawingsCommand, RemoveDocDrawingCommand, SetDocDrawingArrangeCommand, SidebarDocDrawingOperation, UngroupDocDrawingCommand, UniverDocsDrawingUIPlugin, UpdateDrawingDocTransformCommand };