@univerjs/docs-drawing-ui 0.6.5-nightly.202503131607 → 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 +346 -343
- package/lib/umd/index.js +1 -1
- package/package.json +11 -11
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var At = Object.defineProperty;
|
|
2
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
|
|
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
|
|
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
5
|
import { IDocDrawingService as Ue, UniverDocsDrawingPlugin as Qt } from "@univerjs/docs-drawing";
|
|
6
|
-
import { IDrawingManagerService as
|
|
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
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
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";
|
|
@@ -11,7 +11,7 @@ import { RichTextEditingMutation as ne, DocSkeletonManagerService as te, DocSele
|
|
|
11
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
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
13
|
import { MessageType as Vn, clsx as j, InputNumber as Fe, Select as jn, Checkbox as Li, RadioGroup as $n, Radio as be } from "@univerjs/design";
|
|
14
|
-
import { jsxs as K, jsx as
|
|
14
|
+
import { jsxs as K, jsx as p } from "react/jsx-runtime";
|
|
15
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) => {
|
|
@@ -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(
|
|
@@ -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);
|
|
@@ -154,13 +154,13 @@ const Gi = {
|
|
|
154
154
|
};
|
|
155
155
|
function dt(i, e, n, t, r, o, s) {
|
|
156
156
|
var f, u;
|
|
157
|
-
const a = new Sn(), d = X.getInstance(), c = [],
|
|
158
|
-
if (
|
|
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 dt(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 dt(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,7 +224,7 @@ function dt(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
|
}
|
|
@@ -237,10 +237,10 @@ const lt = {
|
|
|
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 f =
|
|
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
245
|
const { drawingId: _ } = E, L = T[_].layoutType, G = Gi[t];
|
|
246
246
|
if (L !== G) {
|
|
@@ -257,11 +257,11 @@ const lt = {
|
|
|
257
257
|
if (t === "inline")
|
|
258
258
|
continue;
|
|
259
259
|
let x = null, V = 0, S = 0;
|
|
260
|
-
for (const D of
|
|
260
|
+
for (const D of v) {
|
|
261
261
|
const { headerId: R, footerId: y, marginTop: U, marginLeft: k, marginBottom: b, pageWidth: A, pageHeight: z } = D;
|
|
262
262
|
switch (f) {
|
|
263
263
|
case We.HEADER: {
|
|
264
|
-
const F = (N =
|
|
264
|
+
const F = (N = w.get(R)) == null ? void 0 : N.get(A);
|
|
265
265
|
F != null && F.skeDrawings.has(_) && (x = F.skeDrawings.get(_), V = F.marginTop, S = k);
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
@@ -324,13 +324,13 @@ const lt = {
|
|
|
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:
|
|
327
|
+
const { drawings: o, dist: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: g = {} } = r.getSnapshot();
|
|
328
328
|
for (const f of o) {
|
|
329
329
|
const { drawingId: u } = f;
|
|
330
|
-
for (const [
|
|
331
|
-
const I =
|
|
332
|
-
if (I !==
|
|
333
|
-
const O = d.replaceOp(["drawings", u,
|
|
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
|
}
|
|
@@ -354,12 +354,12 @@ const lt = {
|
|
|
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:
|
|
357
|
+
const { drawings: o, wrapText: s, unitId: a } = e, d = X.getInstance(), c = [], { drawings: g = {} } = r.getSnapshot();
|
|
358
358
|
for (const f of o) {
|
|
359
|
-
const { drawingId: u } = f,
|
|
360
|
-
if (
|
|
361
|
-
const
|
|
362
|
-
c.push(
|
|
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 = {
|
|
@@ -384,26 +384,26 @@ const lt = {
|
|
|
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: I, key: O, value: C } =
|
|
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
391
|
const M = m.replaceOp(["drawings", I, "docTransform", O], T, C);
|
|
392
|
-
|
|
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",
|
|
@@ -418,13 +418,13 @@ const lt = {
|
|
|
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:
|
|
421
|
+
const { drawing: l, unitId: f, offset: u, segmentId: v, segmentPage: w, needRefreshDrawings: I } = e;
|
|
422
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,
|
|
@@ -459,34 +459,34 @@ const lt = {
|
|
|
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
|
-
|
|
465
|
+
v,
|
|
466
|
+
l,
|
|
467
467
|
I,
|
|
468
468
|
c,
|
|
469
469
|
t
|
|
470
470
|
);
|
|
471
471
|
if (C == null)
|
|
472
472
|
return !1;
|
|
473
|
-
C.length > 0 &&
|
|
473
|
+
C.length > 0 && w.push(...C);
|
|
474
474
|
const T = X.getInstance(), { drawings: M = {} } = c.getSnapshot(), P = M[I].docTransform, { positionH: N, positionV: B, size: E, angle: _ } = P;
|
|
475
475
|
if (!Me.diffValue(N, f.positionH)) {
|
|
476
476
|
const S = T.replaceOp(["drawings", I, "docTransform", "positionH"], N, f.positionH);
|
|
477
|
-
|
|
477
|
+
w.push(S);
|
|
478
478
|
}
|
|
479
479
|
if (!Me.diffValue(B, f.positionV)) {
|
|
480
480
|
const S = T.replaceOp(["drawings", I, "docTransform", "positionV"], B, f.positionV);
|
|
481
|
-
|
|
481
|
+
w.push(S);
|
|
482
482
|
}
|
|
483
483
|
if (!Me.diffValue(E, f.size)) {
|
|
484
484
|
const S = T.replaceOp(["drawings", I, "docTransform", "size"], E, f.size);
|
|
485
|
-
|
|
485
|
+
w.push(S);
|
|
486
486
|
}
|
|
487
487
|
if (!Me.diffValue(_, f.angle)) {
|
|
488
488
|
const S = T.replaceOp(["drawings", I, "docTransform", "angle"], _, f.angle);
|
|
489
|
-
|
|
489
|
+
w.push(S);
|
|
490
490
|
}
|
|
491
491
|
const L = {
|
|
492
492
|
id: ne.id,
|
|
@@ -497,7 +497,7 @@ const lt = {
|
|
|
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,20 +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
|
|
556
|
+
const w = this._univerInstanceService.getUniverDocInstance(v.unitId), I = (a = w == null ? void 0 : w.getSnapshot().drawings) == null ? void 0 : a[v.drawingId];
|
|
557
557
|
if ((I == null ? void 0 : I.layoutType) === W.INLINE)
|
|
558
558
|
try {
|
|
559
559
|
d.setOpacity(0.2);
|
|
560
560
|
} catch {
|
|
561
561
|
}
|
|
562
|
-
I != null && this._transformerCache.set(
|
|
562
|
+
I != null && this._transformerCache.set(v.drawingId, {
|
|
563
563
|
drawing: I,
|
|
564
564
|
top: f,
|
|
565
|
-
left:
|
|
566
|
-
width:
|
|
565
|
+
left: l,
|
|
566
|
+
width: g,
|
|
567
567
|
height: m,
|
|
568
568
|
angle: u
|
|
569
569
|
});
|
|
@@ -579,8 +579,8 @@ let sn = class extends Ge {
|
|
|
579
579
|
if (s.size > 1)
|
|
580
580
|
t(s);
|
|
581
581
|
else if (s.size === 1) {
|
|
582
|
-
const c = this._transformerCache.values().next().value,
|
|
583
|
-
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)
|
|
584
584
|
return;
|
|
585
585
|
c && (c.drawing.layoutType, W.INLINE), c && c.drawing.layoutType === W.INLINE && a != null && d != null && this._updateInlineDrawingAnchor(c.drawing, a, d);
|
|
586
586
|
}
|
|
@@ -592,10 +592,10 @@ let sn = class extends Ge {
|
|
|
592
592
|
n.changeEnd$.subscribe((o) => {
|
|
593
593
|
const { objects: s, offsetX: a, offsetY: d } = o;
|
|
594
594
|
for (const c of s.values()) {
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
595
|
+
const g = this._drawingManagerService.getDrawingOKey(c.oKey);
|
|
596
|
+
if (g == null)
|
|
597
597
|
continue;
|
|
598
|
-
const m = this._transformerCache.get(
|
|
598
|
+
const m = this._transformerCache.get(g == null ? void 0 : g.drawingId);
|
|
599
599
|
if ((m == null ? void 0 : m.drawing.layoutType) === W.INLINE)
|
|
600
600
|
try {
|
|
601
601
|
c.setOpacity(1);
|
|
@@ -605,10 +605,10 @@ let sn = class extends Ge {
|
|
|
605
605
|
if (this._anchorShape && this._anchorShape.hide(), s.size > 1)
|
|
606
606
|
this._updateMultipleDrawingDocTransform(s);
|
|
607
607
|
else if (s.size === 1) {
|
|
608
|
-
const c = this._transformerCache.values().next().value,
|
|
609
|
-
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)
|
|
610
610
|
return;
|
|
611
|
-
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);
|
|
612
612
|
}
|
|
613
613
|
this._transformerCache.clear();
|
|
614
614
|
})
|
|
@@ -623,37 +623,37 @@ let sn = class extends Ge {
|
|
|
623
623
|
let t, r;
|
|
624
624
|
for (const o of e.values()) {
|
|
625
625
|
const { oKey: s, left: a, top: d, angle: c } = o;
|
|
626
|
-
let { width:
|
|
627
|
-
const
|
|
628
|
-
if (
|
|
626
|
+
let { width: g, height: m } = o;
|
|
627
|
+
const l = this._drawingManagerService.getDrawingOKey(s);
|
|
628
|
+
if (l == null)
|
|
629
629
|
continue;
|
|
630
|
-
t == null && (t =
|
|
631
|
-
const f = this._transformerCache.get(
|
|
630
|
+
t == null && (t = l.unitId), r == null && (r = l.subUnitId);
|
|
631
|
+
const f = this._transformerCache.get(l.drawingId);
|
|
632
632
|
if (f == null)
|
|
633
633
|
continue;
|
|
634
|
-
const { drawing: u, top:
|
|
635
|
-
if (
|
|
636
|
-
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,
|
|
637
637
|
key: "size",
|
|
638
638
|
value: {
|
|
639
|
-
width:
|
|
639
|
+
width: g,
|
|
640
640
|
height: m
|
|
641
641
|
}
|
|
642
642
|
}), C !== c && n.push({
|
|
643
|
-
drawingId:
|
|
643
|
+
drawingId: l.drawingId,
|
|
644
644
|
key: "angle",
|
|
645
645
|
value: c
|
|
646
|
-
}),
|
|
647
|
-
const P = d -
|
|
646
|
+
}), v !== d || w !== a) {
|
|
647
|
+
const P = d - v, N = a - w;
|
|
648
648
|
P !== 0 && n.push({
|
|
649
|
-
drawingId:
|
|
649
|
+
drawingId: l.drawingId,
|
|
650
650
|
key: "positionV",
|
|
651
651
|
value: {
|
|
652
652
|
relativeFrom: u.docTransform.positionV.relativeFrom,
|
|
653
653
|
posOffset: u.docTransform.positionV.posOffset + P
|
|
654
654
|
}
|
|
655
655
|
}), N !== 0 && n.push({
|
|
656
|
-
drawingId:
|
|
656
|
+
drawingId: l.drawingId,
|
|
657
657
|
key: "positionH",
|
|
658
658
|
value: {
|
|
659
659
|
relativeFrom: u.docTransform.positionH.relativeFrom,
|
|
@@ -688,29 +688,29 @@ let sn = class extends Ge {
|
|
|
688
688
|
if (r == null)
|
|
689
689
|
return;
|
|
690
690
|
const { mainComponent: s, scene: a } = r, d = s, c = a.getViewports()[0], {
|
|
691
|
-
pageLayoutType:
|
|
691
|
+
pageLayoutType: g = Ln.VERTICAL,
|
|
692
692
|
pageMarginLeft: m,
|
|
693
|
-
pageMarginTop:
|
|
693
|
+
pageMarginTop: l
|
|
694
694
|
} = d.getOffsetConfig();
|
|
695
|
-
let f = null, u = !1,
|
|
695
|
+
let f = null, u = !1, v = -1, w = "";
|
|
696
696
|
const I = 0.5, O = this._getTransformCoordForDocumentOffset(d, c, n, t);
|
|
697
697
|
if (O == null)
|
|
698
698
|
return;
|
|
699
699
|
const C = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Re);
|
|
700
700
|
if (C == null)
|
|
701
701
|
return;
|
|
702
|
-
const T = o == null ? void 0 : o.findNodeByCoord(O,
|
|
702
|
+
const T = o == null ? void 0 : o.findNodeByCoord(O, g, m, l, {
|
|
703
703
|
strict: !1,
|
|
704
704
|
segmentId: C.getSegment(),
|
|
705
705
|
segmentPage: C.getSegmentPage()
|
|
706
706
|
});
|
|
707
707
|
if (T) {
|
|
708
708
|
const { node: S, ratioX: D, segmentPage: R, segmentId: y } = T;
|
|
709
|
-
u = D < I, f = S,
|
|
709
|
+
u = D < I, f = S, v = R, w = y;
|
|
710
710
|
}
|
|
711
711
|
if (f == null)
|
|
712
712
|
return;
|
|
713
|
-
const M = o == null ? void 0 : o.findPositionByGlyph(f,
|
|
713
|
+
const M = o == null ? void 0 : o.findPositionByGlyph(f, v), P = this._getDocObject();
|
|
714
714
|
if (M == null || o == null || P == null || Xn(M))
|
|
715
715
|
return;
|
|
716
716
|
const N = {
|
|
@@ -718,7 +718,7 @@ let sn = class extends Ge {
|
|
|
718
718
|
isBack: u
|
|
719
719
|
}, B = P.document.getOffsetConfig(), E = new kn(B, o), { cursorList: _, contentBoxPointGroup: L } = E.getRangePointData(N, N), { startOffset: G } = (V = Fn(_)) != null ? V : {};
|
|
720
720
|
if (G != null)
|
|
721
|
-
return { offset: G, contentBoxPointGroup: L, segmentId:
|
|
721
|
+
return { offset: G, contentBoxPointGroup: L, segmentId: w, segmentPage: v };
|
|
722
722
|
}
|
|
723
723
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
724
724
|
_getDrawingAnchor(e, n) {
|
|
@@ -726,7 +726,7 @@ let sn = class extends Ge {
|
|
|
726
726
|
const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(te).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
|
|
727
727
|
if (o == null || t == null)
|
|
728
728
|
return;
|
|
729
|
-
const { pages: s, skeHeaders: a, skeFooters: d } = o, { mainComponent: c, scene:
|
|
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
730
|
let { width: M, height: P } = n;
|
|
731
731
|
const { positionV: N, positionH: B } = e.docTransform, { width: E, height: _ } = this._getPageContentSize(e);
|
|
732
732
|
M = Math.min(M, E), P = Math.min(P, _);
|
|
@@ -738,13 +738,13 @@ let sn = class extends Ge {
|
|
|
738
738
|
height: P
|
|
739
739
|
},
|
|
740
740
|
angle: T
|
|
741
|
-
}, { x: D, y: R } =
|
|
741
|
+
}, { x: D, y: R } = g.getViewportScrollXY(l), y = this._getTransformCoordForDocumentOffset(m, l, O - D, C - R);
|
|
742
742
|
if (y == null)
|
|
743
743
|
return;
|
|
744
744
|
const U = (De = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : De.with(Re);
|
|
745
745
|
if (U == null)
|
|
746
746
|
return;
|
|
747
|
-
const k = r == null ? void 0 : r.findNodeByCoord(y, f, u,
|
|
747
|
+
const k = r == null ? void 0 : r.findNodeByCoord(y, f, u, v, {
|
|
748
748
|
strict: !1,
|
|
749
749
|
segmentId: U.getSegment(),
|
|
750
750
|
segmentPage: U.getSegmentPage()
|
|
@@ -791,18 +791,18 @@ let sn = class extends Ge {
|
|
|
791
791
|
}
|
|
792
792
|
if (this._liquid.translatePagePadding(we), we === F)
|
|
793
793
|
break;
|
|
794
|
-
this._liquid.restorePagePadding(we), this._liquid.translatePage(we, f, u,
|
|
794
|
+
this._liquid.restorePagePadding(we), this._liquid.translatePage(we, f, u, v);
|
|
795
795
|
}
|
|
796
796
|
switch (N.relativeFrom === H.LINE ? L = b.divides[0].glyphGroup[0] : L = (ge = (le = (Pe = (Ae = z.divides) == null ? void 0 : Ae[0]) == null ? void 0 : Pe.glyphGroup) == null ? void 0 : le[0]) != null ? ge : L, S.positionH = {
|
|
797
797
|
relativeFrom: B.relativeFrom,
|
|
798
|
-
posOffset: O - this._liquid.x -
|
|
798
|
+
posOffset: O - this._liquid.x - w
|
|
799
799
|
}, B.relativeFrom) {
|
|
800
800
|
case ee.MARGIN: {
|
|
801
|
-
S.positionH.posOffset = O - this._liquid.x -
|
|
801
|
+
S.positionH.posOffset = O - this._liquid.x - w - F.marginLeft;
|
|
802
802
|
break;
|
|
803
803
|
}
|
|
804
804
|
case ee.COLUMN: {
|
|
805
|
-
S.positionH.posOffset = O - this._liquid.x -
|
|
805
|
+
S.positionH.posOffset = O - this._liquid.x - w - A.left;
|
|
806
806
|
break;
|
|
807
807
|
}
|
|
808
808
|
}
|
|
@@ -838,19 +838,19 @@ let sn = class extends Ge {
|
|
|
838
838
|
// Update drawing when use transformer to resize it.
|
|
839
839
|
_updateDrawingSize(e, n) {
|
|
840
840
|
const t = [], { drawing: r, width: o, height: s, angle: a } = e, { unitId: d, subUnitId: c } = r;
|
|
841
|
-
let { width:
|
|
841
|
+
let { width: g, height: m, angle: l } = n;
|
|
842
842
|
const { width: f, height: u } = this._getPageContentSize(r);
|
|
843
|
-
|
|
843
|
+
g = Math.min(f, g), m = Math.min(u, m), (g !== o || m !== s) && t.push({
|
|
844
844
|
drawingId: r.drawingId,
|
|
845
845
|
key: "size",
|
|
846
846
|
value: {
|
|
847
|
-
width:
|
|
847
|
+
width: g,
|
|
848
848
|
height: m
|
|
849
849
|
}
|
|
850
|
-
}),
|
|
850
|
+
}), l !== a && t.push({
|
|
851
851
|
drawingId: r.drawingId,
|
|
852
852
|
key: "angle",
|
|
853
|
-
value:
|
|
853
|
+
value: l
|
|
854
854
|
}), t.length > 0 && d && c && this._commandService.executeCommand(Ke.id, {
|
|
855
855
|
unitId: d,
|
|
856
856
|
subUnitId: c,
|
|
@@ -873,8 +873,8 @@ let sn = class extends Ge {
|
|
|
873
873
|
// Limit the drawing to the page area, mainly in the vertical direction,
|
|
874
874
|
// and the upper and lower limits cannot exceed the page margin area.
|
|
875
875
|
_limitDrawingInPage(e, n) {
|
|
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(),
|
|
877
|
-
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)
|
|
878
878
|
return {
|
|
879
879
|
left: r,
|
|
880
880
|
top: o,
|
|
@@ -882,7 +882,7 @@ let sn = class extends Ge {
|
|
|
882
882
|
height: a,
|
|
883
883
|
angle: d
|
|
884
884
|
};
|
|
885
|
-
const { mainComponent:
|
|
885
|
+
const { mainComponent: l } = t, f = l, { top: u, pageLayoutType: v, pageMarginLeft: w, pageMarginTop: I } = f;
|
|
886
886
|
let O = o;
|
|
887
887
|
this._liquid.reset();
|
|
888
888
|
for (const C of m) {
|
|
@@ -898,7 +898,7 @@ let sn = class extends Ge {
|
|
|
898
898
|
const E = o + a / 2, _ = this._liquid.y + u + M + I / 2;
|
|
899
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);
|
|
900
900
|
}
|
|
901
|
-
this._liquid.translatePage(C,
|
|
901
|
+
this._liquid.translatePage(C, v, w, I);
|
|
902
902
|
}
|
|
903
903
|
return {
|
|
904
904
|
left: r,
|
|
@@ -944,20 +944,20 @@ let sn = class extends Ge {
|
|
|
944
944
|
const { mainComponent: r, scene: o } = t, s = r, {
|
|
945
945
|
docsLeft: a,
|
|
946
946
|
docsTop: d
|
|
947
|
-
} = 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;
|
|
948
948
|
if (this._anchorShape) {
|
|
949
|
-
this._anchorShape.transformByState({ left: f, top: u, height:
|
|
949
|
+
this._anchorShape.transformByState({ left: f, top: u, height: l }), this._anchorShape.show();
|
|
950
950
|
return;
|
|
951
951
|
}
|
|
952
|
-
const
|
|
952
|
+
const v = 6, w = new ui($i + Me.generateRandomId(v), {
|
|
953
953
|
left: f,
|
|
954
954
|
top: u,
|
|
955
|
-
height:
|
|
955
|
+
height: l,
|
|
956
956
|
strokeWidth: 2,
|
|
957
957
|
stroke: fi(kt.darkGray, 1),
|
|
958
958
|
evented: !1
|
|
959
959
|
});
|
|
960
|
-
this._anchorShape =
|
|
960
|
+
this._anchorShape = w, o.addObject(w, Pi);
|
|
961
961
|
}
|
|
962
962
|
_getDocObject() {
|
|
963
963
|
return bi(this._univerInstanceService, this._renderManagerService);
|
|
@@ -972,17 +972,17 @@ let sn = class extends Ge {
|
|
|
972
972
|
const { pages: a } = s;
|
|
973
973
|
let d = null;
|
|
974
974
|
for (const c of a) {
|
|
975
|
-
const { skeDrawings:
|
|
976
|
-
if (
|
|
975
|
+
const { skeDrawings: g } = c;
|
|
976
|
+
if (g.has(e.drawingId)) {
|
|
977
977
|
d = c;
|
|
978
978
|
break;
|
|
979
979
|
}
|
|
980
980
|
}
|
|
981
981
|
if (d) {
|
|
982
|
-
const { pageWidth: c, pageHeight:
|
|
982
|
+
const { pageWidth: c, pageHeight: g, marginLeft: m, marginBottom: l, marginRight: f, marginTop: u } = d;
|
|
983
983
|
return {
|
|
984
984
|
width: Math.max(r, c - m - f),
|
|
985
|
-
height: Math.max(o,
|
|
985
|
+
height: Math.max(o, g - u - l)
|
|
986
986
|
};
|
|
987
987
|
} else
|
|
988
988
|
return {
|
|
@@ -994,7 +994,7 @@ let sn = class extends Ge {
|
|
|
994
994
|
sn = ji([
|
|
995
995
|
Je(0, $),
|
|
996
996
|
Je(1, q),
|
|
997
|
-
Je(2,
|
|
997
|
+
Je(2, _e),
|
|
998
998
|
Je(3, J)
|
|
999
999
|
], sn);
|
|
1000
1000
|
var he = function() {
|
|
@@ -1060,22 +1060,22 @@ const yn = {
|
|
|
1060
1060
|
const n = i.get($), t = i.get(q), r = i.get(J), o = t.getCurrentUniverDocInstance();
|
|
1061
1061
|
if (e == null || o == null)
|
|
1062
1062
|
return !1;
|
|
1063
|
-
const s = r.getRenderById(e.unitId).with(Re), { drawings: a } = e, d = (M = s.getSegment()) != null ? M : "", c = new Sn(),
|
|
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();
|
|
1064
1064
|
u.reset();
|
|
1065
|
-
const
|
|
1065
|
+
const v = l[0].startIndex, w = [
|
|
1066
1066
|
{
|
|
1067
|
-
startOffset:
|
|
1068
|
-
endOffset:
|
|
1067
|
+
startOffset: v,
|
|
1068
|
+
endOffset: v
|
|
1069
1069
|
}
|
|
1070
1070
|
], I = {
|
|
1071
1071
|
id: ne.id,
|
|
1072
1072
|
params: {
|
|
1073
1073
|
unitId: f,
|
|
1074
1074
|
actions: [],
|
|
1075
|
-
textRanges:
|
|
1075
|
+
textRanges: w
|
|
1076
1076
|
}
|
|
1077
1077
|
}, O = [];
|
|
1078
|
-
for (const E of
|
|
1078
|
+
for (const E of l) {
|
|
1079
1079
|
const { startIndex: _ } = E;
|
|
1080
1080
|
_ > u.cursor && c.push({
|
|
1081
1081
|
t: Q.RETAIN,
|
|
@@ -1086,9 +1086,9 @@ const yn = {
|
|
|
1086
1086
|
}), u.moveCursorTo(_ + 1);
|
|
1087
1087
|
}
|
|
1088
1088
|
const C = qe(o, d);
|
|
1089
|
-
O.push(
|
|
1090
|
-
for (const E of
|
|
1091
|
-
const { blockId: _ } = E, L = ((B = o.getDrawings()) != null ? B : {})[_], x = o.getDrawingsOrder().indexOf(_), V =
|
|
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
1092
|
O.push(V), O.push(S);
|
|
1093
1093
|
}
|
|
1094
1094
|
return I.params.actions = O.reduce((E, _) => X.compose(E, _), null), !!n.syncExecuteCommand(I.id, I.params);
|
|
@@ -1101,12 +1101,12 @@ const yn = {
|
|
|
1101
1101
|
if (t.length === 0)
|
|
1102
1102
|
return !1;
|
|
1103
1103
|
const { unitId: r } = t[0], o = t.map((s) => {
|
|
1104
|
-
const { unitId: a, subUnitId: d, drawingId: c, drawingType:
|
|
1104
|
+
const { unitId: a, subUnitId: d, drawingId: c, drawingType: g } = s;
|
|
1105
1105
|
return {
|
|
1106
1106
|
unitId: a,
|
|
1107
1107
|
subUnitId: d,
|
|
1108
1108
|
drawingId: c,
|
|
1109
|
-
drawingType:
|
|
1109
|
+
drawingType: g
|
|
1110
1110
|
};
|
|
1111
1111
|
});
|
|
1112
1112
|
return e.executeCommand(yn.id, {
|
|
@@ -1122,9 +1122,9 @@ const yn = {
|
|
|
1122
1122
|
const n = i.get(Ue);
|
|
1123
1123
|
if (!e) return !1;
|
|
1124
1124
|
const t = [];
|
|
1125
|
-
e.forEach(({ parent:
|
|
1126
|
-
t.push(
|
|
1127
|
-
t.push(
|
|
1125
|
+
e.forEach(({ parent: g, children: m }) => {
|
|
1126
|
+
t.push(g.unitId), m.forEach((l) => {
|
|
1127
|
+
t.push(l.unitId);
|
|
1128
1128
|
});
|
|
1129
1129
|
});
|
|
1130
1130
|
const r = n.getGroupDrawingOp(e), { unitId: o, subUnitId: s, undo: a, redo: d, objects: c } = r;
|
|
@@ -1141,27 +1141,27 @@ const yn = {
|
|
|
1141
1141
|
const n = i.get($), t = i.get(On), r = i.get(q), o = t.getActiveTextRange(), s = r.getCurrentUniverDocInstance();
|
|
1142
1142
|
if (o == null || s == null)
|
|
1143
1143
|
return !1;
|
|
1144
|
-
const a = s.getUnitId(), { drawings: d } = e, { collapsed: c, startOffset:
|
|
1145
|
-
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)
|
|
1146
1146
|
return !1;
|
|
1147
|
-
const f = new Sn(), u = X.getInstance(),
|
|
1147
|
+
const f = new Sn(), u = X.getInstance(), v = [], w = (N = (P = s.getSnapshot().drawingsOrder) == null ? void 0 : P.length) != null ? N : 0;
|
|
1148
1148
|
let I = 0;
|
|
1149
1149
|
if (c)
|
|
1150
|
-
|
|
1150
|
+
g > 0 && f.push({
|
|
1151
1151
|
t: Q.RETAIN,
|
|
1152
|
-
len:
|
|
1152
|
+
len: g
|
|
1153
1153
|
});
|
|
1154
1154
|
else {
|
|
1155
|
-
const _ = Wt.selection.delete([o],
|
|
1155
|
+
const _ = Wt.selection.delete([o], l, 0, null, !1);
|
|
1156
1156
|
f.push(..._);
|
|
1157
|
-
const L = Mi(
|
|
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);
|
|
1158
1158
|
if (V.length > 0)
|
|
1159
1159
|
for (const S of V) {
|
|
1160
1160
|
const D = G[S], R = x.indexOf(S);
|
|
1161
1161
|
if (D == null || R < 0)
|
|
1162
1162
|
continue;
|
|
1163
1163
|
const y = u.removeOp(["drawings", S], D), U = u.removeOp(["drawingsOrder", R], S);
|
|
1164
|
-
|
|
1164
|
+
v.push(y), v.push(U), I++;
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
1167
|
f.push({
|
|
@@ -1176,10 +1176,10 @@ const yn = {
|
|
|
1176
1176
|
len: d.length
|
|
1177
1177
|
});
|
|
1178
1178
|
const O = qe(s, m), C = u.editOp(f.serialize(), O);
|
|
1179
|
-
|
|
1179
|
+
v.push(C);
|
|
1180
1180
|
for (const _ of d) {
|
|
1181
|
-
const { drawingId: L } = _, G = u.insertOp(["drawings", L], _), x = u.insertOp(["drawingsOrder",
|
|
1182
|
-
|
|
1181
|
+
const { drawingId: L } = _, G = u.insertOp(["drawings", L], _), x = u.insertOp(["drawingsOrder", w - I], L);
|
|
1182
|
+
v.push(G), v.push(x);
|
|
1183
1183
|
}
|
|
1184
1184
|
const T = {
|
|
1185
1185
|
id: ne.id,
|
|
@@ -1189,7 +1189,7 @@ const yn = {
|
|
|
1189
1189
|
textRanges: []
|
|
1190
1190
|
}
|
|
1191
1191
|
};
|
|
1192
|
-
return T.params.actions =
|
|
1192
|
+
return T.params.actions = v.reduce((_, L) => X.compose(_, L), null), !!n.syncExecuteCommand(T.id, T.params);
|
|
1193
1193
|
}
|
|
1194
1194
|
}, _t = {
|
|
1195
1195
|
id: "doc.command.set-drawing-arrange",
|
|
@@ -1202,12 +1202,12 @@ const yn = {
|
|
|
1202
1202
|
let c;
|
|
1203
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)
|
|
1204
1204
|
return !1;
|
|
1205
|
-
const { redo:
|
|
1206
|
-
if (
|
|
1205
|
+
const { redo: g } = c;
|
|
1206
|
+
if (g == null)
|
|
1207
1207
|
return !1;
|
|
1208
1208
|
const m = [];
|
|
1209
|
-
let
|
|
1210
|
-
|
|
1209
|
+
let l = Me.deepClone(g);
|
|
1210
|
+
l = l.slice(3), l.unshift("drawingsOrder"), m.push(l);
|
|
1211
1211
|
const f = {
|
|
1212
1212
|
id: ne.id,
|
|
1213
1213
|
params: {
|
|
@@ -1216,7 +1216,7 @@ const yn = {
|
|
|
1216
1216
|
textRanges: null
|
|
1217
1217
|
}
|
|
1218
1218
|
};
|
|
1219
|
-
return f.params.actions = m.reduce((
|
|
1219
|
+
return f.params.actions = m.reduce((v, w) => X.compose(v, w), null), !!n.syncExecuteCommand(f.id, f.params);
|
|
1220
1220
|
}
|
|
1221
1221
|
}, St = {
|
|
1222
1222
|
id: "doc.command.ungroup-doc-image",
|
|
@@ -1226,9 +1226,9 @@ const yn = {
|
|
|
1226
1226
|
const n = i.get(Ue);
|
|
1227
1227
|
if (!e) return !1;
|
|
1228
1228
|
const t = [];
|
|
1229
|
-
e.forEach(({ parent:
|
|
1230
|
-
t.push(
|
|
1231
|
-
t.push(
|
|
1229
|
+
e.forEach(({ parent: g, children: m }) => {
|
|
1230
|
+
t.push(g.unitId), m.forEach((l) => {
|
|
1231
|
+
t.push(l.unitId);
|
|
1232
1232
|
});
|
|
1233
1233
|
});
|
|
1234
1234
|
const r = n.getUngroupDrawingOp(e), { unitId: o, subUnitId: s, undo: a, redo: d, objects: c } = r;
|
|
@@ -1241,8 +1241,8 @@ var Zi = Object.getOwnPropertyDescriptor, Qi = (i, e, n, t) => {
|
|
|
1241
1241
|
return r;
|
|
1242
1242
|
}, me = (i, e) => (n, t) => e(n, t, i);
|
|
1243
1243
|
let an = class extends Ge {
|
|
1244
|
-
constructor(i, e, n, t, r, o, s, a, d, c,
|
|
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 =
|
|
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();
|
|
1246
1246
|
}
|
|
1247
1247
|
async insertDocImage() {
|
|
1248
1248
|
const i = await this._fileOpenerService.openFile({
|
|
@@ -1284,14 +1284,14 @@ let an = class extends Ge {
|
|
|
1284
1284
|
for (const r of e) {
|
|
1285
1285
|
if (r == null)
|
|
1286
1286
|
continue;
|
|
1287
|
-
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 || "");
|
|
1288
1288
|
this._imageIoService.addImageSourceCache(o, s, m);
|
|
1289
|
-
let
|
|
1290
|
-
if (c > An ||
|
|
1291
|
-
const
|
|
1292
|
-
|
|
1289
|
+
let l = 1;
|
|
1290
|
+
if (c > An || g > xn) {
|
|
1291
|
+
const w = An / c, I = xn / g;
|
|
1292
|
+
l = Math.min(w, I);
|
|
1293
1293
|
}
|
|
1294
|
-
const f = this._getImagePosition(c *
|
|
1294
|
+
const f = this._getImagePosition(c * l, g * l);
|
|
1295
1295
|
if (f == null)
|
|
1296
1296
|
return;
|
|
1297
1297
|
const u = {
|
|
@@ -1407,10 +1407,10 @@ let an = class extends Ge {
|
|
|
1407
1407
|
if (((s = n == null ? void 0 : n.customBlocks) != null ? s : []).some((c) => c.blockId === i))
|
|
1408
1408
|
return "";
|
|
1409
1409
|
for (const c of Object.keys(t))
|
|
1410
|
-
if ((a = t[c].body.customBlocks) != null && a.some((
|
|
1410
|
+
if ((a = t[c].body.customBlocks) != null && a.some((g) => g.blockId === i))
|
|
1411
1411
|
return c;
|
|
1412
1412
|
for (const c of Object.keys(r))
|
|
1413
|
-
if ((d = r[c].body.customBlocks) != null && d.some((
|
|
1413
|
+
if ((d = r[c].body.customBlocks) != null && d.some((g) => g.blockId === i))
|
|
1414
1414
|
return c;
|
|
1415
1415
|
return "";
|
|
1416
1416
|
}
|
|
@@ -1422,18 +1422,18 @@ let an = class extends Ge {
|
|
|
1422
1422
|
return;
|
|
1423
1423
|
const r = i.getSnapshot(), { drawings: o = {} } = r, s = t.getEditArea() === We.BODY;
|
|
1424
1424
|
for (const d of Object.keys(o)) {
|
|
1425
|
-
const c = o[d],
|
|
1425
|
+
const c = o[d], g = ii({ unitId: n, drawingId: c.drawingId, subUnitId: n }), m = e.fuzzyMathObjects(g, !0);
|
|
1426
1426
|
if (m.length)
|
|
1427
|
-
for (const
|
|
1428
|
-
e.detachTransformerFrom(
|
|
1427
|
+
for (const l of m) {
|
|
1428
|
+
e.detachTransformerFrom(l);
|
|
1429
1429
|
try {
|
|
1430
|
-
|
|
1430
|
+
l.setOpacity(0.5);
|
|
1431
1431
|
} catch {
|
|
1432
1432
|
}
|
|
1433
1433
|
if (s && c.isMultiTransform !== se.TRUE || !s && c.isMultiTransform === se.TRUE) {
|
|
1434
|
-
c.allowTransform !== !1 && e.attachTransformerTo(
|
|
1434
|
+
c.allowTransform !== !1 && e.attachTransformerTo(l);
|
|
1435
1435
|
try {
|
|
1436
|
-
|
|
1436
|
+
l.setOpacity(1);
|
|
1437
1437
|
} catch {
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
@@ -1474,7 +1474,7 @@ an = Qi([
|
|
|
1474
1474
|
me(3, J),
|
|
1475
1475
|
me(4, Jt),
|
|
1476
1476
|
me(5, Ue),
|
|
1477
|
-
me(6,
|
|
1477
|
+
me(6, _e),
|
|
1478
1478
|
me(7, Zn),
|
|
1479
1479
|
me(8, wi),
|
|
1480
1480
|
me(9, pe(mn)),
|
|
@@ -1488,7 +1488,7 @@ const Dt = {
|
|
|
1488
1488
|
handler: (i) => {
|
|
1489
1489
|
var t, r;
|
|
1490
1490
|
const e = i.get(q), n = i.get(J);
|
|
1491
|
-
return (r = (t = hi(
|
|
1491
|
+
return (r = (t = hi(Ie.UNIVER_DOC, e, n)) == null ? void 0 : t.with(an).insertDocImage()) != null ? r : !1;
|
|
1492
1492
|
}
|
|
1493
1493
|
}, Ye = {
|
|
1494
1494
|
id: "doc.command.move-drawing",
|
|
@@ -1497,21 +1497,21 @@ const Dt = {
|
|
|
1497
1497
|
const n = i.get($), t = i.get(Ue), r = i.get(q), o = i.get(J), { direction: s } = e, a = t.getFocusDrawings();
|
|
1498
1498
|
if (a.length === 0)
|
|
1499
1499
|
return !1;
|
|
1500
|
-
const d = a[0].unitId, c = o.getRenderById(d),
|
|
1501
|
-
if (
|
|
1500
|
+
const d = a[0].unitId, c = o.getRenderById(d), g = c == null ? void 0 : c.scene;
|
|
1501
|
+
if (g == null)
|
|
1502
1502
|
return !1;
|
|
1503
|
-
const m =
|
|
1503
|
+
const m = g.getTransformerByCreate(), l = r.getUniverDocInstance(d), f = a.map((v) => {
|
|
1504
1504
|
var P, N, B, E, _;
|
|
1505
|
-
const { drawingId:
|
|
1505
|
+
const { drawingId: w } = v, I = (P = l == null ? void 0 : l.getSnapshot().drawings) == null ? void 0 : P[w];
|
|
1506
1506
|
if (I == null || I.layoutType === W.INLINE)
|
|
1507
1507
|
return null;
|
|
1508
1508
|
const { positionH: O, positionV: C } = I.docTransform, T = { ...O }, M = { ...C };
|
|
1509
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:
|
|
1510
|
+
drawingId: w,
|
|
1511
1511
|
key: s === fe.UP || s === fe.DOWN ? "positionV" : "positionH",
|
|
1512
1512
|
value: s === fe.UP || s === fe.DOWN ? M : T
|
|
1513
1513
|
};
|
|
1514
|
-
}).filter((
|
|
1514
|
+
}).filter((v) => v != null);
|
|
1515
1515
|
if (f.length === 0)
|
|
1516
1516
|
return !1;
|
|
1517
1517
|
const u = n.syncExecuteCommand(Ke.id, {
|
|
@@ -1535,7 +1535,7 @@ const Dt = {
|
|
|
1535
1535
|
id: "sidebar.operation.doc-image",
|
|
1536
1536
|
type: Y.COMMAND,
|
|
1537
1537
|
handler: async (i, e) => {
|
|
1538
|
-
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);
|
|
1539
1539
|
switch (e.value) {
|
|
1540
1540
|
case "open":
|
|
1541
1541
|
n.open({
|
|
@@ -1558,10 +1558,10 @@ const Dt = {
|
|
|
1558
1558
|
id: "doc.operation.edit-doc-image",
|
|
1559
1559
|
type: Y.OPERATION,
|
|
1560
1560
|
handler: (i, e) => {
|
|
1561
|
-
const n = i.get(
|
|
1561
|
+
const n = i.get(_e), t = i.get($);
|
|
1562
1562
|
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Ot.id, { value: "open" }), !0);
|
|
1563
1563
|
}
|
|
1564
|
-
}, er = "univer-image-common-panel", nr = "univer-image-common-panel-grid", tr = "univer-image-common-panel-border", ir = "univer-image-common-panel-title", rr = "univer-image-common-panel-subtitle", or = "univer-image-common-panel-row", sr = "univer-image-common-panel-column", ar = "univer-image-common-panel-span2", cr = "univer-image-common-panel-input",
|
|
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 = {
|
|
1565
1565
|
imageCommonPanel: er,
|
|
1566
1566
|
imageCommonPanelGrid: nr,
|
|
1567
1567
|
imageCommonPanelBorder: tr,
|
|
@@ -1572,13 +1572,13 @@ const Dt = {
|
|
|
1572
1572
|
imageCommonPanelSpan2: ar,
|
|
1573
1573
|
imageCommonPanelInput: cr
|
|
1574
1574
|
}, qn = -1e3, Kn = 1e3, dr = (i) => {
|
|
1575
|
-
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];
|
|
1576
1576
|
if (a == null)
|
|
1577
1577
|
return;
|
|
1578
|
-
const { unitId: d } = a, c = o.getUniverDocInstance(d),
|
|
1579
|
-
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)
|
|
1580
1580
|
return;
|
|
1581
|
-
const f =
|
|
1581
|
+
const f = l.getTransformerByCreate(), u = [{
|
|
1582
1582
|
label: n.t("image-position.column"),
|
|
1583
1583
|
value: String(ee.COLUMN)
|
|
1584
1584
|
}, {
|
|
@@ -1587,22 +1587,22 @@ const Dt = {
|
|
|
1587
1587
|
}, {
|
|
1588
1588
|
label: n.t("image-position.margin"),
|
|
1589
1589
|
value: String(ee.MARGIN)
|
|
1590
|
-
}],
|
|
1590
|
+
}], v = [{
|
|
1591
1591
|
label: n.t("image-position.line"),
|
|
1592
1592
|
value: String(H.LINE),
|
|
1593
|
-
disabled:
|
|
1593
|
+
disabled: g === pn.MODERN
|
|
1594
1594
|
}, {
|
|
1595
1595
|
label: n.t("image-position.page"),
|
|
1596
1596
|
value: String(H.PAGE),
|
|
1597
|
-
disabled:
|
|
1597
|
+
disabled: g === pn.MODERN
|
|
1598
1598
|
}, {
|
|
1599
1599
|
label: n.t("image-position.margin"),
|
|
1600
1600
|
value: String(H.MARGIN),
|
|
1601
|
-
disabled:
|
|
1601
|
+
disabled: g === pn.MODERN
|
|
1602
1602
|
}, {
|
|
1603
1603
|
label: n.t("image-position.paragraph"),
|
|
1604
1604
|
value: String(H.PARAGRAPH)
|
|
1605
|
-
}], [
|
|
1605
|
+
}], [w, I] = oe(!0), [O, C] = oe({
|
|
1606
1606
|
relativeFrom: ee.PAGE,
|
|
1607
1607
|
posOffset: 0
|
|
1608
1608
|
}), [T, M] = oe({
|
|
@@ -1727,19 +1727,19 @@ const Dt = {
|
|
|
1727
1727
|
return () => {
|
|
1728
1728
|
D.unsubscribe(), R.dispose();
|
|
1729
1729
|
};
|
|
1730
|
-
}, []), /* @__PURE__ */ K("div", { className: j(
|
|
1731
|
-
/* @__PURE__ */
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */ K("div", { className:
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
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(
|
|
1737
1737
|
Fe,
|
|
1738
1738
|
{
|
|
1739
1739
|
min: qn,
|
|
1740
1740
|
max: Kn,
|
|
1741
1741
|
precision: 1,
|
|
1742
|
-
disabled:
|
|
1742
|
+
disabled: w,
|
|
1743
1743
|
value: O.posOffset,
|
|
1744
1744
|
onChange: (D) => {
|
|
1745
1745
|
_("positionH", {
|
|
@@ -1747,34 +1747,34 @@ const Dt = {
|
|
|
1747
1747
|
posOffset: D
|
|
1748
1748
|
});
|
|
1749
1749
|
},
|
|
1750
|
-
className:
|
|
1750
|
+
className: h.imageCommonPanelInput
|
|
1751
1751
|
}
|
|
1752
1752
|
) }) })
|
|
1753
1753
|
] }) }),
|
|
1754
|
-
/* @__PURE__ */
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */
|
|
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(
|
|
1757
1757
|
jn,
|
|
1758
1758
|
{
|
|
1759
1759
|
value: String(O.relativeFrom),
|
|
1760
|
-
disabled:
|
|
1760
|
+
disabled: w,
|
|
1761
1761
|
options: u,
|
|
1762
1762
|
onChange: L
|
|
1763
1763
|
}
|
|
1764
1764
|
) }) })
|
|
1765
1765
|
] }) })
|
|
1766
1766
|
] }),
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */ K("div", { className:
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
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(
|
|
1772
1772
|
Fe,
|
|
1773
1773
|
{
|
|
1774
1774
|
min: qn,
|
|
1775
1775
|
max: Kn,
|
|
1776
1776
|
precision: 1,
|
|
1777
|
-
disabled:
|
|
1777
|
+
disabled: w,
|
|
1778
1778
|
value: T.posOffset,
|
|
1779
1779
|
onChange: (D) => {
|
|
1780
1780
|
_("positionV", {
|
|
@@ -1782,34 +1782,34 @@ const Dt = {
|
|
|
1782
1782
|
posOffset: D
|
|
1783
1783
|
});
|
|
1784
1784
|
},
|
|
1785
|
-
className:
|
|
1785
|
+
className: h.imageCommonPanelInput
|
|
1786
1786
|
}
|
|
1787
1787
|
) }) })
|
|
1788
1788
|
] }) }),
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
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(
|
|
1792
1792
|
jn,
|
|
1793
1793
|
{
|
|
1794
|
-
disabled:
|
|
1794
|
+
disabled: w,
|
|
1795
1795
|
value: String(T.relativeFrom),
|
|
1796
|
-
options:
|
|
1796
|
+
options: v,
|
|
1797
1797
|
onChange: G
|
|
1798
1798
|
}
|
|
1799
1799
|
) }) })
|
|
1800
1800
|
] }) })
|
|
1801
1801
|
] }),
|
|
1802
|
-
/* @__PURE__ */
|
|
1803
|
-
/* @__PURE__ */
|
|
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") }) }) })
|
|
1804
1804
|
] });
|
|
1805
1805
|
}, en = 0, nn = 100, lr = (i) => {
|
|
1806
|
-
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];
|
|
1807
1807
|
if (a == null)
|
|
1808
1808
|
return null;
|
|
1809
|
-
const { unitId: d } = a, c = o.getUniverDocInstance(d),
|
|
1810
|
-
if ((
|
|
1809
|
+
const { unitId: d } = a, c = o.getUniverDocInstance(d), g = r.getRenderById(d);
|
|
1810
|
+
if ((g == null ? void 0 : g.scene) == null)
|
|
1811
1811
|
return null;
|
|
1812
|
-
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({
|
|
1813
1813
|
distT: 0,
|
|
1814
1814
|
distL: 0,
|
|
1815
1815
|
distB: 0,
|
|
@@ -1894,7 +1894,7 @@ const Dt = {
|
|
|
1894
1894
|
distL: y,
|
|
1895
1895
|
distB: U,
|
|
1896
1896
|
distR: k
|
|
1897
|
-
}), M(z), f(b !== W.WRAP_SQUARE), b === W.WRAP_NONE || b === W.INLINE ?
|
|
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)
|
|
1898
1898
|
A === se.TRUE ? C(ue.BEHIND_TEXT) : C(ue.IN_FRONT_OF_TEXT);
|
|
1899
1899
|
else
|
|
1900
1900
|
switch (b) {
|
|
@@ -1925,27 +1925,27 @@ const Dt = {
|
|
|
1925
1925
|
return () => {
|
|
1926
1926
|
S.unsubscribe(), D.dispose();
|
|
1927
1927
|
};
|
|
1928
|
-
}, []), /* @__PURE__ */ K("div", { className: j(
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
/* @__PURE__ */
|
|
1934
|
-
/* @__PURE__ */
|
|
1935
|
-
/* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
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") })
|
|
1937
1937
|
] }) }) }),
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
/* @__PURE__ */
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
/* @__PURE__ */
|
|
1942
|
-
/* @__PURE__ */
|
|
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") })
|
|
1943
1943
|
] }) }) }),
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
/* @__PURE__ */ K("div", { className:
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
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(
|
|
1949
1949
|
Fe,
|
|
1950
1950
|
{
|
|
1951
1951
|
min: en,
|
|
@@ -1956,32 +1956,32 @@ const Dt = {
|
|
|
1956
1956
|
onChange: (S) => {
|
|
1957
1957
|
G(S, "distT");
|
|
1958
1958
|
},
|
|
1959
|
-
className:
|
|
1959
|
+
className: h.imageCommonPanelInput
|
|
1960
1960
|
}
|
|
1961
1961
|
) }) })
|
|
1962
1962
|
] }) }),
|
|
1963
|
-
/* @__PURE__ */
|
|
1964
|
-
/* @__PURE__ */
|
|
1965
|
-
/* @__PURE__ */
|
|
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(
|
|
1966
1966
|
Fe,
|
|
1967
1967
|
{
|
|
1968
1968
|
min: en,
|
|
1969
1969
|
max: nn,
|
|
1970
|
-
disabled:
|
|
1970
|
+
disabled: w,
|
|
1971
1971
|
precision: 1,
|
|
1972
1972
|
value: P.distL,
|
|
1973
1973
|
onChange: (S) => {
|
|
1974
1974
|
G(S, "distL");
|
|
1975
1975
|
},
|
|
1976
|
-
className:
|
|
1976
|
+
className: h.imageCommonPanelInput
|
|
1977
1977
|
}
|
|
1978
1978
|
) }) })
|
|
1979
1979
|
] }) })
|
|
1980
1980
|
] }),
|
|
1981
|
-
/* @__PURE__ */ K("div", { className:
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
/* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
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(
|
|
1985
1985
|
Fe,
|
|
1986
1986
|
{
|
|
1987
1987
|
min: en,
|
|
@@ -1992,31 +1992,31 @@ const Dt = {
|
|
|
1992
1992
|
onChange: (S) => {
|
|
1993
1993
|
G(S, "distB");
|
|
1994
1994
|
},
|
|
1995
|
-
className:
|
|
1995
|
+
className: h.imageCommonPanelInput
|
|
1996
1996
|
}
|
|
1997
1997
|
) }) })
|
|
1998
1998
|
] }) }),
|
|
1999
|
-
/* @__PURE__ */
|
|
2000
|
-
/* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
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(
|
|
2002
2002
|
Fe,
|
|
2003
2003
|
{
|
|
2004
2004
|
min: en,
|
|
2005
2005
|
max: nn,
|
|
2006
|
-
disabled:
|
|
2006
|
+
disabled: w,
|
|
2007
2007
|
precision: 1,
|
|
2008
2008
|
value: P.distR,
|
|
2009
2009
|
onChange: (S) => {
|
|
2010
2010
|
G(S, "distR");
|
|
2011
2011
|
},
|
|
2012
|
-
className:
|
|
2012
|
+
className: h.imageCommonPanelInput
|
|
2013
2013
|
}
|
|
2014
2014
|
) }) })
|
|
2015
2015
|
] }) })
|
|
2016
2016
|
] })
|
|
2017
2017
|
] });
|
|
2018
2018
|
}, gr = () => {
|
|
2019
|
-
const i = ve(
|
|
2019
|
+
const i = ve(_e), e = i.getFocusDrawings(), [n, t] = oe(e);
|
|
2020
2020
|
return Tn(() => {
|
|
2021
2021
|
const r = i.focus$.subscribe((o) => {
|
|
2022
2022
|
t(o);
|
|
@@ -2024,10 +2024,10 @@ const Dt = {
|
|
|
2024
2024
|
return () => {
|
|
2025
2025
|
r.unsubscribe();
|
|
2026
2026
|
};
|
|
2027
|
-
}, []), !!(n != null && n.length) && /* @__PURE__ */ K("div", { className:
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2030
|
-
/* @__PURE__ */
|
|
2027
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ K("div", { className: h.imageCommonPanel, children: [
|
|
2028
|
+
/* @__PURE__ */ p(oi, { drawings: n, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
|
|
2029
|
+
/* @__PURE__ */ p(lr, { drawings: n }),
|
|
2030
|
+
/* @__PURE__ */ p(dr, { drawings: n })
|
|
2031
2031
|
] });
|
|
2032
2032
|
}, yt = "addition-and-subtraction-single", Pt = "doc.menu.image", bt = Dt.id, mr = (i) => {
|
|
2033
2033
|
const e = i.get(On), n = i.get(q);
|
|
@@ -2036,9 +2036,9 @@ const Dt = {
|
|
|
2036
2036
|
var s;
|
|
2037
2037
|
const o = e.getActiveTextRange();
|
|
2038
2038
|
if (o) {
|
|
2039
|
-
const { segmentId: a, startOffset: d, endOffset: c } = o,
|
|
2040
|
-
if (m && m.length && m.some((
|
|
2041
|
-
const { startIndex: f, endIndex: u } =
|
|
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
2042
|
return d >= f && d < u || c >= f && c < u;
|
|
2043
2043
|
})) {
|
|
2044
2044
|
t.next(!0);
|
|
@@ -2060,7 +2060,7 @@ function ur(i) {
|
|
|
2060
2060
|
icon: yt,
|
|
2061
2061
|
tooltip: "docImage.title",
|
|
2062
2062
|
disabled$: mr(i),
|
|
2063
|
-
hidden$: et(i,
|
|
2063
|
+
hidden$: et(i, Ie.UNIVER_DOC, void 0, Cn)
|
|
2064
2064
|
};
|
|
2065
2065
|
}
|
|
2066
2066
|
function fr(i) {
|
|
@@ -2068,7 +2068,7 @@ function fr(i) {
|
|
|
2068
2068
|
id: bt,
|
|
2069
2069
|
title: "docImage.upload.float",
|
|
2070
2070
|
type: nt.BUTTON,
|
|
2071
|
-
hidden$: et(i,
|
|
2071
|
+
hidden$: et(i, Ie.UNIVER_DOC, void 0, Cn)
|
|
2072
2072
|
};
|
|
2073
2073
|
}
|
|
2074
2074
|
const hr = {
|
|
@@ -2200,11 +2200,11 @@ var Cr = Object.getOwnPropertyDescriptor, Or = (i, e, n, t) => {
|
|
|
2200
2200
|
return r;
|
|
2201
2201
|
}, ke = (i, e) => (n, t) => e(n, t, i);
|
|
2202
2202
|
function vn(i, e) {
|
|
2203
|
-
const { top: n, left: t, width: r, height: o, angle: s, opacity: a } = i, d = e.scene, c = d.getViewport(it.VIEW_MAIN), { viewportScrollX:
|
|
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();
|
|
2204
2204
|
return {
|
|
2205
|
-
startX: (t -
|
|
2205
|
+
startX: (t - g) * l,
|
|
2206
2206
|
startY: (n - m) * f,
|
|
2207
|
-
endX: (t + r -
|
|
2207
|
+
endX: (t + r - g) * l,
|
|
2208
2208
|
endY: (n + o - m) * f,
|
|
2209
2209
|
width: r,
|
|
2210
2210
|
height: o,
|
|
@@ -2219,7 +2219,7 @@ function vn(i, e) {
|
|
|
2219
2219
|
let dn = class extends Ge {
|
|
2220
2220
|
constructor(e, n, t, r, o, s) {
|
|
2221
2221
|
super();
|
|
2222
|
-
|
|
2222
|
+
Se(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
2223
2223
|
this._renderManagerService = e, this._drawingManagerService = n, this._drawingRenderService = t, this._canvasFloatDomService = r, this._univerInstanceService = o, this._commandService = s, this._initialize();
|
|
2224
2224
|
}
|
|
2225
2225
|
dispose() {
|
|
@@ -2252,50 +2252,53 @@ let dn = class extends Ge {
|
|
|
2252
2252
|
}
|
|
2253
2253
|
_insertRects(e) {
|
|
2254
2254
|
e.forEach(async (n) => {
|
|
2255
|
-
const { unitId: t } = n
|
|
2256
|
-
if (
|
|
2255
|
+
const { unitId: t } = n;
|
|
2256
|
+
if (!this._univerInstanceService.getUnit(t, Ie.UNIVER_DOC))
|
|
2257
2257
|
return;
|
|
2258
|
-
const o = this.
|
|
2258
|
+
const o = this._getSceneAndTransformerByDrawingSearch(t);
|
|
2259
2259
|
if (o == null)
|
|
2260
2260
|
return;
|
|
2261
|
-
const s =
|
|
2262
|
-
if (
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
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,
|
|
2269
2272
|
unitId: t
|
|
2270
2273
|
};
|
|
2271
2274
|
this._canvasFloatDomService.addFloatDom({
|
|
2272
|
-
position$:
|
|
2273
|
-
id:
|
|
2274
|
-
componentKey:
|
|
2275
|
-
onPointerDown: (
|
|
2276
|
-
|
|
2275
|
+
position$: m,
|
|
2276
|
+
id: s.drawingId,
|
|
2277
|
+
componentKey: s.componentKey,
|
|
2278
|
+
onPointerDown: (w) => {
|
|
2279
|
+
l.dispatchEvent(new PointerEvent(w.type, w));
|
|
2277
2280
|
},
|
|
2278
|
-
onPointerMove: (
|
|
2279
|
-
|
|
2281
|
+
onPointerMove: (w) => {
|
|
2282
|
+
l.dispatchEvent(new PointerEvent(w.type, w));
|
|
2280
2283
|
},
|
|
2281
|
-
onPointerUp: (
|
|
2282
|
-
|
|
2284
|
+
onPointerUp: (w) => {
|
|
2285
|
+
l.dispatchEvent(new PointerEvent(w.type, w));
|
|
2283
2286
|
},
|
|
2284
|
-
onWheel: (
|
|
2285
|
-
|
|
2287
|
+
onWheel: (w) => {
|
|
2288
|
+
l.dispatchEvent(new WheelEvent(w.type, w));
|
|
2286
2289
|
},
|
|
2287
|
-
data:
|
|
2290
|
+
data: f,
|
|
2288
2291
|
unitId: t
|
|
2289
2292
|
});
|
|
2290
|
-
const
|
|
2291
|
-
const
|
|
2292
|
-
|
|
2293
|
-
|
|
2293
|
+
const v = d.onTransformChange$.subscribeEvent(() => {
|
|
2294
|
+
const w = vn(d, o.renderUnit);
|
|
2295
|
+
m.next(
|
|
2296
|
+
w
|
|
2294
2297
|
);
|
|
2295
2298
|
});
|
|
2296
|
-
|
|
2297
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
2298
|
-
}),
|
|
2299
|
+
c.add(() => {
|
|
2300
|
+
this._canvasFloatDomService.removeFloatDom(s.drawingId);
|
|
2301
|
+
}), v && c.add(v), this._domLayerInfoMap.set(s.drawingId, u);
|
|
2299
2302
|
}
|
|
2300
2303
|
});
|
|
2301
2304
|
}
|
|
@@ -2333,7 +2336,7 @@ let dn = class extends Ge {
|
|
|
2333
2336
|
});
|
|
2334
2337
|
};
|
|
2335
2338
|
this.disposeWithMe(
|
|
2336
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
2339
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(Ie.UNIVER_DOC).pipe(
|
|
2337
2340
|
Wn((n) => {
|
|
2338
2341
|
if (!n) return null;
|
|
2339
2342
|
const t = n.getUnitId(), r = this._renderManagerService.getRenderById(t);
|
|
@@ -2355,16 +2358,16 @@ let dn = class extends Ge {
|
|
|
2355
2358
|
}));
|
|
2356
2359
|
}
|
|
2357
2360
|
insertFloatDom(e, n) {
|
|
2358
|
-
var
|
|
2359
|
-
const t = this._univerInstanceService.getCurrentUnitOfType(
|
|
2361
|
+
var v, w, I;
|
|
2362
|
+
const t = this._univerInstanceService.getCurrentUnitOfType(Ie.UNIVER_DOC);
|
|
2360
2363
|
if (!t) return !1;
|
|
2361
2364
|
const r = this._getSceneAndTransformerByDrawingSearch(t.getUnitId());
|
|
2362
2365
|
if (!r) return !1;
|
|
2363
|
-
const a = (
|
|
2366
|
+
const a = (v = r.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : v.pages[0];
|
|
2364
2367
|
if (!a) return !1;
|
|
2365
|
-
const { pageWidth: d, marginLeft: c, marginRight:
|
|
2368
|
+
const { pageWidth: d, marginLeft: c, marginRight: g } = a, m = d - c - g, l = {
|
|
2366
2369
|
size: {
|
|
2367
|
-
width: (
|
|
2370
|
+
width: (w = n.width) != null ? w : m,
|
|
2368
2371
|
height: n.height
|
|
2369
2372
|
},
|
|
2370
2373
|
positionH: {
|
|
@@ -2387,9 +2390,9 @@ let dn = class extends Ge {
|
|
|
2387
2390
|
...e,
|
|
2388
2391
|
title: "",
|
|
2389
2392
|
description: "",
|
|
2390
|
-
docTransform:
|
|
2393
|
+
docTransform: l,
|
|
2391
2394
|
layoutType: W.INLINE,
|
|
2392
|
-
transform: tt(
|
|
2395
|
+
transform: tt(l)
|
|
2393
2396
|
}
|
|
2394
2397
|
]
|
|
2395
2398
|
};
|
|
@@ -2398,7 +2401,7 @@ let dn = class extends Ge {
|
|
|
2398
2401
|
};
|
|
2399
2402
|
dn = Or([
|
|
2400
2403
|
ke(0, J),
|
|
2401
|
-
ke(1,
|
|
2404
|
+
ke(1, _e),
|
|
2402
2405
|
ke(2, pe(si)),
|
|
2403
2406
|
ke(3, pe(Oi)),
|
|
2404
2407
|
ke(4, q),
|
|
@@ -2412,11 +2415,11 @@ var Tr = Object.getOwnPropertyDescriptor, yr = (i, e, n, t) => {
|
|
|
2412
2415
|
let ln = class extends jt {
|
|
2413
2416
|
constructor(e, n, t, r, o) {
|
|
2414
2417
|
super();
|
|
2415
|
-
|
|
2418
|
+
Se(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
2416
2419
|
this._drawingManagerService = e, this._canvasPopManagerService = n, this._renderManagerService = t, this._univerInstanceService = r, this._contextService = o, this._init();
|
|
2417
2420
|
}
|
|
2418
2421
|
_init() {
|
|
2419
|
-
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));
|
|
2420
2423
|
}
|
|
2421
2424
|
_dispose(e) {
|
|
2422
2425
|
const n = e.getUnitId();
|
|
@@ -2459,22 +2462,22 @@ let ln = class extends jt {
|
|
|
2459
2462
|
const d = a.oKey, c = this._drawingManagerService.getDrawingOKey(d);
|
|
2460
2463
|
if (!c)
|
|
2461
2464
|
return;
|
|
2462
|
-
const { unitId:
|
|
2465
|
+
const { unitId: g, subUnitId: m, drawingId: l, drawingType: f } = c, u = this._canvasPopManagerService.attachPopupToObject(
|
|
2463
2466
|
a,
|
|
2464
2467
|
{
|
|
2465
2468
|
componentKey: ci,
|
|
2466
2469
|
direction: "horizontal",
|
|
2467
2470
|
offset: [2, 0],
|
|
2468
2471
|
extraProps: {
|
|
2469
|
-
menuItems: this._getImageMenuItems(
|
|
2472
|
+
menuItems: this._getImageMenuItems(g, m, l, f)
|
|
2470
2473
|
}
|
|
2471
2474
|
},
|
|
2472
|
-
|
|
2475
|
+
g
|
|
2473
2476
|
);
|
|
2474
|
-
r.push(this.disposeWithMe(u)), !this._drawingManagerService.getFocusDrawings().find((I) => I.unitId ===
|
|
2475
|
-
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,
|
|
2476
2479
|
subUnitId: m,
|
|
2477
|
-
drawingId:
|
|
2480
|
+
drawingId: l
|
|
2478
2481
|
}]);
|
|
2479
2482
|
})
|
|
2480
2483
|
)
|
|
@@ -2534,7 +2537,7 @@ let ln = class extends jt {
|
|
|
2534
2537
|
}
|
|
2535
2538
|
};
|
|
2536
2539
|
ln = yr([
|
|
2537
|
-
ze(0,
|
|
2540
|
+
ze(0, _e),
|
|
2538
2541
|
ze(1, pe(Ri)),
|
|
2539
2542
|
ze(2, J),
|
|
2540
2543
|
ze(3, q),
|
|
@@ -2548,7 +2551,7 @@ var Pr = Object.getOwnPropertyDescriptor, br = (i, e, n, t) => {
|
|
|
2548
2551
|
let _n = class extends Ge {
|
|
2549
2552
|
constructor(e, n, t, r, o, s, a, d) {
|
|
2550
2553
|
super();
|
|
2551
|
-
|
|
2554
|
+
Se(this, "_liquid", new Jn());
|
|
2552
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();
|
|
2553
2556
|
}
|
|
2554
2557
|
_initialize() {
|
|
@@ -2598,12 +2601,12 @@ let _n = class extends Ge {
|
|
|
2598
2601
|
const n = e == null ? void 0 : e.getSkeletonData(), { mainComponent: t, unitId: r } = this._context, o = t;
|
|
2599
2602
|
if (!n)
|
|
2600
2603
|
return;
|
|
2601
|
-
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 = {};
|
|
2602
2605
|
this._liquid.reset();
|
|
2603
2606
|
for (let T = 0, M = m.length; T < M; T++) {
|
|
2604
2607
|
const P = m[T], { headerId: N, footerId: B, pageWidth: E } = P;
|
|
2605
2608
|
if (N) {
|
|
2606
|
-
const _ = (O =
|
|
2609
|
+
const _ = (O = l.get(N)) == null ? void 0 : O.get(E);
|
|
2607
2610
|
_ && this._calculateDrawingPosition(
|
|
2608
2611
|
r,
|
|
2609
2612
|
_,
|
|
@@ -2626,10 +2629,10 @@ let _n = class extends Ge {
|
|
|
2626
2629
|
P.marginLeft
|
|
2627
2630
|
);
|
|
2628
2631
|
}
|
|
2629
|
-
this._calculateDrawingPosition(r, P, s, a, u, P.marginTop, P.marginLeft), this._liquid.translatePage(P, d, c,
|
|
2632
|
+
this._calculateDrawingPosition(r, P, s, a, u, P.marginTop, P.marginLeft), this._liquid.translatePage(P, d, c, g);
|
|
2630
2633
|
}
|
|
2631
|
-
const
|
|
2632
|
-
|
|
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);
|
|
2633
2636
|
}
|
|
2634
2637
|
_handleMultiDrawingsTransform(e) {
|
|
2635
2638
|
const { scene: n, unitId: t } = this._context, r = n.getTransformerByCreate();
|
|
@@ -2650,22 +2653,22 @@ let _n = class extends Ge {
|
|
|
2650
2653
|
marginTop: s,
|
|
2651
2654
|
marginLeft: a
|
|
2652
2655
|
}), d.forEach((c) => {
|
|
2653
|
-
const { aLeft:
|
|
2654
|
-
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,
|
|
2655
2658
|
top: m + r + this._liquid.y,
|
|
2656
2659
|
width: f,
|
|
2657
|
-
height:
|
|
2660
|
+
height: l,
|
|
2658
2661
|
angle: u
|
|
2659
2662
|
};
|
|
2660
|
-
o[
|
|
2663
|
+
o[v] == null ? o[v] = {
|
|
2661
2664
|
unitId: e,
|
|
2662
2665
|
subUnitId: e,
|
|
2663
|
-
drawingId:
|
|
2666
|
+
drawingId: v,
|
|
2664
2667
|
behindText: I,
|
|
2665
2668
|
transform: C,
|
|
2666
2669
|
transforms: [C],
|
|
2667
2670
|
isMultiTransform: O
|
|
2668
|
-
} : O === se.TRUE && o[
|
|
2671
|
+
} : O === se.TRUE && o[v].transforms.push(C);
|
|
2669
2672
|
}), this._liquid.restorePagePadding({
|
|
2670
2673
|
marginTop: s,
|
|
2671
2674
|
marginLeft: a
|
|
@@ -2685,7 +2688,7 @@ _n = br([
|
|
|
2685
2688
|
Le(1, pe(te)),
|
|
2686
2689
|
Le(2, $),
|
|
2687
2690
|
Le(3, Ei),
|
|
2688
|
-
Le(4,
|
|
2691
|
+
Le(4, _e),
|
|
2689
2692
|
Le(5, pe(un)),
|
|
2690
2693
|
Le(6, q),
|
|
2691
2694
|
Le(7, pe(zt))
|
|
@@ -2720,13 +2723,13 @@ let gn = class extends Yt {
|
|
|
2720
2723
|
[
|
|
2721
2724
|
[an],
|
|
2722
2725
|
[_n]
|
|
2723
|
-
].forEach((i) => this._renderManagerSrv.registerRenderModule(
|
|
2726
|
+
].forEach((i) => this._renderManagerSrv.registerRenderModule(Ie.UNIVER_DOC, i)), this._injector.get(on), this._injector.get(cn), this._injector.get(sn);
|
|
2724
2727
|
}
|
|
2725
2728
|
onRendered() {
|
|
2726
2729
|
this._injector.get(ln), this._injector.get(dn);
|
|
2727
2730
|
}
|
|
2728
2731
|
};
|
|
2729
|
-
Mt(gn, "type",
|
|
2732
|
+
Mt(gn, "type", Ie.UNIVER_DOC);
|
|
2730
2733
|
Mt(gn, "pluginName", Ar);
|
|
2731
2734
|
gn = Nr([
|
|
2732
2735
|
Xt(gi, ri, Qt, Ti),
|