@univerjs/docs-drawing-ui 0.5.5-nightly.202501211606 → 0.5.5
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/LICENSE +176 -0
- package/lib/es/index.js +1744 -1774
- package/lib/es/locale/en-US.js +2 -2
- package/lib/es/locale/fa-IR.js +2 -2
- package/lib/es/locale/fr-FR.js +2 -2
- package/lib/es/locale/ru-RU.js +2 -2
- package/lib/es/locale/vi-VN.js +2 -2
- package/lib/es/locale/zh-CN.js +2 -2
- package/lib/es/locale/zh-TW.js +2 -2
- package/package.json +10 -10
package/lib/es/index.js
CHANGED
|
@@ -1,610 +1,601 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (JSONX.isNoop(actions) || !Array.isArray(actions))
|
|
1
|
+
var Pt = Object.defineProperty;
|
|
2
|
+
var Tt = (i, e, n) => e in i ? Pt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var Se = (i, e, n) => Tt(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { Disposable as Xe, UndoCommand as yt, RedoCommand as bt, IUniverInstanceService as J, ICommandService as z, JSONX as q, PositionedObjectLayoutType as k, CommandType as X, BooleanNumber as re, ObjectRelativeFromH as ee, ObjectRelativeFromV as G, Tools as Pe, TextX as In, TextXActionType as Y, toDisposable as Ae, throttle as xn, COLORS as Mt, MemoryCursor as Rt, IUndoRedoService as $n, BuildTextUtils as Nt, ArrangeTypeEnum as Je, Inject as we, LocaleService as ln, DrawingTypeEnum as Et, WrapTextType as $e, FOCUSING_COMMON_DRAWINGS as tn, IContextService as zn, UniverInstanceType as Te, Direction as ue, useDependency as pe, DocumentFlavor as fn, FOCUSING_UNIVER_EDITOR as At, RxDisposable as jt, SHEET_EDITOR_UNITS as Lt, LifecycleService as Bt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as Ut, fromEventSubject as Ft, LifecycleStages as Pn, DependentOn as kt, Injector as Ht, Plugin as Wt, merge as Gt, IConfigService as Vt } from "@univerjs/core";
|
|
5
|
+
import { IDocDrawingService as je, UniverDocsDrawingPlugin as $t } from "@univerjs/docs-drawing";
|
|
6
|
+
import { IDrawingManagerService as ve, DRAWING_IMAGE_ALLOW_IMAGE_LIST as zt, DRAWING_IMAGE_COUNT_LIMIT as Tn, ImageUploadStatusType as hn, DRAWING_IMAGE_ALLOW_SIZE as qt, getImageSize as Xt, getDrawingShapeKeyByDrawingSearch as Kt, IImageIoService as Yt, DRAWING_IMAGE_WIDTH_LIMIT as yn, DRAWING_IMAGE_HEIGHT_LIMIT as bn, UniverDrawingPlugin as Jt } from "@univerjs/drawing";
|
|
7
|
+
import { DrawingCommonPanel as Zt, ImageCropperObject as Qt, COMPONENT_IMAGE_POPUP_MENU as ei, OpenImageCropOperation as ni, ImageResetSizeOperation as ti, UniverDrawingUIPlugin as ii } from "@univerjs/drawing-ui";
|
|
8
|
+
import { IRenderManagerService as Q, DocumentEditArea as Ue, Liquid as qn, PageLayoutType as Mn, DocumentSkeletonPageType as Rn, Vector2 as ri, Rect as oi, getColor as si, TRANSFORM_CHANGE_OBSERVABLE_TYPE as ai } from "@univerjs/engine-render";
|
|
9
|
+
import { IMessageService as ci, ILocalFileService as di, ISidebarService as li, MenuItemType as Xn, getMenuHiddenObservable as Kn, RibbonStartGroup as gi, KeyCode as Fe, ComponentManager as mi, IMenuManagerService as ui, IShortcutService as fi, UniverUIPlugin as hi } from "@univerjs/ui";
|
|
10
|
+
import { RichTextEditingMutation as Z, DocSkeletonManagerService as oe, DocSelectionManagerService as _n } from "@univerjs/docs";
|
|
11
|
+
import { DocSelectionRenderService as ye, getRichTextEditPath as ze, NodePositionConvertToCursor as Nn, getOneTextSelectionRange as En, getAnchorBounding as pi, TEXT_RANGE_LAYER_INDEX as wi, getDocObject as vi, getCustomBlockIdsInSelections as Ii, docDrawingPositionToTransform as _i, DocCanvasPopManagerService as Si, IEditorService as Ci, SetDocZoomRatioOperation as Di } from "@univerjs/docs-ui";
|
|
12
|
+
import { BehaviorSubject as Oi, debounceTime as Yn, Observable as xi, takeUntil as An, filter as jn } from "rxjs";
|
|
13
|
+
import { MessageType as Ln, InputNumber as Be, Select as Bn, Checkbox as Pi, RadioGroup as Un, Radio as xe } from "@univerjs/design";
|
|
14
|
+
import Ti, { forwardRef as Jn, useRef as yi, createElement as Zn, useState as ie, useEffect as Sn } from "react";
|
|
15
|
+
const bi = "docs-drawing-ui.config", Fn = {};
|
|
16
|
+
var Mi = Object.defineProperty, Ri = Object.getOwnPropertyDescriptor, Ni = (i, e, n, t) => {
|
|
17
|
+
for (var r = t > 1 ? void 0 : t ? Ri(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
18
|
+
(s = i[o]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
19
|
+
return t && r && Mi(e, n, r), r;
|
|
20
|
+
}, We = (i, e) => (n, t) => e(n, t, i);
|
|
21
|
+
function Ei(i) {
|
|
22
|
+
var t, r, o, s;
|
|
23
|
+
if (q.isNoop(i) || !Array.isArray(i))
|
|
25
24
|
return null;
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
25
|
+
const e = i.find((a) => Array.isArray(a) && (a == null ? void 0 : a[0]) === "drawings");
|
|
26
|
+
if (e == null || !Array.isArray(e) || e.length < 3 || typeof e[1] == "string" && typeof e[2] != "object" || Array.isArray(e[1]) && typeof e[1][1] != "object")
|
|
28
27
|
return null;
|
|
29
|
-
const
|
|
30
|
-
if (Array.isArray(
|
|
31
|
-
for (const
|
|
32
|
-
Array.isArray(
|
|
33
|
-
type: (
|
|
34
|
-
drawingId:
|
|
35
|
-
drawing: (
|
|
28
|
+
const n = [];
|
|
29
|
+
if (Array.isArray(e == null ? void 0 : e[1]))
|
|
30
|
+
for (const a of e)
|
|
31
|
+
Array.isArray(a) && n.push({
|
|
32
|
+
type: (t = a == null ? void 0 : a[1]) != null && t.i ? "add" : "remove",
|
|
33
|
+
drawingId: a == null ? void 0 : a[0],
|
|
34
|
+
drawing: (r = a == null ? void 0 : a[1]) == null ? void 0 : r.i
|
|
36
35
|
});
|
|
37
36
|
else
|
|
38
|
-
|
|
39
|
-
type: (
|
|
40
|
-
drawingId:
|
|
41
|
-
drawing: (
|
|
37
|
+
n.push({
|
|
38
|
+
type: (o = e[2]) != null && o.i ? "add" : "remove",
|
|
39
|
+
drawingId: e[1],
|
|
40
|
+
drawing: (s = e[2]) == null ? void 0 : s.i
|
|
42
41
|
});
|
|
43
|
-
return
|
|
42
|
+
return n;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!Array.isArray(actions) || actions.length < 3 || actions[0] !== "drawingsOrder")
|
|
44
|
+
function Ai(i) {
|
|
45
|
+
if (!Array.isArray(i) || i.length < 3 || i[0] !== "drawingsOrder")
|
|
48
46
|
return [];
|
|
49
|
-
const
|
|
50
|
-
for (let
|
|
51
|
-
const
|
|
52
|
-
if (Array.isArray(
|
|
53
|
-
|
|
47
|
+
const e = [];
|
|
48
|
+
for (let n = 1; n < i.length; n++) {
|
|
49
|
+
const t = i[n];
|
|
50
|
+
if (Array.isArray(t) && typeof t[0] == "number" && typeof t[1] == "object")
|
|
51
|
+
e.push(t[0]);
|
|
54
52
|
else {
|
|
55
|
-
|
|
53
|
+
e.length = 0;
|
|
56
54
|
break;
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
|
-
return
|
|
57
|
+
return e;
|
|
60
58
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
constructor(_univerInstanceService, _commandService, _drawingManagerService, _docDrawingService, _renderManagerService) {
|
|
65
|
-
super(), this._univerInstanceService = _univerInstanceService, this._commandService = _commandService, this._drawingManagerService = _drawingManagerService, this._docDrawingService = _docDrawingService, this._renderManagerService = _renderManagerService, this._initialize();
|
|
59
|
+
let rn = class extends Xe {
|
|
60
|
+
constructor(i, e, n, t, r) {
|
|
61
|
+
super(), this._univerInstanceService = i, this._commandService = e, this._drawingManagerService = n, this._docDrawingService = t, this._renderManagerService = r, this._initialize();
|
|
66
62
|
}
|
|
67
63
|
_initialize() {
|
|
68
64
|
this._commandExecutedListener();
|
|
69
65
|
}
|
|
70
66
|
_commandExecutedListener() {
|
|
71
67
|
this.disposeWithMe(
|
|
72
|
-
this._commandService.beforeCommandExecuted((
|
|
73
|
-
if (
|
|
68
|
+
this._commandService.beforeCommandExecuted((i) => {
|
|
69
|
+
if (i.id !== Z.id)
|
|
74
70
|
return;
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
for (const { type, drawingId, drawing } of
|
|
78
|
-
|
|
71
|
+
const e = i.params, { unitId: n, actions: t } = e, r = Ei(t);
|
|
72
|
+
if (r != null)
|
|
73
|
+
for (const { type: o, drawingId: s, drawing: a } of r)
|
|
74
|
+
o === "add" ? this._addDrawings(n, [a]) : this._removeDrawings(n, [s]);
|
|
79
75
|
})
|
|
80
76
|
), this.disposeWithMe(
|
|
81
|
-
this._commandService.onCommandExecuted((
|
|
82
|
-
if (
|
|
77
|
+
this._commandService.onCommandExecuted((i) => {
|
|
78
|
+
if (i.id !== Z.id)
|
|
83
79
|
return;
|
|
84
|
-
const
|
|
85
|
-
|
|
80
|
+
const e = i.params, { unitId: n, actions: t } = e;
|
|
81
|
+
Ai(t).length > 0 && this._updateDrawingsOrder(n);
|
|
86
82
|
})
|
|
87
83
|
), this.disposeWithMe(
|
|
88
|
-
this._commandService.onCommandExecuted((
|
|
89
|
-
var
|
|
90
|
-
if (
|
|
84
|
+
this._commandService.onCommandExecuted((i) => {
|
|
85
|
+
var s;
|
|
86
|
+
if (i.id !== yt.id && i.id !== bt.id)
|
|
91
87
|
return;
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
88
|
+
const e = (s = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : s.getUnitId(), n = this._drawingManagerService.getFocusDrawings();
|
|
89
|
+
if (e == null || n.length === 0)
|
|
94
90
|
return;
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
91
|
+
const t = this._renderManagerService.getRenderById(e), r = t == null ? void 0 : t.scene;
|
|
92
|
+
if (r == null)
|
|
97
93
|
return !1;
|
|
98
|
-
|
|
94
|
+
r.getTransformerByCreate().refreshControls();
|
|
99
95
|
})
|
|
100
96
|
);
|
|
101
97
|
}
|
|
102
|
-
_addDrawings(
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
_removeDrawings(
|
|
107
|
-
const
|
|
108
|
-
unitId,
|
|
109
|
-
subUnitId:
|
|
110
|
-
drawingId
|
|
111
|
-
}))), { subUnitId, redo:
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
_updateDrawingsOrder(
|
|
115
|
-
const
|
|
116
|
-
if (
|
|
98
|
+
_addDrawings(i, e) {
|
|
99
|
+
const n = this._drawingManagerService, t = this._docDrawingService, r = this._docDrawingService.getBatchAddOp(e), { subUnitId: o, redo: s, objects: a } = r;
|
|
100
|
+
n.applyJson1(i, o, s), t.applyJson1(i, o, s), n.addNotification(a), t.addNotification(a);
|
|
101
|
+
}
|
|
102
|
+
_removeDrawings(i, e) {
|
|
103
|
+
const n = this._drawingManagerService, t = this._docDrawingService, r = this._docDrawingService.getBatchRemoveOp(e.map((d) => ({
|
|
104
|
+
unitId: i,
|
|
105
|
+
subUnitId: i,
|
|
106
|
+
drawingId: d
|
|
107
|
+
}))), { subUnitId: o, redo: s, objects: a } = r;
|
|
108
|
+
n.applyJson1(i, o, s), t.applyJson1(i, o, s), n.removeNotification(a), t.removeNotification(a);
|
|
109
|
+
}
|
|
110
|
+
_updateDrawingsOrder(i) {
|
|
111
|
+
const e = this._univerInstanceService.getUniverDocInstance(i);
|
|
112
|
+
if (e == null)
|
|
117
113
|
return;
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
114
|
+
const n = e.getSnapshot().drawingsOrder;
|
|
115
|
+
if (n == null)
|
|
120
116
|
return;
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
unitId,
|
|
125
|
-
subUnitId:
|
|
126
|
-
drawingIds:
|
|
117
|
+
const t = this._drawingManagerService, r = this._docDrawingService;
|
|
118
|
+
t.setDrawingOrder(i, i, n), r.setDrawingOrder(i, i, n);
|
|
119
|
+
const o = {
|
|
120
|
+
unitId: i,
|
|
121
|
+
subUnitId: i,
|
|
122
|
+
drawingIds: n
|
|
127
123
|
};
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
],
|
|
138
|
-
|
|
124
|
+
t.orderNotification(o), r.orderNotification(o);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
rn = Ni([
|
|
128
|
+
We(0, J),
|
|
129
|
+
We(1, z),
|
|
130
|
+
We(2, ve),
|
|
131
|
+
We(3, je),
|
|
132
|
+
We(4, Q)
|
|
133
|
+
], rn);
|
|
134
|
+
class gn {
|
|
139
135
|
constructor() {
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
Se(this, "_refreshDrawings$", new Oi(null));
|
|
137
|
+
Se(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
|
|
142
138
|
}
|
|
143
|
-
refreshDrawings(
|
|
144
|
-
this._refreshDrawings$.next(
|
|
139
|
+
refreshDrawings(e) {
|
|
140
|
+
this._refreshDrawings$.next(e);
|
|
145
141
|
}
|
|
142
|
+
}
|
|
143
|
+
var me = /* @__PURE__ */ ((i) => (i.INLINE = "inline", i.BEHIND_TEXT = "behindText", i.IN_FRONT_OF_TEXT = "inFrontOfText", i.WRAP_SQUARE = "wrapSquare", i.WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom", i))(me || {});
|
|
144
|
+
const ji = {
|
|
145
|
+
inline: k.INLINE,
|
|
146
|
+
wrapSquare: k.WRAP_SQUARE,
|
|
147
|
+
wrapTopAndBottom: k.WRAP_TOP_AND_BOTTOM,
|
|
148
|
+
inFrontOfText: k.WRAP_NONE,
|
|
149
|
+
behindText: k.WRAP_NONE
|
|
146
150
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
inline: PositionedObjectLayoutType.INLINE,
|
|
152
|
-
wrapSquare: PositionedObjectLayoutType.WRAP_SQUARE,
|
|
153
|
-
wrapTopAndBottom: PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM,
|
|
154
|
-
inFrontOfText: PositionedObjectLayoutType.WRAP_NONE,
|
|
155
|
-
behindText: PositionedObjectLayoutType.WRAP_NONE
|
|
156
|
-
};
|
|
157
|
-
function getDeleteAndInsertCustomBlockActions(segmentId, oldSegmentId, segmentPage, offset, drawingId, documentDataModel, docSelectionRenderManager) {
|
|
158
|
-
var _a8, _b;
|
|
159
|
-
const textX = new TextX(), jsonX = JSONX.getInstance(), rawActions = [], oldBody = documentDataModel.getSelfOrHeaderFooterModel(oldSegmentId).getBody(), body = documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();
|
|
160
|
-
if (oldBody == null || body == null)
|
|
151
|
+
function Qn(i, e, n, t, r, o, s) {
|
|
152
|
+
var p, h;
|
|
153
|
+
const a = new In(), d = q.getInstance(), c = [], l = o.getSelfOrHeaderFooterModel(e).getBody(), u = o.getSelfOrHeaderFooterModel(i).getBody();
|
|
154
|
+
if (l == null || u == null)
|
|
161
155
|
return;
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
if (
|
|
165
|
-
if (
|
|
166
|
-
t:
|
|
167
|
-
len:
|
|
168
|
-
}),
|
|
169
|
-
t:
|
|
156
|
+
const m = (h = (p = l.customBlocks) == null ? void 0 : p.find((v) => v.blockId === r)) == null ? void 0 : h.startIndex;
|
|
157
|
+
if (m != null) {
|
|
158
|
+
if (t = Math.min(u.dataStream.length - 2, t), i === e) {
|
|
159
|
+
if (t < m ? (t > 0 && a.push({
|
|
160
|
+
t: Y.RETAIN,
|
|
161
|
+
len: t
|
|
162
|
+
}), a.push({
|
|
163
|
+
t: Y.INSERT,
|
|
170
164
|
body: {
|
|
171
165
|
dataStream: "\b",
|
|
172
166
|
customBlocks: [{
|
|
173
167
|
startIndex: 0,
|
|
174
|
-
blockId:
|
|
168
|
+
blockId: r
|
|
175
169
|
}]
|
|
176
170
|
},
|
|
177
171
|
len: 1
|
|
178
|
-
}),
|
|
179
|
-
t:
|
|
180
|
-
len:
|
|
181
|
-
}),
|
|
182
|
-
t:
|
|
172
|
+
}), a.push({
|
|
173
|
+
t: Y.RETAIN,
|
|
174
|
+
len: m - t
|
|
175
|
+
}), a.push({
|
|
176
|
+
t: Y.DELETE,
|
|
183
177
|
len: 1
|
|
184
|
-
})) : (
|
|
185
|
-
t:
|
|
186
|
-
len:
|
|
187
|
-
}),
|
|
188
|
-
t:
|
|
178
|
+
})) : (m > 0 && a.push({
|
|
179
|
+
t: Y.RETAIN,
|
|
180
|
+
len: m
|
|
181
|
+
}), a.push({
|
|
182
|
+
t: Y.DELETE,
|
|
189
183
|
len: 1
|
|
190
|
-
}),
|
|
191
|
-
t:
|
|
192
|
-
len:
|
|
193
|
-
}),
|
|
194
|
-
t:
|
|
184
|
+
}), t - m - 1 > 0 && a.push({
|
|
185
|
+
t: Y.RETAIN,
|
|
186
|
+
len: t - m - 1
|
|
187
|
+
}), a.push({
|
|
188
|
+
t: Y.INSERT,
|
|
195
189
|
body: {
|
|
196
190
|
dataStream: "\b",
|
|
197
191
|
customBlocks: [{
|
|
198
192
|
startIndex: 0,
|
|
199
|
-
blockId:
|
|
193
|
+
blockId: r
|
|
200
194
|
}]
|
|
201
195
|
},
|
|
202
196
|
len: 1
|
|
203
|
-
})),
|
|
204
|
-
const
|
|
205
|
-
|
|
197
|
+
})), t !== m) {
|
|
198
|
+
const v = ze(o, e), w = d.editOp(a.serialize(), v);
|
|
199
|
+
c.push(w);
|
|
206
200
|
}
|
|
207
201
|
} else {
|
|
208
|
-
|
|
209
|
-
t:
|
|
210
|
-
len:
|
|
211
|
-
}),
|
|
212
|
-
t:
|
|
202
|
+
m > 0 && a.push({
|
|
203
|
+
t: Y.RETAIN,
|
|
204
|
+
len: m
|
|
205
|
+
}), a.push({
|
|
206
|
+
t: Y.DELETE,
|
|
213
207
|
len: 1
|
|
214
208
|
});
|
|
215
|
-
let
|
|
216
|
-
|
|
217
|
-
t:
|
|
218
|
-
len:
|
|
219
|
-
}),
|
|
220
|
-
t:
|
|
209
|
+
let v = ze(o, e), w = d.editOp(a.serialize(), v);
|
|
210
|
+
c.push(w), a.empty(), t > 0 && a.push({
|
|
211
|
+
t: Y.RETAIN,
|
|
212
|
+
len: t
|
|
213
|
+
}), a.push({
|
|
214
|
+
t: Y.INSERT,
|
|
221
215
|
body: {
|
|
222
216
|
dataStream: "\b",
|
|
223
217
|
customBlocks: [{
|
|
224
218
|
startIndex: 0,
|
|
225
|
-
blockId:
|
|
219
|
+
blockId: r
|
|
226
220
|
}]
|
|
227
221
|
},
|
|
228
222
|
len: 1
|
|
229
|
-
}),
|
|
223
|
+
}), v = ze(o, i), w = d.editOp(a.serialize(), v), c.push(w), s.setSegment(i), s.setSegmentPage(n);
|
|
230
224
|
}
|
|
231
|
-
return
|
|
225
|
+
return c;
|
|
232
226
|
}
|
|
233
227
|
}
|
|
234
|
-
|
|
235
|
-
const UpdateDocDrawingWrappingStyleCommand = {
|
|
228
|
+
const et = {
|
|
236
229
|
id: "doc.command.update-doc-drawing-wrapping-style",
|
|
237
|
-
type:
|
|
230
|
+
type: X.COMMAND,
|
|
238
231
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
239
|
-
handler:
|
|
240
|
-
var
|
|
241
|
-
if (
|
|
232
|
+
handler: (i, e) => {
|
|
233
|
+
var N, B;
|
|
234
|
+
if (e == null)
|
|
242
235
|
return !1;
|
|
243
|
-
const { drawings, wrappingStyle, unitId } =
|
|
244
|
-
if (
|
|
236
|
+
const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get(z), s = i.get(J), d = i.get(Q).getRenderById(r), c = d == null ? void 0 : d.with(oe).getSkeleton().getSkeletonData(), l = d == null ? void 0 : d.with(oe).getViewModel(), u = d == null ? void 0 : d.scene, m = s.getCurrentUniverDocInstance();
|
|
237
|
+
if (m == null || c == null || u == null || l == null)
|
|
245
238
|
return !1;
|
|
246
|
-
const
|
|
247
|
-
for (const
|
|
248
|
-
const { drawingId } =
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
|
|
239
|
+
const p = l.getEditArea(), h = u.getTransformerByCreate(), { pages: v, skeHeaders: w, skeFooters: S } = c, O = q.getInstance(), D = [], { drawings: x = {} } = m.getSnapshot();
|
|
240
|
+
for (const R of n) {
|
|
241
|
+
const { drawingId: I } = R, j = x[I].layoutType, H = ji[t];
|
|
242
|
+
if (j !== H) {
|
|
243
|
+
const C = O.replaceOp(["drawings", I, "layoutType"], j, H);
|
|
244
|
+
D.push(C);
|
|
252
245
|
}
|
|
253
|
-
if (
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
const
|
|
257
|
-
|
|
246
|
+
if (t === "behindText" || t === "inFrontOfText") {
|
|
247
|
+
const C = x[I].behindDoc, M = t === "behindText" ? re.TRUE : re.FALSE;
|
|
248
|
+
if (C !== M) {
|
|
249
|
+
const P = O.replaceOp(["drawings", I, "behindDoc"], C, M);
|
|
250
|
+
D.push(P);
|
|
258
251
|
}
|
|
259
252
|
}
|
|
260
|
-
if (
|
|
253
|
+
if (t === "inline")
|
|
261
254
|
continue;
|
|
262
|
-
let
|
|
263
|
-
for (const
|
|
264
|
-
const { headerId, footerId, marginTop, marginLeft, marginBottom, pageWidth, pageHeight } =
|
|
265
|
-
switch (
|
|
266
|
-
case
|
|
267
|
-
const
|
|
268
|
-
|
|
255
|
+
let A = null, W = 0, _ = 0;
|
|
256
|
+
for (const C of v) {
|
|
257
|
+
const { headerId: M, footerId: P, marginTop: L, marginLeft: U, marginBottom: y, pageWidth: E, pageHeight: $ } = C;
|
|
258
|
+
switch (p) {
|
|
259
|
+
case Ue.HEADER: {
|
|
260
|
+
const F = (N = w.get(M)) == null ? void 0 : N.get(E);
|
|
261
|
+
F != null && F.skeDrawings.has(I) && (A = F.skeDrawings.get(I), W = F.marginTop, _ = U);
|
|
269
262
|
break;
|
|
270
263
|
}
|
|
271
|
-
case
|
|
272
|
-
const
|
|
273
|
-
|
|
264
|
+
case Ue.FOOTER: {
|
|
265
|
+
const F = (B = S.get(P)) == null ? void 0 : B.get(E);
|
|
266
|
+
F != null && F.skeDrawings.has(I) && (A = F.skeDrawings.get(I), W = $ - y + F.marginTop, _ = U);
|
|
274
267
|
break;
|
|
275
268
|
}
|
|
276
|
-
case
|
|
277
|
-
|
|
269
|
+
case Ue.BODY: {
|
|
270
|
+
C.skeDrawings.has(I) && (A = C.skeDrawings.get(I), W = L, _ = U);
|
|
278
271
|
break;
|
|
279
272
|
}
|
|
280
273
|
}
|
|
281
|
-
if (
|
|
274
|
+
if (A != null)
|
|
282
275
|
break;
|
|
283
276
|
}
|
|
284
|
-
if (
|
|
285
|
-
const { aTop, aLeft } =
|
|
286
|
-
let
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
relativeFrom:
|
|
290
|
-
posOffset:
|
|
277
|
+
if (A != null) {
|
|
278
|
+
const { aTop: C, aLeft: M } = A, P = x[I].docTransform.positionH;
|
|
279
|
+
let L = M;
|
|
280
|
+
P.relativeFrom === ee.MARGIN ? L -= _ : P.relativeFrom === ee.COLUMN && (L -= A.columnLeft);
|
|
281
|
+
const U = {
|
|
282
|
+
relativeFrom: P.relativeFrom,
|
|
283
|
+
posOffset: L
|
|
291
284
|
};
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
|
|
285
|
+
if (P.posOffset !== U.posOffset) {
|
|
286
|
+
const F = O.replaceOp(["drawings", I, "docTransform", "positionH"], P, U);
|
|
287
|
+
D.push(F);
|
|
295
288
|
}
|
|
296
|
-
const
|
|
297
|
-
let
|
|
298
|
-
|
|
299
|
-
const
|
|
300
|
-
relativeFrom:
|
|
301
|
-
posOffset:
|
|
289
|
+
const y = x[I].docTransform.positionV;
|
|
290
|
+
let E = C;
|
|
291
|
+
y.relativeFrom === G.PAGE ? E += W : y.relativeFrom === G.LINE ? E -= A.lineTop : y.relativeFrom === G.PARAGRAPH && (E -= A.blockAnchorTop);
|
|
292
|
+
const $ = {
|
|
293
|
+
relativeFrom: y.relativeFrom,
|
|
294
|
+
posOffset: E
|
|
302
295
|
};
|
|
303
|
-
if (
|
|
304
|
-
const
|
|
305
|
-
|
|
296
|
+
if (y.posOffset !== $.posOffset) {
|
|
297
|
+
const F = O.replaceOp(["drawings", I, "docTransform", "positionV"], y, $);
|
|
298
|
+
D.push(F);
|
|
306
299
|
}
|
|
307
300
|
}
|
|
308
301
|
}
|
|
309
|
-
const
|
|
310
|
-
id:
|
|
302
|
+
const b = {
|
|
303
|
+
id: Z.id,
|
|
311
304
|
params: {
|
|
312
|
-
unitId,
|
|
305
|
+
unitId: r,
|
|
313
306
|
actions: [],
|
|
314
307
|
textRanges: null
|
|
315
308
|
}
|
|
316
309
|
};
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
return
|
|
320
|
-
}
|
|
321
|
-
},
|
|
310
|
+
b.params.actions = D.reduce((R, I) => q.compose(R, I), null);
|
|
311
|
+
const T = o.syncExecuteCommand(b.id, b.params);
|
|
312
|
+
return h.refreshControls(), !!T;
|
|
313
|
+
}
|
|
314
|
+
}, nt = {
|
|
322
315
|
id: "doc.command.update-doc-drawing-distance",
|
|
323
|
-
type:
|
|
324
|
-
handler:
|
|
325
|
-
if (
|
|
316
|
+
type: X.COMMAND,
|
|
317
|
+
handler: (i, e) => {
|
|
318
|
+
if (e == null)
|
|
326
319
|
return !1;
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
320
|
+
const n = i.get(z), r = i.get(J).getCurrentUniverDocInstance();
|
|
321
|
+
if (r == null)
|
|
329
322
|
return !1;
|
|
330
|
-
const { drawings, dist, unitId } =
|
|
331
|
-
for (const
|
|
332
|
-
const { drawingId } =
|
|
333
|
-
for (const [
|
|
334
|
-
const
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
|
|
323
|
+
const { drawings: o, dist: s, unitId: a } = e, d = q.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
|
|
324
|
+
for (const p of o) {
|
|
325
|
+
const { drawingId: h } = p;
|
|
326
|
+
for (const [v, w] of Object.entries(s)) {
|
|
327
|
+
const S = l[h][v];
|
|
328
|
+
if (S !== w) {
|
|
329
|
+
const O = d.replaceOp(["drawings", h, v], S, w);
|
|
330
|
+
c.push(O);
|
|
338
331
|
}
|
|
339
332
|
}
|
|
340
333
|
}
|
|
341
|
-
const
|
|
342
|
-
id:
|
|
334
|
+
const u = {
|
|
335
|
+
id: Z.id,
|
|
343
336
|
params: {
|
|
344
|
-
unitId,
|
|
337
|
+
unitId: a,
|
|
345
338
|
actions: [],
|
|
346
339
|
textRanges: null
|
|
347
340
|
}
|
|
348
341
|
};
|
|
349
|
-
return
|
|
350
|
-
}
|
|
351
|
-
},
|
|
342
|
+
return u.params.actions = c.reduce((p, h) => q.compose(p, h), null), !!n.syncExecuteCommand(u.id, u.params);
|
|
343
|
+
}
|
|
344
|
+
}, tt = {
|
|
352
345
|
id: "doc.command.update-doc-drawing-wrap-text",
|
|
353
|
-
type:
|
|
354
|
-
handler:
|
|
355
|
-
if (
|
|
346
|
+
type: X.COMMAND,
|
|
347
|
+
handler: (i, e) => {
|
|
348
|
+
if (e == null)
|
|
356
349
|
return !1;
|
|
357
|
-
const
|
|
358
|
-
if (
|
|
350
|
+
const n = i.get(z), r = i.get(J).getCurrentUniverDocInstance();
|
|
351
|
+
if (r == null)
|
|
359
352
|
return !1;
|
|
360
|
-
const { drawings, wrapText, unitId } =
|
|
361
|
-
for (const
|
|
362
|
-
const { drawingId } =
|
|
363
|
-
if (
|
|
364
|
-
const
|
|
365
|
-
|
|
353
|
+
const { drawings: o, wrapText: s, unitId: a } = e, d = q.getInstance(), c = [], { drawings: l = {} } = r.getSnapshot();
|
|
354
|
+
for (const p of o) {
|
|
355
|
+
const { drawingId: h } = p, v = l[h].wrapText;
|
|
356
|
+
if (v !== s) {
|
|
357
|
+
const w = d.replaceOp(["drawings", h, "wrapText"], v, s);
|
|
358
|
+
c.push(w);
|
|
366
359
|
}
|
|
367
360
|
}
|
|
368
|
-
const
|
|
369
|
-
id:
|
|
361
|
+
const u = {
|
|
362
|
+
id: Z.id,
|
|
370
363
|
params: {
|
|
371
|
-
unitId,
|
|
364
|
+
unitId: a,
|
|
372
365
|
actions: [],
|
|
373
366
|
textRanges: null
|
|
374
367
|
}
|
|
375
368
|
};
|
|
376
|
-
return
|
|
377
|
-
}
|
|
378
|
-
},
|
|
369
|
+
return u.params.actions = c.reduce((p, h) => q.compose(p, h), null), !!n.syncExecuteCommand(u.id, u.params);
|
|
370
|
+
}
|
|
371
|
+
}, qe = {
|
|
379
372
|
id: "doc.command.update-drawing-doc-transform",
|
|
380
|
-
type:
|
|
381
|
-
handler:
|
|
382
|
-
if (
|
|
373
|
+
type: X.COMMAND,
|
|
374
|
+
handler: (i, e) => {
|
|
375
|
+
if (e == null)
|
|
383
376
|
return !1;
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
377
|
+
const n = i.get(z), t = i.get(J), o = i.get(Q).getRenderById(e.unitId), s = o == null ? void 0 : o.scene;
|
|
378
|
+
if (s == null)
|
|
386
379
|
return !1;
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
380
|
+
const a = s.getTransformerByCreate(), d = t.getCurrentUniverDocInstance();
|
|
381
|
+
if (d == null)
|
|
389
382
|
return !1;
|
|
390
|
-
const { drawings, unitId } =
|
|
391
|
-
for (const
|
|
392
|
-
const { drawingId, key, value } =
|
|
393
|
-
if (!
|
|
394
|
-
const
|
|
395
|
-
|
|
383
|
+
const { drawings: c, unitId: l } = e, u = q.getInstance(), m = [], { drawings: p = {} } = d.getSnapshot();
|
|
384
|
+
for (const w of c) {
|
|
385
|
+
const { drawingId: S, key: O, value: D } = w, x = p[S].docTransform[O];
|
|
386
|
+
if (!Pe.diffValue(x, D)) {
|
|
387
|
+
const b = u.replaceOp(["drawings", S, "docTransform", O], x, D);
|
|
388
|
+
m.push(b);
|
|
396
389
|
}
|
|
397
390
|
}
|
|
398
|
-
const
|
|
399
|
-
id:
|
|
391
|
+
const h = {
|
|
392
|
+
id: Z.id,
|
|
400
393
|
params: {
|
|
401
|
-
unitId,
|
|
394
|
+
unitId: l,
|
|
402
395
|
actions: [],
|
|
403
396
|
textRanges: null,
|
|
404
397
|
debounce: !0
|
|
405
398
|
}
|
|
406
399
|
};
|
|
407
|
-
|
|
408
|
-
const
|
|
409
|
-
return
|
|
410
|
-
}
|
|
411
|
-
},
|
|
400
|
+
h.params.actions = m.reduce((w, S) => q.compose(w, S), null);
|
|
401
|
+
const v = n.syncExecuteCommand(h.id, h.params);
|
|
402
|
+
return a.refreshControls(), !!v;
|
|
403
|
+
}
|
|
404
|
+
}, it = {
|
|
412
405
|
id: "doc.command.move-inline-drawing",
|
|
413
|
-
type:
|
|
414
|
-
handler:
|
|
415
|
-
var
|
|
416
|
-
if (
|
|
406
|
+
type: X.COMMAND,
|
|
407
|
+
handler: (i, e) => {
|
|
408
|
+
var B, R;
|
|
409
|
+
if (e == null)
|
|
417
410
|
return !1;
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
411
|
+
const n = i.get(Q), t = (B = n.getRenderById(e.unitId)) == null ? void 0 : B.with(ye), r = i.get(gn), o = n.getRenderById(e.unitId), s = o == null ? void 0 : o.scene, a = o == null ? void 0 : o.with(oe).getSkeleton();
|
|
412
|
+
if (s == null || t == null)
|
|
420
413
|
return !1;
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
414
|
+
const d = s.getTransformerByCreate(), c = i.get(z), u = i.get(J).getCurrentUniverDocInstance();
|
|
415
|
+
if (u == null)
|
|
423
416
|
return !1;
|
|
424
|
-
const { drawing, unitId, offset, segmentId:
|
|
425
|
-
if (
|
|
426
|
-
return
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
417
|
+
const { drawing: m, unitId: p, offset: h, segmentId: v, segmentPage: w, needRefreshDrawings: S } = e;
|
|
418
|
+
if (S)
|
|
419
|
+
return r.refreshDrawings(a), d.refreshControls(), !0;
|
|
420
|
+
const O = [], { drawingId: D } = m, x = (R = t.getSegment()) != null ? R : "", b = Qn(
|
|
421
|
+
v,
|
|
422
|
+
x,
|
|
423
|
+
w,
|
|
424
|
+
h,
|
|
425
|
+
D,
|
|
426
|
+
u,
|
|
427
|
+
t
|
|
435
428
|
);
|
|
436
|
-
if (
|
|
437
|
-
return
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
id:
|
|
429
|
+
if (b == null || b.length === 0)
|
|
430
|
+
return r.refreshDrawings(a), d.refreshControls(), !1;
|
|
431
|
+
O.push(...b);
|
|
432
|
+
const T = {
|
|
433
|
+
id: Z.id,
|
|
441
434
|
params: {
|
|
442
|
-
unitId,
|
|
435
|
+
unitId: p,
|
|
443
436
|
actions: [],
|
|
444
437
|
textRanges: null
|
|
445
438
|
}
|
|
446
439
|
};
|
|
447
|
-
|
|
448
|
-
const
|
|
449
|
-
return
|
|
450
|
-
}
|
|
451
|
-
},
|
|
440
|
+
T.params.actions = O.reduce((I, j) => q.compose(I, j), null);
|
|
441
|
+
const N = c.syncExecuteCommand(T.id, T.params);
|
|
442
|
+
return d.refreshControls(), !!N;
|
|
443
|
+
}
|
|
444
|
+
}, rt = {
|
|
452
445
|
id: "doc.command.transform-non-inline-drawing",
|
|
453
|
-
type:
|
|
446
|
+
type: X.COMMAND,
|
|
454
447
|
// eslint-disable-next-line max-lines-per-function
|
|
455
|
-
handler:
|
|
456
|
-
var
|
|
457
|
-
if (
|
|
448
|
+
handler: (i, e) => {
|
|
449
|
+
var A, W;
|
|
450
|
+
if (e == null)
|
|
458
451
|
return !1;
|
|
459
|
-
const
|
|
460
|
-
if (
|
|
452
|
+
const n = i.get(Q), t = (A = n.getRenderById(e.unitId)) == null ? void 0 : A.with(ye), r = n.getRenderById(e.unitId), o = r == null ? void 0 : r.scene;
|
|
453
|
+
if (o == null || t == null)
|
|
461
454
|
return !1;
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
455
|
+
const s = o.getTransformerByCreate(), a = i.get(z), c = i.get(J).getCurrentUniverDocInstance();
|
|
456
|
+
if (c == null)
|
|
464
457
|
return !1;
|
|
465
|
-
const { drawing, unitId, offset, docTransform, segmentId:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
458
|
+
const { drawing: l, unitId: u, offset: m, docTransform: p, segmentId: h, segmentPage: v } = e, w = [], { drawingId: S } = l, O = (W = t.getSegment()) != null ? W : "", D = Qn(
|
|
459
|
+
h,
|
|
460
|
+
O,
|
|
461
|
+
v,
|
|
462
|
+
m,
|
|
463
|
+
S,
|
|
464
|
+
c,
|
|
465
|
+
t
|
|
473
466
|
);
|
|
474
|
-
if (
|
|
467
|
+
if (D == null)
|
|
475
468
|
return !1;
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
if (!
|
|
479
|
-
const
|
|
480
|
-
|
|
469
|
+
D.length > 0 && w.push(...D);
|
|
470
|
+
const x = q.getInstance(), { drawings: b = {} } = c.getSnapshot(), T = b[S].docTransform, { positionH: N, positionV: B, size: R, angle: I } = T;
|
|
471
|
+
if (!Pe.diffValue(N, p.positionH)) {
|
|
472
|
+
const _ = x.replaceOp(["drawings", S, "docTransform", "positionH"], N, p.positionH);
|
|
473
|
+
w.push(_);
|
|
481
474
|
}
|
|
482
|
-
if (!
|
|
483
|
-
const
|
|
484
|
-
|
|
475
|
+
if (!Pe.diffValue(B, p.positionV)) {
|
|
476
|
+
const _ = x.replaceOp(["drawings", S, "docTransform", "positionV"], B, p.positionV);
|
|
477
|
+
w.push(_);
|
|
485
478
|
}
|
|
486
|
-
if (!
|
|
487
|
-
const
|
|
488
|
-
|
|
479
|
+
if (!Pe.diffValue(R, p.size)) {
|
|
480
|
+
const _ = x.replaceOp(["drawings", S, "docTransform", "size"], R, p.size);
|
|
481
|
+
w.push(_);
|
|
489
482
|
}
|
|
490
|
-
if (!
|
|
491
|
-
const
|
|
492
|
-
|
|
483
|
+
if (!Pe.diffValue(I, p.angle)) {
|
|
484
|
+
const _ = x.replaceOp(["drawings", S, "docTransform", "angle"], I, p.angle);
|
|
485
|
+
w.push(_);
|
|
493
486
|
}
|
|
494
|
-
const
|
|
495
|
-
id:
|
|
487
|
+
const j = {
|
|
488
|
+
id: Z.id,
|
|
496
489
|
params: {
|
|
497
|
-
unitId,
|
|
490
|
+
unitId: u,
|
|
498
491
|
actions: [],
|
|
499
492
|
textRanges: null,
|
|
500
493
|
debounce: !0
|
|
501
494
|
}
|
|
502
495
|
};
|
|
503
|
-
|
|
504
|
-
const
|
|
505
|
-
return
|
|
506
|
-
}
|
|
496
|
+
j.params.actions = w.reduce((_, C) => q.compose(_, C), null);
|
|
497
|
+
const H = a.syncExecuteCommand(j.id, j.params);
|
|
498
|
+
return s.refreshControls(), !!H;
|
|
499
|
+
}
|
|
507
500
|
};
|
|
508
|
-
var
|
|
509
|
-
for (var
|
|
510
|
-
(
|
|
511
|
-
return
|
|
512
|
-
},
|
|
513
|
-
const
|
|
514
|
-
function
|
|
515
|
-
const { path } =
|
|
516
|
-
return
|
|
501
|
+
var Li = Object.defineProperty, Bi = Object.getOwnPropertyDescriptor, Ui = (i, e, n, t) => {
|
|
502
|
+
for (var r = t > 1 ? void 0 : t ? Bi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
503
|
+
(s = i[o]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
504
|
+
return t && r && Li(e, n, r), r;
|
|
505
|
+
}, Ze = (i, e) => (n, t) => e(n, t, i);
|
|
506
|
+
const Fi = "__InlineDrawingAnchor__";
|
|
507
|
+
function kn(i) {
|
|
508
|
+
const { path: e } = i;
|
|
509
|
+
return e.some((n) => n === "cells");
|
|
517
510
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
let DocDrawingTransformerController = (_a2 = class extends Disposable {
|
|
521
|
-
constructor(_commandService, _univerInstanceService, _drawingManagerService, _renderManagerService) {
|
|
511
|
+
let on = class extends Xe {
|
|
512
|
+
constructor(e, n, t, r) {
|
|
522
513
|
super();
|
|
523
|
-
|
|
524
|
-
|
|
514
|
+
Se(this, "_liquid", new qn());
|
|
515
|
+
Se(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
|
|
525
516
|
// Use to cache the drawings is under transforming or scaling.
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
this._commandService =
|
|
517
|
+
Se(this, "_transformerCache", /* @__PURE__ */ new Map());
|
|
518
|
+
Se(this, "_anchorShape");
|
|
519
|
+
this._commandService = e, this._univerInstanceService = n, this._drawingManagerService = t, this._renderManagerService = r, this._init();
|
|
529
520
|
}
|
|
530
521
|
_init() {
|
|
531
522
|
this._listenDrawingFocus();
|
|
532
523
|
}
|
|
533
524
|
_listenDrawingFocus() {
|
|
534
525
|
this.disposeWithMe(
|
|
535
|
-
this._drawingManagerService.add$.subscribe((
|
|
536
|
-
if (
|
|
537
|
-
for (const
|
|
538
|
-
const { unitId } =
|
|
539
|
-
this._listenerOnImageMap.has(
|
|
526
|
+
this._drawingManagerService.add$.subscribe((e) => {
|
|
527
|
+
if (e.length !== 0)
|
|
528
|
+
for (const n of e) {
|
|
529
|
+
const { unitId: t } = n;
|
|
530
|
+
this._listenerOnImageMap.has(t) || (this._listenTransformerChange(t), this._listenerOnImageMap.add(t));
|
|
540
531
|
}
|
|
541
532
|
})
|
|
542
533
|
);
|
|
543
534
|
}
|
|
544
535
|
// Only handle one drawing transformer change.
|
|
545
536
|
// eslint-disable-next-line max-lines-per-function
|
|
546
|
-
_listenTransformerChange(
|
|
547
|
-
var
|
|
548
|
-
const
|
|
549
|
-
if (
|
|
537
|
+
_listenTransformerChange(e) {
|
|
538
|
+
var r;
|
|
539
|
+
const n = (r = this._getSceneAndTransformerByDrawingSearch(e)) == null ? void 0 : r.transformer;
|
|
540
|
+
if (n == null)
|
|
550
541
|
return;
|
|
551
542
|
this.disposeWithMe(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
var
|
|
543
|
+
Ae(
|
|
544
|
+
n.changeStart$.subscribe((o) => {
|
|
545
|
+
var a;
|
|
555
546
|
this._transformerCache.clear();
|
|
556
|
-
const { objects } =
|
|
557
|
-
for (const
|
|
558
|
-
const { oKey, width, height, left, top, angle } =
|
|
559
|
-
if (
|
|
547
|
+
const { objects: s } = o;
|
|
548
|
+
for (const d of s.values()) {
|
|
549
|
+
const { oKey: c, width: l, height: u, left: m, top: p, angle: h } = d, v = this._drawingManagerService.getDrawingOKey(c);
|
|
550
|
+
if (v == null)
|
|
560
551
|
continue;
|
|
561
|
-
const
|
|
562
|
-
(
|
|
563
|
-
drawing:
|
|
564
|
-
top,
|
|
565
|
-
left,
|
|
566
|
-
width,
|
|
567
|
-
height,
|
|
568
|
-
angle
|
|
552
|
+
const w = this._univerInstanceService.getUniverDocInstance(v.unitId), S = (a = w == null ? void 0 : w.getSnapshot().drawings) == null ? void 0 : a[v.drawingId];
|
|
553
|
+
(S == null ? void 0 : S.layoutType) === k.INLINE && d.setOpacity(0.2), S != null && this._transformerCache.set(v.drawingId, {
|
|
554
|
+
drawing: S,
|
|
555
|
+
top: p,
|
|
556
|
+
left: m,
|
|
557
|
+
width: l,
|
|
558
|
+
height: u,
|
|
559
|
+
angle: h
|
|
569
560
|
});
|
|
570
561
|
}
|
|
571
562
|
})
|
|
572
563
|
)
|
|
573
564
|
);
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
const { objects, offsetX, offsetY } =
|
|
579
|
-
if (
|
|
580
|
-
|
|
581
|
-
else if (
|
|
582
|
-
const
|
|
583
|
-
if (
|
|
565
|
+
const t = xn(this._updateMultipleDrawingDocTransform.bind(this), 50);
|
|
566
|
+
xn(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
|
|
567
|
+
Ae(
|
|
568
|
+
n.changing$.subscribe((o) => {
|
|
569
|
+
const { objects: s, offsetX: a, offsetY: d } = o;
|
|
570
|
+
if (s.size > 1)
|
|
571
|
+
t(s);
|
|
572
|
+
else if (s.size === 1) {
|
|
573
|
+
const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: u, height: m, top: p, left: h, angle: v } = l;
|
|
574
|
+
if (c && u === c.width && m === c.height && p === c.top && h === c.left && v === c.angle)
|
|
584
575
|
return;
|
|
585
|
-
|
|
576
|
+
c && (c.drawing.layoutType, k.INLINE), c && c.drawing.layoutType === k.INLINE && a != null && d != null && this._updateInlineDrawingAnchor(c.drawing, a, d);
|
|
586
577
|
}
|
|
587
578
|
})
|
|
588
579
|
)
|
|
589
580
|
), this.disposeWithMe(
|
|
590
|
-
|
|
581
|
+
Ae(
|
|
591
582
|
// eslint-disable-next-line complexity
|
|
592
|
-
|
|
593
|
-
const { objects, offsetX, offsetY } =
|
|
594
|
-
for (const
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
583
|
+
n.changeEnd$.subscribe((o) => {
|
|
584
|
+
const { objects: s, offsetX: a, offsetY: d } = o;
|
|
585
|
+
for (const c of s.values()) {
|
|
586
|
+
const l = this._drawingManagerService.getDrawingOKey(c.oKey);
|
|
587
|
+
if (l == null)
|
|
597
588
|
continue;
|
|
598
|
-
const
|
|
599
|
-
(
|
|
589
|
+
const u = this._transformerCache.get(l == null ? void 0 : l.drawingId);
|
|
590
|
+
(u == null ? void 0 : u.drawing.layoutType) === k.INLINE && c.setOpacity(1);
|
|
600
591
|
}
|
|
601
|
-
if (this._anchorShape && this._anchorShape.hide(),
|
|
602
|
-
this._updateMultipleDrawingDocTransform(
|
|
603
|
-
else if (
|
|
604
|
-
const
|
|
605
|
-
if (
|
|
592
|
+
if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
|
|
593
|
+
this._updateMultipleDrawingDocTransform(s);
|
|
594
|
+
else if (s.size === 1) {
|
|
595
|
+
const c = this._transformerCache.values().next().value, l = s.values().next().value, { width: u, height: m, top: p, left: h, angle: v } = l;
|
|
596
|
+
if (c && u === c.width && m === c.height && p === c.top && h === c.left && v === c.angle)
|
|
606
597
|
return;
|
|
607
|
-
|
|
598
|
+
c && c.drawing.layoutType === k.INLINE ? u !== c.width || m !== c.height || v !== c.angle ? this._updateDrawingSize(c, l) : a != null && d != null && this._moveInlineDrawing(c.drawing, a, d) : c && this._nonInlineDrawingTransform(c.drawing, l);
|
|
608
599
|
}
|
|
609
600
|
this._transformerCache.clear();
|
|
610
601
|
})
|
|
@@ -612,177 +603,177 @@ let DocDrawingTransformerController = (_a2 = class extends Disposable {
|
|
|
612
603
|
);
|
|
613
604
|
}
|
|
614
605
|
// eslint-disable-next-line max-lines-per-function
|
|
615
|
-
_updateMultipleDrawingDocTransform(
|
|
616
|
-
if (
|
|
606
|
+
_updateMultipleDrawingDocTransform(e) {
|
|
607
|
+
if (e.size < 1)
|
|
617
608
|
return;
|
|
618
|
-
const
|
|
619
|
-
let
|
|
620
|
-
for (const
|
|
621
|
-
const { oKey, left, top, angle } =
|
|
622
|
-
let { width, height } =
|
|
623
|
-
const
|
|
624
|
-
if (
|
|
609
|
+
const n = [];
|
|
610
|
+
let t, r;
|
|
611
|
+
for (const o of e.values()) {
|
|
612
|
+
const { oKey: s, left: a, top: d, angle: c } = o;
|
|
613
|
+
let { width: l, height: u } = o;
|
|
614
|
+
const m = this._drawingManagerService.getDrawingOKey(s);
|
|
615
|
+
if (m == null)
|
|
625
616
|
continue;
|
|
626
|
-
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
617
|
+
t == null && (t = m.unitId), r == null && (r = m.subUnitId);
|
|
618
|
+
const p = this._transformerCache.get(m.drawingId);
|
|
619
|
+
if (p == null)
|
|
629
620
|
continue;
|
|
630
|
-
const { drawing:
|
|
631
|
-
if (
|
|
632
|
-
drawingId:
|
|
621
|
+
const { drawing: h, top: v, left: w, width: S, height: O, angle: D } = p, { width: x, height: b } = this._getPageContentSize(h);
|
|
622
|
+
if (l = Math.min(l, x), u = Math.min(u, b), (S !== l || O !== u) && n.push({
|
|
623
|
+
drawingId: m.drawingId,
|
|
633
624
|
key: "size",
|
|
634
625
|
value: {
|
|
635
|
-
width,
|
|
636
|
-
height
|
|
626
|
+
width: l,
|
|
627
|
+
height: u
|
|
637
628
|
}
|
|
638
|
-
}),
|
|
639
|
-
drawingId:
|
|
629
|
+
}), D !== c && n.push({
|
|
630
|
+
drawingId: m.drawingId,
|
|
640
631
|
key: "angle",
|
|
641
|
-
value:
|
|
642
|
-
}),
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
drawingId:
|
|
632
|
+
value: c
|
|
633
|
+
}), v !== d || w !== a) {
|
|
634
|
+
const T = d - v, N = a - w;
|
|
635
|
+
T !== 0 && n.push({
|
|
636
|
+
drawingId: m.drawingId,
|
|
646
637
|
key: "positionV",
|
|
647
638
|
value: {
|
|
648
|
-
relativeFrom:
|
|
649
|
-
posOffset:
|
|
639
|
+
relativeFrom: h.docTransform.positionV.relativeFrom,
|
|
640
|
+
posOffset: h.docTransform.positionV.posOffset + T
|
|
650
641
|
}
|
|
651
|
-
}),
|
|
652
|
-
drawingId:
|
|
642
|
+
}), N !== 0 && n.push({
|
|
643
|
+
drawingId: m.drawingId,
|
|
653
644
|
key: "positionH",
|
|
654
645
|
value: {
|
|
655
|
-
relativeFrom:
|
|
656
|
-
posOffset:
|
|
646
|
+
relativeFrom: h.docTransform.positionH.relativeFrom,
|
|
647
|
+
posOffset: h.docTransform.positionH.posOffset + N
|
|
657
648
|
}
|
|
658
649
|
});
|
|
659
650
|
}
|
|
660
651
|
}
|
|
661
|
-
|
|
662
|
-
unitId,
|
|
663
|
-
subUnitId,
|
|
664
|
-
drawings
|
|
652
|
+
n.length > 0 && t && r && this._commandService.executeCommand(qe.id, {
|
|
653
|
+
unitId: t,
|
|
654
|
+
subUnitId: r,
|
|
655
|
+
drawings: n
|
|
665
656
|
});
|
|
666
657
|
}
|
|
667
658
|
// TODO: @JOCS, Use to draw and update the drawing anchor.
|
|
668
|
-
_updateDrawingAnchor(
|
|
659
|
+
_updateDrawingAnchor(e) {
|
|
669
660
|
if (this._transformerCache.size !== 1)
|
|
670
661
|
return;
|
|
671
|
-
const
|
|
672
|
-
this._getDrawingAnchor(
|
|
662
|
+
const n = this._transformerCache.values().next().value, t = e.values().next().value;
|
|
663
|
+
this._getDrawingAnchor(n.drawing, t);
|
|
673
664
|
}
|
|
674
|
-
_updateInlineDrawingAnchor(
|
|
675
|
-
var
|
|
665
|
+
_updateInlineDrawingAnchor(e, n, t) {
|
|
666
|
+
var o;
|
|
676
667
|
if (this._transformerCache.size !== 1)
|
|
677
668
|
return;
|
|
678
|
-
const { contentBoxPointGroup } = (
|
|
679
|
-
|
|
669
|
+
const { contentBoxPointGroup: r } = (o = this._getInlineDrawingAnchor(e, n, t)) != null ? o : {};
|
|
670
|
+
r != null && this._createOrUpdateInlineAnchor(e.unitId, r);
|
|
680
671
|
}
|
|
681
|
-
_getInlineDrawingAnchor(
|
|
682
|
-
var
|
|
683
|
-
const
|
|
684
|
-
if (
|
|
672
|
+
_getInlineDrawingAnchor(e, n, t) {
|
|
673
|
+
var A, W;
|
|
674
|
+
const r = this._renderManagerService.getRenderById(e.unitId), o = r == null ? void 0 : r.with(oe).getSkeleton();
|
|
675
|
+
if (r == null)
|
|
685
676
|
return;
|
|
686
|
-
const { mainComponent, scene } =
|
|
687
|
-
pageLayoutType =
|
|
688
|
-
pageMarginLeft,
|
|
689
|
-
pageMarginTop
|
|
690
|
-
} =
|
|
691
|
-
let
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
677
|
+
const { mainComponent: s, scene: a } = r, d = s, c = a.getViewports()[0], {
|
|
678
|
+
pageLayoutType: l = Mn.VERTICAL,
|
|
679
|
+
pageMarginLeft: u,
|
|
680
|
+
pageMarginTop: m
|
|
681
|
+
} = d.getOffsetConfig();
|
|
682
|
+
let p = null, h = !1, v = -1, w = "";
|
|
683
|
+
const S = 0.5, O = this._getTransformCoordForDocumentOffset(d, c, n, t);
|
|
684
|
+
if (O == null)
|
|
694
685
|
return;
|
|
695
|
-
const
|
|
696
|
-
if (
|
|
686
|
+
const D = (A = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : A.with(ye);
|
|
687
|
+
if (D == null)
|
|
697
688
|
return;
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
689
|
+
const x = o == null ? void 0 : o.findNodeByCoord(
|
|
690
|
+
O,
|
|
691
|
+
l,
|
|
692
|
+
u,
|
|
693
|
+
m,
|
|
703
694
|
{
|
|
704
695
|
strict: !1,
|
|
705
|
-
segmentId:
|
|
706
|
-
segmentPage:
|
|
696
|
+
segmentId: D.getSegment(),
|
|
697
|
+
segmentPage: D.getSegmentPage()
|
|
707
698
|
}
|
|
708
699
|
);
|
|
709
|
-
if (
|
|
710
|
-
const { node, ratioX, segmentPage, segmentId:
|
|
711
|
-
|
|
700
|
+
if (x) {
|
|
701
|
+
const { node: _, ratioX: C, segmentPage: M, segmentId: P } = x;
|
|
702
|
+
h = C < S, p = _, v = M, w = P;
|
|
712
703
|
}
|
|
713
|
-
if (
|
|
704
|
+
if (p == null)
|
|
714
705
|
return;
|
|
715
|
-
const
|
|
716
|
-
if (
|
|
706
|
+
const b = o == null ? void 0 : o.findPositionByGlyph(p, v), T = this._getDocObject();
|
|
707
|
+
if (b == null || o == null || T == null || kn(b))
|
|
717
708
|
return;
|
|
718
|
-
const
|
|
719
|
-
...
|
|
720
|
-
isBack
|
|
721
|
-
},
|
|
722
|
-
if (
|
|
723
|
-
return { offset:
|
|
709
|
+
const N = {
|
|
710
|
+
...b,
|
|
711
|
+
isBack: h
|
|
712
|
+
}, B = T.document.getOffsetConfig(), R = new Nn(B, o), { cursorList: I, contentBoxPointGroup: j } = R.getRangePointData(N, N), { startOffset: H } = (W = En(I)) != null ? W : {};
|
|
713
|
+
if (H != null)
|
|
714
|
+
return { offset: H, contentBoxPointGroup: j, segmentId: w, segmentPage: v };
|
|
724
715
|
}
|
|
725
716
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
726
|
-
_getDrawingAnchor(
|
|
727
|
-
var
|
|
728
|
-
const
|
|
729
|
-
if (
|
|
717
|
+
_getDrawingAnchor(e, n) {
|
|
718
|
+
var Ie, _e, ce, Ce, De, Me, Re, Oe, de, le, Ne;
|
|
719
|
+
const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(oe).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
|
|
720
|
+
if (o == null || t == null)
|
|
730
721
|
return;
|
|
731
|
-
const { pages, skeHeaders, skeFooters } =
|
|
732
|
-
let { width, height } =
|
|
733
|
-
const { positionV, positionH } =
|
|
734
|
-
|
|
735
|
-
let
|
|
736
|
-
const
|
|
737
|
-
...
|
|
722
|
+
const { pages: s, skeHeaders: a, skeFooters: d } = o, { mainComponent: c, scene: l } = t, u = c, m = l.getViewports()[0], { pageLayoutType: p = Mn.VERTICAL, pageMarginLeft: h, pageMarginTop: v, docsLeft: w, docsTop: S } = u.getOffsetConfig(), { left: O, top: D, angle: x } = n;
|
|
723
|
+
let { width: b, height: T } = n;
|
|
724
|
+
const { positionV: N, positionH: B } = e.docTransform, { width: R, height: I } = this._getPageContentSize(e);
|
|
725
|
+
b = Math.min(b, R), T = Math.min(T, I);
|
|
726
|
+
let j = null, H = "", A = -1;
|
|
727
|
+
const W = !1, _ = {
|
|
728
|
+
...e.docTransform,
|
|
738
729
|
size: {
|
|
739
|
-
width,
|
|
740
|
-
height
|
|
730
|
+
width: b,
|
|
731
|
+
height: T
|
|
741
732
|
},
|
|
742
|
-
angle
|
|
743
|
-
}, { x, y } =
|
|
744
|
-
if (
|
|
733
|
+
angle: x
|
|
734
|
+
}, { x: C, y: M } = l.getViewportScrollXY(m), P = this._getTransformCoordForDocumentOffset(u, m, O - C, D - M);
|
|
735
|
+
if (P == null)
|
|
745
736
|
return;
|
|
746
|
-
const
|
|
747
|
-
if (
|
|
737
|
+
const L = (Ie = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : Ie.with(ye);
|
|
738
|
+
if (L == null)
|
|
748
739
|
return;
|
|
749
|
-
const
|
|
740
|
+
const U = r == null ? void 0 : r.findNodeByCoord(P, p, h, v, {
|
|
750
741
|
strict: !1,
|
|
751
|
-
segmentId:
|
|
752
|
-
segmentPage:
|
|
742
|
+
segmentId: L.getSegment(),
|
|
743
|
+
segmentPage: L.getSegmentPage()
|
|
753
744
|
});
|
|
754
|
-
if (
|
|
755
|
-
const { node, segmentPage:
|
|
756
|
-
|
|
745
|
+
if (U) {
|
|
746
|
+
const { node: he, segmentPage: mn, segmentId: un } = U;
|
|
747
|
+
j = he, A = mn, H = un;
|
|
757
748
|
}
|
|
758
|
-
if (
|
|
749
|
+
if (j == null)
|
|
759
750
|
return;
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
751
|
+
const y = (_e = j.parent) == null ? void 0 : _e.parent, E = y == null ? void 0 : y.parent, $ = (ce = E == null ? void 0 : E.lines.find((he) => he.paragraphIndex === (y == null ? void 0 : y.paragraphIndex) && he.paragraphStart)) != null ? ce : E == null ? void 0 : E.lines[0], F = (Ce = E == null ? void 0 : E.parent) == null ? void 0 : Ce.parent;
|
|
752
|
+
if (y == null || E == null || $ == null || F == null)
|
|
762
753
|
return;
|
|
763
754
|
this._liquid.reset();
|
|
764
|
-
const
|
|
765
|
-
for (const
|
|
766
|
-
const { headerId, footerId, pageHeight, pageWidth, marginLeft, marginBottom } =
|
|
767
|
-
if (
|
|
768
|
-
switch (
|
|
769
|
-
case
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
755
|
+
const K = F.type;
|
|
756
|
+
for (const he of s) {
|
|
757
|
+
const { headerId: mn, footerId: un, pageHeight: Dt, pageWidth: Dn, marginLeft: On, marginBottom: Ot } = he, xt = s.indexOf(he);
|
|
758
|
+
if (A > -1 && xt === A) {
|
|
759
|
+
switch (K) {
|
|
760
|
+
case Rn.HEADER: {
|
|
761
|
+
const He = (De = a.get(mn)) == null ? void 0 : De.get(Dn);
|
|
762
|
+
if (He)
|
|
772
763
|
this._liquid.translatePagePadding({
|
|
773
|
-
marginTop:
|
|
774
|
-
marginLeft
|
|
764
|
+
marginTop: He.marginTop,
|
|
765
|
+
marginLeft: On
|
|
775
766
|
});
|
|
776
767
|
else
|
|
777
768
|
throw new Error("header skeleton not found");
|
|
778
769
|
break;
|
|
779
770
|
}
|
|
780
|
-
case
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
771
|
+
case Rn.FOOTER: {
|
|
772
|
+
const He = (Me = d.get(un)) == null ? void 0 : Me.get(Dn);
|
|
773
|
+
if (He)
|
|
783
774
|
this._liquid.translatePagePadding({
|
|
784
|
-
marginTop:
|
|
785
|
-
marginLeft
|
|
775
|
+
marginTop: Dt - Ot + He.marginTop,
|
|
776
|
+
marginLeft: On
|
|
786
777
|
});
|
|
787
778
|
else
|
|
788
779
|
throw new Error("footer skeleton not found");
|
|
@@ -791,590 +782,586 @@ let DocDrawingTransformerController = (_a2 = class extends Disposable {
|
|
|
791
782
|
}
|
|
792
783
|
break;
|
|
793
784
|
}
|
|
794
|
-
if (this._liquid.translatePagePadding(
|
|
785
|
+
if (this._liquid.translatePagePadding(he), he === F)
|
|
795
786
|
break;
|
|
796
|
-
this._liquid.restorePagePadding(
|
|
787
|
+
this._liquid.restorePagePadding(he), this._liquid.translatePage(he, p, h, v);
|
|
797
788
|
}
|
|
798
|
-
switch (
|
|
799
|
-
relativeFrom:
|
|
800
|
-
posOffset:
|
|
801
|
-
},
|
|
802
|
-
case
|
|
803
|
-
|
|
789
|
+
switch (N.relativeFrom === G.LINE ? j = y.divides[0].glyphGroup[0] : j = (le = (de = (Oe = (Re = $.divides) == null ? void 0 : Re[0]) == null ? void 0 : Oe.glyphGroup) == null ? void 0 : de[0]) != null ? le : j, _.positionH = {
|
|
790
|
+
relativeFrom: B.relativeFrom,
|
|
791
|
+
posOffset: O - this._liquid.x - w
|
|
792
|
+
}, B.relativeFrom) {
|
|
793
|
+
case ee.MARGIN: {
|
|
794
|
+
_.positionH.posOffset = O - this._liquid.x - w - F.marginLeft;
|
|
804
795
|
break;
|
|
805
796
|
}
|
|
806
|
-
case
|
|
807
|
-
|
|
797
|
+
case ee.COLUMN: {
|
|
798
|
+
_.positionH.posOffset = O - this._liquid.x - w - E.left;
|
|
808
799
|
break;
|
|
809
800
|
}
|
|
810
801
|
}
|
|
811
|
-
switch (
|
|
812
|
-
relativeFrom:
|
|
813
|
-
posOffset:
|
|
814
|
-
},
|
|
815
|
-
case
|
|
816
|
-
|
|
802
|
+
switch (_.positionV = {
|
|
803
|
+
relativeFrom: N.relativeFrom,
|
|
804
|
+
posOffset: D - this._liquid.y - S
|
|
805
|
+
}, N.relativeFrom) {
|
|
806
|
+
case G.PAGE: {
|
|
807
|
+
_.positionV.posOffset = D - this._liquid.y - S - F.marginTop;
|
|
817
808
|
break;
|
|
818
809
|
}
|
|
819
|
-
case
|
|
820
|
-
|
|
810
|
+
case G.LINE: {
|
|
811
|
+
_.positionV.posOffset = D - this._liquid.y - S - y.top;
|
|
821
812
|
break;
|
|
822
813
|
}
|
|
823
|
-
case
|
|
824
|
-
|
|
814
|
+
case G.PARAGRAPH: {
|
|
815
|
+
_.positionV.posOffset = D - this._liquid.y - S - $.top;
|
|
825
816
|
break;
|
|
826
817
|
}
|
|
827
818
|
}
|
|
828
|
-
if (
|
|
819
|
+
if (j == null)
|
|
829
820
|
return;
|
|
830
|
-
const
|
|
831
|
-
if (
|
|
821
|
+
const se = r == null ? void 0 : r.findPositionByGlyph(j, A), Le = this._getDocObject();
|
|
822
|
+
if (se == null || r == null || Le == null || kn(se))
|
|
832
823
|
return;
|
|
833
|
-
const
|
|
834
|
-
...
|
|
835
|
-
isBack
|
|
836
|
-
},
|
|
837
|
-
if (
|
|
838
|
-
return { offset:
|
|
824
|
+
const be = {
|
|
825
|
+
...se,
|
|
826
|
+
isBack: W
|
|
827
|
+
}, ke = Le.document.getOffsetConfig(), ae = new Nn(ke, r), { cursorList: ne } = ae.getRangePointData(be, be), { startOffset: te } = (Ne = En(ne)) != null ? Ne : {};
|
|
828
|
+
if (te != null)
|
|
829
|
+
return { offset: te, docTransform: _, segmentId: H, segmentPage: A };
|
|
839
830
|
}
|
|
840
831
|
// Update drawing when use transformer to resize it.
|
|
841
|
-
_updateDrawingSize(
|
|
842
|
-
const
|
|
843
|
-
let { width, height, angle } =
|
|
844
|
-
const { width:
|
|
845
|
-
|
|
846
|
-
drawingId:
|
|
832
|
+
_updateDrawingSize(e, n) {
|
|
833
|
+
const t = [], { drawing: r, width: o, height: s, angle: a } = e, { unitId: d, subUnitId: c } = r;
|
|
834
|
+
let { width: l, height: u, angle: m } = n;
|
|
835
|
+
const { width: p, height: h } = this._getPageContentSize(r);
|
|
836
|
+
l = Math.min(p, l), u = Math.min(h, u), (l !== o || u !== s) && t.push({
|
|
837
|
+
drawingId: r.drawingId,
|
|
847
838
|
key: "size",
|
|
848
839
|
value: {
|
|
849
|
-
width,
|
|
850
|
-
height
|
|
840
|
+
width: l,
|
|
841
|
+
height: u
|
|
851
842
|
}
|
|
852
|
-
}),
|
|
853
|
-
drawingId:
|
|
843
|
+
}), m !== a && t.push({
|
|
844
|
+
drawingId: r.drawingId,
|
|
854
845
|
key: "angle",
|
|
855
|
-
value:
|
|
856
|
-
}),
|
|
857
|
-
unitId,
|
|
858
|
-
subUnitId,
|
|
859
|
-
drawings
|
|
846
|
+
value: m
|
|
847
|
+
}), t.length > 0 && d && c && this._commandService.executeCommand(qe.id, {
|
|
848
|
+
unitId: d,
|
|
849
|
+
subUnitId: c,
|
|
850
|
+
drawings: t
|
|
860
851
|
});
|
|
861
852
|
}
|
|
862
853
|
// Update inline drawing when use transformer to move it.
|
|
863
|
-
_moveInlineDrawing(
|
|
864
|
-
const
|
|
865
|
-
return this._commandService.executeCommand(
|
|
866
|
-
unitId:
|
|
867
|
-
subUnitId:
|
|
868
|
-
drawing,
|
|
869
|
-
offset,
|
|
870
|
-
segmentId,
|
|
871
|
-
segmentPage,
|
|
872
|
-
needRefreshDrawings:
|
|
854
|
+
_moveInlineDrawing(e, n, t) {
|
|
855
|
+
const r = this._getInlineDrawingAnchor(e, n, t), { offset: o, segmentId: s, segmentPage: a } = r != null ? r : {};
|
|
856
|
+
return this._commandService.executeCommand(it.id, {
|
|
857
|
+
unitId: e.unitId,
|
|
858
|
+
subUnitId: e.unitId,
|
|
859
|
+
drawing: e,
|
|
860
|
+
offset: o,
|
|
861
|
+
segmentId: s,
|
|
862
|
+
segmentPage: a,
|
|
863
|
+
needRefreshDrawings: o == null
|
|
873
864
|
});
|
|
874
865
|
}
|
|
875
866
|
// Limit the drawing to the page area, mainly in the vertical direction,
|
|
876
867
|
// and the upper and lower limits cannot exceed the page margin area.
|
|
877
|
-
_limitDrawingInPage(
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
868
|
+
_limitDrawingInPage(e, n) {
|
|
869
|
+
const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: s, height: a, angle: d } = n, c = t == null ? void 0 : t.with(oe).getSkeleton(), l = c == null ? void 0 : c.getSkeletonData(), { pages: u } = l != null ? l : {};
|
|
870
|
+
if (l == null || t == null || u == null)
|
|
880
871
|
return {
|
|
881
|
-
left,
|
|
882
|
-
top,
|
|
883
|
-
width,
|
|
884
|
-
height,
|
|
885
|
-
angle
|
|
872
|
+
left: r,
|
|
873
|
+
top: o,
|
|
874
|
+
width: s,
|
|
875
|
+
height: a,
|
|
876
|
+
angle: d
|
|
886
877
|
};
|
|
887
|
-
const { mainComponent } =
|
|
888
|
-
let
|
|
878
|
+
const { mainComponent: m } = t, p = m, { top: h, pageLayoutType: v, pageMarginLeft: w, pageMarginTop: S } = p;
|
|
879
|
+
let O = o;
|
|
889
880
|
this._liquid.reset();
|
|
890
|
-
for (const
|
|
891
|
-
const { marginBottom, pageHeight } =
|
|
892
|
-
if (
|
|
881
|
+
for (const D of u) {
|
|
882
|
+
const { marginBottom: x, pageHeight: b } = D, T = u.indexOf(D), N = u[T + 1];
|
|
883
|
+
if (N == null)
|
|
893
884
|
continue;
|
|
894
|
-
if (
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
this._liquid.y +
|
|
898
|
-
this._liquid.y +
|
|
885
|
+
if (Pe.hasIntersectionBetweenTwoRanges(
|
|
886
|
+
o,
|
|
887
|
+
o + a,
|
|
888
|
+
this._liquid.y + h + b - x,
|
|
889
|
+
this._liquid.y + h + b + S + N.marginTop
|
|
899
890
|
)) {
|
|
900
|
-
const
|
|
901
|
-
|
|
891
|
+
const R = o + a / 2, I = this._liquid.y + h + b + S / 2;
|
|
892
|
+
R < I ? O = Math.min(o, this._liquid.y + h + b - x - a) : O = Math.max(o, this._liquid.y + h + b + S + N.marginTop);
|
|
902
893
|
}
|
|
903
|
-
this._liquid.translatePage(
|
|
894
|
+
this._liquid.translatePage(D, v, w, S);
|
|
904
895
|
}
|
|
905
896
|
return {
|
|
906
|
-
left,
|
|
907
|
-
top:
|
|
908
|
-
width,
|
|
909
|
-
height,
|
|
910
|
-
angle
|
|
897
|
+
left: r,
|
|
898
|
+
top: O,
|
|
899
|
+
width: s,
|
|
900
|
+
height: a,
|
|
901
|
+
angle: d
|
|
911
902
|
};
|
|
912
903
|
}
|
|
913
|
-
_nonInlineDrawingTransform(
|
|
914
|
-
const
|
|
915
|
-
if (
|
|
904
|
+
_nonInlineDrawingTransform(e, n, t = !1) {
|
|
905
|
+
const r = e.isMultiTransform === re.TRUE ? n : this._limitDrawingInPage(e, n);
|
|
906
|
+
if (t && r.top !== n.top)
|
|
916
907
|
return;
|
|
917
|
-
const
|
|
918
|
-
return
|
|
919
|
-
unitId:
|
|
920
|
-
subUnitId:
|
|
921
|
-
drawing,
|
|
922
|
-
offset,
|
|
923
|
-
docTransform,
|
|
924
|
-
segmentId,
|
|
925
|
-
segmentPage
|
|
908
|
+
const o = this._getDrawingAnchor(e, r), { offset: s, docTransform: a, segmentId: d, segmentPage: c } = o != null ? o : {};
|
|
909
|
+
return s == null || a == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, n]])) : this._commandService.executeCommand(rt.id, {
|
|
910
|
+
unitId: e.unitId,
|
|
911
|
+
subUnitId: e.unitId,
|
|
912
|
+
drawing: e,
|
|
913
|
+
offset: s,
|
|
914
|
+
docTransform: a,
|
|
915
|
+
segmentId: d,
|
|
916
|
+
segmentPage: c
|
|
926
917
|
});
|
|
927
918
|
}
|
|
928
|
-
_getSceneAndTransformerByDrawingSearch(
|
|
929
|
-
if (
|
|
919
|
+
_getSceneAndTransformerByDrawingSearch(e) {
|
|
920
|
+
if (e == null)
|
|
930
921
|
return;
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
922
|
+
const n = this._renderManagerService.getRenderById(e), t = n == null ? void 0 : n.scene;
|
|
923
|
+
if (t == null)
|
|
933
924
|
return;
|
|
934
|
-
const
|
|
935
|
-
return { scene, transformer };
|
|
925
|
+
const r = t.getTransformerByCreate();
|
|
926
|
+
return { scene: t, transformer: r };
|
|
936
927
|
}
|
|
937
|
-
_getTransformCoordForDocumentOffset(
|
|
938
|
-
const { documentTransform } =
|
|
939
|
-
if (
|
|
940
|
-
return
|
|
928
|
+
_getTransformCoordForDocumentOffset(e, n, t, r) {
|
|
929
|
+
const { documentTransform: o } = e.getOffsetConfig(), s = n.transformVector2SceneCoord(ri.FromArray([t, r]));
|
|
930
|
+
if (s)
|
|
931
|
+
return o.clone().invert().applyPoint(s);
|
|
941
932
|
}
|
|
942
|
-
_createOrUpdateInlineAnchor(
|
|
943
|
-
const
|
|
944
|
-
if (
|
|
933
|
+
_createOrUpdateInlineAnchor(e, n) {
|
|
934
|
+
const t = this._renderManagerService.getRenderById(e);
|
|
935
|
+
if (t == null)
|
|
945
936
|
return;
|
|
946
|
-
const { mainComponent, scene } =
|
|
947
|
-
docsLeft,
|
|
948
|
-
docsTop
|
|
949
|
-
} =
|
|
937
|
+
const { mainComponent: r, scene: o } = t, s = r, {
|
|
938
|
+
docsLeft: a,
|
|
939
|
+
docsTop: d
|
|
940
|
+
} = s.getOffsetConfig(), c = pi(n), { left: l, top: u, height: m } = c, p = l + a, h = u + d;
|
|
950
941
|
if (this._anchorShape) {
|
|
951
|
-
this._anchorShape.transformByState({ left, top, height }), this._anchorShape.show();
|
|
942
|
+
this._anchorShape.transformByState({ left: p, top: h, height: m }), this._anchorShape.show();
|
|
952
943
|
return;
|
|
953
944
|
}
|
|
954
|
-
const
|
|
955
|
-
left,
|
|
956
|
-
top,
|
|
957
|
-
height,
|
|
945
|
+
const v = 6, w = new oi(Fi + Pe.generateRandomId(v), {
|
|
946
|
+
left: p,
|
|
947
|
+
top: h,
|
|
948
|
+
height: m,
|
|
958
949
|
strokeWidth: 2,
|
|
959
|
-
stroke:
|
|
950
|
+
stroke: si(Mt.darkGray, 1),
|
|
960
951
|
evented: !1
|
|
961
952
|
});
|
|
962
|
-
this._anchorShape =
|
|
953
|
+
this._anchorShape = w, o.addObject(w, wi);
|
|
963
954
|
}
|
|
964
955
|
_getDocObject() {
|
|
965
|
-
return
|
|
956
|
+
return vi(this._univerInstanceService, this._renderManagerService);
|
|
966
957
|
}
|
|
967
|
-
_getPageContentSize(
|
|
968
|
-
const
|
|
969
|
-
if (
|
|
958
|
+
_getPageContentSize(e) {
|
|
959
|
+
const n = this._renderManagerService.getRenderById(e.unitId), t = n == null ? void 0 : n.with(oe).getSkeleton(), r = 500, o = 500, s = t == null ? void 0 : t.getSkeletonData();
|
|
960
|
+
if (s == null || n == null)
|
|
970
961
|
return {
|
|
971
|
-
width:
|
|
972
|
-
height:
|
|
962
|
+
width: r,
|
|
963
|
+
height: o
|
|
973
964
|
};
|
|
974
|
-
const { pages } =
|
|
975
|
-
let
|
|
976
|
-
for (const
|
|
977
|
-
const { skeDrawings } =
|
|
978
|
-
if (
|
|
979
|
-
|
|
965
|
+
const { pages: a } = s;
|
|
966
|
+
let d = null;
|
|
967
|
+
for (const c of a) {
|
|
968
|
+
const { skeDrawings: l } = c;
|
|
969
|
+
if (l.has(e.drawingId)) {
|
|
970
|
+
d = c;
|
|
980
971
|
break;
|
|
981
972
|
}
|
|
982
973
|
}
|
|
983
|
-
if (
|
|
984
|
-
const { pageWidth, pageHeight, marginLeft, marginBottom, marginRight, marginTop } =
|
|
974
|
+
if (d) {
|
|
975
|
+
const { pageWidth: c, pageHeight: l, marginLeft: u, marginBottom: m, marginRight: p, marginTop: h } = d;
|
|
985
976
|
return {
|
|
986
|
-
width: Math.max(
|
|
987
|
-
height: Math.max(
|
|
977
|
+
width: Math.max(r, c - u - p),
|
|
978
|
+
height: Math.max(o, l - h - m)
|
|
988
979
|
};
|
|
989
980
|
} else
|
|
990
981
|
return {
|
|
991
|
-
width:
|
|
992
|
-
height:
|
|
982
|
+
width: r,
|
|
983
|
+
height: o
|
|
993
984
|
};
|
|
994
985
|
}
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
],
|
|
1002
|
-
var
|
|
1003
|
-
return
|
|
1004
|
-
for (var
|
|
1005
|
-
|
|
1006
|
-
for (var
|
|
986
|
+
};
|
|
987
|
+
on = Ui([
|
|
988
|
+
Ze(0, z),
|
|
989
|
+
Ze(1, J),
|
|
990
|
+
Ze(2, ve),
|
|
991
|
+
Ze(3, Q)
|
|
992
|
+
], on);
|
|
993
|
+
var fe = function() {
|
|
994
|
+
return fe = Object.assign || function(i) {
|
|
995
|
+
for (var e, n = 1, t = arguments.length; n < t; n++) {
|
|
996
|
+
e = arguments[n];
|
|
997
|
+
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
|
|
1007
998
|
}
|
|
1008
|
-
return
|
|
1009
|
-
},
|
|
1010
|
-
},
|
|
1011
|
-
var
|
|
1012
|
-
for (var
|
|
1013
|
-
if (
|
|
1014
|
-
for (var
|
|
1015
|
-
e.indexOf(
|
|
1016
|
-
return
|
|
1017
|
-
},
|
|
1018
|
-
var
|
|
1019
|
-
return
|
|
999
|
+
return i;
|
|
1000
|
+
}, fe.apply(this, arguments);
|
|
1001
|
+
}, ki = function(i, e) {
|
|
1002
|
+
var n = {};
|
|
1003
|
+
for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
|
|
1004
|
+
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1005
|
+
for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
|
|
1006
|
+
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
|
|
1007
|
+
return n;
|
|
1008
|
+
}, ot = Jn(function(i, e) {
|
|
1009
|
+
var n = i.icon, t = i.id, r = i.className, o = i.extend, s = ki(i, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), d = yi("_".concat(Gi()));
|
|
1010
|
+
return st(n, "".concat(t), { defIds: n.defIds, idSuffix: d.current }, fe({ ref: e, className: a }, s), o);
|
|
1020
1011
|
});
|
|
1021
|
-
function
|
|
1022
|
-
return
|
|
1023
|
-
return
|
|
1012
|
+
function st(i, e, n, t, r) {
|
|
1013
|
+
return Zn(i.tag, fe(fe({ key: e }, Hi(i, n, r)), t), (Wi(i, n).children || []).map(function(o, s) {
|
|
1014
|
+
return st(o, "".concat(e, "-").concat(i.tag, "-").concat(s), n, void 0, r);
|
|
1024
1015
|
}));
|
|
1025
1016
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
})), attrs;
|
|
1017
|
+
function Hi(i, e, n) {
|
|
1018
|
+
var t = fe({}, i.attrs);
|
|
1019
|
+
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
1020
|
+
var r = e.defIds;
|
|
1021
|
+
return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(o) {
|
|
1022
|
+
var s = o[0], a = o[1];
|
|
1023
|
+
typeof a == "string" && (t[s] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
1024
|
+
})), t;
|
|
1035
1025
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
}) }) : node;
|
|
1026
|
+
function Wi(i, e) {
|
|
1027
|
+
var n, t = e.defIds;
|
|
1028
|
+
return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? fe(fe({}, i), { children: i.children.map(function(r) {
|
|
1029
|
+
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? fe(fe({}, r), { attrs: fe(fe({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
1030
|
+
}) }) : i;
|
|
1042
1031
|
}
|
|
1043
|
-
|
|
1044
|
-
function generateShortUuid() {
|
|
1032
|
+
function Gi() {
|
|
1045
1033
|
return Math.random().toString(36).substring(2, 8);
|
|
1046
1034
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
return createElement(IconBase, Object.assign({}, props, {
|
|
1035
|
+
ot.displayName = "UniverIcon";
|
|
1036
|
+
var Vi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.2498 3.65005C2.2498 2.87685 2.87661 2.25005 3.64981 2.25005H7.9998C8.33118 2.25005 8.5998 1.98142 8.5998 1.65005C8.5998 1.31868 8.33118 1.05005 7.9998 1.05005H3.64981C2.21387 1.05005 1.0498 2.21411 1.0498 3.65005V12.35C1.0498 13.786 2.21386 14.95 3.6498 14.95H12.3498C13.7857 14.95 14.9498 13.786 14.9498 12.3501V8.00005C14.9498 7.66868 14.6812 7.40005 14.3498 7.40005C14.0184 7.40005 13.7498 7.66868 13.7498 8.00005V9.23974L12.2385 8.1063C11.7252 7.72129 11.0068 7.7723 10.5531 8.22605L9.00869 9.77041L6.73916 7.8251C6.24387 7.40055 5.5095 7.41278 5.02864 7.85359L2.2498 10.4009V3.65005ZM2.2498 12.0287V12.35C2.2498 13.1232 2.87661 13.75 3.6498 13.75H12.3498C13.123 13.75 13.7498 13.1232 13.7498 12.3501V10.7397L11.5186 9.06631C11.4829 9.03956 11.433 9.04314 11.4016 9.07458L9.92249 10.5537L11.1015 11.5642C11.3531 11.7799 11.3822 12.1587 11.1666 12.4103C10.9509 12.6619 10.5721 12.691 10.3205 12.4753L5.9582 8.7362C5.92384 8.70674 5.87288 8.70758 5.83952 8.73816L2.2498 12.0287Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M11.8097 1.14783C12.1411 1.14783 12.4097 1.41646 12.4097 1.74783V3.297H14.1541C14.4855 3.297 14.7541 3.56563 14.7541 3.897C14.7541 4.22837 14.4855 4.497 14.1541 4.497H12.4097V6.24167C12.4097 6.57304 12.1411 6.84167 11.8097 6.84167C11.4783 6.84167 11.2097 6.57304 11.2097 6.24167V4.497H9.6603C9.32893 4.497 9.0603 4.22837 9.0603 3.897C9.0603 3.56563 9.32893 3.297 9.6603 3.297H11.2097V1.74783C11.2097 1.41646 11.4783 1.14783 11.8097 1.14783Z" } }] }, at = Jn(function(i, e) {
|
|
1037
|
+
return Zn(ot, Object.assign({}, i, {
|
|
1051
1038
|
id: "add-image-single",
|
|
1052
|
-
ref,
|
|
1053
|
-
icon:
|
|
1039
|
+
ref: e,
|
|
1040
|
+
icon: Vi
|
|
1054
1041
|
}));
|
|
1055
1042
|
});
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1043
|
+
at.displayName = "AddImageSingle";
|
|
1044
|
+
const Cn = {
|
|
1058
1045
|
id: "doc.command.remove-doc-image",
|
|
1059
|
-
type:
|
|
1046
|
+
type: X.COMMAND,
|
|
1060
1047
|
// eslint-disable-next-line max-lines-per-function
|
|
1061
|
-
handler:
|
|
1062
|
-
var
|
|
1063
|
-
const
|
|
1064
|
-
if (
|
|
1048
|
+
handler: (i, e) => {
|
|
1049
|
+
var b, T, N, B;
|
|
1050
|
+
const n = i.get(z), t = i.get(J), r = i.get(Q), o = t.getCurrentUniverDocInstance();
|
|
1051
|
+
if (e == null || o == null)
|
|
1065
1052
|
return !1;
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
const
|
|
1053
|
+
const s = r.getRenderById(e.unitId).with(ye), { drawings: a } = e, d = (b = s.getSegment()) != null ? b : "", c = new In(), l = q.getInstance(), u = (N = (T = o.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : T.customBlocks) != null ? N : [], m = a.map((R) => u.find((I) => I.blockId === R.drawingId)).filter((R) => !!R).sort((R, I) => R.startIndex > I.startIndex ? 1 : -1), p = a[0].unitId, h = new Rt();
|
|
1054
|
+
h.reset();
|
|
1055
|
+
const v = m[0].startIndex, w = [
|
|
1069
1056
|
{
|
|
1070
|
-
startOffset:
|
|
1071
|
-
endOffset:
|
|
1057
|
+
startOffset: v,
|
|
1058
|
+
endOffset: v
|
|
1072
1059
|
}
|
|
1073
|
-
],
|
|
1074
|
-
id:
|
|
1060
|
+
], S = {
|
|
1061
|
+
id: Z.id,
|
|
1075
1062
|
params: {
|
|
1076
|
-
unitId,
|
|
1063
|
+
unitId: p,
|
|
1077
1064
|
actions: [],
|
|
1078
|
-
textRanges
|
|
1065
|
+
textRanges: w
|
|
1079
1066
|
}
|
|
1080
|
-
},
|
|
1081
|
-
for (const
|
|
1082
|
-
const { startIndex } =
|
|
1083
|
-
|
|
1084
|
-
t:
|
|
1085
|
-
len:
|
|
1086
|
-
}),
|
|
1087
|
-
t:
|
|
1067
|
+
}, O = [];
|
|
1068
|
+
for (const R of m) {
|
|
1069
|
+
const { startIndex: I } = R;
|
|
1070
|
+
I > h.cursor && c.push({
|
|
1071
|
+
t: Y.RETAIN,
|
|
1072
|
+
len: I - h.cursor
|
|
1073
|
+
}), c.push({
|
|
1074
|
+
t: Y.DELETE,
|
|
1088
1075
|
len: 1
|
|
1089
|
-
}),
|
|
1076
|
+
}), h.moveCursorTo(I + 1);
|
|
1090
1077
|
}
|
|
1091
|
-
const
|
|
1092
|
-
|
|
1093
|
-
for (const
|
|
1094
|
-
const { blockId } =
|
|
1095
|
-
|
|
1078
|
+
const D = ze(o, d);
|
|
1079
|
+
O.push(l.editOp(c.serialize(), D));
|
|
1080
|
+
for (const R of m) {
|
|
1081
|
+
const { blockId: I } = R, j = ((B = o.getDrawings()) != null ? B : {})[I], A = o.getDrawingsOrder().indexOf(I), W = l.removeOp(["drawings", I], j), _ = l.removeOp(["drawingsOrder", A], I);
|
|
1082
|
+
O.push(W), O.push(_);
|
|
1096
1083
|
}
|
|
1097
|
-
return
|
|
1098
|
-
}
|
|
1099
|
-
},
|
|
1084
|
+
return S.params.actions = O.reduce((R, I) => q.compose(R, I), null), !!n.syncExecuteCommand(S.id, S.params);
|
|
1085
|
+
}
|
|
1086
|
+
}, ct = {
|
|
1100
1087
|
id: "doc.command.delete-drawing",
|
|
1101
|
-
type:
|
|
1102
|
-
handler:
|
|
1103
|
-
const
|
|
1104
|
-
if (
|
|
1088
|
+
type: X.COMMAND,
|
|
1089
|
+
handler: (i) => {
|
|
1090
|
+
const e = i.get(z), t = i.get(je).getFocusDrawings();
|
|
1091
|
+
if (t.length === 0)
|
|
1105
1092
|
return !1;
|
|
1106
|
-
const { unitId } =
|
|
1107
|
-
const { unitId:
|
|
1093
|
+
const { unitId: r } = t[0], o = t.map((s) => {
|
|
1094
|
+
const { unitId: a, subUnitId: d, drawingId: c, drawingType: l } = s;
|
|
1108
1095
|
return {
|
|
1109
|
-
unitId:
|
|
1110
|
-
subUnitId,
|
|
1111
|
-
drawingId,
|
|
1112
|
-
drawingType
|
|
1096
|
+
unitId: a,
|
|
1097
|
+
subUnitId: d,
|
|
1098
|
+
drawingId: c,
|
|
1099
|
+
drawingType: l
|
|
1113
1100
|
};
|
|
1114
1101
|
});
|
|
1115
|
-
return
|
|
1116
|
-
unitId,
|
|
1117
|
-
drawings:
|
|
1102
|
+
return e.executeCommand(Cn.id, {
|
|
1103
|
+
unitId: r,
|
|
1104
|
+
drawings: o
|
|
1118
1105
|
});
|
|
1119
|
-
}
|
|
1120
|
-
},
|
|
1106
|
+
}
|
|
1107
|
+
}, dt = {
|
|
1121
1108
|
id: "doc.command.group-doc-image",
|
|
1122
|
-
type:
|
|
1123
|
-
handler:
|
|
1124
|
-
|
|
1125
|
-
const
|
|
1126
|
-
if (!
|
|
1127
|
-
const
|
|
1128
|
-
return
|
|
1129
|
-
|
|
1130
|
-
|
|
1109
|
+
type: X.COMMAND,
|
|
1110
|
+
handler: (i, e) => {
|
|
1111
|
+
i.get(z), i.get($n);
|
|
1112
|
+
const n = i.get(je);
|
|
1113
|
+
if (!e) return !1;
|
|
1114
|
+
const t = [];
|
|
1115
|
+
return e.forEach(({ parent: r, children: o }) => {
|
|
1116
|
+
t.push(r.unitId), o.forEach((s) => {
|
|
1117
|
+
t.push(s.unitId);
|
|
1131
1118
|
});
|
|
1132
|
-
}),
|
|
1133
|
-
}
|
|
1134
|
-
},
|
|
1119
|
+
}), n.getGroupDrawingOp(e), !1;
|
|
1120
|
+
}
|
|
1121
|
+
}, lt = {
|
|
1135
1122
|
id: "doc.command.insert-doc-image",
|
|
1136
|
-
type:
|
|
1123
|
+
type: X.COMMAND,
|
|
1137
1124
|
// eslint-disable-next-line max-lines-per-function
|
|
1138
|
-
handler:
|
|
1139
|
-
var
|
|
1140
|
-
if (
|
|
1125
|
+
handler: (i, e) => {
|
|
1126
|
+
var T, N, B, R;
|
|
1127
|
+
if (e == null)
|
|
1141
1128
|
return !1;
|
|
1142
|
-
const
|
|
1143
|
-
if (
|
|
1129
|
+
const n = i.get(z), t = i.get(_n), r = i.get(J), o = t.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
|
|
1130
|
+
if (o == null || s == null)
|
|
1144
1131
|
return !1;
|
|
1145
|
-
const
|
|
1146
|
-
if (
|
|
1132
|
+
const a = s.getUnitId(), { drawings: d } = e, { collapsed: c, startOffset: l, segmentId: u } = o, m = s.getSelfOrHeaderFooterModel(u).getBody();
|
|
1133
|
+
if (m == null)
|
|
1147
1134
|
return !1;
|
|
1148
|
-
const
|
|
1149
|
-
let
|
|
1150
|
-
if (
|
|
1151
|
-
|
|
1152
|
-
t:
|
|
1153
|
-
len:
|
|
1135
|
+
const p = new In(), h = q.getInstance(), v = [], w = (N = (T = s.getSnapshot().drawingsOrder) == null ? void 0 : T.length) != null ? N : 0;
|
|
1136
|
+
let S = 0;
|
|
1137
|
+
if (c)
|
|
1138
|
+
l > 0 && p.push({
|
|
1139
|
+
t: Y.RETAIN,
|
|
1140
|
+
len: l
|
|
1154
1141
|
});
|
|
1155
1142
|
else {
|
|
1156
|
-
const
|
|
1157
|
-
|
|
1158
|
-
const
|
|
1159
|
-
if (
|
|
1160
|
-
for (const
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1143
|
+
const I = Nt.selection.delete([o], m, 0, null, !1);
|
|
1144
|
+
p.push(...I);
|
|
1145
|
+
const j = Ii(m, [o]), H = (B = s.getDrawings()) != null ? B : {}, A = (R = s.getDrawingsOrder()) != null ? R : [], W = j.sort((_, C) => A.indexOf(_) > A.indexOf(C) ? -1 : A.indexOf(_) < A.indexOf(C) ? 1 : 0);
|
|
1146
|
+
if (W.length > 0)
|
|
1147
|
+
for (const _ of W) {
|
|
1148
|
+
const C = H[_], M = A.indexOf(_);
|
|
1149
|
+
if (C == null || M < 0)
|
|
1163
1150
|
continue;
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1151
|
+
const P = h.removeOp(["drawings", _], C), L = h.removeOp(["drawingsOrder", M], _);
|
|
1152
|
+
v.push(P), v.push(L), S++;
|
|
1166
1153
|
}
|
|
1167
1154
|
}
|
|
1168
|
-
|
|
1169
|
-
t:
|
|
1155
|
+
p.push({
|
|
1156
|
+
t: Y.INSERT,
|
|
1170
1157
|
body: {
|
|
1171
|
-
dataStream: "\b".repeat(
|
|
1172
|
-
customBlocks:
|
|
1173
|
-
startIndex:
|
|
1174
|
-
blockId:
|
|
1158
|
+
dataStream: "\b".repeat(d.length),
|
|
1159
|
+
customBlocks: d.map((I, j) => ({
|
|
1160
|
+
startIndex: j,
|
|
1161
|
+
blockId: I.drawingId
|
|
1175
1162
|
}))
|
|
1176
1163
|
},
|
|
1177
|
-
len:
|
|
1164
|
+
len: d.length
|
|
1178
1165
|
});
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
for (const
|
|
1182
|
-
const { drawingId } =
|
|
1183
|
-
|
|
1166
|
+
const O = ze(s, u), D = h.editOp(p.serialize(), O);
|
|
1167
|
+
v.push(D);
|
|
1168
|
+
for (const I of d) {
|
|
1169
|
+
const { drawingId: j } = I, H = h.insertOp(["drawings", j], I), A = h.insertOp(["drawingsOrder", w - S], j);
|
|
1170
|
+
v.push(H), v.push(A);
|
|
1184
1171
|
}
|
|
1185
|
-
const
|
|
1186
|
-
id:
|
|
1172
|
+
const x = {
|
|
1173
|
+
id: Z.id,
|
|
1187
1174
|
params: {
|
|
1188
|
-
unitId,
|
|
1175
|
+
unitId: a,
|
|
1189
1176
|
actions: [],
|
|
1190
1177
|
textRanges: []
|
|
1191
1178
|
}
|
|
1192
1179
|
};
|
|
1193
|
-
return
|
|
1194
|
-
}
|
|
1195
|
-
},
|
|
1180
|
+
return x.params.actions = v.reduce((I, j) => q.compose(I, j), null), !!n.syncExecuteCommand(x.id, x.params);
|
|
1181
|
+
}
|
|
1182
|
+
}, gt = {
|
|
1196
1183
|
id: "doc.command.set-drawing-arrange",
|
|
1197
|
-
type:
|
|
1198
|
-
handler:
|
|
1199
|
-
const
|
|
1200
|
-
if (
|
|
1184
|
+
type: X.COMMAND,
|
|
1185
|
+
handler: (i, e) => {
|
|
1186
|
+
const n = i.get(z), t = i.get(je);
|
|
1187
|
+
if (e == null)
|
|
1201
1188
|
return !1;
|
|
1202
|
-
const { unitId, subUnitId, drawingIds, arrangeType } =
|
|
1203
|
-
let
|
|
1204
|
-
if (
|
|
1189
|
+
const { unitId: r, subUnitId: o, drawingIds: s, arrangeType: a } = e, d = { unitId: r, subUnitId: o, drawingIds: s };
|
|
1190
|
+
let c;
|
|
1191
|
+
if (a === Je.forward ? c = t.getForwardDrawingsOp(d) : a === Je.backward ? c = t.getBackwardDrawingOp(d) : a === Je.front ? c = t.getFrontDrawingsOp(d) : a === Je.back && (c = t.getBackDrawingsOp(d)), c == null)
|
|
1205
1192
|
return !1;
|
|
1206
|
-
const { redo } =
|
|
1207
|
-
if (
|
|
1193
|
+
const { redo: l } = c;
|
|
1194
|
+
if (l == null)
|
|
1208
1195
|
return !1;
|
|
1209
|
-
const
|
|
1210
|
-
let
|
|
1211
|
-
|
|
1212
|
-
const
|
|
1213
|
-
id:
|
|
1196
|
+
const u = [];
|
|
1197
|
+
let m = Pe.deepClone(l);
|
|
1198
|
+
m = m.slice(3), m.unshift("drawingsOrder"), u.push(m);
|
|
1199
|
+
const p = {
|
|
1200
|
+
id: Z.id,
|
|
1214
1201
|
params: {
|
|
1215
|
-
unitId,
|
|
1202
|
+
unitId: r,
|
|
1216
1203
|
actions: [],
|
|
1217
1204
|
textRanges: null
|
|
1218
1205
|
}
|
|
1219
1206
|
};
|
|
1220
|
-
return
|
|
1221
|
-
}
|
|
1222
|
-
},
|
|
1207
|
+
return p.params.actions = u.reduce((v, w) => q.compose(v, w), null), !!n.syncExecuteCommand(p.id, p.params);
|
|
1208
|
+
}
|
|
1209
|
+
}, mt = {
|
|
1223
1210
|
id: "doc.command.ungroup-doc-image",
|
|
1224
|
-
type:
|
|
1225
|
-
handler:
|
|
1226
|
-
|
|
1227
|
-
const
|
|
1228
|
-
if (!
|
|
1229
|
-
const
|
|
1230
|
-
return
|
|
1231
|
-
|
|
1232
|
-
|
|
1211
|
+
type: X.COMMAND,
|
|
1212
|
+
handler: (i, e) => {
|
|
1213
|
+
i.get(z), i.get($n);
|
|
1214
|
+
const n = i.get(je);
|
|
1215
|
+
if (!e) return !1;
|
|
1216
|
+
const t = [];
|
|
1217
|
+
return e.forEach(({ parent: r, children: o }) => {
|
|
1218
|
+
t.push(r.unitId), o.forEach((s) => {
|
|
1219
|
+
t.push(s.unitId);
|
|
1233
1220
|
});
|
|
1234
|
-
}),
|
|
1235
|
-
}
|
|
1221
|
+
}), n.getUngroupDrawingOp(e), !1;
|
|
1222
|
+
}
|
|
1236
1223
|
};
|
|
1237
|
-
var
|
|
1238
|
-
for (var
|
|
1239
|
-
(
|
|
1240
|
-
return
|
|
1241
|
-
},
|
|
1242
|
-
let
|
|
1243
|
-
constructor(
|
|
1244
|
-
super(), this._context =
|
|
1224
|
+
var $i = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, qi = (i, e, n, t) => {
|
|
1225
|
+
for (var r = t > 1 ? void 0 : t ? zi(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1226
|
+
(s = i[o]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
1227
|
+
return t && r && $i(e, n, r), r;
|
|
1228
|
+
}, ge = (i, e) => (n, t) => e(n, t, i);
|
|
1229
|
+
let sn = class extends Xe {
|
|
1230
|
+
constructor(i, e, n, t, r, o, s, a, d, c, l, u, m) {
|
|
1231
|
+
super(), this._context = i, this._commandService = e, this._docSelectionManagerService = n, this._renderManagerSrv = t, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = s, this._contextService = a, this._messageService = d, this._localeService = c, this._docSelectionRenderService = l, this._docRefreshDrawingsService = u, this._fileOpenerService = m, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
|
|
1245
1232
|
}
|
|
1246
1233
|
async insertDocImage() {
|
|
1247
|
-
const
|
|
1234
|
+
const i = await this._fileOpenerService.openFile({
|
|
1248
1235
|
multiple: !0,
|
|
1249
|
-
accept:
|
|
1250
|
-
}),
|
|
1251
|
-
return
|
|
1252
|
-
type:
|
|
1253
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
1254
|
-
}), !1) :
|
|
1236
|
+
accept: zt.map((n) => `.${n.replace("image/", "")}`).join(",")
|
|
1237
|
+
}), e = i.length;
|
|
1238
|
+
return e > Tn ? (this._messageService.show({
|
|
1239
|
+
type: Ln.Error,
|
|
1240
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(Tn))
|
|
1241
|
+
}), !1) : e === 0 ? !1 : (await this._insertFloatImages(i), !0);
|
|
1255
1242
|
}
|
|
1256
1243
|
// eslint-disable-next-line max-lines-per-function
|
|
1257
|
-
async _insertFloatImages(
|
|
1258
|
-
let
|
|
1244
|
+
async _insertFloatImages(i) {
|
|
1245
|
+
let e = [];
|
|
1259
1246
|
try {
|
|
1260
|
-
|
|
1261
|
-
} catch (
|
|
1262
|
-
const
|
|
1263
|
-
let
|
|
1264
|
-
switch (
|
|
1265
|
-
case
|
|
1266
|
-
|
|
1247
|
+
e = await Promise.all(i.map((r) => this._imageIoService.saveImage(r)));
|
|
1248
|
+
} catch (r) {
|
|
1249
|
+
const o = r.message;
|
|
1250
|
+
let s = "";
|
|
1251
|
+
switch (o) {
|
|
1252
|
+
case hn.ERROR_EXCEED_SIZE:
|
|
1253
|
+
s = this._localeService.t("update-status.exceedMaxSize", String(qt / (1024 * 1024)));
|
|
1267
1254
|
break;
|
|
1268
|
-
case
|
|
1269
|
-
|
|
1255
|
+
case hn.ERROR_IMAGE_TYPE:
|
|
1256
|
+
s = this._localeService.t("update-status.invalidImageType");
|
|
1270
1257
|
break;
|
|
1271
|
-
case
|
|
1272
|
-
|
|
1258
|
+
case hn.ERROR_IMAGE:
|
|
1259
|
+
s = this._localeService.t("update-status.invalidImage");
|
|
1273
1260
|
break;
|
|
1274
1261
|
}
|
|
1275
1262
|
this._messageService.show({
|
|
1276
|
-
type:
|
|
1277
|
-
content
|
|
1263
|
+
type: Ln.Error,
|
|
1264
|
+
content: s
|
|
1278
1265
|
});
|
|
1279
1266
|
}
|
|
1280
|
-
if (
|
|
1267
|
+
if (e.length === 0)
|
|
1281
1268
|
return;
|
|
1282
|
-
const { unitId } = this._context,
|
|
1283
|
-
for (const
|
|
1284
|
-
if (
|
|
1269
|
+
const { unitId: n } = this._context, t = [];
|
|
1270
|
+
for (const r of e) {
|
|
1271
|
+
if (r == null)
|
|
1285
1272
|
continue;
|
|
1286
|
-
const { imageId, imageSourceType, source, base64Cache } =
|
|
1287
|
-
this._imageIoService.addImageSourceCache(
|
|
1288
|
-
let
|
|
1289
|
-
if (
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1273
|
+
const { imageId: o, imageSourceType: s, source: a, base64Cache: d } = r, { width: c, height: l, image: u } = await Xt(d || "");
|
|
1274
|
+
this._imageIoService.addImageSourceCache(o, s, u);
|
|
1275
|
+
let m = 1;
|
|
1276
|
+
if (c > yn || l > bn) {
|
|
1277
|
+
const w = yn / c, S = bn / l;
|
|
1278
|
+
m = Math.min(w, S);
|
|
1292
1279
|
}
|
|
1293
|
-
const
|
|
1294
|
-
if (
|
|
1280
|
+
const p = this._getImagePosition(c * m, l * m);
|
|
1281
|
+
if (p == null)
|
|
1295
1282
|
return;
|
|
1296
|
-
const
|
|
1297
|
-
unitId,
|
|
1298
|
-
subUnitId:
|
|
1299
|
-
drawingId:
|
|
1300
|
-
drawingType:
|
|
1301
|
-
imageSourceType,
|
|
1302
|
-
source,
|
|
1303
|
-
transform:
|
|
1304
|
-
docTransform,
|
|
1305
|
-
behindDoc:
|
|
1283
|
+
const h = {
|
|
1284
|
+
unitId: n,
|
|
1285
|
+
subUnitId: n,
|
|
1286
|
+
drawingId: o,
|
|
1287
|
+
drawingType: Et.DRAWING_IMAGE,
|
|
1288
|
+
imageSourceType: s,
|
|
1289
|
+
source: a,
|
|
1290
|
+
transform: _i(p),
|
|
1291
|
+
docTransform: p,
|
|
1292
|
+
behindDoc: re.FALSE,
|
|
1306
1293
|
title: "",
|
|
1307
1294
|
description: "",
|
|
1308
|
-
layoutType:
|
|
1295
|
+
layoutType: k.INLINE,
|
|
1309
1296
|
// Insert inline drawing by default.
|
|
1310
|
-
wrapText:
|
|
1297
|
+
wrapText: $e.BOTH_SIDES,
|
|
1311
1298
|
distB: 0,
|
|
1312
1299
|
distL: 0,
|
|
1313
1300
|
distR: 0,
|
|
1314
1301
|
distT: 0
|
|
1315
1302
|
};
|
|
1316
|
-
this._isInsertInHeaderFooter() && (
|
|
1303
|
+
this._isInsertInHeaderFooter() && (h.isMultiTransform = re.TRUE, h.transforms = h.transform ? [h.transform] : null), t.push(h);
|
|
1317
1304
|
}
|
|
1318
|
-
this._commandService.executeCommand(
|
|
1319
|
-
unitId,
|
|
1320
|
-
drawings:
|
|
1305
|
+
this._commandService.executeCommand(lt.id, {
|
|
1306
|
+
unitId: n,
|
|
1307
|
+
drawings: t
|
|
1321
1308
|
});
|
|
1322
1309
|
}
|
|
1323
1310
|
_isInsertInHeaderFooter() {
|
|
1324
|
-
var
|
|
1325
|
-
const { unitId } = this._context,
|
|
1326
|
-
return
|
|
1311
|
+
var t;
|
|
1312
|
+
const { unitId: i } = this._context, e = (t = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : t.with(oe).getViewModel(), n = e == null ? void 0 : e.getEditArea();
|
|
1313
|
+
return n === Ue.HEADER || n === Ue.FOOTER;
|
|
1327
1314
|
}
|
|
1328
|
-
_getImagePosition(
|
|
1329
|
-
const
|
|
1315
|
+
_getImagePosition(i, e) {
|
|
1316
|
+
const n = this._docSelectionRenderService.getActiveTextRange(), t = (n == null ? void 0 : n.getAbsolutePosition()) || {
|
|
1330
1317
|
left: 0,
|
|
1331
1318
|
top: 0
|
|
1332
1319
|
};
|
|
1333
1320
|
return {
|
|
1334
1321
|
size: {
|
|
1335
|
-
width:
|
|
1336
|
-
height:
|
|
1322
|
+
width: i,
|
|
1323
|
+
height: e
|
|
1337
1324
|
},
|
|
1338
1325
|
positionH: {
|
|
1339
|
-
relativeFrom:
|
|
1340
|
-
posOffset:
|
|
1326
|
+
relativeFrom: ee.PAGE,
|
|
1327
|
+
posOffset: t.left
|
|
1341
1328
|
},
|
|
1342
1329
|
positionV: {
|
|
1343
|
-
relativeFrom:
|
|
1330
|
+
relativeFrom: G.PARAGRAPH,
|
|
1344
1331
|
posOffset: 0
|
|
1345
1332
|
},
|
|
1346
1333
|
angle: 0
|
|
1347
1334
|
};
|
|
1348
1335
|
}
|
|
1349
1336
|
_updateOrderListener() {
|
|
1350
|
-
this._drawingManagerService.featurePluginOrderUpdate$.subscribe((
|
|
1351
|
-
const { unitId, subUnitId, drawingIds, arrangeType } =
|
|
1352
|
-
this._commandService.executeCommand(
|
|
1353
|
-
unitId,
|
|
1354
|
-
subUnitId,
|
|
1355
|
-
drawingIds,
|
|
1356
|
-
arrangeType
|
|
1337
|
+
this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
|
|
1338
|
+
const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: r } = i;
|
|
1339
|
+
this._commandService.executeCommand(gt.id, {
|
|
1340
|
+
unitId: e,
|
|
1341
|
+
subUnitId: n,
|
|
1342
|
+
drawingIds: t,
|
|
1343
|
+
arrangeType: r
|
|
1357
1344
|
});
|
|
1358
1345
|
});
|
|
1359
1346
|
}
|
|
1360
1347
|
_groupDrawingListener() {
|
|
1361
|
-
this._drawingManagerService.featurePluginGroupUpdate$.subscribe((
|
|
1362
|
-
this._commandService.executeCommand(
|
|
1363
|
-
}), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((
|
|
1364
|
-
this._commandService.executeCommand(
|
|
1348
|
+
this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
|
|
1349
|
+
this._commandService.executeCommand(dt.id, i);
|
|
1350
|
+
}), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
|
|
1351
|
+
this._commandService.executeCommand(mt.id, i);
|
|
1365
1352
|
});
|
|
1366
1353
|
}
|
|
1367
1354
|
_getCurrentSceneAndTransformer() {
|
|
1368
|
-
const { scene, mainComponent } = this._context;
|
|
1369
|
-
if (
|
|
1355
|
+
const { scene: i, mainComponent: e } = this._context;
|
|
1356
|
+
if (i == null || e == null)
|
|
1370
1357
|
return;
|
|
1371
|
-
const
|
|
1372
|
-
return { scene, transformer, docsLeft, docsTop };
|
|
1358
|
+
const n = i.getTransformerByCreate(), { docsLeft: t, docsTop: r } = e.getOffsetConfig();
|
|
1359
|
+
return { scene: i, transformer: n, docsLeft: t, docsTop: r };
|
|
1373
1360
|
}
|
|
1374
1361
|
_transformDrawingListener() {
|
|
1375
|
-
const
|
|
1376
|
-
if (
|
|
1377
|
-
this.disposeWithMe(
|
|
1362
|
+
const i = this._getCurrentSceneAndTransformer();
|
|
1363
|
+
if (i && i.transformer)
|
|
1364
|
+
this.disposeWithMe(i.transformer.changeEnd$.pipe(Yn(30)).subscribe((e) => {
|
|
1378
1365
|
this._docSelectionManagerService.refreshSelection();
|
|
1379
1366
|
}));
|
|
1380
1367
|
else
|
|
@@ -1382,174 +1369,174 @@ let DocDrawingUpdateRenderController = (_a3 = class extends Disposable {
|
|
|
1382
1369
|
}
|
|
1383
1370
|
_focusDrawingListener() {
|
|
1384
1371
|
this.disposeWithMe(
|
|
1385
|
-
this._drawingManagerService.focus$.subscribe((
|
|
1386
|
-
var
|
|
1387
|
-
const { transformer, docsLeft, docsTop } = (
|
|
1388
|
-
if (
|
|
1389
|
-
this._contextService.setContextValue(
|
|
1372
|
+
this._drawingManagerService.focus$.subscribe((i) => {
|
|
1373
|
+
var r;
|
|
1374
|
+
const { transformer: e, docsLeft: n, docsTop: t } = (r = this._getCurrentSceneAndTransformer()) != null ? r : {};
|
|
1375
|
+
if (i == null || i.length === 0)
|
|
1376
|
+
this._contextService.setContextValue(tn, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
|
|
1390
1377
|
zeroTop: 0,
|
|
1391
1378
|
zeroLeft: 0
|
|
1392
1379
|
});
|
|
1393
1380
|
else {
|
|
1394
|
-
this._contextService.setContextValue(
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1397
|
-
zeroTop:
|
|
1398
|
-
zeroLeft:
|
|
1381
|
+
this._contextService.setContextValue(tn, !0), this._docDrawingService.focusDrawing(i), this._setDrawingSelections(i);
|
|
1382
|
+
const o = this._docSelectionRenderService.getSegment(), s = this._findSegmentIdByDrawingId(i[0].drawingId);
|
|
1383
|
+
o !== s && this._docSelectionRenderService.setSegment(s), e && e.resetProps({
|
|
1384
|
+
zeroTop: t,
|
|
1385
|
+
zeroLeft: n
|
|
1399
1386
|
});
|
|
1400
1387
|
}
|
|
1401
1388
|
})
|
|
1402
1389
|
);
|
|
1403
1390
|
}
|
|
1404
|
-
_findSegmentIdByDrawingId(
|
|
1405
|
-
var
|
|
1406
|
-
const { unit:
|
|
1407
|
-
if (((
|
|
1391
|
+
_findSegmentIdByDrawingId(i) {
|
|
1392
|
+
var s, a, d;
|
|
1393
|
+
const { unit: e } = this._context, { body: n, headers: t = {}, footers: r = {} } = e.getSnapshot();
|
|
1394
|
+
if (((s = n == null ? void 0 : n.customBlocks) != null ? s : []).some((c) => c.blockId === i))
|
|
1408
1395
|
return "";
|
|
1409
|
-
for (const
|
|
1410
|
-
if ((
|
|
1411
|
-
return
|
|
1412
|
-
for (const
|
|
1413
|
-
if ((
|
|
1414
|
-
return
|
|
1396
|
+
for (const c of Object.keys(t))
|
|
1397
|
+
if ((a = t[c].body.customBlocks) != null && a.some((l) => l.blockId === i))
|
|
1398
|
+
return c;
|
|
1399
|
+
for (const c of Object.keys(r))
|
|
1400
|
+
if ((d = r[c].body.customBlocks) != null && d.some((l) => l.blockId === i))
|
|
1401
|
+
return c;
|
|
1415
1402
|
return "";
|
|
1416
1403
|
}
|
|
1417
1404
|
// Update drawings edit status and opacity. You can not edit header footer images when you are editing body. and vice verse.
|
|
1418
1405
|
_updateDrawingsEditStatus() {
|
|
1419
|
-
var
|
|
1420
|
-
const { unit:
|
|
1421
|
-
if (
|
|
1406
|
+
var a;
|
|
1407
|
+
const { unit: i, scene: e, unitId: n } = this._context, t = (a = this._renderManagerSrv.getRenderById(n)) == null ? void 0 : a.with(oe).getViewModel();
|
|
1408
|
+
if (t == null || i == null)
|
|
1422
1409
|
return;
|
|
1423
|
-
const
|
|
1424
|
-
for (const
|
|
1425
|
-
const
|
|
1426
|
-
if (
|
|
1427
|
-
for (const
|
|
1428
|
-
|
|
1410
|
+
const r = i.getSnapshot(), { drawings: o = {} } = r, s = t.getEditArea() === Ue.BODY;
|
|
1411
|
+
for (const d of Object.keys(o)) {
|
|
1412
|
+
const c = o[d], l = Kt({ unitId: n, drawingId: c.drawingId, subUnitId: n }), u = e.fuzzyMathObjects(l, !0);
|
|
1413
|
+
if (u.length)
|
|
1414
|
+
for (const m of u)
|
|
1415
|
+
e.detachTransformerFrom(m), m.setOpacity(0.5), (s && c.isMultiTransform !== re.TRUE || !s && c.isMultiTransform === re.TRUE) && (e.attachTransformerTo(m), m.setOpacity(1));
|
|
1429
1416
|
}
|
|
1430
1417
|
}
|
|
1431
1418
|
_editAreaChangeListener() {
|
|
1432
|
-
var
|
|
1433
|
-
const { unitId } = this._context,
|
|
1434
|
-
|
|
1435
|
-
|
|
1419
|
+
var n;
|
|
1420
|
+
const { unitId: i } = this._context, e = (n = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : n.with(oe).getViewModel();
|
|
1421
|
+
e != null && (this._updateDrawingsEditStatus(), this.disposeWithMe(
|
|
1422
|
+
e.editAreaChange$.subscribe(() => {
|
|
1436
1423
|
this._updateDrawingsEditStatus();
|
|
1437
1424
|
})
|
|
1438
|
-
), this._docRefreshDrawingsService.refreshDrawings$.subscribe((
|
|
1439
|
-
|
|
1425
|
+
), this._docRefreshDrawingsService.refreshDrawings$.subscribe((t) => {
|
|
1426
|
+
t != null && queueMicrotask(() => {
|
|
1440
1427
|
this._updateDrawingsEditStatus();
|
|
1441
1428
|
});
|
|
1442
1429
|
}), this.disposeWithMe(
|
|
1443
|
-
this._commandService.onCommandExecuted(async (
|
|
1444
|
-
|
|
1430
|
+
this._commandService.onCommandExecuted(async (t) => {
|
|
1431
|
+
t.id === Z.id && queueMicrotask(() => {
|
|
1445
1432
|
this._updateDrawingsEditStatus();
|
|
1446
1433
|
});
|
|
1447
1434
|
})
|
|
1448
1435
|
));
|
|
1449
1436
|
}
|
|
1450
|
-
_setDrawingSelections(
|
|
1451
|
-
var
|
|
1452
|
-
const { unit } = this._context,
|
|
1453
|
-
const
|
|
1454
|
-
return
|
|
1455
|
-
}).filter((
|
|
1456
|
-
this._docSelectionManagerService.replaceDocRanges(
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
],
|
|
1473
|
-
const
|
|
1437
|
+
_setDrawingSelections(i) {
|
|
1438
|
+
var r, o;
|
|
1439
|
+
const { unit: e } = this._context, n = (o = (r = e.getSnapshot().body) == null ? void 0 : r.customBlocks) != null ? o : [], t = i.map((s) => {
|
|
1440
|
+
const a = s.drawingId, d = n.find((c) => c.blockId === a);
|
|
1441
|
+
return d ? d.startIndex : null;
|
|
1442
|
+
}).filter((s) => s !== null).map((s) => ({ startOffset: s, endOffset: s + 1 }));
|
|
1443
|
+
this._docSelectionManagerService.replaceDocRanges(t);
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
sn = qi([
|
|
1447
|
+
ge(1, z),
|
|
1448
|
+
ge(2, we(_n)),
|
|
1449
|
+
ge(3, Q),
|
|
1450
|
+
ge(4, Yt),
|
|
1451
|
+
ge(5, je),
|
|
1452
|
+
ge(6, ve),
|
|
1453
|
+
ge(7, zn),
|
|
1454
|
+
ge(8, ci),
|
|
1455
|
+
ge(9, we(ln)),
|
|
1456
|
+
ge(10, we(ye)),
|
|
1457
|
+
ge(11, we(gn)),
|
|
1458
|
+
ge(12, di)
|
|
1459
|
+
], sn);
|
|
1460
|
+
const ut = {
|
|
1474
1461
|
id: "doc.command.insert-float-image",
|
|
1475
|
-
type:
|
|
1476
|
-
handler:
|
|
1477
|
-
var
|
|
1478
|
-
return (
|
|
1479
|
-
}
|
|
1480
|
-
},
|
|
1462
|
+
type: X.COMMAND,
|
|
1463
|
+
handler: (i) => {
|
|
1464
|
+
var n, t;
|
|
1465
|
+
return (t = (n = i.get(Q).getCurrentTypeOfRenderer(Te.UNIVER_DOC)) == null ? void 0 : n.with(sn).insertDocImage()) != null ? t : !1;
|
|
1466
|
+
}
|
|
1467
|
+
}, Ke = {
|
|
1481
1468
|
id: "doc.command.move-drawing",
|
|
1482
|
-
type:
|
|
1483
|
-
handler:
|
|
1484
|
-
const
|
|
1485
|
-
if (
|
|
1469
|
+
type: X.COMMAND,
|
|
1470
|
+
handler: (i, e) => {
|
|
1471
|
+
const n = i.get(z), t = i.get(je), r = i.get(J), o = i.get(Q), { direction: s } = e, a = t.getFocusDrawings();
|
|
1472
|
+
if (a.length === 0)
|
|
1486
1473
|
return !1;
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1474
|
+
const d = a[0].unitId, c = o.getRenderById(d), l = c == null ? void 0 : c.scene;
|
|
1475
|
+
if (l == null)
|
|
1489
1476
|
return !1;
|
|
1490
|
-
const
|
|
1491
|
-
var
|
|
1492
|
-
const { drawingId } =
|
|
1493
|
-
if (
|
|
1477
|
+
const u = l.getTransformerByCreate(), m = r.getUniverDocInstance(d), p = a.map((v) => {
|
|
1478
|
+
var T, N, B, R, I;
|
|
1479
|
+
const { drawingId: w } = v, S = (T = m == null ? void 0 : m.getSnapshot().drawings) == null ? void 0 : T[w];
|
|
1480
|
+
if (S == null || S.layoutType === k.INLINE)
|
|
1494
1481
|
return null;
|
|
1495
|
-
const { positionH, positionV } =
|
|
1496
|
-
return
|
|
1497
|
-
drawingId,
|
|
1498
|
-
key:
|
|
1499
|
-
value:
|
|
1482
|
+
const { positionH: O, positionV: D } = S.docTransform, x = { ...O }, b = { ...D };
|
|
1483
|
+
return s === ue.UP ? b.posOffset = ((N = b.posOffset) != null ? N : 0) - 2 : s === ue.DOWN ? b.posOffset = ((B = b.posOffset) != null ? B : 0) + 2 : s === ue.LEFT ? x.posOffset = ((R = x.posOffset) != null ? R : 0) - 2 : s === ue.RIGHT && (x.posOffset = ((I = x.posOffset) != null ? I : 0) + 2), {
|
|
1484
|
+
drawingId: w,
|
|
1485
|
+
key: s === ue.UP || s === ue.DOWN ? "positionV" : "positionH",
|
|
1486
|
+
value: s === ue.UP || s === ue.DOWN ? b : x
|
|
1500
1487
|
};
|
|
1501
|
-
}).filter((
|
|
1502
|
-
if (
|
|
1488
|
+
}).filter((v) => v != null);
|
|
1489
|
+
if (p.length === 0)
|
|
1503
1490
|
return !1;
|
|
1504
|
-
const
|
|
1505
|
-
unitId,
|
|
1506
|
-
subUnitId:
|
|
1507
|
-
drawings:
|
|
1491
|
+
const h = n.syncExecuteCommand(qe.id, {
|
|
1492
|
+
unitId: d,
|
|
1493
|
+
subUnitId: d,
|
|
1494
|
+
drawings: p
|
|
1508
1495
|
});
|
|
1509
|
-
return
|
|
1510
|
-
}
|
|
1511
|
-
},
|
|
1496
|
+
return u.refreshControls(), !!h;
|
|
1497
|
+
}
|
|
1498
|
+
}, Xi = {
|
|
1512
1499
|
id: "doc.operation.clear-drawing-transformer",
|
|
1513
|
-
type:
|
|
1514
|
-
handler:
|
|
1515
|
-
const
|
|
1516
|
-
return
|
|
1517
|
-
var
|
|
1518
|
-
(
|
|
1500
|
+
type: X.MUTATION,
|
|
1501
|
+
handler: (i, e) => {
|
|
1502
|
+
const n = i.get(Q);
|
|
1503
|
+
return e.forEach((t) => {
|
|
1504
|
+
var r, o;
|
|
1505
|
+
(o = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || o.debounceRefreshControls();
|
|
1519
1506
|
}), !0;
|
|
1520
|
-
}
|
|
1521
|
-
},
|
|
1507
|
+
}
|
|
1508
|
+
}, ft = "COMPONENT_DOC_DRAWING_PANEL", ht = {
|
|
1522
1509
|
id: "sidebar.operation.doc-image",
|
|
1523
|
-
type:
|
|
1524
|
-
handler:
|
|
1525
|
-
const
|
|
1526
|
-
switch (
|
|
1510
|
+
type: X.COMMAND,
|
|
1511
|
+
handler: async (i, e) => {
|
|
1512
|
+
const n = i.get(li), t = i.get(ln), r = i.get(ve);
|
|
1513
|
+
switch (e.value) {
|
|
1527
1514
|
case "open":
|
|
1528
|
-
|
|
1529
|
-
header: { title:
|
|
1530
|
-
children: { label:
|
|
1531
|
-
onClose:
|
|
1532
|
-
|
|
1533
|
-
},
|
|
1515
|
+
n.open({
|
|
1516
|
+
header: { title: t.t("docImage.panel.title") },
|
|
1517
|
+
children: { label: ft },
|
|
1518
|
+
onClose: () => {
|
|
1519
|
+
r.focusDrawing(null);
|
|
1520
|
+
},
|
|
1534
1521
|
width: 360
|
|
1535
1522
|
});
|
|
1536
1523
|
break;
|
|
1537
1524
|
case "close":
|
|
1538
1525
|
default:
|
|
1539
|
-
|
|
1526
|
+
n.close();
|
|
1540
1527
|
break;
|
|
1541
1528
|
}
|
|
1542
1529
|
return !0;
|
|
1543
|
-
}
|
|
1544
|
-
},
|
|
1530
|
+
}
|
|
1531
|
+
}, pt = {
|
|
1545
1532
|
id: "doc.operation.edit-doc-image",
|
|
1546
|
-
type:
|
|
1547
|
-
handler:
|
|
1548
|
-
const
|
|
1549
|
-
return
|
|
1550
|
-
}
|
|
1533
|
+
type: X.OPERATION,
|
|
1534
|
+
handler: (i, e) => {
|
|
1535
|
+
const n = i.get(ve), t = i.get(z);
|
|
1536
|
+
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(ht.id, { value: "open" }), !0);
|
|
1537
|
+
}
|
|
1551
1538
|
};
|
|
1552
|
-
var
|
|
1539
|
+
var pn = { exports: {} }, Ge = {};
|
|
1553
1540
|
/**
|
|
1554
1541
|
* @license React
|
|
1555
1542
|
* react-jsx-runtime.production.min.js
|
|
@@ -1559,1035 +1546,1018 @@ var jsxRuntime = { exports: {} }, reactJsxRuntime_production_min = {};
|
|
|
1559
1546
|
* This source code is licensed under the MIT license found in the
|
|
1560
1547
|
* LICENSE file in the root directory of this source tree.
|
|
1561
1548
|
*/
|
|
1562
|
-
var
|
|
1563
|
-
function
|
|
1564
|
-
if (
|
|
1565
|
-
|
|
1566
|
-
var
|
|
1567
|
-
function
|
|
1568
|
-
var
|
|
1569
|
-
|
|
1570
|
-
for (
|
|
1571
|
-
if (
|
|
1572
|
-
return { $$typeof:
|
|
1573
|
-
}
|
|
1574
|
-
return
|
|
1549
|
+
var Hn;
|
|
1550
|
+
function Ki() {
|
|
1551
|
+
if (Hn) return Ge;
|
|
1552
|
+
Hn = 1;
|
|
1553
|
+
var i = Ti, e = Symbol.for("react.element"), n = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, r = i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
1554
|
+
function s(a, d, c) {
|
|
1555
|
+
var l, u = {}, m = null, p = null;
|
|
1556
|
+
c !== void 0 && (m = "" + c), d.key !== void 0 && (m = "" + d.key), d.ref !== void 0 && (p = d.ref);
|
|
1557
|
+
for (l in d) t.call(d, l) && !o.hasOwnProperty(l) && (u[l] = d[l]);
|
|
1558
|
+
if (a && a.defaultProps) for (l in d = a.defaultProps, d) u[l] === void 0 && (u[l] = d[l]);
|
|
1559
|
+
return { $$typeof: e, type: a, key: m, ref: p, props: u, _owner: r.current };
|
|
1560
|
+
}
|
|
1561
|
+
return Ge.Fragment = n, Ge.jsx = s, Ge.jsxs = s, Ge;
|
|
1575
1562
|
}
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
return hasRequiredJsxRuntime || (hasRequiredJsxRuntime = 1, jsxRuntime.exports = requireReactJsxRuntime_production_min()), jsxRuntime.exports;
|
|
1563
|
+
var Wn;
|
|
1564
|
+
function Yi() {
|
|
1565
|
+
return Wn || (Wn = 1, pn.exports = Ki()), pn.exports;
|
|
1580
1566
|
}
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
if (typeof
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
return n;
|
|
1567
|
+
var g = Yi();
|
|
1568
|
+
function wt(i) {
|
|
1569
|
+
var e, n, t = "";
|
|
1570
|
+
if (typeof i == "string" || typeof i == "number") t += i;
|
|
1571
|
+
else if (typeof i == "object") if (Array.isArray(i)) {
|
|
1572
|
+
var r = i.length;
|
|
1573
|
+
for (e = 0; e < r; e++) i[e] && (n = wt(i[e])) && (t && (t += " "), t += n);
|
|
1574
|
+
} else for (n in i) i[n] && (t && (t += " "), t += n);
|
|
1575
|
+
return t;
|
|
1591
1576
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
return n;
|
|
1577
|
+
function V() {
|
|
1578
|
+
for (var i, e, n = 0, t = "", r = arguments.length; n < r; n++) (i = arguments[n]) && (e = wt(i)) && (t && (t += " "), t += e);
|
|
1579
|
+
return t;
|
|
1596
1580
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
if (drawingParam == null)
|
|
1581
|
+
const Ji = "univer-image-common-panel", Zi = "univer-image-common-panel-grid", Qi = "univer-image-common-panel-border", er = "univer-image-common-panel-title", nr = "univer-image-common-panel-subtitle", tr = "univer-image-common-panel-row", ir = "univer-image-common-panel-row-vertical", rr = "univer-image-common-panel-column", or = "univer-image-common-panel-column-center", sr = "univer-image-common-panel-inline", ar = "univer-image-common-panel-span2", cr = "univer-image-common-panel-span3", dr = "univer-image-common-panel-input", lr = "univer-sheet-image-menu", gr = "univer-sheet-image-menu-input", f = {
|
|
1582
|
+
imageCommonPanel: Ji,
|
|
1583
|
+
imageCommonPanelGrid: Zi,
|
|
1584
|
+
imageCommonPanelBorder: Qi,
|
|
1585
|
+
imageCommonPanelTitle: er,
|
|
1586
|
+
imageCommonPanelSubtitle: nr,
|
|
1587
|
+
imageCommonPanelRow: tr,
|
|
1588
|
+
imageCommonPanelRowVertical: ir,
|
|
1589
|
+
imageCommonPanelColumn: rr,
|
|
1590
|
+
imageCommonPanelColumnCenter: or,
|
|
1591
|
+
imageCommonPanelInline: sr,
|
|
1592
|
+
imageCommonPanelSpan2: ar,
|
|
1593
|
+
imageCommonPanelSpan3: cr,
|
|
1594
|
+
imageCommonPanelInput: dr,
|
|
1595
|
+
sheetImageMenu: lr,
|
|
1596
|
+
sheetImageMenuInput: gr
|
|
1597
|
+
}, Gn = -1e3, Vn = 1e3, mr = (i) => {
|
|
1598
|
+
const e = pe(z), n = pe(ln), t = pe(ve), r = pe(Q), o = pe(J), { drawings: s } = i, a = s[0];
|
|
1599
|
+
if (a == null)
|
|
1617
1600
|
return;
|
|
1618
|
-
const { unitId } =
|
|
1619
|
-
if (
|
|
1601
|
+
const { unitId: d } = a, c = o.getUniverDocInstance(d), l = c == null ? void 0 : c.getSnapshot().documentStyle.documentFlavor, u = r.getRenderById(d), m = u == null ? void 0 : u.scene;
|
|
1602
|
+
if (m == null)
|
|
1620
1603
|
return;
|
|
1621
|
-
const
|
|
1622
|
-
label:
|
|
1623
|
-
value: String(
|
|
1604
|
+
const p = m.getTransformerByCreate(), h = [{
|
|
1605
|
+
label: n.t("image-position.column"),
|
|
1606
|
+
value: String(ee.COLUMN)
|
|
1624
1607
|
}, {
|
|
1625
|
-
label:
|
|
1626
|
-
value: String(
|
|
1608
|
+
label: n.t("image-position.page"),
|
|
1609
|
+
value: String(ee.PAGE)
|
|
1627
1610
|
}, {
|
|
1628
|
-
label:
|
|
1629
|
-
value: String(
|
|
1630
|
-
}],
|
|
1631
|
-
label:
|
|
1632
|
-
value: String(
|
|
1633
|
-
disabled:
|
|
1611
|
+
label: n.t("image-position.margin"),
|
|
1612
|
+
value: String(ee.MARGIN)
|
|
1613
|
+
}], v = [{
|
|
1614
|
+
label: n.t("image-position.line"),
|
|
1615
|
+
value: String(G.LINE),
|
|
1616
|
+
disabled: l === fn.MODERN
|
|
1634
1617
|
}, {
|
|
1635
|
-
label:
|
|
1636
|
-
value: String(
|
|
1637
|
-
disabled:
|
|
1618
|
+
label: n.t("image-position.page"),
|
|
1619
|
+
value: String(G.PAGE),
|
|
1620
|
+
disabled: l === fn.MODERN
|
|
1638
1621
|
}, {
|
|
1639
|
-
label:
|
|
1640
|
-
value: String(
|
|
1641
|
-
disabled:
|
|
1622
|
+
label: n.t("image-position.margin"),
|
|
1623
|
+
value: String(G.MARGIN),
|
|
1624
|
+
disabled: l === fn.MODERN
|
|
1642
1625
|
}, {
|
|
1643
|
-
label:
|
|
1644
|
-
value: String(
|
|
1645
|
-
}], [
|
|
1646
|
-
relativeFrom:
|
|
1626
|
+
label: n.t("image-position.paragraph"),
|
|
1627
|
+
value: String(G.PARAGRAPH)
|
|
1628
|
+
}], [w, S] = ie(!0), [O, D] = ie({
|
|
1629
|
+
relativeFrom: ee.PAGE,
|
|
1647
1630
|
posOffset: 0
|
|
1648
|
-
}), [
|
|
1649
|
-
relativeFrom:
|
|
1631
|
+
}), [x, b] = ie({
|
|
1632
|
+
relativeFrom: G.PAGE,
|
|
1650
1633
|
posOffset: 0
|
|
1651
|
-
}), [
|
|
1652
|
-
function
|
|
1653
|
-
var
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1656
|
-
if (
|
|
1634
|
+
}), [T, N] = ie(!0), [B, R] = ie(!0);
|
|
1635
|
+
function I(C, M) {
|
|
1636
|
+
var y;
|
|
1637
|
+
C === "positionH" ? D(M) : b(M);
|
|
1638
|
+
const P = t.getFocusDrawings();
|
|
1639
|
+
if (P.length === 0)
|
|
1657
1640
|
return;
|
|
1658
|
-
const
|
|
1659
|
-
unitId:
|
|
1660
|
-
subUnitId:
|
|
1661
|
-
drawingId:
|
|
1641
|
+
const L = P.map((E) => ({
|
|
1642
|
+
unitId: E.unitId,
|
|
1643
|
+
subUnitId: E.subUnitId,
|
|
1644
|
+
drawingId: E.drawingId
|
|
1662
1645
|
}));
|
|
1663
|
-
|
|
1664
|
-
unitId:
|
|
1665
|
-
subUnitId:
|
|
1666
|
-
drawings:
|
|
1667
|
-
drawingId:
|
|
1668
|
-
key:
|
|
1669
|
-
value
|
|
1646
|
+
e.executeCommand(qe.id, {
|
|
1647
|
+
unitId: P[0].unitId,
|
|
1648
|
+
subUnitId: P[0].unitId,
|
|
1649
|
+
drawings: L.map((E) => ({
|
|
1650
|
+
drawingId: E.drawingId,
|
|
1651
|
+
key: C,
|
|
1652
|
+
value: M
|
|
1670
1653
|
}))
|
|
1671
1654
|
});
|
|
1672
|
-
const
|
|
1673
|
-
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
if (prevRelativeFrom === relativeFrom)
|
|
1655
|
+
const U = (y = r.getRenderById(d)) == null ? void 0 : y.with(ye);
|
|
1656
|
+
U && U.blur(), p.refreshControls();
|
|
1657
|
+
}
|
|
1658
|
+
function j(C) {
|
|
1659
|
+
var te, Ie, _e;
|
|
1660
|
+
const M = O.relativeFrom, P = O.posOffset, L = Number(C);
|
|
1661
|
+
if (M === L)
|
|
1680
1662
|
return;
|
|
1681
|
-
const
|
|
1682
|
-
if (
|
|
1663
|
+
const U = t.getFocusDrawings();
|
|
1664
|
+
if (U.length === 0)
|
|
1683
1665
|
return;
|
|
1684
|
-
const
|
|
1685
|
-
let
|
|
1686
|
-
const
|
|
1687
|
-
if (
|
|
1666
|
+
const y = U[0].drawingId, E = U[0].unitId;
|
|
1667
|
+
let $ = null, F = 0;
|
|
1668
|
+
const K = (te = r.getRenderById(E)) == null ? void 0 : te.with(oe).getSkeleton(), se = K == null ? void 0 : K.getSkeletonData();
|
|
1669
|
+
if (se == null)
|
|
1688
1670
|
return;
|
|
1689
|
-
const { pages, skeHeaders, skeFooters } =
|
|
1690
|
-
for (const
|
|
1691
|
-
const { marginLeft, skeDrawings, headerId, footerId, pageWidth } =
|
|
1692
|
-
if (
|
|
1693
|
-
|
|
1671
|
+
const { pages: Le, skeHeaders: be, skeFooters: ke } = se;
|
|
1672
|
+
for (const ce of Le) {
|
|
1673
|
+
const { marginLeft: Ce, skeDrawings: De, headerId: Me, footerId: Re, pageWidth: Oe } = ce;
|
|
1674
|
+
if (De.has(y)) {
|
|
1675
|
+
$ = De.get(y), F = Ce;
|
|
1694
1676
|
break;
|
|
1695
1677
|
}
|
|
1696
|
-
const
|
|
1697
|
-
if (
|
|
1698
|
-
|
|
1678
|
+
const de = (Ie = be.get(Me)) == null ? void 0 : Ie.get(Oe);
|
|
1679
|
+
if (de != null && de.skeDrawings.has(y)) {
|
|
1680
|
+
$ = de == null ? void 0 : de.skeDrawings.get(y), F = Ce;
|
|
1699
1681
|
break;
|
|
1700
1682
|
}
|
|
1701
|
-
const
|
|
1702
|
-
if (
|
|
1703
|
-
|
|
1683
|
+
const le = (_e = ke.get(Re)) == null ? void 0 : _e.get(Oe);
|
|
1684
|
+
if (le != null && le.skeDrawings.has(y)) {
|
|
1685
|
+
$ = le == null ? void 0 : le.skeDrawings.get(y), F = Ce;
|
|
1704
1686
|
break;
|
|
1705
1687
|
}
|
|
1706
1688
|
}
|
|
1707
|
-
if (
|
|
1689
|
+
if ($ == null)
|
|
1708
1690
|
return;
|
|
1709
|
-
let
|
|
1710
|
-
|
|
1711
|
-
const
|
|
1712
|
-
relativeFrom,
|
|
1713
|
-
posOffset: (
|
|
1691
|
+
let ae = 0;
|
|
1692
|
+
M === ee.COLUMN ? ae -= $.columnLeft : M === ee.MARGIN && (ae -= F), L === ee.COLUMN ? ae += $.columnLeft : L === ee.MARGIN ? ae += F : ee.PAGE;
|
|
1693
|
+
const ne = {
|
|
1694
|
+
relativeFrom: L,
|
|
1695
|
+
posOffset: (P != null ? P : 0) - ae
|
|
1714
1696
|
};
|
|
1715
|
-
|
|
1697
|
+
I("positionH", ne);
|
|
1716
1698
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
if (prevRelativeFrom === relativeFrom)
|
|
1699
|
+
function H(C) {
|
|
1700
|
+
var De, Me, Re, Oe, de, le;
|
|
1701
|
+
const M = x.relativeFrom, P = x.posOffset, L = Number(C);
|
|
1702
|
+
if (M === L)
|
|
1722
1703
|
return;
|
|
1723
|
-
const
|
|
1724
|
-
if (
|
|
1704
|
+
const U = t.getFocusDrawings();
|
|
1705
|
+
if (U.length === 0)
|
|
1725
1706
|
return;
|
|
1726
|
-
const { drawingId, unitId:
|
|
1727
|
-
if (
|
|
1707
|
+
const { drawingId: y, unitId: E } = U[0], $ = o.getUniverDocInstance(E), F = (De = r.getRenderById(E)) == null ? void 0 : De.with(oe).getSkeleton(), K = (Me = r.getRenderById(E)) == null ? void 0 : Me.with(ye), se = K == null ? void 0 : K.getSegment(), Le = K == null ? void 0 : K.getSegmentPage(), be = (Oe = (Re = $ == null ? void 0 : $.getSelfOrHeaderFooterModel(se).getBody()) == null ? void 0 : Re.customBlocks) == null ? void 0 : Oe.find((Ne) => Ne.blockId === y);
|
|
1708
|
+
if (be == null || F == null || K == null)
|
|
1728
1709
|
return;
|
|
1729
|
-
const { startIndex } =
|
|
1730
|
-
if (
|
|
1710
|
+
const { startIndex: ke } = be, ae = F.findNodeByCharIndex(ke, se, Le), ne = (de = ae == null ? void 0 : ae.parent) == null ? void 0 : de.parent, te = ne == null ? void 0 : ne.parent, Ie = te == null ? void 0 : te.lines.find((Ne) => Ne.paragraphIndex === (ne == null ? void 0 : ne.paragraphIndex) && Ne.paragraphStart), _e = (le = te == null ? void 0 : te.parent) == null ? void 0 : le.parent;
|
|
1711
|
+
if (ae == null || ne == null || Ie == null || te == null || _e == null)
|
|
1731
1712
|
return;
|
|
1732
|
-
let
|
|
1733
|
-
|
|
1734
|
-
const
|
|
1735
|
-
relativeFrom,
|
|
1736
|
-
posOffset: (
|
|
1713
|
+
let ce = 0;
|
|
1714
|
+
M === G.PARAGRAPH ? ce -= Ie.top : M === G.LINE ? ce -= ne.top : M === G.PAGE && (ce += _e.marginTop), L === G.PARAGRAPH ? ce += Ie.top : L === G.LINE ? ce += ne.top : L === G.PAGE && (ce -= _e.marginTop);
|
|
1715
|
+
const Ce = {
|
|
1716
|
+
relativeFrom: L,
|
|
1717
|
+
posOffset: (P != null ? P : 0) - ce
|
|
1737
1718
|
};
|
|
1738
|
-
|
|
1719
|
+
I("positionV", Ce);
|
|
1739
1720
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
if (drawing == null)
|
|
1721
|
+
function A(C) {
|
|
1722
|
+
var E;
|
|
1723
|
+
const M = c == null ? void 0 : c.getSnapshot(), P = (E = M == null ? void 0 : M.drawings) == null ? void 0 : E[C.drawingId];
|
|
1724
|
+
if (P == null)
|
|
1745
1725
|
return;
|
|
1746
|
-
const { layoutType } =
|
|
1747
|
-
positionH,
|
|
1748
|
-
positionV
|
|
1749
|
-
} =
|
|
1750
|
-
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
if (drawingParams.length === 0) {
|
|
1765
|
-
setShowPanel(!1);
|
|
1726
|
+
const { layoutType: L } = P, {
|
|
1727
|
+
positionH: U,
|
|
1728
|
+
positionV: y
|
|
1729
|
+
} = P.docTransform;
|
|
1730
|
+
D(U), b(y), S(L === k.INLINE), N(y.relativeFrom === G.PARAGRAPH || y.relativeFrom === G.LINE);
|
|
1731
|
+
}
|
|
1732
|
+
function W() {
|
|
1733
|
+
const C = t.getFocusDrawings();
|
|
1734
|
+
C.length !== 0 && A(C[0]);
|
|
1735
|
+
}
|
|
1736
|
+
function _(C) {
|
|
1737
|
+
N(C), H(String(C ? G.PARAGRAPH : G.PAGE));
|
|
1738
|
+
}
|
|
1739
|
+
return Sn(() => {
|
|
1740
|
+
W();
|
|
1741
|
+
const C = t.focus$.subscribe((P) => {
|
|
1742
|
+
if (P.length === 0) {
|
|
1743
|
+
R(!1);
|
|
1766
1744
|
return;
|
|
1767
1745
|
}
|
|
1768
|
-
|
|
1769
|
-
}),
|
|
1770
|
-
|
|
1746
|
+
R(!0), A(P[0]);
|
|
1747
|
+
}), M = e.onCommandExecuted(async (P) => {
|
|
1748
|
+
P.id === Z.id && W();
|
|
1771
1749
|
});
|
|
1772
1750
|
return () => {
|
|
1773
|
-
|
|
1751
|
+
C.unsubscribe(), M.dispose();
|
|
1774
1752
|
};
|
|
1775
|
-
}, []), /* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1782
|
-
|
|
1753
|
+
}, []), /* @__PURE__ */ g.jsxs("div", { className: V(f.imageCommonPanelGrid, f.imageCommonPanelBorder), style: { display: B ? "block" : "none" }, children: [
|
|
1754
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelTitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-position.title") }) }) }),
|
|
1755
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSubtitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-position.horizontal") }) }) }),
|
|
1756
|
+
/* @__PURE__ */ g.jsxs("div", { className: f.imageCommonPanelRow, children: [
|
|
1757
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
1758
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
|
|
1759
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
1760
|
+
Be,
|
|
1783
1761
|
{
|
|
1784
|
-
min:
|
|
1785
|
-
max:
|
|
1762
|
+
min: Gn,
|
|
1763
|
+
max: Vn,
|
|
1786
1764
|
precision: 1,
|
|
1787
|
-
disabled,
|
|
1788
|
-
value:
|
|
1789
|
-
onChange:
|
|
1790
|
-
|
|
1791
|
-
relativeFrom:
|
|
1792
|
-
posOffset:
|
|
1765
|
+
disabled: w,
|
|
1766
|
+
value: O.posOffset,
|
|
1767
|
+
onChange: (C) => {
|
|
1768
|
+
I("positionH", {
|
|
1769
|
+
relativeFrom: O.relativeFrom,
|
|
1770
|
+
posOffset: C
|
|
1793
1771
|
});
|
|
1794
|
-
},
|
|
1795
|
-
className:
|
|
1772
|
+
},
|
|
1773
|
+
className: f.imageCommonPanelInput
|
|
1796
1774
|
}
|
|
1797
1775
|
) }) })
|
|
1798
1776
|
] }) }),
|
|
1799
|
-
/* @__PURE__ */
|
|
1800
|
-
/* @__PURE__ */
|
|
1801
|
-
/* @__PURE__ */
|
|
1802
|
-
|
|
1777
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
1778
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-position.toTheRightOf") }) }),
|
|
1779
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
1780
|
+
Bn,
|
|
1803
1781
|
{
|
|
1804
|
-
value: String(
|
|
1805
|
-
disabled,
|
|
1806
|
-
options:
|
|
1807
|
-
onChange:
|
|
1782
|
+
value: String(O.relativeFrom),
|
|
1783
|
+
disabled: w,
|
|
1784
|
+
options: h,
|
|
1785
|
+
onChange: j
|
|
1808
1786
|
}
|
|
1809
1787
|
) }) })
|
|
1810
1788
|
] }) })
|
|
1811
1789
|
] }),
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
1814
|
-
/* @__PURE__ */
|
|
1815
|
-
/* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
|
|
1790
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSubtitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-position.vertical") }) }) }),
|
|
1791
|
+
/* @__PURE__ */ g.jsxs("div", { className: f.imageCommonPanelRow, children: [
|
|
1792
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
1793
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-position.absolutePosition") }) }),
|
|
1794
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
1795
|
+
Be,
|
|
1818
1796
|
{
|
|
1819
|
-
min:
|
|
1820
|
-
max:
|
|
1797
|
+
min: Gn,
|
|
1798
|
+
max: Vn,
|
|
1821
1799
|
precision: 1,
|
|
1822
|
-
disabled,
|
|
1823
|
-
value:
|
|
1824
|
-
onChange:
|
|
1825
|
-
|
|
1826
|
-
relativeFrom:
|
|
1827
|
-
posOffset:
|
|
1800
|
+
disabled: w,
|
|
1801
|
+
value: x.posOffset,
|
|
1802
|
+
onChange: (C) => {
|
|
1803
|
+
I("positionV", {
|
|
1804
|
+
relativeFrom: x.relativeFrom,
|
|
1805
|
+
posOffset: C
|
|
1828
1806
|
});
|
|
1829
|
-
},
|
|
1830
|
-
className:
|
|
1807
|
+
},
|
|
1808
|
+
className: f.imageCommonPanelInput
|
|
1831
1809
|
}
|
|
1832
1810
|
) }) })
|
|
1833
1811
|
] }) }),
|
|
1834
|
-
/* @__PURE__ */
|
|
1835
|
-
/* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
|
|
1812
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
1813
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-position.bellow") }) }),
|
|
1814
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
1815
|
+
Bn,
|
|
1838
1816
|
{
|
|
1839
|
-
disabled,
|
|
1840
|
-
value: String(
|
|
1841
|
-
options:
|
|
1842
|
-
onChange:
|
|
1817
|
+
disabled: w,
|
|
1818
|
+
value: String(x.relativeFrom),
|
|
1819
|
+
options: v,
|
|
1820
|
+
onChange: H
|
|
1843
1821
|
}
|
|
1844
1822
|
) }) })
|
|
1845
1823
|
] }) })
|
|
1846
1824
|
] }),
|
|
1847
|
-
/* @__PURE__ */
|
|
1848
|
-
/* @__PURE__ */
|
|
1825
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSubtitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-position.options") }) }) }),
|
|
1826
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, style: { marginBottom: "50px" }, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(Pi, { disabled: w, checked: T, onChange: _, children: n.t("image-position.moveObjectWithText") }) }) })
|
|
1849
1827
|
] });
|
|
1850
|
-
},
|
|
1851
|
-
const
|
|
1852
|
-
if (
|
|
1828
|
+
}, Qe = 0, en = 100, ur = (i) => {
|
|
1829
|
+
const e = pe(z), n = pe(ln), t = pe(ve), r = pe(Q), o = pe(J), { drawings: s } = i, a = s[0];
|
|
1830
|
+
if (a == null)
|
|
1853
1831
|
return null;
|
|
1854
|
-
const { unitId } =
|
|
1855
|
-
if ((
|
|
1832
|
+
const { unitId: d } = a, c = o.getUniverDocInstance(d), l = r.getRenderById(d);
|
|
1833
|
+
if ((l == null ? void 0 : l.scene) == null)
|
|
1856
1834
|
return null;
|
|
1857
|
-
const [
|
|
1835
|
+
const [m, p] = ie(!0), [h, v] = ie(!0), [w, S] = ie(!0), [O, D] = ie(me.INLINE), [x, b] = ie(""), [T, N] = ie({
|
|
1858
1836
|
distT: 0,
|
|
1859
1837
|
distL: 0,
|
|
1860
1838
|
distB: 0,
|
|
1861
1839
|
distR: 0
|
|
1862
|
-
}), [
|
|
1863
|
-
function
|
|
1864
|
-
|
|
1865
|
-
const
|
|
1866
|
-
if (
|
|
1840
|
+
}), [B, R] = ie(!0);
|
|
1841
|
+
function I(_) {
|
|
1842
|
+
D(_);
|
|
1843
|
+
const C = t.getFocusDrawings();
|
|
1844
|
+
if (C.length === 0)
|
|
1867
1845
|
return;
|
|
1868
|
-
const { unitId:
|
|
1869
|
-
unitId:
|
|
1870
|
-
subUnitId:
|
|
1871
|
-
drawingId
|
|
1846
|
+
const { unitId: M, subUnitId: P } = C[0], L = C.map(({ unitId: U, subUnitId: y, drawingId: E }) => ({
|
|
1847
|
+
unitId: U,
|
|
1848
|
+
subUnitId: y,
|
|
1849
|
+
drawingId: E
|
|
1872
1850
|
}));
|
|
1873
|
-
|
|
1874
|
-
unitId:
|
|
1875
|
-
subUnitId,
|
|
1876
|
-
drawings:
|
|
1877
|
-
wrappingStyle:
|
|
1851
|
+
e.executeCommand(et.id, {
|
|
1852
|
+
unitId: M,
|
|
1853
|
+
subUnitId: P,
|
|
1854
|
+
drawings: L,
|
|
1855
|
+
wrappingStyle: _
|
|
1878
1856
|
});
|
|
1879
1857
|
}
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
if (focusDrawings.length === 0)
|
|
1858
|
+
function j(_) {
|
|
1859
|
+
b(_);
|
|
1860
|
+
const C = t.getFocusDrawings();
|
|
1861
|
+
if (C.length === 0)
|
|
1885
1862
|
return;
|
|
1886
|
-
const
|
|
1887
|
-
unitId:
|
|
1888
|
-
subUnitId:
|
|
1889
|
-
drawingId:
|
|
1863
|
+
const M = C.map((P) => ({
|
|
1864
|
+
unitId: P.unitId,
|
|
1865
|
+
subUnitId: P.subUnitId,
|
|
1866
|
+
drawingId: P.drawingId
|
|
1890
1867
|
}));
|
|
1891
|
-
|
|
1892
|
-
unitId:
|
|
1893
|
-
subUnitId:
|
|
1894
|
-
drawings:
|
|
1895
|
-
wrapText:
|
|
1868
|
+
e.executeCommand(tt.id, {
|
|
1869
|
+
unitId: C[0].unitId,
|
|
1870
|
+
subUnitId: C[0].unitId,
|
|
1871
|
+
drawings: M,
|
|
1872
|
+
wrapText: _
|
|
1896
1873
|
});
|
|
1897
1874
|
}
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
if (value == null)
|
|
1875
|
+
function H(_, C) {
|
|
1876
|
+
if (_ == null)
|
|
1901
1877
|
return;
|
|
1902
|
-
const
|
|
1903
|
-
|
|
1904
|
-
const
|
|
1905
|
-
if (
|
|
1878
|
+
const M = { ...T, [C]: _ };
|
|
1879
|
+
N(M);
|
|
1880
|
+
const P = t.getFocusDrawings();
|
|
1881
|
+
if (P.length === 0)
|
|
1906
1882
|
return;
|
|
1907
|
-
const
|
|
1908
|
-
unitId:
|
|
1909
|
-
subUnitId:
|
|
1910
|
-
drawingId:
|
|
1883
|
+
const L = P.map((U) => ({
|
|
1884
|
+
unitId: U.unitId,
|
|
1885
|
+
subUnitId: U.subUnitId,
|
|
1886
|
+
drawingId: U.drawingId
|
|
1911
1887
|
}));
|
|
1912
|
-
|
|
1913
|
-
unitId:
|
|
1914
|
-
subUnitId:
|
|
1915
|
-
drawings:
|
|
1888
|
+
e.executeCommand(nt.id, {
|
|
1889
|
+
unitId: P[0].unitId,
|
|
1890
|
+
subUnitId: P[0].unitId,
|
|
1891
|
+
drawings: L,
|
|
1916
1892
|
dist: {
|
|
1917
|
-
[
|
|
1893
|
+
[C]: _
|
|
1918
1894
|
}
|
|
1919
1895
|
});
|
|
1920
1896
|
}
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
focusDrawings.length !== 0 && updateState(focusDrawings[0]);
|
|
1897
|
+
function A() {
|
|
1898
|
+
const _ = t.getFocusDrawings();
|
|
1899
|
+
_.length !== 0 && W(_[0]);
|
|
1925
1900
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
if (drawing == null)
|
|
1901
|
+
function W(_) {
|
|
1902
|
+
var K, se;
|
|
1903
|
+
const C = (se = (K = c == null ? void 0 : c.getSnapshot()) == null ? void 0 : K.drawings) == null ? void 0 : se[_.drawingId];
|
|
1904
|
+
if (C == null)
|
|
1931
1905
|
return;
|
|
1932
1906
|
const {
|
|
1933
|
-
distT = 0,
|
|
1934
|
-
distL = 0,
|
|
1935
|
-
distB = 0,
|
|
1936
|
-
distR = 0,
|
|
1937
|
-
layoutType =
|
|
1938
|
-
behindDoc =
|
|
1939
|
-
wrapText:
|
|
1940
|
-
} =
|
|
1941
|
-
if (
|
|
1942
|
-
distT,
|
|
1943
|
-
distL,
|
|
1944
|
-
distB,
|
|
1945
|
-
distR
|
|
1946
|
-
}),
|
|
1947
|
-
|
|
1907
|
+
distT: M = 0,
|
|
1908
|
+
distL: P = 0,
|
|
1909
|
+
distB: L = 0,
|
|
1910
|
+
distR: U = 0,
|
|
1911
|
+
layoutType: y = k.INLINE,
|
|
1912
|
+
behindDoc: E = re.FALSE,
|
|
1913
|
+
wrapText: $ = $e.BOTH_SIDES
|
|
1914
|
+
} = C;
|
|
1915
|
+
if (N({
|
|
1916
|
+
distT: M,
|
|
1917
|
+
distL: P,
|
|
1918
|
+
distB: L,
|
|
1919
|
+
distR: U
|
|
1920
|
+
}), b($), p(y !== k.WRAP_SQUARE), y === k.WRAP_NONE || y === k.INLINE ? v(!0) : v(!1), y === k.WRAP_NONE || y === k.INLINE || y === k.WRAP_TOP_AND_BOTTOM ? S(!0) : S(!1), y === k.WRAP_NONE)
|
|
1921
|
+
E === re.TRUE ? D(me.BEHIND_TEXT) : D(me.IN_FRONT_OF_TEXT);
|
|
1948
1922
|
else
|
|
1949
|
-
switch (
|
|
1950
|
-
case
|
|
1951
|
-
|
|
1923
|
+
switch (y) {
|
|
1924
|
+
case k.INLINE:
|
|
1925
|
+
D(me.INLINE);
|
|
1952
1926
|
break;
|
|
1953
|
-
case
|
|
1954
|
-
|
|
1927
|
+
case k.WRAP_SQUARE:
|
|
1928
|
+
D(me.WRAP_SQUARE);
|
|
1955
1929
|
break;
|
|
1956
|
-
case
|
|
1957
|
-
|
|
1930
|
+
case k.WRAP_TOP_AND_BOTTOM:
|
|
1931
|
+
D(me.WRAP_TOP_AND_BOTTOM);
|
|
1958
1932
|
break;
|
|
1959
1933
|
default:
|
|
1960
|
-
throw new Error(`Unsupported layout type: ${
|
|
1934
|
+
throw new Error(`Unsupported layout type: ${y}`);
|
|
1961
1935
|
}
|
|
1962
1936
|
}
|
|
1963
|
-
return
|
|
1964
|
-
|
|
1965
|
-
const
|
|
1966
|
-
if (
|
|
1967
|
-
|
|
1937
|
+
return Sn(() => {
|
|
1938
|
+
A();
|
|
1939
|
+
const _ = t.focus$.subscribe((M) => {
|
|
1940
|
+
if (M.length === 0) {
|
|
1941
|
+
R(!1);
|
|
1968
1942
|
return;
|
|
1969
1943
|
}
|
|
1970
|
-
|
|
1971
|
-
}),
|
|
1972
|
-
|
|
1944
|
+
R(!0), W(M[0]);
|
|
1945
|
+
}), C = e.onCommandExecuted(async (M) => {
|
|
1946
|
+
M.id === Z.id && A();
|
|
1973
1947
|
});
|
|
1974
1948
|
return () => {
|
|
1975
|
-
|
|
1949
|
+
_.unsubscribe(), C.dispose();
|
|
1976
1950
|
};
|
|
1977
|
-
}, []), /* @__PURE__ */
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
/* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
1985
|
-
/* @__PURE__ */
|
|
1951
|
+
}, []), /* @__PURE__ */ g.jsxs("div", { className: V(f.imageCommonPanelGrid, f.imageCommonPanelBorder), style: { display: B ? "block" : "none" }, children: [
|
|
1952
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelTitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-text-wrap.title") }) }) }),
|
|
1953
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSubtitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-text-wrap.wrappingStyle") }) }) }),
|
|
1954
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelRow), children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn), children: /* @__PURE__ */ g.jsxs(Un, { value: O, onChange: I, direction: "vertical", children: [
|
|
1955
|
+
/* @__PURE__ */ g.jsx(xe, { value: me.INLINE, children: n.t("image-text-wrap.inline") }),
|
|
1956
|
+
/* @__PURE__ */ g.jsx(xe, { value: me.WRAP_SQUARE, children: n.t("image-text-wrap.square") }),
|
|
1957
|
+
/* @__PURE__ */ g.jsx(xe, { value: me.WRAP_TOP_AND_BOTTOM, children: n.t("image-text-wrap.topAndBottom") }),
|
|
1958
|
+
/* @__PURE__ */ g.jsx(xe, { value: me.BEHIND_TEXT, children: n.t("image-text-wrap.behindText") }),
|
|
1959
|
+
/* @__PURE__ */ g.jsx(xe, { value: me.IN_FRONT_OF_TEXT, children: n.t("image-text-wrap.inFrontText") })
|
|
1986
1960
|
] }) }) }),
|
|
1987
|
-
/* @__PURE__ */
|
|
1988
|
-
/* @__PURE__ */
|
|
1989
|
-
/* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
1991
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSubtitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-text-wrap.wrapText") }) }) }),
|
|
1962
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelRow), children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn), children: /* @__PURE__ */ g.jsxs(Un, { disabled: m, value: x, onChange: j, direction: "horizontal", children: [
|
|
1963
|
+
/* @__PURE__ */ g.jsx(xe, { value: $e.BOTH_SIDES, children: n.t("image-text-wrap.bothSide") }),
|
|
1964
|
+
/* @__PURE__ */ g.jsx(xe, { value: $e.LEFT, children: n.t("image-text-wrap.leftOnly") }),
|
|
1965
|
+
/* @__PURE__ */ g.jsx(xe, { value: $e.RIGHT, children: n.t("image-text-wrap.rightOnly") })
|
|
1992
1966
|
] }) }) }),
|
|
1993
|
-
/* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
1998
|
-
|
|
1967
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSubtitle), children: /* @__PURE__ */ g.jsx("div", { children: n.t("image-text-wrap.distanceFromText") }) }) }),
|
|
1968
|
+
/* @__PURE__ */ g.jsxs("div", { className: f.imageCommonPanelRow, children: [
|
|
1969
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
1970
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-text-wrap.top") }) }),
|
|
1971
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
1972
|
+
Be,
|
|
1999
1973
|
{
|
|
2000
|
-
min:
|
|
2001
|
-
max:
|
|
2002
|
-
disabled:
|
|
1974
|
+
min: Qe,
|
|
1975
|
+
max: en,
|
|
1976
|
+
disabled: h,
|
|
2003
1977
|
precision: 1,
|
|
2004
|
-
value:
|
|
2005
|
-
onChange:
|
|
2006
|
-
|
|
2007
|
-
},
|
|
2008
|
-
className:
|
|
1978
|
+
value: T.distT,
|
|
1979
|
+
onChange: (_) => {
|
|
1980
|
+
H(_, "distT");
|
|
1981
|
+
},
|
|
1982
|
+
className: f.imageCommonPanelInput
|
|
2009
1983
|
}
|
|
2010
1984
|
) }) })
|
|
2011
1985
|
] }) }),
|
|
2012
|
-
/* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
/* @__PURE__ */
|
|
2015
|
-
|
|
1986
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
1987
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-text-wrap.left") }) }),
|
|
1988
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
1989
|
+
Be,
|
|
2016
1990
|
{
|
|
2017
|
-
min:
|
|
2018
|
-
max:
|
|
2019
|
-
disabled:
|
|
1991
|
+
min: Qe,
|
|
1992
|
+
max: en,
|
|
1993
|
+
disabled: w,
|
|
2020
1994
|
precision: 1,
|
|
2021
|
-
value:
|
|
2022
|
-
onChange:
|
|
2023
|
-
|
|
2024
|
-
},
|
|
2025
|
-
className:
|
|
1995
|
+
value: T.distL,
|
|
1996
|
+
onChange: (_) => {
|
|
1997
|
+
H(_, "distL");
|
|
1998
|
+
},
|
|
1999
|
+
className: f.imageCommonPanelInput
|
|
2026
2000
|
}
|
|
2027
2001
|
) }) })
|
|
2028
2002
|
] }) })
|
|
2029
2003
|
] }),
|
|
2030
|
-
/* @__PURE__ */
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
|
|
2004
|
+
/* @__PURE__ */ g.jsxs("div", { className: f.imageCommonPanelRow, children: [
|
|
2005
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
2006
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-text-wrap.bottom") }) }),
|
|
2007
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
2008
|
+
Be,
|
|
2035
2009
|
{
|
|
2036
|
-
min:
|
|
2037
|
-
max:
|
|
2038
|
-
disabled:
|
|
2010
|
+
min: Qe,
|
|
2011
|
+
max: en,
|
|
2012
|
+
disabled: h,
|
|
2039
2013
|
precision: 1,
|
|
2040
|
-
value:
|
|
2041
|
-
onChange:
|
|
2042
|
-
|
|
2043
|
-
},
|
|
2044
|
-
className:
|
|
2014
|
+
value: T.distB,
|
|
2015
|
+
onChange: (_) => {
|
|
2016
|
+
H(_, "distB");
|
|
2017
|
+
},
|
|
2018
|
+
className: f.imageCommonPanelInput
|
|
2045
2019
|
}
|
|
2046
2020
|
) }) })
|
|
2047
2021
|
] }) }),
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
/* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2051
|
-
|
|
2022
|
+
/* @__PURE__ */ g.jsx("div", { className: V(f.imageCommonPanelColumn, f.imageCommonPanelSpan2), children: /* @__PURE__ */ g.jsxs("label", { children: [
|
|
2023
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: n.t("image-text-wrap.right") }) }),
|
|
2024
|
+
/* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelRow, children: /* @__PURE__ */ g.jsx("div", { className: f.imageCommonPanelColumn, children: /* @__PURE__ */ g.jsx(
|
|
2025
|
+
Be,
|
|
2052
2026
|
{
|
|
2053
|
-
min:
|
|
2054
|
-
max:
|
|
2055
|
-
disabled:
|
|
2027
|
+
min: Qe,
|
|
2028
|
+
max: en,
|
|
2029
|
+
disabled: w,
|
|
2056
2030
|
precision: 1,
|
|
2057
|
-
value:
|
|
2058
|
-
onChange:
|
|
2059
|
-
|
|
2060
|
-
},
|
|
2061
|
-
className:
|
|
2031
|
+
value: T.distR,
|
|
2032
|
+
onChange: (_) => {
|
|
2033
|
+
H(_, "distR");
|
|
2034
|
+
},
|
|
2035
|
+
className: f.imageCommonPanelInput
|
|
2062
2036
|
}
|
|
2063
2037
|
) }) })
|
|
2064
2038
|
] }) })
|
|
2065
2039
|
] })
|
|
2066
2040
|
] });
|
|
2067
|
-
},
|
|
2068
|
-
const
|
|
2069
|
-
return
|
|
2070
|
-
const
|
|
2071
|
-
|
|
2041
|
+
}, fr = () => {
|
|
2042
|
+
const i = pe(ve), e = i.getFocusDrawings(), [n, t] = ie(e);
|
|
2043
|
+
return Sn(() => {
|
|
2044
|
+
const r = i.focus$.subscribe((o) => {
|
|
2045
|
+
t(o);
|
|
2072
2046
|
});
|
|
2073
2047
|
return () => {
|
|
2074
|
-
|
|
2048
|
+
r.unsubscribe();
|
|
2075
2049
|
};
|
|
2076
|
-
}, []), !!(
|
|
2077
|
-
/* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
2079
|
-
/* @__PURE__ */
|
|
2050
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ g.jsxs("div", { className: f.imageCommonPanel, children: [
|
|
2051
|
+
/* @__PURE__ */ g.jsx(Zt, { drawings: n, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
|
|
2052
|
+
/* @__PURE__ */ g.jsx(ur, { drawings: n }),
|
|
2053
|
+
/* @__PURE__ */ g.jsx(mr, { drawings: n })
|
|
2080
2054
|
] });
|
|
2081
|
-
},
|
|
2082
|
-
const
|
|
2083
|
-
return new
|
|
2084
|
-
const
|
|
2085
|
-
var
|
|
2086
|
-
const
|
|
2087
|
-
if (
|
|
2088
|
-
const { segmentId, startOffset, endOffset } =
|
|
2089
|
-
if (
|
|
2090
|
-
const { startIndex, endIndex } =
|
|
2091
|
-
return
|
|
2055
|
+
}, vt = "addition-and-subtraction-single", It = "doc.menu.image", _t = ut.id, hr = (i) => {
|
|
2056
|
+
const e = i.get(_n), n = i.get(J);
|
|
2057
|
+
return new xi((t) => {
|
|
2058
|
+
const r = e.textSelection$.subscribe(() => {
|
|
2059
|
+
var s;
|
|
2060
|
+
const o = e.getActiveTextRange();
|
|
2061
|
+
if (o) {
|
|
2062
|
+
const { segmentId: a, startOffset: d, endOffset: c } = o, l = n.getCurrentUniverDocInstance(), u = (s = l == null ? void 0 : l.getSelfOrHeaderFooterModel(a).getBody()) == null ? void 0 : s.tables;
|
|
2063
|
+
if (u && u.length && u.some((m) => {
|
|
2064
|
+
const { startIndex: p, endIndex: h } = m;
|
|
2065
|
+
return d >= p && d < h || c >= p && c < h;
|
|
2092
2066
|
})) {
|
|
2093
|
-
|
|
2067
|
+
t.next(!0);
|
|
2094
2068
|
return;
|
|
2095
2069
|
}
|
|
2096
2070
|
} else {
|
|
2097
|
-
|
|
2071
|
+
t.next(!0);
|
|
2098
2072
|
return;
|
|
2099
2073
|
}
|
|
2100
|
-
|
|
2074
|
+
t.next(!1);
|
|
2101
2075
|
});
|
|
2102
|
-
return () =>
|
|
2076
|
+
return () => r.unsubscribe();
|
|
2103
2077
|
});
|
|
2104
|
-
}
|
|
2105
|
-
function
|
|
2078
|
+
};
|
|
2079
|
+
function pr(i) {
|
|
2106
2080
|
return {
|
|
2107
|
-
id:
|
|
2108
|
-
type:
|
|
2109
|
-
icon:
|
|
2081
|
+
id: It,
|
|
2082
|
+
type: Xn.SUBITEMS,
|
|
2083
|
+
icon: vt,
|
|
2110
2084
|
tooltip: "docImage.title",
|
|
2111
|
-
disabled$:
|
|
2112
|
-
hidden$:
|
|
2085
|
+
disabled$: hr(i),
|
|
2086
|
+
hidden$: Kn(i, Te.UNIVER_DOC)
|
|
2113
2087
|
};
|
|
2114
2088
|
}
|
|
2115
|
-
|
|
2116
|
-
function UploadFloatImageMenuFactory(_accessor) {
|
|
2089
|
+
function wr(i) {
|
|
2117
2090
|
return {
|
|
2118
|
-
id:
|
|
2091
|
+
id: _t,
|
|
2119
2092
|
title: "docImage.upload.float",
|
|
2120
|
-
type:
|
|
2121
|
-
hidden$:
|
|
2093
|
+
type: Xn.BUTTON,
|
|
2094
|
+
hidden$: Kn(i, Te.UNIVER_DOC)
|
|
2122
2095
|
};
|
|
2123
2096
|
}
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
[DOCS_IMAGE_MENU_ID]: {
|
|
2097
|
+
const vr = {
|
|
2098
|
+
[gi.LAYOUT]: {
|
|
2099
|
+
[It]: {
|
|
2128
2100
|
order: 0,
|
|
2129
|
-
menuItemFactory:
|
|
2130
|
-
[
|
|
2101
|
+
menuItemFactory: pr,
|
|
2102
|
+
[_t]: {
|
|
2131
2103
|
order: 0,
|
|
2132
|
-
menuItemFactory:
|
|
2104
|
+
menuItemFactory: wr
|
|
2133
2105
|
}
|
|
2134
2106
|
}
|
|
2135
2107
|
}
|
|
2136
2108
|
};
|
|
2137
|
-
function
|
|
2138
|
-
return
|
|
2109
|
+
function Ye(i) {
|
|
2110
|
+
return i.getContextValue(At) && i.getContextValue(tn);
|
|
2139
2111
|
}
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
id: MoveDocDrawingsCommand.id,
|
|
2112
|
+
const Ir = {
|
|
2113
|
+
id: Ke.id,
|
|
2143
2114
|
description: "shortcut.doc.drawing-move-down",
|
|
2144
2115
|
group: "4_doc-drawing-view",
|
|
2145
|
-
binding:
|
|
2116
|
+
binding: Fe.ARROW_DOWN,
|
|
2146
2117
|
priority: 100,
|
|
2147
|
-
preconditions:
|
|
2118
|
+
preconditions: Ye,
|
|
2148
2119
|
staticParameters: {
|
|
2149
|
-
direction:
|
|
2120
|
+
direction: ue.DOWN
|
|
2150
2121
|
}
|
|
2151
|
-
},
|
|
2152
|
-
id:
|
|
2122
|
+
}, _r = {
|
|
2123
|
+
id: Ke.id,
|
|
2153
2124
|
description: "shortcut.doc.drawing-move-up",
|
|
2154
2125
|
group: "4_doc-drawing-view",
|
|
2155
|
-
binding:
|
|
2126
|
+
binding: Fe.ARROW_UP,
|
|
2156
2127
|
priority: 100,
|
|
2157
|
-
preconditions:
|
|
2128
|
+
preconditions: Ye,
|
|
2158
2129
|
staticParameters: {
|
|
2159
|
-
direction:
|
|
2130
|
+
direction: ue.UP
|
|
2160
2131
|
}
|
|
2161
|
-
},
|
|
2162
|
-
id:
|
|
2132
|
+
}, Sr = {
|
|
2133
|
+
id: Ke.id,
|
|
2163
2134
|
description: "shortcut.doc.drawing-move-left",
|
|
2164
2135
|
group: "4_doc-drawing-view",
|
|
2165
|
-
binding:
|
|
2136
|
+
binding: Fe.ARROW_LEFT,
|
|
2166
2137
|
priority: 100,
|
|
2167
|
-
preconditions:
|
|
2138
|
+
preconditions: Ye,
|
|
2168
2139
|
staticParameters: {
|
|
2169
|
-
direction:
|
|
2140
|
+
direction: ue.LEFT
|
|
2170
2141
|
}
|
|
2171
|
-
},
|
|
2172
|
-
id:
|
|
2142
|
+
}, Cr = {
|
|
2143
|
+
id: Ke.id,
|
|
2173
2144
|
description: "shortcut.doc.drawing-move-right",
|
|
2174
2145
|
group: "4_doc-drawing-view",
|
|
2175
|
-
binding:
|
|
2146
|
+
binding: Fe.ARROW_RIGHT,
|
|
2176
2147
|
priority: 100,
|
|
2177
|
-
preconditions:
|
|
2148
|
+
preconditions: Ye,
|
|
2178
2149
|
staticParameters: {
|
|
2179
|
-
direction:
|
|
2150
|
+
direction: ue.RIGHT
|
|
2180
2151
|
}
|
|
2181
|
-
},
|
|
2182
|
-
id:
|
|
2152
|
+
}, Dr = {
|
|
2153
|
+
id: ct.id,
|
|
2183
2154
|
description: "shortcut.doc.drawing-delete",
|
|
2184
2155
|
group: "4_doc-drawing-view",
|
|
2185
2156
|
// when focusing on any other input tag do not trigger this shortcut
|
|
2186
|
-
preconditions:
|
|
2187
|
-
binding:
|
|
2188
|
-
mac:
|
|
2157
|
+
preconditions: Ye,
|
|
2158
|
+
binding: Fe.DELETE,
|
|
2159
|
+
mac: Fe.BACKSPACE
|
|
2189
2160
|
};
|
|
2190
|
-
var
|
|
2191
|
-
for (var
|
|
2192
|
-
(
|
|
2193
|
-
return
|
|
2194
|
-
},
|
|
2195
|
-
let
|
|
2196
|
-
constructor(
|
|
2197
|
-
super(), this._componentManager =
|
|
2161
|
+
var Or = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Pr = (i, e, n, t) => {
|
|
2162
|
+
for (var r = t > 1 ? void 0 : t ? xr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2163
|
+
(s = i[o]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
2164
|
+
return t && r && Or(e, n, r), r;
|
|
2165
|
+
}, nn = (i, e) => (n, t) => e(n, t, i);
|
|
2166
|
+
let an = class extends Xe {
|
|
2167
|
+
constructor(i, e, n, t) {
|
|
2168
|
+
super(), this._componentManager = i, this._menuManagerService = e, this._commandService = n, this._shortcutService = t, this._init();
|
|
2198
2169
|
}
|
|
2199
2170
|
_initCustomComponents() {
|
|
2200
|
-
const
|
|
2201
|
-
this.disposeWithMe(
|
|
2171
|
+
const i = this._componentManager;
|
|
2172
|
+
this.disposeWithMe(i.register(vt, at)), this.disposeWithMe(i.register(ft, fr));
|
|
2202
2173
|
}
|
|
2203
2174
|
_initMenus() {
|
|
2204
|
-
this._menuManagerService.mergeMenu(
|
|
2175
|
+
this._menuManagerService.mergeMenu(vr);
|
|
2205
2176
|
}
|
|
2206
2177
|
_initCommands() {
|
|
2207
2178
|
[
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
].forEach((
|
|
2179
|
+
ut,
|
|
2180
|
+
lt,
|
|
2181
|
+
et,
|
|
2182
|
+
nt,
|
|
2183
|
+
tt,
|
|
2184
|
+
qe,
|
|
2185
|
+
it,
|
|
2186
|
+
rt,
|
|
2187
|
+
Cn,
|
|
2188
|
+
ht,
|
|
2189
|
+
Xi,
|
|
2190
|
+
pt,
|
|
2191
|
+
dt,
|
|
2192
|
+
mt,
|
|
2193
|
+
Ke,
|
|
2194
|
+
ct,
|
|
2195
|
+
gt
|
|
2196
|
+
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
2226
2197
|
}
|
|
2227
2198
|
_initShortcuts() {
|
|
2228
2199
|
[
|
|
2229
2200
|
// sheet drawing shortcuts
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
].forEach((
|
|
2236
|
-
this.disposeWithMe(this._shortcutService.registerShortcut(
|
|
2201
|
+
Ir,
|
|
2202
|
+
_r,
|
|
2203
|
+
Sr,
|
|
2204
|
+
Cr,
|
|
2205
|
+
Dr
|
|
2206
|
+
].forEach((i) => {
|
|
2207
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(i));
|
|
2237
2208
|
});
|
|
2238
2209
|
}
|
|
2239
2210
|
_init() {
|
|
2240
2211
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
2241
2212
|
}
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
],
|
|
2249
|
-
var
|
|
2250
|
-
for (var
|
|
2251
|
-
(
|
|
2252
|
-
return
|
|
2253
|
-
},
|
|
2254
|
-
let
|
|
2255
|
-
constructor(
|
|
2213
|
+
};
|
|
2214
|
+
an = Pr([
|
|
2215
|
+
nn(0, we(mi)),
|
|
2216
|
+
nn(1, ui),
|
|
2217
|
+
nn(2, z),
|
|
2218
|
+
nn(3, fi)
|
|
2219
|
+
], an);
|
|
2220
|
+
var Tr = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, br = (i, e, n, t) => {
|
|
2221
|
+
for (var r = t > 1 ? void 0 : t ? yr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2222
|
+
(s = i[o]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
2223
|
+
return t && r && Tr(e, n, r), r;
|
|
2224
|
+
}, Ve = (i, e) => (n, t) => e(n, t, i);
|
|
2225
|
+
let cn = class extends jt {
|
|
2226
|
+
constructor(e, n, t, r, o) {
|
|
2256
2227
|
super();
|
|
2257
|
-
|
|
2258
|
-
this._drawingManagerService =
|
|
2228
|
+
Se(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
2229
|
+
this._drawingManagerService = e, this._canvasPopManagerService = n, this._renderManagerService = t, this._univerInstanceService = r, this._contextService = o, this._init();
|
|
2259
2230
|
}
|
|
2260
2231
|
_init() {
|
|
2261
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2232
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(Te.UNIVER_DOC).pipe(An(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(Te.UNIVER_DOC).pipe(An(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(Te.UNIVER_DOC).forEach((e) => this._create(e));
|
|
2262
2233
|
}
|
|
2263
|
-
_dispose(
|
|
2264
|
-
const
|
|
2265
|
-
this._renderManagerService.removeRender(
|
|
2234
|
+
_dispose(e) {
|
|
2235
|
+
const n = e.getUnitId();
|
|
2236
|
+
this._renderManagerService.removeRender(n);
|
|
2266
2237
|
}
|
|
2267
|
-
_create(
|
|
2268
|
-
if (!
|
|
2238
|
+
_create(e) {
|
|
2239
|
+
if (!e)
|
|
2269
2240
|
return;
|
|
2270
|
-
const
|
|
2271
|
-
this._renderManagerService.has(
|
|
2241
|
+
const n = e.getUnitId();
|
|
2242
|
+
this._renderManagerService.has(n) && !this._initImagePopupMenu.has(n) && (this._popupMenuListener(n), this._initImagePopupMenu.add(n));
|
|
2272
2243
|
}
|
|
2273
|
-
_hasCropObject(
|
|
2274
|
-
const
|
|
2275
|
-
for (const
|
|
2276
|
-
if (
|
|
2244
|
+
_hasCropObject(e) {
|
|
2245
|
+
const n = e.getAllObjects();
|
|
2246
|
+
for (const t of n)
|
|
2247
|
+
if (t instanceof Qt)
|
|
2277
2248
|
return !0;
|
|
2278
2249
|
return !1;
|
|
2279
2250
|
}
|
|
2280
2251
|
// eslint-disable-next-line max-lines-per-function
|
|
2281
|
-
_popupMenuListener(
|
|
2282
|
-
var
|
|
2283
|
-
const
|
|
2284
|
-
if (!
|
|
2252
|
+
_popupMenuListener(e) {
|
|
2253
|
+
var o;
|
|
2254
|
+
const n = (o = this._renderManagerService.getRenderById(e)) == null ? void 0 : o.scene;
|
|
2255
|
+
if (!n)
|
|
2285
2256
|
return;
|
|
2286
|
-
const
|
|
2287
|
-
if (!
|
|
2257
|
+
const t = n.getTransformerByCreate();
|
|
2258
|
+
if (!t)
|
|
2288
2259
|
return;
|
|
2289
|
-
const
|
|
2260
|
+
const r = [];
|
|
2290
2261
|
this.disposeWithMe(
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
if (this._hasCropObject(
|
|
2262
|
+
Ae(
|
|
2263
|
+
t.createControl$.subscribe(() => {
|
|
2264
|
+
if (this._hasCropObject(n))
|
|
2294
2265
|
return;
|
|
2295
|
-
const
|
|
2296
|
-
if (
|
|
2266
|
+
const s = t.getSelectedObjectMap();
|
|
2267
|
+
if (r.forEach((w) => w.dispose()), r.length = 0, s.size > 1)
|
|
2297
2268
|
return;
|
|
2298
|
-
const
|
|
2299
|
-
if (!
|
|
2269
|
+
const a = s.values().next().value;
|
|
2270
|
+
if (!a)
|
|
2300
2271
|
return;
|
|
2301
|
-
const
|
|
2302
|
-
if (!
|
|
2272
|
+
const d = a.oKey, c = this._drawingManagerService.getDrawingOKey(d);
|
|
2273
|
+
if (!c)
|
|
2303
2274
|
return;
|
|
2304
|
-
const { unitId:
|
|
2305
|
-
|
|
2275
|
+
const { unitId: l, subUnitId: u, drawingId: m } = c, p = this._canvasPopManagerService.attachPopupToObject(
|
|
2276
|
+
a,
|
|
2306
2277
|
{
|
|
2307
|
-
componentKey:
|
|
2278
|
+
componentKey: ei,
|
|
2308
2279
|
direction: "horizontal",
|
|
2309
2280
|
offset: [2, 0],
|
|
2310
2281
|
extraProps: {
|
|
2311
|
-
menuItems: this._getImageMenuItems(
|
|
2282
|
+
menuItems: this._getImageMenuItems(l, u, m)
|
|
2312
2283
|
}
|
|
2313
2284
|
},
|
|
2314
|
-
|
|
2285
|
+
l
|
|
2315
2286
|
);
|
|
2316
|
-
|
|
2317
|
-
unitId:
|
|
2318
|
-
subUnitId,
|
|
2319
|
-
drawingId
|
|
2287
|
+
r.push(this.disposeWithMe(p)), !this._drawingManagerService.getFocusDrawings().find((w) => w.unitId === l && w.subUnitId === u && w.drawingId === m) && this._drawingManagerService.focusDrawing([{
|
|
2288
|
+
unitId: l,
|
|
2289
|
+
subUnitId: u,
|
|
2290
|
+
drawingId: m
|
|
2320
2291
|
}]);
|
|
2321
2292
|
})
|
|
2322
2293
|
)
|
|
2323
2294
|
), this.disposeWithMe(
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2295
|
+
Ae(
|
|
2296
|
+
t.clearControl$.subscribe(() => {
|
|
2297
|
+
r.forEach((s) => s.dispose()), r.length = 0, this._contextService.setContextValue(tn, !1), this._drawingManagerService.focusDrawing(null);
|
|
2327
2298
|
})
|
|
2328
2299
|
)
|
|
2329
2300
|
), this.disposeWithMe(
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2301
|
+
Ae(
|
|
2302
|
+
t.changing$.subscribe(() => {
|
|
2303
|
+
r.forEach((s) => s.dispose()), r.length = 0;
|
|
2333
2304
|
})
|
|
2334
2305
|
)
|
|
2335
2306
|
), this.disposeWithMe(
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2307
|
+
Ae(
|
|
2308
|
+
t.changeStart$.subscribe(() => {
|
|
2309
|
+
r.forEach((s) => s.dispose()), r.length = 0;
|
|
2339
2310
|
})
|
|
2340
2311
|
)
|
|
2341
2312
|
);
|
|
2342
2313
|
}
|
|
2343
|
-
_getImageMenuItems(
|
|
2314
|
+
_getImageMenuItems(e, n, t) {
|
|
2344
2315
|
return [
|
|
2345
2316
|
{
|
|
2346
2317
|
label: "image-popup.edit",
|
|
2347
2318
|
index: 0,
|
|
2348
|
-
commandId:
|
|
2349
|
-
commandParams: { unitId, subUnitId, drawingId },
|
|
2350
|
-
disable: !!
|
|
2319
|
+
commandId: pt.id,
|
|
2320
|
+
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
2321
|
+
disable: !!Lt.includes(e)
|
|
2351
2322
|
},
|
|
2352
2323
|
{
|
|
2353
2324
|
label: "image-popup.delete",
|
|
2354
2325
|
index: 1,
|
|
2355
|
-
commandId:
|
|
2356
|
-
commandParams: { unitId, drawings: [{ unitId, subUnitId, drawingId }] },
|
|
2326
|
+
commandId: Cn.id,
|
|
2327
|
+
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
|
|
2357
2328
|
disable: !1
|
|
2358
2329
|
},
|
|
2359
2330
|
{
|
|
2360
2331
|
label: "image-popup.crop",
|
|
2361
2332
|
index: 2,
|
|
2362
|
-
commandId:
|
|
2363
|
-
commandParams: { unitId, subUnitId, drawingId },
|
|
2333
|
+
commandId: ni.id,
|
|
2334
|
+
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
2364
2335
|
disable: !0
|
|
2365
2336
|
// TODO: @JOCS, feature is not ready.
|
|
2366
2337
|
},
|
|
2367
2338
|
{
|
|
2368
2339
|
label: "image-popup.reset",
|
|
2369
2340
|
index: 3,
|
|
2370
|
-
commandId:
|
|
2371
|
-
commandParams: [{ unitId, subUnitId, drawingId }],
|
|
2341
|
+
commandId: ti.id,
|
|
2342
|
+
commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
|
|
2372
2343
|
disable: !0
|
|
2373
2344
|
// TODO: @JOCS, feature is not ready.
|
|
2374
2345
|
}
|
|
2375
2346
|
];
|
|
2376
2347
|
}
|
|
2377
|
-
}
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
],
|
|
2385
|
-
var
|
|
2386
|
-
for (var
|
|
2387
|
-
(
|
|
2388
|
-
return
|
|
2389
|
-
},
|
|
2390
|
-
let
|
|
2391
|
-
constructor(
|
|
2348
|
+
};
|
|
2349
|
+
cn = br([
|
|
2350
|
+
Ve(0, ve),
|
|
2351
|
+
Ve(1, we(Si)),
|
|
2352
|
+
Ve(2, Q),
|
|
2353
|
+
Ve(3, J),
|
|
2354
|
+
Ve(4, zn)
|
|
2355
|
+
], cn);
|
|
2356
|
+
var Mr = Object.defineProperty, Rr = Object.getOwnPropertyDescriptor, Nr = (i, e, n, t) => {
|
|
2357
|
+
for (var r = t > 1 ? void 0 : t ? Rr(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2358
|
+
(s = i[o]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
2359
|
+
return t && r && Mr(e, n, r), r;
|
|
2360
|
+
}, Ee = (i, e) => (n, t) => e(n, t, i);
|
|
2361
|
+
let vn = class extends Xe {
|
|
2362
|
+
constructor(e, n, t, r, o, s, a, d) {
|
|
2392
2363
|
super();
|
|
2393
|
-
|
|
2394
|
-
this._context =
|
|
2364
|
+
Se(this, "_liquid", new qn());
|
|
2365
|
+
this._context = e, this._docSkeletonManagerService = n, this._commandService = t, this._editorService = r, this._drawingManagerService = o, this._docRefreshDrawingsService = s, this._univerInstanceService = a, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
|
|
2395
2366
|
}
|
|
2396
2367
|
_initialize() {
|
|
2397
2368
|
this._initialRenderRefresh(), this._drawingInitializeListener(), this._initResize();
|
|
2398
2369
|
}
|
|
2399
2370
|
_initialRenderRefresh() {
|
|
2400
|
-
this._docSkeletonManagerService.currentSkeleton$.subscribe((
|
|
2401
|
-
|
|
2402
|
-
}), this._docRefreshDrawingsService.refreshDrawings$.subscribe((
|
|
2403
|
-
|
|
2371
|
+
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
2372
|
+
e != null && this._refreshDrawing(e);
|
|
2373
|
+
}), this._docRefreshDrawingsService.refreshDrawings$.subscribe((e) => {
|
|
2374
|
+
e != null && this._refreshDrawing(e);
|
|
2404
2375
|
});
|
|
2405
2376
|
}
|
|
2406
2377
|
_commandExecutedListener() {
|
|
2407
|
-
const
|
|
2378
|
+
const e = [Z.id, Di.id];
|
|
2408
2379
|
this.disposeWithMe(
|
|
2409
|
-
this._commandService.onCommandExecuted((
|
|
2410
|
-
if (
|
|
2411
|
-
const
|
|
2412
|
-
if (
|
|
2380
|
+
this._commandService.onCommandExecuted((n) => {
|
|
2381
|
+
if (e.includes(n.id)) {
|
|
2382
|
+
const t = n.params, { unitId: r } = t, { unitId: o, mainComponent: s } = this._context;
|
|
2383
|
+
if (r !== o)
|
|
2413
2384
|
return;
|
|
2414
|
-
const
|
|
2415
|
-
if (
|
|
2385
|
+
const a = this._docSkeletonManagerService.getSkeleton();
|
|
2386
|
+
if (a == null)
|
|
2416
2387
|
return;
|
|
2417
|
-
if (this._editorService.isEditor(
|
|
2418
|
-
|
|
2388
|
+
if (this._editorService.isEditor(o) && o !== Ut) {
|
|
2389
|
+
s == null || s.makeDirty();
|
|
2419
2390
|
return;
|
|
2420
2391
|
}
|
|
2421
|
-
this._refreshDrawing(
|
|
2392
|
+
this._refreshDrawing(a);
|
|
2422
2393
|
}
|
|
2423
2394
|
})
|
|
2424
2395
|
);
|
|
2425
2396
|
}
|
|
2426
2397
|
_initResize() {
|
|
2427
2398
|
this.disposeWithMe(
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2399
|
+
Ft(this._context.engine.onTransformChange$).pipe(
|
|
2400
|
+
jn((e) => e.type === ai.resize),
|
|
2401
|
+
Yn(16)
|
|
2431
2402
|
).subscribe(() => {
|
|
2432
|
-
var
|
|
2433
|
-
const
|
|
2434
|
-
(
|
|
2403
|
+
var t;
|
|
2404
|
+
const e = this._docSkeletonManagerService.getSkeleton(), { scene: n } = this._context;
|
|
2405
|
+
(t = n.getTransformer()) == null || t.refreshControls(), this._refreshDrawing(e);
|
|
2435
2406
|
})
|
|
2436
2407
|
);
|
|
2437
2408
|
}
|
|
2438
|
-
_refreshDrawing(
|
|
2439
|
-
var
|
|
2440
|
-
const
|
|
2441
|
-
if (!
|
|
2409
|
+
_refreshDrawing(e) {
|
|
2410
|
+
var O, D;
|
|
2411
|
+
const n = e == null ? void 0 : e.getSkeletonData(), { mainComponent: t, unitId: r } = this._context, o = t;
|
|
2412
|
+
if (!n)
|
|
2442
2413
|
return;
|
|
2443
|
-
const { left:
|
|
2414
|
+
const { left: s, top: a, pageLayoutType: d, pageMarginLeft: c, pageMarginTop: l } = o, { pages: u, skeHeaders: m, skeFooters: p } = n, h = {};
|
|
2444
2415
|
this._liquid.reset();
|
|
2445
|
-
for (let
|
|
2446
|
-
const
|
|
2447
|
-
if (
|
|
2448
|
-
const
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2416
|
+
for (let x = 0, b = u.length; x < b; x++) {
|
|
2417
|
+
const T = u[x], { headerId: N, footerId: B, pageWidth: R } = T;
|
|
2418
|
+
if (N) {
|
|
2419
|
+
const I = (O = m.get(N)) == null ? void 0 : O.get(R);
|
|
2420
|
+
I && this._calculateDrawingPosition(
|
|
2421
|
+
r,
|
|
2422
|
+
I,
|
|
2423
|
+
s,
|
|
2424
|
+
a,
|
|
2425
|
+
h,
|
|
2426
|
+
I.marginTop,
|
|
2427
|
+
T.marginLeft
|
|
2457
2428
|
);
|
|
2458
2429
|
}
|
|
2459
|
-
if (
|
|
2460
|
-
const
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2430
|
+
if (B) {
|
|
2431
|
+
const I = (D = p.get(B)) == null ? void 0 : D.get(R);
|
|
2432
|
+
I && this._calculateDrawingPosition(
|
|
2433
|
+
r,
|
|
2434
|
+
I,
|
|
2435
|
+
s,
|
|
2436
|
+
a,
|
|
2437
|
+
h,
|
|
2438
|
+
T.pageHeight - T.marginBottom + I.marginTop,
|
|
2439
|
+
T.marginLeft
|
|
2469
2440
|
);
|
|
2470
2441
|
}
|
|
2471
|
-
this._calculateDrawingPosition(
|
|
2442
|
+
this._calculateDrawingPosition(r, T, s, a, h, T.marginTop, T.marginLeft), this._liquid.translatePage(T, d, c, l);
|
|
2472
2443
|
}
|
|
2473
|
-
const
|
|
2474
|
-
|
|
2475
|
-
}
|
|
2476
|
-
_handleMultiDrawingsTransform(
|
|
2477
|
-
const { scene, unitId } = this._context,
|
|
2478
|
-
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2444
|
+
const v = Object.values(h), w = v.filter((x) => !x.isMultiTransform), S = v.filter((x) => x.isMultiTransform);
|
|
2445
|
+
w.length > 0 && this._drawingManagerService.refreshTransform(w), this._handleMultiDrawingsTransform(S);
|
|
2446
|
+
}
|
|
2447
|
+
_handleMultiDrawingsTransform(e) {
|
|
2448
|
+
const { scene: n, unitId: t } = this._context, r = n.getTransformerByCreate();
|
|
2449
|
+
e.forEach((d) => {
|
|
2450
|
+
const c = this._drawingManagerService.getDrawingByParam(d);
|
|
2451
|
+
c != null && (c.transform = d.transform, c.transforms = d.transforms, c.isMultiTransform = d.isMultiTransform);
|
|
2481
2452
|
});
|
|
2482
|
-
const
|
|
2483
|
-
this._drawingManagerService.removeNotification(
|
|
2484
|
-
for (const
|
|
2485
|
-
const
|
|
2486
|
-
|
|
2453
|
+
const s = [...r.getSelectedObjectMap().keys()], a = Object.values(this._drawingManagerService.getDrawingData(t, t)).filter((d) => d.isMultiTransform === re.TRUE);
|
|
2454
|
+
this._drawingManagerService.removeNotification(a), e.length > 0 && this._drawingManagerService.addNotification(e);
|
|
2455
|
+
for (const d of s) {
|
|
2456
|
+
const c = n.getObject(d);
|
|
2457
|
+
c && r.setSelectedControl(c);
|
|
2487
2458
|
}
|
|
2488
2459
|
}
|
|
2489
|
-
_calculateDrawingPosition(
|
|
2490
|
-
const { skeDrawings } =
|
|
2460
|
+
_calculateDrawingPosition(e, n, t, r, o, s, a) {
|
|
2461
|
+
const { skeDrawings: d } = n;
|
|
2491
2462
|
this._liquid.translatePagePadding({
|
|
2492
|
-
marginTop,
|
|
2493
|
-
marginLeft
|
|
2494
|
-
}),
|
|
2495
|
-
const { aLeft, aTop, height, width, angle, drawingId, drawingOrigin } =
|
|
2496
|
-
left:
|
|
2497
|
-
top:
|
|
2498
|
-
width,
|
|
2499
|
-
height,
|
|
2500
|
-
angle
|
|
2463
|
+
marginTop: s,
|
|
2464
|
+
marginLeft: a
|
|
2465
|
+
}), d.forEach((c) => {
|
|
2466
|
+
const { aLeft: l, aTop: u, height: m, width: p, angle: h, drawingId: v, drawingOrigin: w } = c, S = w.layoutType === k.WRAP_NONE && w.behindDoc === re.TRUE, { isMultiTransform: O = re.FALSE } = w, D = {
|
|
2467
|
+
left: l + t + this._liquid.x,
|
|
2468
|
+
top: u + r + this._liquid.y,
|
|
2469
|
+
width: p,
|
|
2470
|
+
height: m,
|
|
2471
|
+
angle: h
|
|
2501
2472
|
};
|
|
2502
|
-
|
|
2503
|
-
unitId,
|
|
2504
|
-
subUnitId:
|
|
2505
|
-
drawingId,
|
|
2506
|
-
behindText,
|
|
2507
|
-
transform,
|
|
2508
|
-
transforms: [
|
|
2509
|
-
isMultiTransform
|
|
2510
|
-
} :
|
|
2473
|
+
o[v] == null ? o[v] = {
|
|
2474
|
+
unitId: e,
|
|
2475
|
+
subUnitId: e,
|
|
2476
|
+
drawingId: v,
|
|
2477
|
+
behindText: S,
|
|
2478
|
+
transform: D,
|
|
2479
|
+
transforms: [D],
|
|
2480
|
+
isMultiTransform: O
|
|
2481
|
+
} : O === re.TRUE && o[v].transforms.push(D);
|
|
2511
2482
|
}), this._liquid.restorePagePadding({
|
|
2512
|
-
marginTop,
|
|
2513
|
-
marginLeft
|
|
2483
|
+
marginTop: s,
|
|
2484
|
+
marginLeft: a
|
|
2514
2485
|
});
|
|
2515
2486
|
}
|
|
2516
2487
|
_drawingInitializeListener() {
|
|
2517
|
-
const
|
|
2518
|
-
const
|
|
2519
|
-
|
|
2520
|
-
}
|
|
2521
|
-
this._lifecycleService.stage ===
|
|
2522
|
-
|
|
2523
|
-
}, 1e3) : this._lifecycleService.lifecycle$.pipe(
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
],
|
|
2535
|
-
var
|
|
2536
|
-
for (var
|
|
2537
|
-
(
|
|
2538
|
-
return
|
|
2539
|
-
},
|
|
2540
|
-
const
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
const { ...rest } = merge(
|
|
2488
|
+
const e = () => {
|
|
2489
|
+
const n = this._docSkeletonManagerService.getSkeleton();
|
|
2490
|
+
n != null && (this._refreshDrawing(n), this._drawingManagerService.initializeNotification(this._context.unitId));
|
|
2491
|
+
};
|
|
2492
|
+
this._lifecycleService.stage === Pn.Steady ? setTimeout(() => {
|
|
2493
|
+
e();
|
|
2494
|
+
}, 1e3) : this._lifecycleService.lifecycle$.pipe(jn((n) => n === Pn.Steady)).subscribe(e);
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
vn = Nr([
|
|
2498
|
+
Ee(1, we(oe)),
|
|
2499
|
+
Ee(2, z),
|
|
2500
|
+
Ee(3, Ci),
|
|
2501
|
+
Ee(4, ve),
|
|
2502
|
+
Ee(5, we(gn)),
|
|
2503
|
+
Ee(6, J),
|
|
2504
|
+
Ee(7, we(Bt))
|
|
2505
|
+
], vn);
|
|
2506
|
+
var St = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, Ar = (i, e, n) => e in i ? St(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, jr = (i, e, n, t) => {
|
|
2507
|
+
for (var r = t > 1 ? void 0 : t ? Er(e, n) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2508
|
+
(s = i[o]) && (r = (t ? s(e, n, r) : s(r)) || r);
|
|
2509
|
+
return t && r && St(e, n, r), r;
|
|
2510
|
+
}, wn = (i, e) => (n, t) => e(n, t, i), Ct = (i, e, n) => Ar(i, typeof e != "symbol" ? e + "" : e, n);
|
|
2511
|
+
const Lr = "DOC_DRAWING_UI_PLUGIN";
|
|
2512
|
+
let dn = class extends Wt {
|
|
2513
|
+
constructor(i = Fn, e, n, t) {
|
|
2514
|
+
super(), this._config = i, this._injector = e, this._renderManagerSrv = n, this._configService = t;
|
|
2515
|
+
const { ...r } = Gt(
|
|
2546
2516
|
{},
|
|
2547
|
-
|
|
2517
|
+
Fn,
|
|
2548
2518
|
this._config
|
|
2549
2519
|
);
|
|
2550
|
-
this._configService.setConfig(
|
|
2520
|
+
this._configService.setConfig(bi, r);
|
|
2551
2521
|
}
|
|
2552
2522
|
onStarting() {
|
|
2553
2523
|
[
|
|
2554
|
-
[
|
|
2555
|
-
[
|
|
2556
|
-
[
|
|
2557
|
-
[
|
|
2558
|
-
[
|
|
2559
|
-
].forEach((
|
|
2524
|
+
[an],
|
|
2525
|
+
[cn],
|
|
2526
|
+
[on],
|
|
2527
|
+
[rn],
|
|
2528
|
+
[gn]
|
|
2529
|
+
].forEach((e) => this._injector.add(e));
|
|
2560
2530
|
}
|
|
2561
2531
|
onReady() {
|
|
2562
2532
|
[
|
|
2563
|
-
[
|
|
2564
|
-
[
|
|
2565
|
-
].forEach((
|
|
2533
|
+
[sn],
|
|
2534
|
+
[vn]
|
|
2535
|
+
].forEach((i) => this._renderManagerSrv.registerRenderModule(Te.UNIVER_DOC, i)), this._injector.get(rn), this._injector.get(an), this._injector.get(on);
|
|
2566
2536
|
}
|
|
2567
2537
|
onRendered() {
|
|
2568
|
-
this._injector.get(
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
],
|
|
2538
|
+
this._injector.get(cn);
|
|
2539
|
+
}
|
|
2540
|
+
};
|
|
2541
|
+
Ct(dn, "type", Te.UNIVER_DOC);
|
|
2542
|
+
Ct(dn, "pluginName", Lr);
|
|
2543
|
+
dn = jr([
|
|
2544
|
+
kt(ii, Jt, $t, hi),
|
|
2545
|
+
wn(1, we(Ht)),
|
|
2546
|
+
wn(2, Q),
|
|
2547
|
+
wn(3, Vt)
|
|
2548
|
+
], dn);
|
|
2579
2549
|
export {
|
|
2580
|
-
ClearDocDrawingTransformerOperation,
|
|
2581
|
-
DOCS_IMAGE_MENU_ID,
|
|
2582
|
-
DeleteDocDrawingsCommand,
|
|
2583
|
-
EditDocDrawingOperation,
|
|
2584
|
-
GroupDocDrawingCommand,
|
|
2585
|
-
InsertDocDrawingCommand,
|
|
2586
|
-
InsertDocImageCommand,
|
|
2587
|
-
MoveDocDrawingsCommand,
|
|
2588
|
-
RemoveDocDrawingCommand,
|
|
2589
|
-
SetDocDrawingArrangeCommand,
|
|
2590
|
-
SidebarDocDrawingOperation,
|
|
2591
|
-
UngroupDocDrawingCommand,
|
|
2592
|
-
UniverDocsDrawingUIPlugin
|
|
2550
|
+
Xi as ClearDocDrawingTransformerOperation,
|
|
2551
|
+
It as DOCS_IMAGE_MENU_ID,
|
|
2552
|
+
ct as DeleteDocDrawingsCommand,
|
|
2553
|
+
pt as EditDocDrawingOperation,
|
|
2554
|
+
dt as GroupDocDrawingCommand,
|
|
2555
|
+
lt as InsertDocDrawingCommand,
|
|
2556
|
+
ut as InsertDocImageCommand,
|
|
2557
|
+
Ke as MoveDocDrawingsCommand,
|
|
2558
|
+
Cn as RemoveDocDrawingCommand,
|
|
2559
|
+
gt as SetDocDrawingArrangeCommand,
|
|
2560
|
+
ht as SidebarDocDrawingOperation,
|
|
2561
|
+
mt as UngroupDocDrawingCommand,
|
|
2562
|
+
dn as UniverDocsDrawingUIPlugin
|
|
2593
2563
|
};
|