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