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