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