@univerjs/docs-drawing-ui 1.3.1 → 1.5.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/README.md +5 -5
- package/lib/cjs/index.js +146 -136
- 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 +149 -139
- 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.css +0 -13
- package/lib/index.js +149 -139
- 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.157.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,28 +278,25 @@ function _typeof(o) {
|
|
|
281
278
|
}, _typeof(o);
|
|
282
279
|
}
|
|
283
280
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
function toPrimitive(t, r) {
|
|
281
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
282
|
+
function toPrimitive(t, e) {
|
|
287
283
|
if ("object" != _typeof(t) || !t) return t;
|
|
288
|
-
var
|
|
289
|
-
if (void 0 !==
|
|
290
|
-
var i =
|
|
284
|
+
var r;
|
|
285
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
286
|
+
var i = r.call(t, e || "default");
|
|
291
287
|
if ("object" != _typeof(i)) return i;
|
|
292
288
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
293
289
|
}
|
|
294
|
-
return ("string" ===
|
|
290
|
+
return ("string" === e ? 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.157.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.157.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.157.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.157.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.5.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 = [{
|
|
@@ -4236,8 +4200,7 @@ function MobileDocDrawingPositionControls(props) {
|
|
|
4236
4200
|
className: "univer-grid univer-gap-2 univer-text-sm",
|
|
4237
4201
|
children: [localeService.t("docs-drawing-ui.image-position.absolutePosition"), /* @__PURE__ */ jsx(InputNumber, {
|
|
4238
4202
|
disabled: props.disabled,
|
|
4239
|
-
className: "univer-
|
|
4240
|
-
inputClassName: "[&_input]:!univer-h-12 [&_input]:!univer-text-base",
|
|
4203
|
+
className: "univer-w-full",
|
|
4241
4204
|
controls: false,
|
|
4242
4205
|
min: props.minOffset,
|
|
4243
4206
|
max: props.maxOffset,
|
|
@@ -4245,7 +4208,8 @@ function MobileDocDrawingPositionControls(props) {
|
|
|
4245
4208
|
value: axis.position.posOffset ?? 0,
|
|
4246
4209
|
onChange: (value) => {
|
|
4247
4210
|
if (value != null) axis.onOffsetChange(value);
|
|
4248
|
-
}
|
|
4211
|
+
},
|
|
4212
|
+
size: "small"
|
|
4249
4213
|
})]
|
|
4250
4214
|
}),
|
|
4251
4215
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -4257,7 +4221,7 @@ function MobileDocDrawingPositionControls(props) {
|
|
|
4257
4221
|
variant: "subtle",
|
|
4258
4222
|
disabled: props.disabled || option.disabled,
|
|
4259
4223
|
"aria-pressed": String(axis.position.relativeFrom) === option.value,
|
|
4260
|
-
className: "univer-px-3 univer-text-center
|
|
4224
|
+
className: "univer-px-3 univer-text-center aria-pressed:!univer-bg-primary-50 aria-pressed:!univer-text-primary-600",
|
|
4261
4225
|
onClick: () => axis.onReferenceChange(option.value)
|
|
4262
4226
|
}, option.value))
|
|
4263
4227
|
})
|
|
@@ -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,
|
|
@@ -4550,7 +4512,7 @@ function MobileDocDrawingTextWrapControls(props) {
|
|
|
4550
4512
|
title: localeService.t(option.label),
|
|
4551
4513
|
variant: "subtle",
|
|
4552
4514
|
"aria-pressed": props.wrapText === option.value,
|
|
4553
|
-
className: "univer-px-2 univer-text-center
|
|
4515
|
+
className: "univer-px-2 univer-text-center aria-pressed:!univer-bg-primary-50 aria-pressed:!univer-text-primary-600",
|
|
4554
4516
|
onClick: () => props.onWrapTextChange(option.value)
|
|
4555
4517
|
}, option.value))
|
|
4556
4518
|
})]
|
|
@@ -4565,14 +4527,14 @@ function MobileDocDrawingTextWrapControls(props) {
|
|
|
4565
4527
|
children: distances.filter(({ key }) => key === "distT" || key === "distB" ? !props.disableDistTB : !props.disableDistLR).map(({ key, label }) => /* @__PURE__ */ jsxs("label", {
|
|
4566
4528
|
className: "univer-grid univer-gap-2 univer-text-sm",
|
|
4567
4529
|
children: [localeService.t(label), /* @__PURE__ */ jsx(InputNumber, {
|
|
4568
|
-
className: "univer-
|
|
4569
|
-
inputClassName: "[&_input]:!univer-h-12 [&_input]:!univer-text-base",
|
|
4530
|
+
className: "univer-w-full",
|
|
4570
4531
|
controls: false,
|
|
4571
4532
|
min: props.minMargin,
|
|
4572
4533
|
max: props.maxMargin,
|
|
4573
4534
|
precision: 1,
|
|
4574
4535
|
value: props.distToText[key] ?? 0,
|
|
4575
|
-
onChange: (value) => props.onDistanceChange(value, key)
|
|
4536
|
+
onChange: (value) => props.onDistanceChange(value, key),
|
|
4537
|
+
size: "small"
|
|
4576
4538
|
})]
|
|
4577
4539
|
}, key))
|
|
4578
4540
|
})]
|
|
@@ -4603,8 +4565,22 @@ function MobileDocDrawingTextWrapContent(props) {
|
|
|
4603
4565
|
}) : null;
|
|
4604
4566
|
}
|
|
4605
4567
|
|
|
4606
|
-
|
|
4607
|
-
|
|
4568
|
+
// src/views/doc-image-panel/MobileDocDrawingPanel.tsx
|
|
4569
|
+
/**
|
|
4570
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4571
|
+
*
|
|
4572
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4573
|
+
* you may not use this file except in compliance with the License.
|
|
4574
|
+
* You may obtain a copy of the License at
|
|
4575
|
+
*
|
|
4576
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4577
|
+
*
|
|
4578
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4579
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4580
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4581
|
+
* See the License for the specific language governing permissions and
|
|
4582
|
+
* limitations under the License.
|
|
4583
|
+
*/
|
|
4608
4584
|
const tabs = [
|
|
4609
4585
|
{
|
|
4610
4586
|
value: "image",
|
|
@@ -4634,7 +4610,7 @@ function MobileDocDrawingPanel() {
|
|
|
4634
4610
|
"aria-pressed": tab === item.value,
|
|
4635
4611
|
title: localeService.t(item.label),
|
|
4636
4612
|
variant: "subtle",
|
|
4637
|
-
className: "univer-min-w-0 univer-px-2 univer-text-center
|
|
4613
|
+
className: "univer-min-w-0 univer-px-2 univer-text-center aria-pressed:!univer-bg-primary-50 aria-pressed:!univer-text-primary-600",
|
|
4638
4614
|
onClick: () => setTab(item.value)
|
|
4639
4615
|
}, item.value))
|
|
4640
4616
|
}), /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -4652,8 +4628,7 @@ function MobileDocDrawingPanel() {
|
|
|
4652
4628
|
});
|
|
4653
4629
|
}
|
|
4654
4630
|
|
|
4655
|
-
|
|
4656
|
-
//#region src/controllers/mobile/components.controller.ts
|
|
4631
|
+
// src/controllers/mobile/components.controller.ts
|
|
4657
4632
|
/**
|
|
4658
4633
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4659
4634
|
*
|
|
@@ -4677,8 +4652,7 @@ let MobileComponentsController = class MobileComponentsController extends Dispos
|
|
|
4677
4652
|
};
|
|
4678
4653
|
MobileComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager))], MobileComponentsController);
|
|
4679
4654
|
|
|
4680
|
-
|
|
4681
|
-
//#region src/commands/operations/mobile/open-drawing-panel.operation.ts
|
|
4655
|
+
// src/commands/operations/mobile/open-drawing-panel.operation.ts
|
|
4682
4656
|
const SidebarDocDrawingMobileOperation = {
|
|
4683
4657
|
id: SidebarDocDrawingOperation.id,
|
|
4684
4658
|
type: CommandType.COMMAND,
|
|
@@ -4706,8 +4680,7 @@ const SidebarDocDrawingMobileOperation = {
|
|
|
4706
4680
|
}
|
|
4707
4681
|
};
|
|
4708
4682
|
|
|
4709
|
-
|
|
4710
|
-
//#region src/services/doc-drawing-floating-toolbar-adapter.service.ts
|
|
4683
|
+
// src/services/doc-drawing-floating-toolbar-adapter.service.ts
|
|
4711
4684
|
var DocDrawingFloatingToolbarAdapterService = class {
|
|
4712
4685
|
constructor() {
|
|
4713
4686
|
_defineProperty(this, "_adapters", []);
|
|
@@ -4728,8 +4701,7 @@ var DocDrawingFloatingToolbarAdapterService = class {
|
|
|
4728
4701
|
}
|
|
4729
4702
|
};
|
|
4730
4703
|
|
|
4731
|
-
|
|
4732
|
-
//#region src/controllers/mobile/drawing-popup-menu.controller.ts
|
|
4704
|
+
// src/controllers/mobile/drawing-popup-menu.controller.ts
|
|
4733
4705
|
let MobileDocDrawingPopupMenuController = class MobileDocDrawingPopupMenuController extends RxDisposable {
|
|
4734
4706
|
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _drawingAdapterService, _docDrawingService, _floatingToolbarAdapterService, _commandService, _menuManagerService, _permissionService) {
|
|
4735
4707
|
super();
|
|
@@ -5075,8 +5047,7 @@ MobileDocDrawingPopupMenuController = __decorate([
|
|
|
5075
5047
|
__decorateParam(10, IPermissionService)
|
|
5076
5048
|
], MobileDocDrawingPopupMenuController);
|
|
5077
5049
|
|
|
5078
|
-
|
|
5079
|
-
//#region src/controllers/mobile/ui.controller.ts
|
|
5050
|
+
// src/controllers/mobile/ui.controller.ts
|
|
5080
5051
|
/**
|
|
5081
5052
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5082
5053
|
*
|
|
@@ -5124,8 +5095,7 @@ let MobileDocDrawingUIController = class MobileDocDrawingUIController extends Di
|
|
|
5124
5095
|
};
|
|
5125
5096
|
MobileDocDrawingUIController = __decorate([__decorateParam(0, IMenuManagerService), __decorateParam(1, ICommandService)], MobileDocDrawingUIController);
|
|
5126
5097
|
|
|
5127
|
-
|
|
5128
|
-
//#region src/controllers/render-controllers/mobile/doc-drawing-update.render-controller.ts
|
|
5098
|
+
// src/controllers/render-controllers/mobile/doc-drawing-update.render-controller.ts
|
|
5129
5099
|
/**
|
|
5130
5100
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5131
5101
|
*
|
|
@@ -5150,8 +5120,7 @@ var MobileDocDrawingUpdateRenderController = class extends DocDrawingUpdateRende
|
|
|
5150
5120
|
}
|
|
5151
5121
|
};
|
|
5152
5122
|
|
|
5153
|
-
|
|
5154
|
-
//#region src/mobile-plugin.ts
|
|
5123
|
+
// src/mobile-plugin.ts
|
|
5155
5124
|
let UniverDocsDrawingMobileUIPlugin = class UniverDocsDrawingMobileUIPlugin extends Plugin {
|
|
5156
5125
|
constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _configService) {
|
|
5157
5126
|
super();
|
|
@@ -5199,8 +5168,7 @@ UniverDocsDrawingMobileUIPlugin = __decorate([
|
|
|
5199
5168
|
__decorateParam(3, IConfigService)
|
|
5200
5169
|
], UniverDocsDrawingMobileUIPlugin);
|
|
5201
5170
|
|
|
5202
|
-
|
|
5203
|
-
//#region src/views/doc-image-panel/DocDrawingPosition.tsx
|
|
5171
|
+
// src/views/doc-image-panel/DocDrawingPosition.tsx
|
|
5204
5172
|
const DocDrawingPosition = (props) => {
|
|
5205
5173
|
var _renderManagerService;
|
|
5206
5174
|
const renderManagerService = useDependency(IRenderManagerService);
|
|
@@ -5283,8 +5251,7 @@ function DocDrawingPositionContent(props) {
|
|
|
5283
5251
|
});
|
|
5284
5252
|
}
|
|
5285
5253
|
|
|
5286
|
-
|
|
5287
|
-
//#region src/views/doc-image-panel/DocDrawingTextWrap.tsx
|
|
5254
|
+
// src/views/doc-image-panel/DocDrawingTextWrap.tsx
|
|
5288
5255
|
const DocDrawingTextWrap = (props) => {
|
|
5289
5256
|
var _renderManagerService;
|
|
5290
5257
|
const renderManagerService = useDependency(IRenderManagerService);
|
|
@@ -5408,8 +5375,7 @@ function DocDrawingTextWrapContent(props) {
|
|
|
5408
5375
|
});
|
|
5409
5376
|
}
|
|
5410
5377
|
|
|
5411
|
-
|
|
5412
|
-
//#region src/views/doc-image-panel/DocDrawingPanel.tsx
|
|
5378
|
+
// src/views/doc-image-panel/DocDrawingPanel.tsx
|
|
5413
5379
|
/**
|
|
5414
5380
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5415
5381
|
*
|
|
@@ -5444,8 +5410,7 @@ const DocDrawingPanel = () => {
|
|
|
5444
5410
|
});
|
|
5445
5411
|
};
|
|
5446
5412
|
|
|
5447
|
-
|
|
5448
|
-
//#region src/controllers/components.controller.ts
|
|
5413
|
+
// src/controllers/components.controller.ts
|
|
5449
5414
|
/**
|
|
5450
5415
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5451
5416
|
*
|
|
@@ -5473,8 +5438,7 @@ let ComponentsController = class ComponentsController extends Disposable {
|
|
|
5473
5438
|
};
|
|
5474
5439
|
ComponentsController = __decorate([__decorateParam(0, Inject(ComponentManager))], ComponentsController);
|
|
5475
5440
|
|
|
5476
|
-
|
|
5477
|
-
//#region src/controllers/render-controllers/doc-drawing-anchor.render-controller.ts
|
|
5441
|
+
// src/controllers/render-controllers/doc-drawing-anchor.render-controller.ts
|
|
5478
5442
|
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
5443
|
let DocDrawingAnchorRenderController = class DocDrawingAnchorRenderController extends Disposable {
|
|
5480
5444
|
constructor(_context, drawingManager, _skeletonManager, _selectionRender, _themeService) {
|
|
@@ -5572,8 +5536,7 @@ DocDrawingAnchorRenderController = __decorate([
|
|
|
5572
5536
|
__decorateParam(4, Inject(ThemeService))
|
|
5573
5537
|
], DocDrawingAnchorRenderController);
|
|
5574
5538
|
|
|
5575
|
-
|
|
5576
|
-
//#region src/controllers/shortcuts/drawing.shortcut.ts
|
|
5539
|
+
// src/controllers/shortcuts/drawing.shortcut.ts
|
|
5577
5540
|
function whenDocDrawingFocused(contextService) {
|
|
5578
5541
|
return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && contextService.getContextValue(FOCUSING_COMMON_DRAWINGS);
|
|
5579
5542
|
}
|
|
@@ -5627,8 +5590,7 @@ const DeleteDrawingsShortcutItem = {
|
|
|
5627
5590
|
mac: KeyCode.BACKSPACE
|
|
5628
5591
|
};
|
|
5629
5592
|
|
|
5630
|
-
|
|
5631
|
-
//#region src/controllers/ui.controller.ts
|
|
5593
|
+
// src/controllers/ui.controller.ts
|
|
5632
5594
|
/**
|
|
5633
5595
|
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5634
5596
|
*
|
|
@@ -5698,10 +5660,9 @@ DocDrawingUIController = __decorate([
|
|
|
5698
5660
|
__decorateParam(2, IShortcutService)
|
|
5699
5661
|
], DocDrawingUIController);
|
|
5700
5662
|
|
|
5701
|
-
|
|
5702
|
-
//#region src/menu/drawing-popup-menu.controller.ts
|
|
5663
|
+
// src/menu/drawing-popup-menu.controller.ts
|
|
5703
5664
|
let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends RxDisposable {
|
|
5704
|
-
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _drawingAdapterService, _docDrawingService, _floatingToolbarAdapterService, _commandService, _menuManagerService, _permissionService, _contextMenuService) {
|
|
5665
|
+
constructor(_drawingManagerService, _canvasPopManagerService, _renderManagerService, _univerInstanceService, _contextService, _drawingAdapterService, _docDrawingService, _floatingToolbarAdapterService, _commandService, _menuManagerService, _permissionService, _contextMenuService, _oleUI) {
|
|
5705
5666
|
super();
|
|
5706
5667
|
this._drawingManagerService = _drawingManagerService;
|
|
5707
5668
|
this._canvasPopManagerService = _canvasPopManagerService;
|
|
@@ -5715,12 +5676,48 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
5715
5676
|
this._menuManagerService = _menuManagerService;
|
|
5716
5677
|
this._permissionService = _permissionService;
|
|
5717
5678
|
this._contextMenuService = _contextMenuService;
|
|
5679
|
+
this._oleUI = _oleUI;
|
|
5718
5680
|
_defineProperty(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
5719
5681
|
_defineProperty(this, "_embeddedRenderUnits", /* @__PURE__ */ new Set());
|
|
5720
5682
|
_defineProperty(this, "_popupMenuListeners", /* @__PURE__ */ new Map());
|
|
5721
5683
|
_defineProperty(this, "_disposePopupsByUnit", /* @__PURE__ */ new Map());
|
|
5722
5684
|
_defineProperty(this, "_popupTargetsByUnit", /* @__PURE__ */ new Map());
|
|
5723
5685
|
_defineProperty(this, "_isDrawingPanelOpen", false);
|
|
5686
|
+
this.disposeWithMe(this._oleUI.registerHost(UniverInstanceType.UNIVER_DOC, {
|
|
5687
|
+
isEditable: (drawing) => this._drawingManagerService.getDrawingEditable() && getDocumentPermissionValue(this._permissionService, drawing.unitId, drawing.unitId, UnitAction.Edit),
|
|
5688
|
+
attach: (object, componentKey, extraProps, drawing, direction = "top-center") => this._canvasPopManagerService.attachPopupToObject(object, {
|
|
5689
|
+
componentKey,
|
|
5690
|
+
extraProps,
|
|
5691
|
+
direction,
|
|
5692
|
+
portal: true,
|
|
5693
|
+
offset: direction === "top-center" ? [0, 8] : [0, 0]
|
|
5694
|
+
}, drawing.unitId),
|
|
5695
|
+
rename: (drawing, name) => this._commandService.executeCommand(UpdateDrawingDocTransformCommand.id, {
|
|
5696
|
+
unitId: drawing.unitId,
|
|
5697
|
+
subUnitId: drawing.subUnitId,
|
|
5698
|
+
drawings: [{
|
|
5699
|
+
drawingId: drawing.drawingId,
|
|
5700
|
+
key: "oleFileName",
|
|
5701
|
+
value: name
|
|
5702
|
+
}]
|
|
5703
|
+
}),
|
|
5704
|
+
saveOnlineUnit: (drawing, online) => this._commandService.executeCommand(UpdateDrawingDocTransformCommand.id, {
|
|
5705
|
+
unitId: drawing.unitId,
|
|
5706
|
+
subUnitId: drawing.subUnitId,
|
|
5707
|
+
drawings: [{
|
|
5708
|
+
drawingId: drawing.drawingId,
|
|
5709
|
+
key: "oleOnlineUnit",
|
|
5710
|
+
value: online
|
|
5711
|
+
}]
|
|
5712
|
+
}),
|
|
5713
|
+
remove: (drawing) => this._commandService.executeCommand(RemoveDocDrawingCommand.id, {
|
|
5714
|
+
unitId: drawing.unitId,
|
|
5715
|
+
drawings: [{
|
|
5716
|
+
...drawing,
|
|
5717
|
+
drawingType: DrawingTypeEnum.DRAWING_OLE
|
|
5718
|
+
}]
|
|
5719
|
+
})
|
|
5720
|
+
}));
|
|
5724
5721
|
this._init();
|
|
5725
5722
|
}
|
|
5726
5723
|
_init() {
|
|
@@ -5869,7 +5866,7 @@ let DocDrawingPopupMenuController = class DocDrawingPopupMenuController extends
|
|
|
5869
5866
|
return;
|
|
5870
5867
|
}
|
|
5871
5868
|
const drawingParam = this._drawingManagerService.getDrawingOKey(object.oKey);
|
|
5872
|
-
if (!drawingParam || drawingParam.drawingType === DrawingTypeEnum.DRAWING_DOM || drawingParam.drawingType === DrawingTypeEnum.DRAWING_SHAPE) {
|
|
5869
|
+
if (!drawingParam || drawingParam.drawingType === DrawingTypeEnum.DRAWING_DOM || drawingParam.drawingType === DrawingTypeEnum.DRAWING_OLE || drawingParam.drawingType === DrawingTypeEnum.DRAWING_SHAPE) {
|
|
5873
5870
|
this._clearPopups(unitId);
|
|
5874
5871
|
return;
|
|
5875
5872
|
}
|
|
@@ -6021,11 +6018,25 @@ DocDrawingPopupMenuController = __decorate([
|
|
|
6021
6018
|
__decorateParam(8, ICommandService),
|
|
6022
6019
|
__decorateParam(9, IMenuManagerService),
|
|
6023
6020
|
__decorateParam(10, IPermissionService),
|
|
6024
|
-
__decorateParam(11, IContextMenuService)
|
|
6021
|
+
__decorateParam(11, IContextMenuService),
|
|
6022
|
+
__decorateParam(12, Inject(OleUIService))
|
|
6025
6023
|
], DocDrawingPopupMenuController);
|
|
6024
|
+
function createDocOlePreview(context) {
|
|
6025
|
+
return createOlePreviewViewer({
|
|
6026
|
+
...context,
|
|
6027
|
+
onResize: (render) => render.with(DocPageLayoutService).calculatePagePosition(),
|
|
6028
|
+
setReadonly: (permissions, unitId) => setDocumentPermissionValue(permissions, unitId, unitId, UnitAction.Edit, false),
|
|
6029
|
+
register: (viewer) => {
|
|
6030
|
+
viewer.registerPlugin(UniverDocsPlugin);
|
|
6031
|
+
viewer.registerPlugin(UniverDocsUIPlugin);
|
|
6032
|
+
viewer.registerPlugin(UniverDocsDrawingPlugin);
|
|
6033
|
+
viewer.registerPlugin(UniverDocsDrawingUIPlugin);
|
|
6034
|
+
}
|
|
6035
|
+
});
|
|
6036
|
+
}
|
|
6037
|
+
registerOlePreviewRenderer(UniverInstanceType.UNIVER_DOC, createDocOlePreview);
|
|
6026
6038
|
|
|
6027
|
-
|
|
6028
|
-
//#region src/plugin.ts
|
|
6039
|
+
// src/plugin.ts
|
|
6029
6040
|
let UniverDocsDrawingUIPlugin = class UniverDocsDrawingUIPlugin extends Plugin {
|
|
6030
6041
|
constructor(_config = defaultPluginConfig, _injector, _renderManagerSrv, _configService) {
|
|
6031
6042
|
super();
|
|
@@ -6077,5 +6088,4 @@ UniverDocsDrawingUIPlugin = __decorate([
|
|
|
6077
6088
|
__decorateParam(3, IConfigService)
|
|
6078
6089
|
], UniverDocsDrawingUIPlugin);
|
|
6079
6090
|
|
|
6080
|
-
//#endregion
|
|
6081
6091
|
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 };
|