@univerjs/docs-drawing-ui 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +117 -122
- package/lib/cjs/locale/ar-SA.js +1 -2
- package/lib/cjs/locale/ca-ES.js +1 -2
- package/lib/cjs/locale/de-DE.js +1 -2
- package/lib/cjs/locale/en-US.js +1 -2
- package/lib/cjs/locale/es-ES.js +1 -2
- package/lib/cjs/locale/fa-IR.js +1 -2
- package/lib/cjs/locale/fr-FR.js +1 -2
- package/lib/cjs/locale/id-ID.js +1 -2
- package/lib/cjs/locale/it-IT.js +1 -2
- package/lib/cjs/locale/ja-JP.js +1 -2
- package/lib/cjs/locale/ko-KR.js +1 -2
- package/lib/cjs/locale/pl-PL.js +1 -2
- package/lib/cjs/locale/pt-BR.js +1 -2
- package/lib/cjs/locale/ru-RU.js +1 -2
- package/lib/cjs/locale/sk-SK.js +1 -2
- package/lib/cjs/locale/vi-VN.js +1 -2
- package/lib/cjs/locale/zh-CN.js +1 -2
- package/lib/cjs/locale/zh-HK.js +1 -2
- package/lib/cjs/locale/zh-TW.js +1 -2
- package/lib/es/index.js +120 -125
- package/lib/es/locale/ar-SA.js +1 -2
- package/lib/es/locale/ca-ES.js +1 -2
- package/lib/es/locale/de-DE.js +1 -2
- package/lib/es/locale/en-US.js +1 -2
- package/lib/es/locale/es-ES.js +1 -2
- package/lib/es/locale/fa-IR.js +1 -2
- package/lib/es/locale/fr-FR.js +1 -2
- package/lib/es/locale/id-ID.js +1 -2
- package/lib/es/locale/it-IT.js +1 -2
- package/lib/es/locale/ja-JP.js +1 -2
- package/lib/es/locale/ko-KR.js +1 -2
- package/lib/es/locale/pl-PL.js +1 -2
- package/lib/es/locale/pt-BR.js +1 -2
- package/lib/es/locale/ru-RU.js +1 -2
- package/lib/es/locale/sk-SK.js +1 -2
- package/lib/es/locale/vi-VN.js +1 -2
- package/lib/es/locale/zh-CN.js +1 -2
- package/lib/es/locale/zh-HK.js +1 -2
- package/lib/es/locale/zh-TW.js +1 -2
- package/lib/index.js +120 -125
- package/lib/locale/ar-SA.js +1 -2
- package/lib/locale/ca-ES.js +1 -2
- package/lib/locale/de-DE.js +1 -2
- package/lib/locale/en-US.js +1 -2
- package/lib/locale/es-ES.js +1 -2
- package/lib/locale/fa-IR.js +1 -2
- package/lib/locale/fr-FR.js +1 -2
- package/lib/locale/id-ID.js +1 -2
- package/lib/locale/it-IT.js +1 -2
- package/lib/locale/ja-JP.js +1 -2
- package/lib/locale/ko-KR.js +1 -2
- package/lib/locale/pl-PL.js +1 -2
- package/lib/locale/pt-BR.js +1 -2
- package/lib/locale/ru-RU.js +1 -2
- package/lib/locale/sk-SK.js +1 -2
- package/lib/locale/vi-VN.js +1 -2
- package/lib/locale/zh-CN.js +1 -2
- package/lib/locale/zh-HK.js +1 -2
- package/lib/locale/zh-TW.js +1 -2
- package/lib/types/menu/drawing-popup-menu.controller.d.ts +3 -1
- package/lib/types/views/doc-image-panel/use-doc-drawing-position.d.ts +2 -2
- package/lib/umd/index.js +1 -1
- package/package.json +18 -18
package/lib/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { AlignTypeH, AlignTypeV, BooleanNumber, COLORS, CommandType, DOC_DRAWING_PRINTING_COMPONENT_KEY, DependentOn, Direction, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, DrawingTypeEnum, FOCUSING_COMMON_DRAWINGS, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, ICommandService, IConfigService, IContextService, IImageIoService, IPermissionService, IUniverInstanceService, ImageSourceType, ImageUploadStatusType, Inject, Injector, JSON1, JSONX, LifecycleService, LifecycleStages, LocaleService, ObjectRelativeFromH, ObjectRelativeFromV, Plugin, PositionedObjectLayoutType, RedoCommand, RxDisposable, TextX, TextXActionType, ThemeService, Tools, UndoCommand, UniverInstanceType, WrapTextType, fromEventSubject, generateRandomId, getRichTextEditPath, isInternalEditorID, merge, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { IDocDrawingAdapterService, IDocDrawingService, InsertDocDrawingCommand, RemoveDocDrawingCommand, SetDocDrawingArrangeCommand, TextWrappingStyle, UniverDocsDrawingPlugin, UpdateDocDrawingWrappingStyleCommand, UpdateDrawingDocTransformCommand, WRAPPING_STYLE_TO_LAYOUT_TYPE, collectDocDrawings, findDocDrawing, getDocDrawingRenderOrder } from "@univerjs/docs-drawing";
|
|
3
|
-
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, MOBILE_DOC_ELEMENT_MENU, NodePositionConvertToCursor, SetDocZoomRatioOperation, TEXT_RANGE_LAYER_INDEX, UniverDocsMobileUIPlugin, UniverDocsUIPlugin, VIEWPORT_KEY, getAnchorBounding, getOneTextSelectionRange, neoGetDocObject } from "@univerjs/docs-ui";
|
|
3
|
+
import { DOC_CONTENT_INSERT_MENU_ID, DOC_PARAGRAPH_T_INSERT_BELOW_MENU_ID, DOC_PARAGRAPH_T_INSERT_MENU_ID, DocCanvasPopManagerService, DocPageLayoutService, DocPrintInterceptorService, DocSelectionRenderService, EMPTY_PARAGRAPH_MENU_ID, IEditorService, INSERT_BELLOW_MENU_ID, MOBILE_DOC_ELEMENT_MENU, NodePositionConvertToCursor, SetDocZoomRatioOperation, TEXT_RANGE_LAYER_INDEX, UniverDocsMobileUIPlugin, UniverDocsUIPlugin, VIEWPORT_KEY, getAnchorBounding, getOneTextSelectionRange, neoGetDocObject } from "@univerjs/docs-ui";
|
|
4
4
|
import { CURSOR_TYPE, DocumentEditArea, DocumentSkeleton, DocumentSkeletonPageType, DocumentViewModel, Documents, IRenderManagerService, Liquid, PageLayoutType, Path, Rect, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin, Vector2, getColor, getCurrentTypeOfRenderer, getDocsTableRenderViewport, getTableIdAndSliceIndex } from "@univerjs/engine-render";
|
|
5
|
-
import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, UniverDocsPlugin, buildDocTransform, canEditDocumentTargets, docDrawingPositionToTransform, getDocumentDrawingSegmentId, getDocumentEditTargetObjectIds, getDocumentEntityParentPermissionObjectIds, getDocumentEntityPermissionObjectId, isSheetLikeDocsCustomBlockChildType } from "@univerjs/docs";
|
|
5
|
+
import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation, UniverDocsPlugin, buildDocTransform, canEditDocumentTargets, docDrawingPositionToTransform, getDocumentDrawingSegmentId, getDocumentEditTargetObjectIds, getDocumentEntityParentPermissionObjectIds, getDocumentEntityPermissionObjectId, getDocumentPermissionValue, isSheetLikeDocsCustomBlockChildType, setDocumentPermissionValue } from "@univerjs/docs";
|
|
6
6
|
import { Checkbox, InputNumber, MessageType, MobileActionRow, Radio, RadioGroup, Select, clsx, render, unmount } from "@univerjs/design";
|
|
7
7
|
import { DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, DRAWING_IMAGE_WIDTH_LIMIT, IDrawingManagerService, UniverDrawingPlugin, getDrawingImageAllowSize, getDrawingShapeKeyByDrawingSearch, getImageSize } from "@univerjs/drawing";
|
|
8
8
|
import { CanvasFloatDomService, ComponentManager, ContextMenuGroup, ContextMenuPosition, FloatingObjectToolbarPosition, IContextMenuService, ILocalFileService, IMenuManagerService, IMessageService, IShortcutService, ISidebarService, KeyCode, MenuItemType, PrintFloatDomSingle, RibbonInsertGroup, connectInjector, getMenuHiddenObservable, useDependency, useObservable } from "@univerjs/ui";
|
|
9
9
|
import { BehaviorSubject, EMPTY, Observable, Subscription, animationFrames, debounceTime, filter, map, merge as merge$1, of, startWith, switchMap, take, takeUntil, throttleTime } from "rxjs";
|
|
10
|
-
import { COMPONENT_IMAGE_POPUP_MENU, COMPONENT_MOBILE_IMAGE_POPUP_MENU, DrawingCommonPanel, DrawingRenderService, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation, UniverDrawingMobileUIPlugin, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
|
|
10
|
+
import { COMPONENT_IMAGE_POPUP_MENU, COMPONENT_MOBILE_IMAGE_POPUP_MENU, DrawingCommonPanel, DrawingRenderService, ImageCropperObject, ImageResetSizeOperation, OleUIService, OpenImageCropOperation, UniverDrawingMobileUIPlugin, UniverDrawingUIPlugin, createOlePreviewViewer, registerOlePreviewRenderer } from "@univerjs/drawing-ui";
|
|
11
11
|
import { useEffect, useMemo, useState } from "react";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { CheckMarkIcon } from "@univerjs/icons";
|
|
14
|
+
import { UnitAction } from "@univerjs/protocol";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
// src/commands/commands/delete-doc-drawing.command.ts
|
|
16
17
|
const DeleteDocDrawingsCommand = {
|
|
17
18
|
id: "doc.command.delete-drawing",
|
|
18
19
|
type: CommandType.COMMAND,
|
|
@@ -42,8 +43,7 @@ const DeleteDocDrawingsCommand = {
|
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
//#region src/commands/commands/doc-drawing-group.ts
|
|
46
|
+
// src/commands/commands/doc-drawing-group.ts
|
|
47
47
|
function findAnchor(model, drawingId) {
|
|
48
48
|
const snapshot = model.getSnapshot();
|
|
49
49
|
const bodies = [
|
|
@@ -254,24 +254,21 @@ function changeDocDrawingGroups(accessor, params, ungroup) {
|
|
|
254
254
|
}));
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
|
|
258
|
-
//#region src/commands/commands/group-doc-drawing.command.ts
|
|
257
|
+
// src/commands/commands/group-doc-drawing.command.ts
|
|
259
258
|
const GroupDocDrawingCommand = {
|
|
260
259
|
id: "doc.command.group-doc-image",
|
|
261
260
|
type: CommandType.COMMAND,
|
|
262
261
|
handler: (accessor, params) => changeDocDrawingGroups(accessor, params, false)
|
|
263
262
|
};
|
|
264
263
|
|
|
265
|
-
|
|
266
|
-
//#region src/commands/commands/ungroup-doc-drawing.command.ts
|
|
264
|
+
// src/commands/commands/ungroup-doc-drawing.command.ts
|
|
267
265
|
const UngroupDocDrawingCommand = {
|
|
268
266
|
id: "doc.command.ungroup-doc-image",
|
|
269
267
|
type: CommandType.COMMAND,
|
|
270
268
|
handler: (accessor, params) => changeDocDrawingGroups(accessor, params, true)
|
|
271
269
|
};
|
|
272
270
|
|
|
273
|
-
|
|
274
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
271
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
|
|
275
272
|
function _typeof(o) {
|
|
276
273
|
"@babel/helpers - typeof";
|
|
277
274
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -281,8 +278,7 @@ function _typeof(o) {
|
|
|
281
278
|
}, _typeof(o);
|
|
282
279
|
}
|
|
283
280
|
|
|
284
|
-
|
|
285
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
281
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
|
|
286
282
|
function toPrimitive(t, r) {
|
|
287
283
|
if ("object" != _typeof(t) || !t) return t;
|
|
288
284
|
var e = t[Symbol.toPrimitive];
|
|
@@ -294,15 +290,13 @@ function toPrimitive(t, r) {
|
|
|
294
290
|
return ("string" === r ? String : Number)(t);
|
|
295
291
|
}
|
|
296
292
|
|
|
297
|
-
|
|
298
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
293
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
|
|
299
294
|
function toPropertyKey(t) {
|
|
300
295
|
var i = toPrimitive(t, "string");
|
|
301
296
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
302
297
|
}
|
|
303
298
|
|
|
304
|
-
|
|
305
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
299
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
|
|
306
300
|
function _defineProperty(e, r, t) {
|
|
307
301
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
308
302
|
value: t,
|
|
@@ -312,8 +306,7 @@ function _defineProperty(e, r, t) {
|
|
|
312
306
|
}) : e[r] = t, e;
|
|
313
307
|
}
|
|
314
308
|
|
|
315
|
-
|
|
316
|
-
//#region src/services/doc-refresh-drawings.service.ts
|
|
309
|
+
// src/services/doc-refresh-drawings.service.ts
|
|
317
310
|
var DocRefreshDrawingsService = class {
|
|
318
311
|
constructor() {
|
|
319
312
|
_defineProperty(this, "_refreshDrawings$", new BehaviorSubject(null));
|
|
@@ -324,8 +317,7 @@ var DocRefreshDrawingsService = class {
|
|
|
324
317
|
}
|
|
325
318
|
};
|
|
326
319
|
|
|
327
|
-
|
|
328
|
-
//#region src/utils/drawing-text-anchor.ts
|
|
320
|
+
// src/utils/drawing-text-anchor.ts
|
|
329
321
|
/** Locate the persisted object character without consulting the active text selection. */
|
|
330
322
|
function findDrawingTextAnchor(snapshot, drawingId) {
|
|
331
323
|
const segments = [
|
|
@@ -378,8 +370,7 @@ function getDrawingTextRanges(snapshot, drawingIds) {
|
|
|
378
370
|
});
|
|
379
371
|
}
|
|
380
372
|
|
|
381
|
-
|
|
382
|
-
//#region src/controllers/render-controllers/doc-drawing-crop.ts
|
|
373
|
+
// src/controllers/render-controllers/doc-drawing-crop.ts
|
|
383
374
|
function getDocImageCropUpdates(param, docDrawing, renderDrawing) {
|
|
384
375
|
const { drawingId, transform } = param;
|
|
385
376
|
if ((docDrawing === null || docDrawing === void 0 ? void 0 : docDrawing.drawingType) !== DrawingTypeEnum.DRAWING_IMAGE || (renderDrawing === null || renderDrawing === void 0 ? void 0 : renderDrawing.transform) == null) return [];
|
|
@@ -429,8 +420,7 @@ function getDocImageCropUpdates(param, docDrawing, renderDrawing) {
|
|
|
429
420
|
return drawings;
|
|
430
421
|
}
|
|
431
422
|
|
|
432
|
-
|
|
433
|
-
//#region src/controllers/render-controllers/doc-drawing-mutation.ts
|
|
423
|
+
// src/controllers/render-controllers/doc-drawing-mutation.ts
|
|
434
424
|
/**
|
|
435
425
|
* Returns the drawing ids that can be refreshed independently. `null` means
|
|
436
426
|
* the mutation is drawing-related but needs a conservative full refresh.
|
|
@@ -459,16 +449,14 @@ function getDocMutationAffectedDrawingIds(actions) {
|
|
|
459
449
|
return !sawComponent || needsFullRefresh ? null : drawingIds;
|
|
460
450
|
}
|
|
461
451
|
|
|
462
|
-
|
|
463
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
452
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
|
|
464
453
|
function __decorateParam(paramIndex, decorator) {
|
|
465
454
|
return function(target, key) {
|
|
466
455
|
decorator(target, key, paramIndex);
|
|
467
456
|
};
|
|
468
457
|
}
|
|
469
458
|
|
|
470
|
-
|
|
471
|
-
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
459
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
|
|
472
460
|
function __decorate(decorators, target, key, desc) {
|
|
473
461
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
474
462
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -476,8 +464,7 @@ function __decorate(decorators, target, key, desc) {
|
|
|
476
464
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
477
465
|
}
|
|
478
466
|
|
|
479
|
-
|
|
480
|
-
//#region src/controllers/render-controllers/doc-drawing-update.render-controller.ts
|
|
467
|
+
// src/controllers/render-controllers/doc-drawing-update.render-controller.ts
|
|
481
468
|
let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController extends Disposable {
|
|
482
469
|
constructor(_context, _commandService, _docSelectionManagerService, _renderManagerSrv, _imageIoService, _docDrawingService, _drawingManagerService, _permissionService, _contextService, _messageService, _localeService, _docSelectionRenderService, _docRefreshDrawingsService, _fileOpenerService) {
|
|
483
470
|
super();
|
|
@@ -767,7 +754,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
767
754
|
const drawingShapes = drawingShapesById.get(drawing.drawingId) ?? [];
|
|
768
755
|
if (drawingShapes.length) for (const shape of drawingShapes) {
|
|
769
756
|
scene.detachTransformerFrom(shape);
|
|
770
|
-
this._setTransformerEditable(shape, editable);
|
|
757
|
+
this._setTransformerEditable(shape, editable, drawing);
|
|
771
758
|
try {
|
|
772
759
|
const fadeBody = isDocInteractionFocusing && drawing.isMultiTransform !== BooleanNumber.TRUE;
|
|
773
760
|
shape.setOpacity(fadeBody ? .5 : 1);
|
|
@@ -812,7 +799,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
812
799
|
const editableFocus = focusedDrawings.filter((drawing) => drawing.unitId !== unitId || !readOnlyDrawingIds.has(drawing.drawingId));
|
|
813
800
|
if (editableFocus.length !== focusedDrawings.length) this._drawingManagerService.focusDrawing(editableFocus);
|
|
814
801
|
}
|
|
815
|
-
_setTransformerEditable(shape, editable) {
|
|
802
|
+
_setTransformerEditable(shape, editable, drawing) {
|
|
816
803
|
var _this$_context$scene$;
|
|
817
804
|
if (editable) {
|
|
818
805
|
const config = this._editableTransformerConfigs.get(shape);
|
|
@@ -829,7 +816,7 @@ let DocDrawingUpdateRenderController = class DocDrawingUpdateRenderController ex
|
|
|
829
816
|
}
|
|
830
817
|
if (!this._editableTransformerConfigs.has(shape)) this._editableTransformerConfigs.set(shape, shape.transformerConfig);
|
|
831
818
|
if (!this._editableEventedStates.has(shape)) this._editableEventedStates.set(shape, shape.evented);
|
|
832
|
-
shape.evented =
|
|
819
|
+
shape.evented = drawing.drawingType === DrawingTypeEnum.DRAWING_OLE;
|
|
833
820
|
(_this$_context$scene$ = this._context.scene.getTransformer()) === null || _this$_context$scene$ === void 0 || _this$_context$scene$.clearControlByIds([shape.oKey]);
|
|
834
821
|
shape.transformerConfig = {
|
|
835
822
|
...shape.transformerConfig,
|
|
@@ -917,8 +904,7 @@ DocDrawingUpdateRenderController = __decorate([
|
|
|
917
904
|
__decorateParam(13, ILocalFileService)
|
|
918
905
|
], DocDrawingUpdateRenderController);
|
|
919
906
|
|
|
920
|
-
|
|
921
|
-
//#region src/commands/commands/insert-image.command.ts
|
|
907
|
+
// src/commands/commands/insert-image.command.ts
|
|
922
908
|
const InsertDocImageCommand = {
|
|
923
909
|
id: "doc.command.insert-float-image",
|
|
924
910
|
type: CommandType.COMMAND,
|
|
@@ -930,8 +916,7 @@ const InsertDocImageCommand = {
|
|
|
930
916
|
}
|
|
931
917
|
};
|
|
932
918
|
|
|
933
|
-
|
|
934
|
-
//#region src/commands/commands/insert-shape.command.ts
|
|
919
|
+
// src/commands/commands/insert-shape.command.ts
|
|
935
920
|
const DOC_SHAPE_FILL = "#3A60F7";
|
|
936
921
|
const DOC_SHAPE_STROKE = "#1D3EA6";
|
|
937
922
|
function createShapeSvgSource(shape, width, height) {
|
|
@@ -976,8 +961,7 @@ function createShapeInsertCommand(shape, width, height, id) {
|
|
|
976
961
|
const InsertDocRectangleShapeCommand = createShapeInsertCommand("rectangle", 144, 96, "doc.command.insert-float-shape.rectangle");
|
|
977
962
|
const InsertDocEllipseShapeCommand = createShapeInsertCommand("ellipse", 112, 112, "doc.command.insert-float-shape.ellipse");
|
|
978
963
|
|
|
979
|
-
|
|
980
|
-
//#region src/utils/drawing-anchor-position.ts
|
|
964
|
+
// src/utils/drawing-anchor-position.ts
|
|
981
965
|
function findDrawingAnchorInPage(page, drawingId, pageMarginTop, pageMarginLeft) {
|
|
982
966
|
const skeDrawing = page.skeDrawings.get(drawingId);
|
|
983
967
|
if (skeDrawing) return {
|
|
@@ -1006,8 +990,7 @@ function resolveDrawingAnchorOffsets(anchor, positionH, positionV) {
|
|
|
1006
990
|
};
|
|
1007
991
|
}
|
|
1008
992
|
|
|
1009
|
-
|
|
1010
|
-
//#region src/commands/commands/move-drawings.command.ts
|
|
993
|
+
// src/commands/commands/move-drawings.command.ts
|
|
1011
994
|
const MoveDocDrawingsCommand = {
|
|
1012
995
|
id: "doc.command.move-drawing",
|
|
1013
996
|
type: CommandType.COMMAND,
|
|
@@ -1095,8 +1078,7 @@ function findDrawingAnchor$1(skeletonData, drawingId) {
|
|
|
1095
1078
|
};
|
|
1096
1079
|
}
|
|
1097
1080
|
|
|
1098
|
-
|
|
1099
|
-
//#region src/commands/operations/clear-drawing-transformer.operation.ts
|
|
1081
|
+
// src/commands/operations/clear-drawing-transformer.operation.ts
|
|
1100
1082
|
const ClearDocDrawingTransformerOperation = {
|
|
1101
1083
|
id: "doc.operation.clear-drawing-transformer",
|
|
1102
1084
|
type: CommandType.MUTATION,
|
|
@@ -1110,8 +1092,7 @@ const ClearDocDrawingTransformerOperation = {
|
|
|
1110
1092
|
}
|
|
1111
1093
|
};
|
|
1112
1094
|
|
|
1113
|
-
|
|
1114
|
-
//#region src/views/doc-image-panel/component-name.ts
|
|
1095
|
+
// src/views/doc-image-panel/component-name.ts
|
|
1115
1096
|
/**
|
|
1116
1097
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1117
1098
|
*
|
|
@@ -1129,8 +1110,7 @@ const ClearDocDrawingTransformerOperation = {
|
|
|
1129
1110
|
*/
|
|
1130
1111
|
const COMPONENT_DOC_DRAWING_PANEL = "COMPONENT_DOC_DRAWING_PANEL";
|
|
1131
1112
|
|
|
1132
|
-
|
|
1133
|
-
//#region src/commands/operations/open-drawing-panel.operation.ts
|
|
1113
|
+
// src/commands/operations/open-drawing-panel.operation.ts
|
|
1134
1114
|
const SidebarDocDrawingOperation = {
|
|
1135
1115
|
id: "sidebar.operation.doc-image",
|
|
1136
1116
|
type: CommandType.COMMAND,
|
|
@@ -1155,8 +1135,7 @@ const SidebarDocDrawingOperation = {
|
|
|
1155
1135
|
}
|
|
1156
1136
|
};
|
|
1157
1137
|
|
|
1158
|
-
|
|
1159
|
-
//#region src/commands/operations/edit-doc-drawing.operation.ts
|
|
1138
|
+
// src/commands/operations/edit-doc-drawing.operation.ts
|
|
1160
1139
|
const EditDocDrawingOperation = {
|
|
1161
1140
|
id: "doc.operation.edit-doc-image",
|
|
1162
1141
|
type: CommandType.OPERATION,
|
|
@@ -1170,8 +1149,7 @@ const EditDocDrawingOperation = {
|
|
|
1170
1149
|
}
|
|
1171
1150
|
};
|
|
1172
1151
|
|
|
1173
|
-
|
|
1174
|
-
//#region src/controllers/doc-float-dom.controller.ts
|
|
1152
|
+
// src/controllers/doc-float-dom.controller.ts
|
|
1175
1153
|
function calcDocFloatDomPositionByRect(rect, scene, opacity = 1, angle = 0) {
|
|
1176
1154
|
const { top, left, bottom, right } = rect;
|
|
1177
1155
|
const width = right - left;
|
|
@@ -1607,8 +1585,7 @@ function subscribeViewportScrollAfter(scrollEvent, callback) {
|
|
|
1607
1585
|
}
|
|
1608
1586
|
}
|
|
1609
1587
|
|
|
1610
|
-
|
|
1611
|
-
//#region src/menu/image.menu.ts
|
|
1588
|
+
// src/menu/image.menu.ts
|
|
1612
1589
|
const DOCS_IMAGE_MENU_ID = "doc.menu.image";
|
|
1613
1590
|
const IMAGE_MENU_UPLOAD_FLOAT_ID = InsertDocImageCommand.id;
|
|
1614
1591
|
const getDisableWhenSelectionInTableObservable = (accessor) => {
|
|
@@ -1672,8 +1649,7 @@ function UploadFloatImageBelowMenuFactory(accessor) {
|
|
|
1672
1649
|
};
|
|
1673
1650
|
}
|
|
1674
1651
|
|
|
1675
|
-
|
|
1676
|
-
//#region src/menu/shape.menu.ts
|
|
1652
|
+
// src/menu/shape.menu.ts
|
|
1677
1653
|
const DOCS_SHAPE_MENU_ID = "doc.command.menu-insert-shape";
|
|
1678
1654
|
const DOCS_SHAPE_BELOW_MENU_ID = "doc.command.menu-insert-shape.below";
|
|
1679
1655
|
function ShapeMenuFactory(accessor) {
|
|
@@ -1733,8 +1709,7 @@ function InsertEllipseShapeBelowMenuFactory(accessor) {
|
|
|
1733
1709
|
};
|
|
1734
1710
|
}
|
|
1735
1711
|
|
|
1736
|
-
|
|
1737
|
-
//#region src/menu/schema.ts
|
|
1712
|
+
// src/menu/schema.ts
|
|
1738
1713
|
const menuSchema = {
|
|
1739
1714
|
[RibbonInsertGroup.MEDIA]: { [DOCS_IMAGE_MENU_ID]: {
|
|
1740
1715
|
order: 0,
|
|
@@ -1802,13 +1777,11 @@ const menuSchema = {
|
|
|
1802
1777
|
}
|
|
1803
1778
|
};
|
|
1804
1779
|
|
|
1805
|
-
|
|
1806
|
-
//#region package.json
|
|
1780
|
+
// package.json
|
|
1807
1781
|
var name = "@univerjs/docs-drawing-ui";
|
|
1808
|
-
var version = "1.
|
|
1782
|
+
var version = "1.4.0";
|
|
1809
1783
|
|
|
1810
|
-
|
|
1811
|
-
//#region src/config/config.ts
|
|
1784
|
+
// src/config/config.ts
|
|
1812
1785
|
/**
|
|
1813
1786
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1814
1787
|
*
|
|
@@ -1829,8 +1802,7 @@ const DOCS_DRAWING_UI_PLUGIN_NAME = "DOC_DRAWING_UI_PLUGIN";
|
|
|
1829
1802
|
const configSymbol = Symbol(DOCS_DRAWING_UI_PLUGIN_CONFIG_KEY);
|
|
1830
1803
|
const defaultPluginConfig = {};
|
|
1831
1804
|
|
|
1832
|
-
|
|
1833
|
-
//#region src/controllers/render-controllers/doc-drawing-transform-update.controller.ts
|
|
1805
|
+
// src/controllers/render-controllers/doc-drawing-transform-update.controller.ts
|
|
1834
1806
|
function mergePublishedDrawing(drawings, next) {
|
|
1835
1807
|
const current = drawings[next.drawingId];
|
|
1836
1808
|
if (current == null) {
|
|
@@ -2490,8 +2462,7 @@ DocDrawingTransformUpdateController = __decorate([
|
|
|
2490
2462
|
__decorateParam(7, Inject(LifecycleService))
|
|
2491
2463
|
], DocDrawingTransformUpdateController);
|
|
2492
2464
|
|
|
2493
|
-
|
|
2494
|
-
//#region src/utils/drawing-wrapping-position.ts
|
|
2465
|
+
// src/utils/drawing-wrapping-position.ts
|
|
2495
2466
|
function findDrawingAnchor(unitId, drawingId, skeleton, editArea, currentDrawing) {
|
|
2496
2467
|
function findInPage(page, pageMarginLeft, pageMarginTop, hostPage) {
|
|
2497
2468
|
var _page$skeColumnGroups;
|
|
@@ -2666,8 +2637,7 @@ function getDrawingWrappingPosition(anchor, layoutType, relativeFromH = anchor.s
|
|
|
2666
2637
|
return result;
|
|
2667
2638
|
}
|
|
2668
2639
|
|
|
2669
|
-
|
|
2670
|
-
//#region src/controllers/doc-drawing-notification.controller.ts
|
|
2640
|
+
// src/controllers/doc-drawing-notification.controller.ts
|
|
2671
2641
|
function getAddOrRemoveDrawings(actions) {
|
|
2672
2642
|
if (JSONX.isNoop(actions)) return null;
|
|
2673
2643
|
const drawings = [];
|
|
@@ -2951,8 +2921,7 @@ DocDrawingAddRemoveController = __decorate([
|
|
|
2951
2921
|
__decorateParam(5, Inject(DocRefreshDrawingsService))
|
|
2952
2922
|
], DocDrawingAddRemoveController);
|
|
2953
2923
|
|
|
2954
|
-
|
|
2955
|
-
//#region src/views/DocPrintingFloatDom.tsx
|
|
2924
|
+
// src/views/DocPrintingFloatDom.tsx
|
|
2956
2925
|
const DocPrintingFloatDom = (props) => {
|
|
2957
2926
|
const { floatDomInfos, scene, offset, bound } = props;
|
|
2958
2927
|
const width = bound.right - bound.left;
|
|
@@ -3000,8 +2969,7 @@ function mountDocPrintingFloatDom(props, root, injector) {
|
|
|
3000
2969
|
return () => unmount(root);
|
|
3001
2970
|
}
|
|
3002
2971
|
|
|
3003
|
-
|
|
3004
|
-
//#region src/controllers/doc-drawing-printing.controller.ts
|
|
2972
|
+
// src/controllers/doc-drawing-printing.controller.ts
|
|
3005
2973
|
let DocDrawingPrintingController = class DocDrawingPrintingController extends Disposable {
|
|
3006
2974
|
constructor(_docPrintInterceptorService, _drawingRenderService, _drawingManagerService, _componetManager, _injector) {
|
|
3007
2975
|
super();
|
|
@@ -3022,7 +2990,7 @@ let DocDrawingPrintingController = class DocDrawingPrintingController extends Di
|
|
|
3022
2990
|
if (subUnitData) subUnitData.order.forEach((id) => {
|
|
3023
2991
|
if (visibleDrawingIds && !visibleDrawingIds.has(id)) return;
|
|
3024
2992
|
const drawing = subUnitData.data[id];
|
|
3025
|
-
if (drawing.drawingType !== DrawingTypeEnum.DRAWING_CHART && drawing.drawingType !== DrawingTypeEnum.DRAWING_DOM) this._drawingRenderService.renderDrawing(drawing, scene);
|
|
2993
|
+
if (drawing.drawingType !== DrawingTypeEnum.DRAWING_CHART && drawing.drawingType !== DrawingTypeEnum.DRAWING_DOM) this._drawingRenderService.renderDrawing(drawing, scene, { interactive: false });
|
|
3026
2994
|
});
|
|
3027
2995
|
return next();
|
|
3028
2996
|
} }));
|
|
@@ -3073,8 +3041,7 @@ DocDrawingPrintingController = __decorate([
|
|
|
3073
3041
|
__decorateParam(4, Inject(Injector))
|
|
3074
3042
|
], DocDrawingPrintingController);
|
|
3075
3043
|
|
|
3076
|
-
|
|
3077
|
-
//#region src/commands/commands/update-doc-drawing.command.ts
|
|
3044
|
+
// src/commands/commands/update-doc-drawing.command.ts
|
|
3078
3045
|
function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPage, offset, drawingId, documentDataModel, docSelectionRenderManager) {
|
|
3079
3046
|
var _documentDataModel$ge, _documentDataModel$ge2, _oldBody$customBlocks;
|
|
3080
3047
|
const textX = new TextX();
|
|
@@ -3399,8 +3366,7 @@ const ITransformNonInlineDrawingCommand = {
|
|
|
3399
3366
|
}
|
|
3400
3367
|
};
|
|
3401
3368
|
|
|
3402
|
-
|
|
3403
|
-
//#region src/controllers/doc-drawing-transformer-update.controller.ts
|
|
3369
|
+
// src/controllers/doc-drawing-transformer-update.controller.ts
|
|
3404
3370
|
const INLINE_DRAWING_ANCHOR_KEY_PREFIX = "__InlineDrawingAnchor__";
|
|
3405
3371
|
function getDocsTableCellAnchorContext(unitId, cell) {
|
|
3406
3372
|
var _row$cells;
|
|
@@ -4015,8 +3981,7 @@ DocDrawingTransformerController = __decorate([
|
|
|
4015
3981
|
__decorateParam(3, IRenderManagerService)
|
|
4016
3982
|
], DocDrawingTransformerController);
|
|
4017
3983
|
|
|
4018
|
-
|
|
4019
|
-
//#region src/views/doc-image-panel/use-doc-drawing-position.ts
|
|
3984
|
+
// src/views/doc-image-panel/use-doc-drawing-position.ts
|
|
4020
3985
|
const MIN_OFFSET = -1e3;
|
|
4021
3986
|
const MAX_OFFSET = 1e3;
|
|
4022
3987
|
function useDocDrawingPosition(props) {
|
|
@@ -4204,8 +4169,7 @@ function useDocDrawingPosition(props) {
|
|
|
4204
4169
|
};
|
|
4205
4170
|
}
|
|
4206
4171
|
|
|
4207
|
-
|
|
4208
|
-
//#region src/views/doc-image-panel/MobileDocDrawingPosition.tsx
|
|
4172
|
+
// src/views/doc-image-panel/MobileDocDrawingPosition.tsx
|
|
4209
4173
|
function MobileDocDrawingPositionControls(props) {
|
|
4210
4174
|
const localeService = useDependency(LocaleService);
|
|
4211
4175
|
const axes = [{
|
|
@@ -4305,8 +4269,7 @@ function MobileDocDrawingPositionContent(props) {
|
|
|
4305
4269
|
}) : null;
|
|
4306
4270
|
}
|
|
4307
4271
|
|
|
4308
|
-
|
|
4309
|
-
//#region src/views/doc-image-panel/use-doc-drawing-text-wrap.ts
|
|
4272
|
+
// src/views/doc-image-panel/use-doc-drawing-text-wrap.ts
|
|
4310
4273
|
const MIN_MARGIN = 0;
|
|
4311
4274
|
const MAX_MARGIN = 100;
|
|
4312
4275
|
function useDocDrawingTextWrap(props) {
|
|
@@ -4465,8 +4428,7 @@ function useDocDrawingTextWrap(props) {
|
|
|
4465
4428
|
};
|
|
4466
4429
|
}
|
|
4467
4430
|
|
|
4468
|
-
|
|
4469
|
-
//#region src/views/doc-image-panel/MobileDocDrawingTextWrap.tsx
|
|
4431
|
+
// src/views/doc-image-panel/MobileDocDrawingTextWrap.tsx
|
|
4470
4432
|
const styles = [
|
|
4471
4433
|
{
|
|
4472
4434
|
value: TextWrappingStyle.INLINE,
|
|
@@ -4603,8 +4565,7 @@ function MobileDocDrawingTextWrapContent(props) {
|
|
|
4603
4565
|
}) : null;
|
|
4604
4566
|
}
|
|
4605
4567
|
|
|
4606
|
-
|
|
4607
|
-
//#region src/views/doc-image-panel/MobileDocDrawingPanel.tsx
|
|
4568
|
+
// src/views/doc-image-panel/MobileDocDrawingPanel.tsx
|
|
4608
4569
|
const tabs = [
|
|
4609
4570
|
{
|
|
4610
4571
|
value: "image",
|
|
@@ -4652,8 +4613,7 @@ function MobileDocDrawingPanel() {
|
|
|
4652
4613
|
});
|
|
4653
4614
|
}
|
|
4654
4615
|
|
|
4655
|
-
|
|
4656
|
-
//#region src/controllers/mobile/components.controller.ts
|
|
4616
|
+
// src/controllers/mobile/components.controller.ts
|
|
4657
4617
|
/**
|
|
4658
4618
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4659
4619
|
*
|
|
@@ -4677,8 +4637,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
|
|
|
4677
4637
|
};
|
|
4678
4638
|
MobileComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager))], MobileComponentsController);
|
|
4679
4639
|
|
|
4680
|
-
|
|
4681
|
-
//#region src/commands/operations/mobile/open-drawing-panel.operation.ts
|
|
4640
|
+
// src/commands/operations/mobile/open-drawing-panel.operation.ts
|
|
4682
4641
|
const SidebarDocDrawingMobileOperation = {
|
|
4683
4642
|
id: SidebarDocDrawingOperation.id,
|
|
4684
4643
|
type: CommandType.COMMAND,
|
|
@@ -4706,8 +4665,7 @@ const SidebarDocDrawingMobileOperation = {
|
|
|
4706
4665
|
}
|
|
4707
4666
|
};
|
|
4708
4667
|
|
|
4709
|
-
|
|
4710
|
-
//#region src/services/doc-drawing-floating-toolbar-adapter.service.ts
|
|
4668
|
+
// src/services/doc-drawing-floating-toolbar-adapter.service.ts
|
|
4711
4669
|
var DocDrawingFloatingToolbarAdapterService = class {
|
|
4712
4670
|
constructor() {
|
|
4713
4671
|
_defineProperty(this, "_adapters", []);
|
|
@@ -4728,8 +4686,7 @@ var DocDrawingFloatingToolbarAdapterService = class {
|
|
|
4728
4686
|
}
|
|
4729
4687
|
};
|
|
4730
4688
|
|
|
4731
|
-
|
|
4732
|
-
//#region src/controllers/mobile/drawing-popup-menu.controller.ts
|
|
4689
|
+
// src/controllers/mobile/drawing-popup-menu.controller.ts
|
|
4733
4690
|
let MobileDocDrawingPopupMenuController = class MobileDocDrawingPopupMenuController extends RxDisposable {
|
|
4734
4691
|
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _drawingAdapterService, _docDrawingService, _floatingToolbarAdapterService, _commandService, _menuManagerService, _permissionService) {
|
|
4735
4692
|
super();
|
|
@@ -5075,8 +5032,7 @@ MobileDocDrawingPopupMenuController = __decorate([
|
|
|
5075
5032
|
__decorateParam(10, IPermissionService)
|
|
5076
5033
|
], MobileDocDrawingPopupMenuController);
|
|
5077
5034
|
|
|
5078
|
-
|
|
5079
|
-
//#region src/controllers/mobile/ui.controller.ts
|
|
5035
|
+
// src/controllers/mobile/ui.controller.ts
|
|
5080
5036
|
/**
|
|
5081
5037
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5082
5038
|
*
|
|
@@ -5124,8 +5080,7 @@ let MobileDocDrawingUIController = class MobileDocDrawingUIController extends Di
|
|
|
5124
5080
|
};
|
|
5125
5081
|
MobileDocDrawingUIController = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, ICommandService)], MobileDocDrawingUIController);
|
|
5126
5082
|
|
|
5127
|
-
|
|
5128
|
-
//#region src/controllers/render-controllers/mobile/doc-drawing-update.render-controller.ts
|
|
5083
|
+
// src/controllers/render-controllers/mobile/doc-drawing-update.render-controller.ts
|
|
5129
5084
|
/**
|
|
5130
5085
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5131
5086
|
*
|
|
@@ -5150,8 +5105,7 @@ var MobileDocDrawingUpdateRenderController = class extends DocDrawingUpdateRende
|
|
|
5150
5105
|
}
|
|
5151
5106
|
};
|
|
5152
5107
|
|
|
5153
|
-
|
|
5154
|
-
//#region src/mobile-plugin.ts
|
|
5108
|
+
// src/mobile-plugin.ts
|
|
5155
5109
|
let UniverDocsDrawingMobileUIPlugin = class UniverDocsDrawingMobileUIPlugin extends Plugin {
|
|
5156
5110
|
constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _configService) {
|
|
5157
5111
|
super();
|
|
@@ -5199,8 +5153,7 @@ UniverDocsDrawingMobileUIPlugin = __decorate([
|
|
|
5199
5153
|
__decorateParam(3, IConfigService)
|
|
5200
5154
|
], UniverDocsDrawingMobileUIPlugin);
|
|
5201
5155
|
|
|
5202
|
-
|
|
5203
|
-
//#region src/views/doc-image-panel/DocDrawingPosition.tsx
|
|
5156
|
+
// src/views/doc-image-panel/DocDrawingPosition.tsx
|
|
5204
5157
|
const DocDrawingPosition = (props) => {
|
|
5205
5158
|
var _renderManagerService;
|
|
5206
5159
|
const renderManagerService = useDependency(IRenderManagerService);
|
|
@@ -5283,8 +5236,7 @@ function DocDrawingPositionContent(props) {
|
|
|
5283
5236
|
});
|
|
5284
5237
|
}
|
|
5285
5238
|
|
|
5286
|
-
|
|
5287
|
-
//#region src/views/doc-image-panel/DocDrawingTextWrap.tsx
|
|
5239
|
+
// src/views/doc-image-panel/DocDrawingTextWrap.tsx
|
|
5288
5240
|
const DocDrawingTextWrap = (props) => {
|
|
5289
5241
|
var _renderManagerService;
|
|
5290
5242
|
const renderManagerService = useDependency(IRenderManagerService);
|
|
@@ -5408,8 +5360,7 @@ function DocDrawingTextWrapContent(props) {
|
|
|
5408
5360
|
});
|
|
5409
5361
|
}
|
|
5410
5362
|
|
|
5411
|
-
|
|
5412
|
-
//#region src/views/doc-image-panel/DocDrawingPanel.tsx
|
|
5363
|
+
// src/views/doc-image-panel/DocDrawingPanel.tsx
|
|
5413
5364
|
/**
|
|
5414
5365
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5415
5366
|
*
|
|
@@ -5444,8 +5395,7 @@ const DocDrawingPanel = () => {
|
|
|
5444
5395
|
});
|
|
5445
5396
|
};
|
|
5446
5397
|
|
|
5447
|
-
|
|
5448
|
-
//#region src/controllers/components.controller.ts
|
|
5398
|
+
// src/controllers/components.controller.ts
|
|
5449
5399
|
/**
|
|
5450
5400
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5451
5401
|
*
|
|
@@ -5473,8 +5423,7 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
5473
5423
|
};
|
|
5474
5424
|
ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager))], ComponentsController);
|
|
5475
5425
|
|
|
5476
|
-
|
|
5477
|
-
//#region src/controllers/render-controllers/doc-drawing-anchor.render-controller.ts
|
|
5426
|
+
// src/controllers/render-controllers/doc-drawing-anchor.render-controller.ts
|
|
5478
5427
|
const ANCHOR_PATH = "M 8 4 C 9.104 4 10 3.104 10 2 C 10 0.896 9.104 0 8 0 C 6.896 0 6 0.896 6 2 C 6 3.104 6.896 4 8 4 Z M 8 4 L 8 16 M 5 7.2 L 11 7.2 M 1 9.5 L 1 10.5 C 1 13.5 4.25 16 8 16 C 11.75 16 15 13.5 15 10.5 L 15 9.5 M 1 9.5 L 3.25 11 M 15 9.5 L 12.75 11";
|
|
5479
5428
|
let DocDrawingAnchorRenderController = class DocDrawingAnchorRenderController extends Disposable {
|
|
5480
5429
|
constructor(_context, drawingManager, _skeletonManager, _selectionRender, _themeService) {
|
|
@@ -5572,8 +5521,7 @@ DocDrawingAnchorRenderController = __decorate([
|
|
|
5572
5521
|
__decorateParam(4, Inject(ThemeService))
|
|
5573
5522
|
], DocDrawingAnchorRenderController);
|
|
5574
5523
|
|
|
5575
|
-
|
|
5576
|
-
//#region src/controllers/shortcuts/drawing.shortcut.ts
|
|
5524
|
+
// src/controllers/shortcuts/drawing.shortcut.ts
|
|
5577
5525
|
function whenDocDrawingFocused(contextService) {
|
|
5578
5526
|
return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
|
|
5579
5527
|
}
|
|
@@ -5627,8 +5575,7 @@ const DeleteDrawingsShortcutItem = {
|
|
|
5627
5575
|
mac: KeyCode.BACKSPACE
|
|
5628
5576
|
};
|
|
5629
5577
|
|
|
5630
|
-
|
|
5631
|
-
//#region src/controllers/ui.controller.ts
|
|
5578
|
+
// src/controllers/ui.controller.ts
|
|
5632
5579
|
/**
|
|
5633
5580
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5634
5581
|
*
|
|
@@ -5698,10 +5645,9 @@ DocDrawingUIController = __decorate([
|
|
|
5698
5645
|
__decorateParam(2, IShortcutService)
|
|
5699
5646
|
], DocDrawingUIController);
|
|
5700
5647
|
|
|
5701
|
-
|
|
5702
|
-
//#region src/menu/drawing-popup-menu.controller.ts
|
|
5648
|
+
// src/menu/drawing-popup-menu.controller.ts
|
|
5703
5649
|
let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends RxDisposable {
|
|
5704
|
-
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _drawingAdapterService, _docDrawingService, _floatingToolbarAdapterService, _commandService, _menuManagerService, _permissionService, _contextMenuService) {
|
|
5650
|
+
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _drawingAdapterService, _docDrawingService, _floatingToolbarAdapterService, _commandService, _menuManagerService, _permissionService, _contextMenuService, _oleUI) {
|
|
5705
5651
|
super();
|
|
5706
5652
|
this._drawingManagerService = _drawingManagerService;
|
|
5707
5653
|
this._canvasPopManagerService = _canvasPopManagerService;
|
|
@@ -5715,12 +5661,48 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
5715
5661
|
this._menuManagerService = _menuManagerService;
|
|
5716
5662
|
this._permissionService = _permissionService;
|
|
5717
5663
|
this._contextMenuService = _contextMenuService;
|
|
5664
|
+
this._oleUI = _oleUI;
|
|
5718
5665
|
_defineProperty(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
5719
5666
|
_defineProperty(this, "_embeddedRenderUnits", /* @__PURE__ */ new Set());
|
|
5720
5667
|
_defineProperty(this, "_popupMenuListeners", /* @__PURE__ */ new Map());
|
|
5721
5668
|
_defineProperty(this, "_disposePopupsByUnit", /* @__PURE__ */ new Map());
|
|
5722
5669
|
_defineProperty(this, "_popupTargetsByUnit", /* @__PURE__ */ new Map());
|
|
5723
5670
|
_defineProperty(this, "_isDrawingPanelOpen", false);
|
|
5671
|
+
this.disposeWithMe(this._oleUI.registerHost(UniverInstanceType.UNIVER_DOC, {
|
|
5672
|
+
isEditable: (drawing) => this._drawingManagerService.getDrawingEditable() && getDocumentPermissionValue(this._permissionService, drawing.unitId, drawing.unitId, UnitAction.Edit),
|
|
5673
|
+
attach: (object, componentKey, extraProps, drawing, direction = "top-center") => this._canvasPopManagerService.attachPopupToObject(object, {
|
|
5674
|
+
componentKey,
|
|
5675
|
+
extraProps,
|
|
5676
|
+
direction,
|
|
5677
|
+
portal: true,
|
|
5678
|
+
offset: direction === "top-center" ? [0, 8] : [0, 0]
|
|
5679
|
+
}, drawing.unitId),
|
|
5680
|
+
rename: (drawing, name) => this._commandService.executeCommand(UpdateDrawingDocTransformCommand.id, {
|
|
5681
|
+
unitId: drawing.unitId,
|
|
5682
|
+
subUnitId: drawing.subUnitId,
|
|
5683
|
+
drawings: [{
|
|
5684
|
+
drawingId: drawing.drawingId,
|
|
5685
|
+
key: "oleFileName",
|
|
5686
|
+
value: name
|
|
5687
|
+
}]
|
|
5688
|
+
}),
|
|
5689
|
+
saveOnlineUnit: (drawing, online) => this._commandService.executeCommand(UpdateDrawingDocTransformCommand.id, {
|
|
5690
|
+
unitId: drawing.unitId,
|
|
5691
|
+
subUnitId: drawing.subUnitId,
|
|
5692
|
+
drawings: [{
|
|
5693
|
+
drawingId: drawing.drawingId,
|
|
5694
|
+
key: "oleOnlineUnit",
|
|
5695
|
+
value: online
|
|
5696
|
+
}]
|
|
5697
|
+
}),
|
|
5698
|
+
remove: (drawing) => this._commandService.executeCommand(RemoveDocDrawingCommand.id, {
|
|
5699
|
+
unitId: drawing.unitId,
|
|
5700
|
+
drawings: [{
|
|
5701
|
+
...drawing,
|
|
5702
|
+
drawingType: DrawingTypeEnum.DRAWING_OLE
|
|
5703
|
+
}]
|
|
5704
|
+
})
|
|
5705
|
+
}));
|
|
5724
5706
|
this._init();
|
|
5725
5707
|
}
|
|
5726
5708
|
_init() {
|
|
@@ -5869,7 +5851,7 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
5869
5851
|
return;
|
|
5870
5852
|
}
|
|
5871
5853
|
const drawingParam = this._drawingManagerService.getDrawingOKey(object.oKey);
|
|
5872
|
-
if (!drawingParam || drawingParam.drawingType === DrawingTypeEnum.DRAWING_DOM || drawingParam.drawingType === DrawingTypeEnum.DRAWING_SHAPE) {
|
|
5854
|
+
if (!drawingParam || drawingParam.drawingType === DrawingTypeEnum.DRAWING_DOM || drawingParam.drawingType === DrawingTypeEnum.DRAWING_OLE || drawingParam.drawingType === DrawingTypeEnum.DRAWING_SHAPE) {
|
|
5873
5855
|
this._clearPopups(unitId);
|
|
5874
5856
|
return;
|
|
5875
5857
|
}
|
|
@@ -6021,11 +6003,25 @@ DocDrawingPopupMenuController = __decorate([
|
|
|
6021
6003
|
__decorateParam(8, ICommandService),
|
|
6022
6004
|
__decorateParam(9, IMenuManagerService),
|
|
6023
6005
|
__decorateParam(10, IPermissionService),
|
|
6024
|
-
__decorateParam(11, IContextMenuService)
|
|
6006
|
+
__decorateParam(11, IContextMenuService),
|
|
6007
|
+
__decorateParam(12, Inject(OleUIService))
|
|
6025
6008
|
], DocDrawingPopupMenuController);
|
|
6009
|
+
function createDocOlePreview(context) {
|
|
6010
|
+
return createOlePreviewViewer({
|
|
6011
|
+
...context,
|
|
6012
|
+
onResize: (render) => render.with(DocPageLayoutService).calculatePagePosition(),
|
|
6013
|
+
setReadonly: (permissions, unitId) => setDocumentPermissionValue(permissions, unitId, unitId, UnitAction.Edit, false),
|
|
6014
|
+
register: (viewer) => {
|
|
6015
|
+
viewer.registerPlugin(UniverDocsPlugin);
|
|
6016
|
+
viewer.registerPlugin(UniverDocsUIPlugin);
|
|
6017
|
+
viewer.registerPlugin(UniverDocsDrawingPlugin);
|
|
6018
|
+
viewer.registerPlugin(UniverDocsDrawingUIPlugin);
|
|
6019
|
+
}
|
|
6020
|
+
});
|
|
6021
|
+
}
|
|
6022
|
+
registerOlePreviewRenderer(UniverInstanceType.UNIVER_DOC, createDocOlePreview);
|
|
6026
6023
|
|
|
6027
|
-
|
|
6028
|
-
//#region src/plugin.ts
|
|
6024
|
+
// src/plugin.ts
|
|
6029
6025
|
let UniverDocsDrawingUIPlugin = class UniverDocsDrawingUIPlugin extends Plugin {
|
|
6030
6026
|
constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _configService) {
|
|
6031
6027
|
super();
|
|
@@ -6077,5 +6073,4 @@ UniverDocsDrawingUIPlugin = __decorate([
|
|
|
6077
6073
|
__decorateParam(3, IConfigService)
|
|
6078
6074
|
], UniverDocsDrawingUIPlugin);
|
|
6079
6075
|
|
|
6080
|
-
//#endregion
|
|
6081
6076
|
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, InsertDocEllipseShapeCommand, InsertDocImageCommand, InsertDocRectangleShapeCommand, MobileDocDrawingPosition, MobileDocDrawingTextWrap, MoveDocDrawingsCommand, SidebarDocDrawingOperation, UngroupDocDrawingCommand, UniverDocsDrawingMobileUIPlugin, UniverDocsDrawingUIPlugin };
|