@univerjs/docs-drawing-ui 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { CommandType, ICommandService, IUniverInstanceService, TextX, JSONX, MemoryCursor, TextXActionType, IUndoRedoService, BuildTextUtils, Tools, Inject, LocaleService, Disposable, BooleanNumber, PositionedObjectLayoutType, WrapTextType, ObjectRelativeFromH, ObjectRelativeFromV, FOCUSING_COMMON_DRAWINGS, IContextService, UniverInstanceType, Direction, useDependency, FOCUSING_UNIVER_EDITOR, UndoCommand, RedoCommand, toDisposable, throttle, COLORS, RxDisposable, LifecycleService, fromEventSubject, LifecycleStages, DependentOn, Injector, Plugin, IConfigService } from "@univerjs/core";
|
|
5
|
+
import { CommandType, ICommandService, IUniverInstanceService, TextX, JSONX, MemoryCursor, TextXActionType, IUndoRedoService, BuildTextUtils, Tools, Inject, LocaleService, Disposable, BooleanNumber, PositionedObjectLayoutType, WrapTextType, ObjectRelativeFromH, ObjectRelativeFromV, FOCUSING_COMMON_DRAWINGS, IContextService, UniverInstanceType, Direction, useDependency, DocumentFlavor, FOCUSING_UNIVER_EDITOR, UndoCommand, RedoCommand, toDisposable, throttle, COLORS, RxDisposable, LifecycleService, fromEventSubject, LifecycleStages, DependentOn, Injector, Plugin, IConfigService } from "@univerjs/core";
|
|
6
6
|
import { IDocDrawingService, UniverDocsDrawingPlugin } from "@univerjs/docs-drawing";
|
|
7
7
|
import { ArrangeTypeEnum, DRAWING_IMAGE_ALLOW_IMAGE_LIST, DRAWING_IMAGE_COUNT_LIMIT, ImageUploadStatusType, DRAWING_IMAGE_ALLOW_SIZE, getImageSize, DrawingTypeEnum, getDrawingShapeKeyByDrawingSearch, IImageIoService, IDrawingManagerService, DRAWING_IMAGE_WIDTH_LIMIT, DRAWING_IMAGE_HEIGHT_LIMIT, UniverDrawingPlugin } from "@univerjs/drawing";
|
|
8
8
|
import { DrawingCommonPanel, ImageCropperObject, COMPONENT_IMAGE_POPUP_MENU, OpenImageCropOperation, ImageResetSizeOperation, UniverDrawingUIPlugin } from "@univerjs/drawing-ui";
|
|
@@ -10,7 +10,7 @@ import { IRenderManagerService, DocumentEditArea, Liquid, PageLayoutType, Docume
|
|
|
10
10
|
import { IMessageService, ILocalFileService, ISidebarService, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, KeyCode, ComponentManager, IMenuManagerService, IShortcutService, UniverUIPlugin } from "@univerjs/ui";
|
|
11
11
|
import { RichTextEditingMutation, DocSelectionManagerService, DocSkeletonManagerService } from "@univerjs/docs";
|
|
12
12
|
import { DocSelectionRenderService, getRichTextEditPath, getCustomBlockIdsInSelections, docDrawingPositionToTransform, NodePositionConvertToCursor, getOneTextSelectionRange, getAnchorBounding, TEXT_RANGE_LAYER_INDEX, getDocObject, DocCanvasPopManagerService, IEditorService, SetDocZoomRatioOperation } from "@univerjs/docs-ui";
|
|
13
|
-
import { MessageType,
|
|
13
|
+
import { MessageType, InputNumber, Select, Checkbox, RadioGroup, Radio } from "@univerjs/design";
|
|
14
14
|
import { BehaviorSubject, Observable, takeUntil, filter, debounceTime } from "rxjs";
|
|
15
15
|
import React, { forwardRef, useRef, createElement, useState, useEffect } from "react";
|
|
16
16
|
const PLUGIN_CONFIG_KEY = "docs-drawing-ui.config", defaultPluginConfig = {};
|
|
@@ -97,13 +97,10 @@ const RemoveDocDrawingCommand = {
|
|
|
97
97
|
const { startIndex } = block;
|
|
98
98
|
startIndex > memoryCursor.cursor && textX.push({
|
|
99
99
|
t: TextXActionType.RETAIN,
|
|
100
|
-
len: startIndex - memoryCursor.cursor
|
|
101
|
-
segmentId: ""
|
|
100
|
+
len: startIndex - memoryCursor.cursor
|
|
102
101
|
}), textX.push({
|
|
103
102
|
t: TextXActionType.DELETE,
|
|
104
|
-
len: 1
|
|
105
|
-
line: 0,
|
|
106
|
-
segmentId: ""
|
|
103
|
+
len: 1
|
|
107
104
|
}), memoryCursor.moveCursorTo(startIndex + 1);
|
|
108
105
|
}
|
|
109
106
|
const path = getRichTextEditPath(documentDataModel, segmentId);
|
|
@@ -168,8 +165,7 @@ const RemoveDocDrawingCommand = {
|
|
|
168
165
|
if (collapsed)
|
|
169
166
|
startOffset > 0 && textX.push({
|
|
170
167
|
t: TextXActionType.RETAIN,
|
|
171
|
-
len: startOffset
|
|
172
|
-
segmentId
|
|
168
|
+
len: startOffset
|
|
173
169
|
});
|
|
174
170
|
else {
|
|
175
171
|
const { dos } = BuildTextUtils.selection.getDeleteActions(activeTextRange, segmentId, 0, body);
|
|
@@ -193,9 +189,7 @@ const RemoveDocDrawingCommand = {
|
|
|
193
189
|
blockId: drawing.drawingId
|
|
194
190
|
}))
|
|
195
191
|
},
|
|
196
|
-
len: drawings.length
|
|
197
|
-
line: 0,
|
|
198
|
-
segmentId
|
|
192
|
+
len: drawings.length
|
|
199
193
|
});
|
|
200
194
|
const path = getRichTextEditPath(documentDataModel, segmentId), placeHolderAction = jsonX.editOp(textX.serialize(), path);
|
|
201
195
|
rawActions.push(placeHolderAction);
|
|
@@ -371,8 +365,8 @@ let DocDrawingUpdateRenderController = (_a = class extends Disposable {
|
|
|
371
365
|
posOffset: position.left
|
|
372
366
|
},
|
|
373
367
|
positionV: {
|
|
374
|
-
relativeFrom: ObjectRelativeFromV.
|
|
375
|
-
posOffset:
|
|
368
|
+
relativeFrom: ObjectRelativeFromV.PARAGRAPH,
|
|
369
|
+
posOffset: 0
|
|
376
370
|
},
|
|
377
371
|
angle: 0
|
|
378
372
|
};
|
|
@@ -510,8 +504,7 @@ function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPa
|
|
|
510
504
|
if (offset = Math.min(body.dataStream.length - 2, offset), segmentId === oldSegmentId) {
|
|
511
505
|
if (offset < oldOffset ? (offset > 0 && textX.push({
|
|
512
506
|
t: TextXActionType.RETAIN,
|
|
513
|
-
len: offset
|
|
514
|
-
segmentId: oldSegmentId
|
|
507
|
+
len: offset
|
|
515
508
|
}), textX.push({
|
|
516
509
|
t: TextXActionType.INSERT,
|
|
517
510
|
body: {
|
|
@@ -521,31 +514,22 @@ function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPa
|
|
|
521
514
|
blockId: drawingId
|
|
522
515
|
}]
|
|
523
516
|
},
|
|
524
|
-
len: 1
|
|
525
|
-
line: 0,
|
|
526
|
-
segmentId: oldSegmentId
|
|
517
|
+
len: 1
|
|
527
518
|
}), textX.push({
|
|
528
519
|
t: TextXActionType.RETAIN,
|
|
529
|
-
len: oldOffset - offset
|
|
530
|
-
segmentId: oldSegmentId
|
|
520
|
+
len: oldOffset - offset
|
|
531
521
|
}), textX.push({
|
|
532
522
|
t: TextXActionType.DELETE,
|
|
533
|
-
len: 1
|
|
534
|
-
line: 0,
|
|
535
|
-
segmentId: ""
|
|
523
|
+
len: 1
|
|
536
524
|
})) : (oldOffset > 0 && textX.push({
|
|
537
525
|
t: TextXActionType.RETAIN,
|
|
538
|
-
len: oldOffset
|
|
539
|
-
segmentId: oldSegmentId
|
|
526
|
+
len: oldOffset
|
|
540
527
|
}), textX.push({
|
|
541
528
|
t: TextXActionType.DELETE,
|
|
542
|
-
len: 1
|
|
543
|
-
line: 0,
|
|
544
|
-
segmentId: ""
|
|
529
|
+
len: 1
|
|
545
530
|
}), offset - oldOffset - 1 > 0 && textX.push({
|
|
546
531
|
t: TextXActionType.RETAIN,
|
|
547
|
-
len: offset - oldOffset - 1
|
|
548
|
-
segmentId: oldSegmentId
|
|
532
|
+
len: offset - oldOffset - 1
|
|
549
533
|
}), textX.push({
|
|
550
534
|
t: TextXActionType.INSERT,
|
|
551
535
|
body: {
|
|
@@ -555,9 +539,7 @@ function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPa
|
|
|
555
539
|
blockId: drawingId
|
|
556
540
|
}]
|
|
557
541
|
},
|
|
558
|
-
len: 1
|
|
559
|
-
line: 0,
|
|
560
|
-
segmentId: oldSegmentId
|
|
542
|
+
len: 1
|
|
561
543
|
})), offset !== oldOffset) {
|
|
562
544
|
const path = getRichTextEditPath(documentDataModel, oldSegmentId), action = jsonX.editOp(textX.serialize(), path);
|
|
563
545
|
rawActions.push(action);
|
|
@@ -565,19 +547,15 @@ function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPa
|
|
|
565
547
|
} else {
|
|
566
548
|
oldOffset > 0 && textX.push({
|
|
567
549
|
t: TextXActionType.RETAIN,
|
|
568
|
-
len: oldOffset
|
|
569
|
-
segmentId: oldSegmentId
|
|
550
|
+
len: oldOffset
|
|
570
551
|
}), textX.push({
|
|
571
552
|
t: TextXActionType.DELETE,
|
|
572
|
-
len: 1
|
|
573
|
-
line: 0,
|
|
574
|
-
segmentId: ""
|
|
553
|
+
len: 1
|
|
575
554
|
});
|
|
576
555
|
let path = getRichTextEditPath(documentDataModel, oldSegmentId), action = jsonX.editOp(textX.serialize(), path);
|
|
577
556
|
rawActions.push(action), textX.empty(), offset > 0 && textX.push({
|
|
578
557
|
t: TextXActionType.RETAIN,
|
|
579
|
-
len: offset
|
|
580
|
-
segmentId
|
|
558
|
+
len: offset
|
|
581
559
|
}), textX.push({
|
|
582
560
|
t: TextXActionType.INSERT,
|
|
583
561
|
body: {
|
|
@@ -587,9 +565,7 @@ function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPa
|
|
|
587
565
|
blockId: drawingId
|
|
588
566
|
}]
|
|
589
567
|
},
|
|
590
|
-
len: 1
|
|
591
|
-
line: 0,
|
|
592
|
-
segmentId
|
|
568
|
+
len: 1
|
|
593
569
|
}), path = getRichTextEditPath(documentDataModel, segmentId), action = jsonX.editOp(textX.serialize(), path), rawActions.push(action), docSelectionRenderManager.setSegment(segmentId), docSelectionRenderManager.setSegmentPage(segmentPage);
|
|
594
570
|
}
|
|
595
571
|
return rawActions;
|
|
@@ -939,22 +915,6 @@ const UpdateDocDrawingWrappingStyleCommand = {
|
|
|
939
915
|
const drawingManagerService = accessor.get(IDrawingManagerService), commandService = accessor.get(ICommandService);
|
|
940
916
|
return params == null ? !1 : (drawingManagerService.focusDrawing([params]), commandService.executeCommand(SidebarDocDrawingOperation.id, { value: "open" }), !0);
|
|
941
917
|
}, "handler")
|
|
942
|
-
}, imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "univer-image-common-panel-grid", imageCommonPanelBorder = "univer-image-common-panel-border", imageCommonPanelTitle = "univer-image-common-panel-title", imageCommonPanelSubtitle = "univer-image-common-panel-subtitle", imageCommonPanelRow = "univer-image-common-panel-row", imageCommonPanelRowVertical = "univer-image-common-panel-row-vertical", imageCommonPanelColumn = "univer-image-common-panel-column", imageCommonPanelColumnCenter = "univer-image-common-panel-column-center", imageCommonPanelInline = "univer-image-common-panel-inline", imageCommonPanelSpan2 = "univer-image-common-panel-span2", imageCommonPanelSpan3 = "univer-image-common-panel-span3", imageCommonPanelInput = "univer-image-common-panel-input", sheetImageMenu = "univer-sheet-image-menu", sheetImageMenuInput = "univer-sheet-image-menu-input", styles = {
|
|
943
|
-
imageCommonPanel,
|
|
944
|
-
imageCommonPanelGrid,
|
|
945
|
-
imageCommonPanelBorder,
|
|
946
|
-
imageCommonPanelTitle,
|
|
947
|
-
imageCommonPanelSubtitle,
|
|
948
|
-
imageCommonPanelRow,
|
|
949
|
-
imageCommonPanelRowVertical,
|
|
950
|
-
imageCommonPanelColumn,
|
|
951
|
-
imageCommonPanelColumnCenter,
|
|
952
|
-
imageCommonPanelInline,
|
|
953
|
-
imageCommonPanelSpan2,
|
|
954
|
-
imageCommonPanelSpan3,
|
|
955
|
-
imageCommonPanelInput,
|
|
956
|
-
sheetImageMenu,
|
|
957
|
-
sheetImageMenuInput
|
|
958
918
|
};
|
|
959
919
|
function r(e) {
|
|
960
920
|
var t, f, n = "";
|
|
@@ -971,191 +931,27 @@ function clsx() {
|
|
|
971
931
|
return n;
|
|
972
932
|
}
|
|
973
933
|
__name(clsx, "clsx");
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
return;
|
|
992
|
-
const { unitId: unitId2, subUnitId } = focusDrawings[0], drawings2 = focusDrawings.map(({ unitId: unitId3, subUnitId: subUnitId2, drawingId }) => ({
|
|
993
|
-
unitId: unitId3,
|
|
994
|
-
subUnitId: subUnitId2,
|
|
995
|
-
drawingId
|
|
996
|
-
}));
|
|
997
|
-
commandService.executeCommand(UpdateDocDrawingWrappingStyleCommand.id, {
|
|
998
|
-
unitId: unitId2,
|
|
999
|
-
subUnitId,
|
|
1000
|
-
drawings: drawings2,
|
|
1001
|
-
wrappingStyle: value
|
|
1002
|
-
});
|
|
1003
|
-
}
|
|
1004
|
-
__name(handleWrappingStyleChange, "handleWrappingStyleChange");
|
|
1005
|
-
function handleWrapTextChange(value) {
|
|
1006
|
-
setWrapText(value);
|
|
1007
|
-
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1008
|
-
if (focusDrawings.length === 0)
|
|
1009
|
-
return;
|
|
1010
|
-
const drawings2 = focusDrawings.map((drawing) => ({
|
|
1011
|
-
unitId: drawing.unitId,
|
|
1012
|
-
subUnitId: drawing.subUnitId,
|
|
1013
|
-
drawingId: drawing.drawingId
|
|
1014
|
-
}));
|
|
1015
|
-
commandService.executeCommand(UpdateDocDrawingWrapTextCommand.id, {
|
|
1016
|
-
unitId: focusDrawings[0].unitId,
|
|
1017
|
-
subUnitId: focusDrawings[0].unitId,
|
|
1018
|
-
drawings: drawings2,
|
|
1019
|
-
wrapText: value
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
__name(handleWrapTextChange, "handleWrapTextChange");
|
|
1023
|
-
function handleDistToTextChange(value, direction) {
|
|
1024
|
-
if (value == null)
|
|
1025
|
-
return;
|
|
1026
|
-
const newDistToText = { ...distToText, [direction]: value };
|
|
1027
|
-
setDistToText(newDistToText);
|
|
1028
|
-
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1029
|
-
if (focusDrawings.length === 0)
|
|
1030
|
-
return;
|
|
1031
|
-
const drawings2 = focusDrawings.map((drawing) => ({
|
|
1032
|
-
unitId: drawing.unitId,
|
|
1033
|
-
subUnitId: drawing.subUnitId,
|
|
1034
|
-
drawingId: drawing.drawingId
|
|
1035
|
-
}));
|
|
1036
|
-
commandService.executeCommand(UpdateDocDrawingDistanceCommand.id, {
|
|
1037
|
-
unitId: focusDrawings[0].unitId,
|
|
1038
|
-
subUnitId: focusDrawings[0].unitId,
|
|
1039
|
-
drawings: drawings2,
|
|
1040
|
-
dist: {
|
|
1041
|
-
[direction]: value
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
__name(handleDistToTextChange, "handleDistToTextChange");
|
|
1046
|
-
function updateFocusDrawingState() {
|
|
1047
|
-
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1048
|
-
focusDrawings.length !== 0 && updateState(focusDrawings[0]);
|
|
1049
|
-
}
|
|
1050
|
-
__name(updateFocusDrawingState, "updateFocusDrawingState");
|
|
1051
|
-
function updateState(drawingParam2) {
|
|
1052
|
-
var _a8, _b;
|
|
1053
|
-
const drawing = (_b = (_a8 = documentDataModel == null ? void 0 : documentDataModel.getSnapshot()) == null ? void 0 : _a8.drawings) == null ? void 0 : _b[drawingParam2.drawingId];
|
|
1054
|
-
if (drawing == null)
|
|
1055
|
-
return;
|
|
1056
|
-
const {
|
|
1057
|
-
distT = 0,
|
|
1058
|
-
distL = 0,
|
|
1059
|
-
distB = 0,
|
|
1060
|
-
distR = 0,
|
|
1061
|
-
layoutType = PositionedObjectLayoutType.INLINE,
|
|
1062
|
-
behindDoc = BooleanNumber.FALSE,
|
|
1063
|
-
wrapText: wrapText2 = WrapTextType.BOTH_SIDES
|
|
1064
|
-
} = drawing;
|
|
1065
|
-
if (setDistToText({
|
|
1066
|
-
distT,
|
|
1067
|
-
distL,
|
|
1068
|
-
distB,
|
|
1069
|
-
distR
|
|
1070
|
-
}), setWrapText(wrapText2), setDisableWrapText(layoutType !== PositionedObjectLayoutType.WRAP_SQUARE), layoutType === PositionedObjectLayoutType.WRAP_NONE || layoutType === PositionedObjectLayoutType.INLINE ? setDisableDistTB(!0) : setDisableDistTB(!1), layoutType === PositionedObjectLayoutType.WRAP_NONE || layoutType === PositionedObjectLayoutType.INLINE || layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM ? setDisableDistLR(!0) : setDisableDistLR(!1), layoutType === PositionedObjectLayoutType.WRAP_NONE)
|
|
1071
|
-
behindDoc === BooleanNumber.TRUE ? setWrappingStyle(TextWrappingStyle.BEHIND_TEXT) : setWrappingStyle(TextWrappingStyle.IN_FRONT_OF_TEXT);
|
|
1072
|
-
else
|
|
1073
|
-
switch (layoutType) {
|
|
1074
|
-
case PositionedObjectLayoutType.INLINE:
|
|
1075
|
-
setWrappingStyle(TextWrappingStyle.INLINE);
|
|
1076
|
-
break;
|
|
1077
|
-
case PositionedObjectLayoutType.WRAP_SQUARE:
|
|
1078
|
-
setWrappingStyle(TextWrappingStyle.WRAP_SQUARE);
|
|
1079
|
-
break;
|
|
1080
|
-
case PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM:
|
|
1081
|
-
setWrappingStyle(TextWrappingStyle.WRAP_TOP_AND_BOTTOM);
|
|
1082
|
-
break;
|
|
1083
|
-
default:
|
|
1084
|
-
throw new Error(`Unsupported layout type: ${layoutType}`);
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
return __name(updateState, "updateState"), useEffect(() => {
|
|
1088
|
-
updateFocusDrawingState();
|
|
1089
|
-
const subscription = drawingManagerService.focus$.subscribe((drawingParams) => {
|
|
1090
|
-
if (drawingParams.length === 0) {
|
|
1091
|
-
setShowPanel(!1);
|
|
1092
|
-
return;
|
|
1093
|
-
}
|
|
1094
|
-
setShowPanel(!0), updateState(drawingParams[0]);
|
|
1095
|
-
}), mutationListener = commandService.onCommandExecuted(async (command) => {
|
|
1096
|
-
command.id === RichTextEditingMutation.id && updateFocusDrawingState();
|
|
1097
|
-
});
|
|
1098
|
-
return () => {
|
|
1099
|
-
subscription.unsubscribe(), mutationListener.dispose();
|
|
1100
|
-
};
|
|
1101
|
-
}, []), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelGrid, styles.imageCommonPanelBorder), style: { display: showPanel ? "block" : "none" } }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.title")))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSubtitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.wrappingStyle")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelRow) }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn) }, /* @__PURE__ */ React.createElement(RadioGroup, { value: wrappingStyle, onChange: handleWrappingStyleChange, direction: "vertical" }, /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.INLINE }, localeService.t("image-text-wrap.inline")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.WRAP_SQUARE }, localeService.t("image-text-wrap.square")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.WRAP_TOP_AND_BOTTOM }, localeService.t("image-text-wrap.topAndBottom")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.BEHIND_TEXT }, localeService.t("image-text-wrap.behindText")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.IN_FRONT_OF_TEXT }, localeService.t("image-text-wrap.inFrontText"))))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSubtitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.wrapText")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelRow) }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn) }, /* @__PURE__ */ React.createElement(RadioGroup, { disabled: disableWrapText, value: wrapText, onChange: handleWrapTextChange, direction: "horizontal" }, /* @__PURE__ */ React.createElement(Radio, { value: WrapTextType.BOTH_SIDES }, localeService.t("image-text-wrap.bothSide")), /* @__PURE__ */ React.createElement(Radio, { value: WrapTextType.LEFT }, localeService.t("image-text-wrap.leftOnly")), /* @__PURE__ */ React.createElement(Radio, { value: WrapTextType.RIGHT }, localeService.t("image-text-wrap.rightOnly"))))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSubtitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.distanceFromText")))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.top"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1102
|
-
InputNumber,
|
|
1103
|
-
{
|
|
1104
|
-
min: MIN_MARGIN,
|
|
1105
|
-
max: MAX_MARGIN,
|
|
1106
|
-
disabled: disableDistTB,
|
|
1107
|
-
precision: 1,
|
|
1108
|
-
value: distToText.distT,
|
|
1109
|
-
onChange: /* @__PURE__ */ __name((val) => {
|
|
1110
|
-
handleDistToTextChange(val, "distT");
|
|
1111
|
-
}, "onChange"),
|
|
1112
|
-
className: styles.imageCommonPanelInput
|
|
1113
|
-
}
|
|
1114
|
-
))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.left"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1115
|
-
InputNumber,
|
|
1116
|
-
{
|
|
1117
|
-
min: MIN_MARGIN,
|
|
1118
|
-
max: MAX_MARGIN,
|
|
1119
|
-
disabled: disableDistLR,
|
|
1120
|
-
precision: 1,
|
|
1121
|
-
value: distToText.distL,
|
|
1122
|
-
onChange: /* @__PURE__ */ __name((val) => {
|
|
1123
|
-
handleDistToTextChange(val, "distL");
|
|
1124
|
-
}, "onChange"),
|
|
1125
|
-
className: styles.imageCommonPanelInput
|
|
1126
|
-
}
|
|
1127
|
-
)))))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.bottom"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1128
|
-
InputNumber,
|
|
1129
|
-
{
|
|
1130
|
-
min: MIN_MARGIN,
|
|
1131
|
-
max: MAX_MARGIN,
|
|
1132
|
-
disabled: disableDistTB,
|
|
1133
|
-
precision: 1,
|
|
1134
|
-
value: distToText.distB,
|
|
1135
|
-
onChange: /* @__PURE__ */ __name((val) => {
|
|
1136
|
-
handleDistToTextChange(val, "distB");
|
|
1137
|
-
}, "onChange"),
|
|
1138
|
-
className: styles.imageCommonPanelInput
|
|
1139
|
-
}
|
|
1140
|
-
))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.right"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1141
|
-
InputNumber,
|
|
1142
|
-
{
|
|
1143
|
-
min: MIN_MARGIN,
|
|
1144
|
-
max: MAX_MARGIN,
|
|
1145
|
-
disabled: disableDistLR,
|
|
1146
|
-
precision: 1,
|
|
1147
|
-
value: distToText.distR,
|
|
1148
|
-
onChange: /* @__PURE__ */ __name((val) => {
|
|
1149
|
-
handleDistToTextChange(val, "distR");
|
|
1150
|
-
}, "onChange"),
|
|
1151
|
-
className: styles.imageCommonPanelInput
|
|
1152
|
-
}
|
|
1153
|
-
)))))));
|
|
1154
|
-
}, "DocDrawingTextWrap"), MIN_OFFSET = -1e3, MAX_OFFSET = 1e3, DocDrawingPosition = /* @__PURE__ */ __name((props) => {
|
|
934
|
+
const imageCommonPanel = "univer-image-common-panel", imageCommonPanelGrid = "univer-image-common-panel-grid", imageCommonPanelBorder = "univer-image-common-panel-border", imageCommonPanelTitle = "univer-image-common-panel-title", imageCommonPanelSubtitle = "univer-image-common-panel-subtitle", imageCommonPanelRow = "univer-image-common-panel-row", imageCommonPanelRowVertical = "univer-image-common-panel-row-vertical", imageCommonPanelColumn = "univer-image-common-panel-column", imageCommonPanelColumnCenter = "univer-image-common-panel-column-center", imageCommonPanelInline = "univer-image-common-panel-inline", imageCommonPanelSpan2 = "univer-image-common-panel-span2", imageCommonPanelSpan3 = "univer-image-common-panel-span3", imageCommonPanelInput = "univer-image-common-panel-input", sheetImageMenu = "univer-sheet-image-menu", sheetImageMenuInput = "univer-sheet-image-menu-input", styles = {
|
|
935
|
+
imageCommonPanel,
|
|
936
|
+
imageCommonPanelGrid,
|
|
937
|
+
imageCommonPanelBorder,
|
|
938
|
+
imageCommonPanelTitle,
|
|
939
|
+
imageCommonPanelSubtitle,
|
|
940
|
+
imageCommonPanelRow,
|
|
941
|
+
imageCommonPanelRowVertical,
|
|
942
|
+
imageCommonPanelColumn,
|
|
943
|
+
imageCommonPanelColumnCenter,
|
|
944
|
+
imageCommonPanelInline,
|
|
945
|
+
imageCommonPanelSpan2,
|
|
946
|
+
imageCommonPanelSpan3,
|
|
947
|
+
imageCommonPanelInput,
|
|
948
|
+
sheetImageMenu,
|
|
949
|
+
sheetImageMenuInput
|
|
950
|
+
}, MIN_OFFSET = -1e3, MAX_OFFSET = 1e3, DocDrawingPosition = /* @__PURE__ */ __name((props) => {
|
|
1155
951
|
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), univerInstanceService = useDependency(IUniverInstanceService), { drawings } = props, drawingParam = drawings[0];
|
|
1156
952
|
if (drawingParam == null)
|
|
1157
953
|
return;
|
|
1158
|
-
const { unitId } = drawingParam, documentDataModel = univerInstanceService.getUniverDocInstance(unitId), renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
954
|
+
const { unitId } = drawingParam, documentDataModel = univerInstanceService.getUniverDocInstance(unitId), documentFlavor = documentDataModel == null ? void 0 : documentDataModel.getSnapshot().documentStyle.documentFlavor, renderObject = renderManagerService.getRenderById(unitId), scene = renderObject == null ? void 0 : renderObject.scene;
|
|
1159
955
|
if (scene == null)
|
|
1160
956
|
return;
|
|
1161
957
|
const transformer = scene.getTransformerByCreate(), HORIZONTAL_RELATIVE_FROM = [{
|
|
@@ -1169,13 +965,16 @@ const MIN_MARGIN = 0, MAX_MARGIN = 100, DocDrawingTextWrap = /* @__PURE__ */ __n
|
|
|
1169
965
|
value: String(ObjectRelativeFromH.MARGIN)
|
|
1170
966
|
}], VERTICAL_RELATIVE_FROM = [{
|
|
1171
967
|
label: localeService.t("image-position.line"),
|
|
1172
|
-
value: String(ObjectRelativeFromV.LINE)
|
|
968
|
+
value: String(ObjectRelativeFromV.LINE),
|
|
969
|
+
disabled: documentFlavor === DocumentFlavor.MODERN
|
|
1173
970
|
}, {
|
|
1174
971
|
label: localeService.t("image-position.page"),
|
|
1175
|
-
value: String(ObjectRelativeFromV.PAGE)
|
|
972
|
+
value: String(ObjectRelativeFromV.PAGE),
|
|
973
|
+
disabled: documentFlavor === DocumentFlavor.MODERN
|
|
1176
974
|
}, {
|
|
1177
975
|
label: localeService.t("image-position.margin"),
|
|
1178
|
-
value: String(ObjectRelativeFromV.MARGIN)
|
|
976
|
+
value: String(ObjectRelativeFromV.MARGIN),
|
|
977
|
+
disabled: documentFlavor === DocumentFlavor.MODERN
|
|
1179
978
|
}, {
|
|
1180
979
|
label: localeService.t("image-position.paragraph"),
|
|
1181
980
|
value: String(ObjectRelativeFromV.PARAGRAPH)
|
|
@@ -1358,7 +1157,187 @@ const MIN_MARGIN = 0, MAX_MARGIN = 100, DocDrawingTextWrap = /* @__PURE__ */ __n
|
|
|
1358
1157
|
onChange: handleVerticalRelativeFromChange
|
|
1359
1158
|
}
|
|
1360
1159
|
)))))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSubtitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-position.options")))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow, style: { marginBottom: "50px" } }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(Checkbox, { disabled, checked: followTextMove, onChange: handleFollowTextMoveCheck }, localeService.t("image-position.moveObjectWithText")))));
|
|
1361
|
-
}, "DocDrawingPosition"),
|
|
1160
|
+
}, "DocDrawingPosition"), MIN_MARGIN = 0, MAX_MARGIN = 100, DocDrawingTextWrap = /* @__PURE__ */ __name((props) => {
|
|
1161
|
+
const commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), drawingManagerService = useDependency(IDrawingManagerService), renderManagerService = useDependency(IRenderManagerService), univerInstanceService = useDependency(IUniverInstanceService), { drawings } = props, drawingParam = drawings[0];
|
|
1162
|
+
if (drawingParam == null)
|
|
1163
|
+
return null;
|
|
1164
|
+
const { unitId } = drawingParam, documentDataModel = univerInstanceService.getUniverDocInstance(unitId), renderObject = renderManagerService.getRenderById(unitId);
|
|
1165
|
+
if ((renderObject == null ? void 0 : renderObject.scene) == null)
|
|
1166
|
+
return null;
|
|
1167
|
+
const [disableWrapText, setDisableWrapText] = useState(!0), [disableDistTB, setDisableDistTB] = useState(!0), [disableDistLR, setDisableDistLR] = useState(!0), [wrappingStyle, setWrappingStyle] = useState(TextWrappingStyle.INLINE), [wrapText, setWrapText] = useState(""), [distToText, setDistToText] = useState({
|
|
1168
|
+
distT: 0,
|
|
1169
|
+
distL: 0,
|
|
1170
|
+
distB: 0,
|
|
1171
|
+
distR: 0
|
|
1172
|
+
}), [showPanel, setShowPanel] = useState(!0);
|
|
1173
|
+
function handleWrappingStyleChange(value) {
|
|
1174
|
+
setWrappingStyle(value);
|
|
1175
|
+
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1176
|
+
if (focusDrawings.length === 0)
|
|
1177
|
+
return;
|
|
1178
|
+
const { unitId: unitId2, subUnitId } = focusDrawings[0], drawings2 = focusDrawings.map(({ unitId: unitId3, subUnitId: subUnitId2, drawingId }) => ({
|
|
1179
|
+
unitId: unitId3,
|
|
1180
|
+
subUnitId: subUnitId2,
|
|
1181
|
+
drawingId
|
|
1182
|
+
}));
|
|
1183
|
+
commandService.executeCommand(UpdateDocDrawingWrappingStyleCommand.id, {
|
|
1184
|
+
unitId: unitId2,
|
|
1185
|
+
subUnitId,
|
|
1186
|
+
drawings: drawings2,
|
|
1187
|
+
wrappingStyle: value
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
__name(handleWrappingStyleChange, "handleWrappingStyleChange");
|
|
1191
|
+
function handleWrapTextChange(value) {
|
|
1192
|
+
setWrapText(value);
|
|
1193
|
+
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1194
|
+
if (focusDrawings.length === 0)
|
|
1195
|
+
return;
|
|
1196
|
+
const drawings2 = focusDrawings.map((drawing) => ({
|
|
1197
|
+
unitId: drawing.unitId,
|
|
1198
|
+
subUnitId: drawing.subUnitId,
|
|
1199
|
+
drawingId: drawing.drawingId
|
|
1200
|
+
}));
|
|
1201
|
+
commandService.executeCommand(UpdateDocDrawingWrapTextCommand.id, {
|
|
1202
|
+
unitId: focusDrawings[0].unitId,
|
|
1203
|
+
subUnitId: focusDrawings[0].unitId,
|
|
1204
|
+
drawings: drawings2,
|
|
1205
|
+
wrapText: value
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
__name(handleWrapTextChange, "handleWrapTextChange");
|
|
1209
|
+
function handleDistToTextChange(value, direction) {
|
|
1210
|
+
if (value == null)
|
|
1211
|
+
return;
|
|
1212
|
+
const newDistToText = { ...distToText, [direction]: value };
|
|
1213
|
+
setDistToText(newDistToText);
|
|
1214
|
+
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1215
|
+
if (focusDrawings.length === 0)
|
|
1216
|
+
return;
|
|
1217
|
+
const drawings2 = focusDrawings.map((drawing) => ({
|
|
1218
|
+
unitId: drawing.unitId,
|
|
1219
|
+
subUnitId: drawing.subUnitId,
|
|
1220
|
+
drawingId: drawing.drawingId
|
|
1221
|
+
}));
|
|
1222
|
+
commandService.executeCommand(UpdateDocDrawingDistanceCommand.id, {
|
|
1223
|
+
unitId: focusDrawings[0].unitId,
|
|
1224
|
+
subUnitId: focusDrawings[0].unitId,
|
|
1225
|
+
drawings: drawings2,
|
|
1226
|
+
dist: {
|
|
1227
|
+
[direction]: value
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
__name(handleDistToTextChange, "handleDistToTextChange");
|
|
1232
|
+
function updateFocusDrawingState() {
|
|
1233
|
+
const focusDrawings = drawingManagerService.getFocusDrawings();
|
|
1234
|
+
focusDrawings.length !== 0 && updateState(focusDrawings[0]);
|
|
1235
|
+
}
|
|
1236
|
+
__name(updateFocusDrawingState, "updateFocusDrawingState");
|
|
1237
|
+
function updateState(drawingParam2) {
|
|
1238
|
+
var _a8, _b;
|
|
1239
|
+
const drawing = (_b = (_a8 = documentDataModel == null ? void 0 : documentDataModel.getSnapshot()) == null ? void 0 : _a8.drawings) == null ? void 0 : _b[drawingParam2.drawingId];
|
|
1240
|
+
if (drawing == null)
|
|
1241
|
+
return;
|
|
1242
|
+
const {
|
|
1243
|
+
distT = 0,
|
|
1244
|
+
distL = 0,
|
|
1245
|
+
distB = 0,
|
|
1246
|
+
distR = 0,
|
|
1247
|
+
layoutType = PositionedObjectLayoutType.INLINE,
|
|
1248
|
+
behindDoc = BooleanNumber.FALSE,
|
|
1249
|
+
wrapText: wrapText2 = WrapTextType.BOTH_SIDES
|
|
1250
|
+
} = drawing;
|
|
1251
|
+
if (setDistToText({
|
|
1252
|
+
distT,
|
|
1253
|
+
distL,
|
|
1254
|
+
distB,
|
|
1255
|
+
distR
|
|
1256
|
+
}), setWrapText(wrapText2), setDisableWrapText(layoutType !== PositionedObjectLayoutType.WRAP_SQUARE), layoutType === PositionedObjectLayoutType.WRAP_NONE || layoutType === PositionedObjectLayoutType.INLINE ? setDisableDistTB(!0) : setDisableDistTB(!1), layoutType === PositionedObjectLayoutType.WRAP_NONE || layoutType === PositionedObjectLayoutType.INLINE || layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM ? setDisableDistLR(!0) : setDisableDistLR(!1), layoutType === PositionedObjectLayoutType.WRAP_NONE)
|
|
1257
|
+
behindDoc === BooleanNumber.TRUE ? setWrappingStyle(TextWrappingStyle.BEHIND_TEXT) : setWrappingStyle(TextWrappingStyle.IN_FRONT_OF_TEXT);
|
|
1258
|
+
else
|
|
1259
|
+
switch (layoutType) {
|
|
1260
|
+
case PositionedObjectLayoutType.INLINE:
|
|
1261
|
+
setWrappingStyle(TextWrappingStyle.INLINE);
|
|
1262
|
+
break;
|
|
1263
|
+
case PositionedObjectLayoutType.WRAP_SQUARE:
|
|
1264
|
+
setWrappingStyle(TextWrappingStyle.WRAP_SQUARE);
|
|
1265
|
+
break;
|
|
1266
|
+
case PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM:
|
|
1267
|
+
setWrappingStyle(TextWrappingStyle.WRAP_TOP_AND_BOTTOM);
|
|
1268
|
+
break;
|
|
1269
|
+
default:
|
|
1270
|
+
throw new Error(`Unsupported layout type: ${layoutType}`);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return __name(updateState, "updateState"), useEffect(() => {
|
|
1274
|
+
updateFocusDrawingState();
|
|
1275
|
+
const subscription = drawingManagerService.focus$.subscribe((drawingParams) => {
|
|
1276
|
+
if (drawingParams.length === 0) {
|
|
1277
|
+
setShowPanel(!1);
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1280
|
+
setShowPanel(!0), updateState(drawingParams[0]);
|
|
1281
|
+
}), mutationListener = commandService.onCommandExecuted(async (command) => {
|
|
1282
|
+
command.id === RichTextEditingMutation.id && updateFocusDrawingState();
|
|
1283
|
+
});
|
|
1284
|
+
return () => {
|
|
1285
|
+
subscription.unsubscribe(), mutationListener.dispose();
|
|
1286
|
+
};
|
|
1287
|
+
}, []), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelGrid, styles.imageCommonPanelBorder), style: { display: showPanel ? "block" : "none" } }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelTitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.title")))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSubtitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.wrappingStyle")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelRow) }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn) }, /* @__PURE__ */ React.createElement(RadioGroup, { value: wrappingStyle, onChange: handleWrappingStyleChange, direction: "vertical" }, /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.INLINE }, localeService.t("image-text-wrap.inline")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.WRAP_SQUARE }, localeService.t("image-text-wrap.square")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.WRAP_TOP_AND_BOTTOM }, localeService.t("image-text-wrap.topAndBottom")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.BEHIND_TEXT }, localeService.t("image-text-wrap.behindText")), /* @__PURE__ */ React.createElement(Radio, { value: TextWrappingStyle.IN_FRONT_OF_TEXT }, localeService.t("image-text-wrap.inFrontText"))))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSubtitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.wrapText")))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelRow) }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn) }, /* @__PURE__ */ React.createElement(RadioGroup, { disabled: disableWrapText, value: wrapText, onChange: handleWrapTextChange, direction: "horizontal" }, /* @__PURE__ */ React.createElement(Radio, { value: WrapTextType.BOTH_SIDES }, localeService.t("image-text-wrap.bothSide")), /* @__PURE__ */ React.createElement(Radio, { value: WrapTextType.LEFT }, localeService.t("image-text-wrap.leftOnly")), /* @__PURE__ */ React.createElement(Radio, { value: WrapTextType.RIGHT }, localeService.t("image-text-wrap.rightOnly"))))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSubtitle) }, /* @__PURE__ */ React.createElement("div", null, localeService.t("image-text-wrap.distanceFromText")))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.top"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1288
|
+
InputNumber,
|
|
1289
|
+
{
|
|
1290
|
+
min: MIN_MARGIN,
|
|
1291
|
+
max: MAX_MARGIN,
|
|
1292
|
+
disabled: disableDistTB,
|
|
1293
|
+
precision: 1,
|
|
1294
|
+
value: distToText.distT,
|
|
1295
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
1296
|
+
handleDistToTextChange(val, "distT");
|
|
1297
|
+
}, "onChange"),
|
|
1298
|
+
className: styles.imageCommonPanelInput
|
|
1299
|
+
}
|
|
1300
|
+
))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.left"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1301
|
+
InputNumber,
|
|
1302
|
+
{
|
|
1303
|
+
min: MIN_MARGIN,
|
|
1304
|
+
max: MAX_MARGIN,
|
|
1305
|
+
disabled: disableDistLR,
|
|
1306
|
+
precision: 1,
|
|
1307
|
+
value: distToText.distL,
|
|
1308
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
1309
|
+
handleDistToTextChange(val, "distL");
|
|
1310
|
+
}, "onChange"),
|
|
1311
|
+
className: styles.imageCommonPanelInput
|
|
1312
|
+
}
|
|
1313
|
+
)))))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.bottom"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1314
|
+
InputNumber,
|
|
1315
|
+
{
|
|
1316
|
+
min: MIN_MARGIN,
|
|
1317
|
+
max: MAX_MARGIN,
|
|
1318
|
+
disabled: disableDistTB,
|
|
1319
|
+
precision: 1,
|
|
1320
|
+
value: distToText.distB,
|
|
1321
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
1322
|
+
handleDistToTextChange(val, "distB");
|
|
1323
|
+
}, "onChange"),
|
|
1324
|
+
className: styles.imageCommonPanelInput
|
|
1325
|
+
}
|
|
1326
|
+
))))), /* @__PURE__ */ React.createElement("div", { className: clsx(styles.imageCommonPanelColumn, styles.imageCommonPanelSpan2) }, /* @__PURE__ */ React.createElement("label", null, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, localeService.t("image-text-wrap.right"))), /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelRow }, /* @__PURE__ */ React.createElement("div", { className: styles.imageCommonPanelColumn }, /* @__PURE__ */ React.createElement(
|
|
1327
|
+
InputNumber,
|
|
1328
|
+
{
|
|
1329
|
+
min: MIN_MARGIN,
|
|
1330
|
+
max: MAX_MARGIN,
|
|
1331
|
+
disabled: disableDistLR,
|
|
1332
|
+
precision: 1,
|
|
1333
|
+
value: distToText.distR,
|
|
1334
|
+
onChange: /* @__PURE__ */ __name((val) => {
|
|
1335
|
+
handleDistToTextChange(val, "distR");
|
|
1336
|
+
}, "onChange"),
|
|
1337
|
+
className: styles.imageCommonPanelInput
|
|
1338
|
+
}
|
|
1339
|
+
)))))));
|
|
1340
|
+
}, "DocDrawingTextWrap"), DocDrawingPanel = /* @__PURE__ */ __name(() => {
|
|
1362
1341
|
const drawingManagerService = useDependency(IDrawingManagerService), focusDrawings = drawingManagerService.getFocusDrawings(), [drawings, setDrawings] = useState(focusDrawings);
|
|
1363
1342
|
return useEffect(() => {
|
|
1364
1343
|
const focusDispose = drawingManagerService.focus$.subscribe((drawings2) => {
|
|
@@ -2376,7 +2355,7 @@ let DocDrawingTransformUpdateController = (_a6 = class extends Disposable {
|
|
|
2376
2355
|
this._calculateDrawingPosition(unitId, page, docsLeft, docsTop, updateDrawingMap, page.marginTop, page.marginLeft), this._liquid.translatePage(page, pageLayoutType, pageMarginLeft, pageMarginTop);
|
|
2377
2356
|
}
|
|
2378
2357
|
const updateDrawings = Object.values(updateDrawingMap), nonMultiDrawings = updateDrawings.filter((drawing) => !drawing.isMultiTransform), multiDrawings = updateDrawings.filter((drawing) => drawing.isMultiTransform);
|
|
2379
|
-
nonMultiDrawings.length > 0 && this._drawingManagerService.refreshTransform(nonMultiDrawings),
|
|
2358
|
+
nonMultiDrawings.length > 0 && this._drawingManagerService.refreshTransform(nonMultiDrawings), this._handleMultiDrawingsTransform(multiDrawings);
|
|
2380
2359
|
}
|
|
2381
2360
|
_handleMultiDrawingsTransform(multiDrawings) {
|
|
2382
2361
|
const { scene, unitId } = this._context, transformer = scene.getTransformerByCreate();
|
|
@@ -2385,7 +2364,7 @@ let DocDrawingTransformUpdateController = (_a6 = class extends Disposable {
|
|
|
2385
2364
|
param != null && (param.transform = updateParam.transform, param.transforms = updateParam.transforms, param.isMultiTransform = updateParam.isMultiTransform);
|
|
2386
2365
|
});
|
|
2387
2366
|
const selectedObjectKeys = [...transformer.getSelectedObjectMap().keys()], allMultiDrawings = Object.values(this._drawingManagerService.getDrawingData(unitId, unitId)).filter((drawing) => drawing.isMultiTransform === BooleanNumber.TRUE);
|
|
2388
|
-
this._drawingManagerService.removeNotification(allMultiDrawings), this._drawingManagerService.addNotification(multiDrawings);
|
|
2367
|
+
this._drawingManagerService.removeNotification(allMultiDrawings), multiDrawings.length > 0 && this._drawingManagerService.addNotification(multiDrawings);
|
|
2389
2368
|
for (const key of selectedObjectKeys) {
|
|
2390
2369
|
const drawingShape = scene.getObject(key);
|
|
2391
2370
|
drawingShape && transformer.setSelectedControl(drawingShape);
|
package/lib/types/controllers/render-controllers/doc-drawing-transform-update.controller.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Disposable, ICommandService, IUniverInstanceService, LifecycleService
|
|
1
|
+
import { DocumentDataModel, Disposable, ICommandService, IUniverInstanceService, LifecycleService } from '@univerjs/core';
|
|
2
|
+
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
2
3
|
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
3
4
|
import { IEditorService } from '@univerjs/docs-ui';
|
|
4
5
|
import { IDrawingManagerService } from '@univerjs/drawing';
|
|
5
|
-
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
6
6
|
import { DocRefreshDrawingsService } from '../../services/doc-refresh-drawings.service';
|
|
7
7
|
export declare class DocDrawingTransformUpdateController extends Disposable implements IRenderModule {
|
|
8
8
|
private readonly _context;
|