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