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