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