@univerjs/docs-drawing-ui 0.10.9 → 0.10.10-experimental.20251016-33b0941
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +819 -801
- package/lib/index.js +819 -801
- package/lib/types/controllers/drawing-popup-menu.controller.d.ts +1 -0
- package/lib/types/controllers/render-controllers/doc-drawing-update.render-controller.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +13 -13
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var Pn = Object.defineProperty;
|
|
2
|
-
var xn = (
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as q, ICommandService as j, IUniverInstanceService as z, TextX as _t, JSONX as $, MemoryCursor as Nn, TextXActionType as Y, IUndoRedoService as Kt, BuildTextUtils as Un, ArrangeTypeEnum as Ze, Tools as
|
|
5
|
-
import { IDocDrawingService as
|
|
2
|
+
var xn = (r, e, t) => e in r ? Pn(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var me = (r, e, t) => xn(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { CommandType as q, ICommandService as j, IUniverInstanceService as z, TextX as _t, JSONX as $, MemoryCursor as Nn, TextXActionType as Y, IUndoRedoService as Kt, BuildTextUtils as Un, ArrangeTypeEnum as Ze, Tools as Ae, Inject as Z, IContextService as Yt, LocaleService as lt, Disposable as xe, WrapTextType as $e, PositionedObjectLayoutType as k, BooleanNumber as se, DrawingTypeEnum as Pe, ObjectRelativeFromV as W, ObjectRelativeFromH as J, FOCUSING_COMMON_DRAWINGS as nt, UniverInstanceType as ve, Direction as he, DisposableCollection as Ln, toDisposable as ze, fromEventSubject as Zt, generateRandomId as Qt, DocumentFlavor as pt, DOCS_ZEN_EDITOR_UNIT_ID_KEY as St, FOCUSING_UNIVER_EDITOR as Bn, UndoCommand as Fn, RedoCommand as kn, Injector as Jt, DOC_DRAWING_PRINTING_COMPONENT_KEY as Wn, throttle as Et, COLORS as Gn, RxDisposable as Hn, LifecycleService as jn, LifecycleStages as Rt, DependentOn as Vn, IConfigService as $n, Plugin as zn, merge as Xn } from "@univerjs/core";
|
|
5
|
+
import { IDocDrawingService as Ne, UniverDocsDrawingPlugin as qn } from "@univerjs/docs-drawing";
|
|
6
6
|
import { RichTextEditingMutation as ee, DocSelectionManagerService as Dt, DocSkeletonManagerService as te } from "@univerjs/docs";
|
|
7
|
-
import { DocSelectionRenderService as Me, getRichTextEditPath as Xe, getCustomBlockIdsInSelections as Kn, docDrawingPositionToTransform as en, VIEWPORT_KEY as tn, SetDocZoomRatioOperation as nn, DocPrintInterceptorService as Yn, NodePositionConvertToCursor as At, getOneTextSelectionRange as Pt, getAnchorBounding as Zn, TEXT_RANGE_LAYER_INDEX as Qn, getDocObject as Jn, DocCanvasPopManagerService as
|
|
8
|
-
import { IRenderManagerService as Q, DocumentEditArea as
|
|
9
|
-
import { MessageType as Lt, clsx as
|
|
10
|
-
import { IImageIoService as
|
|
11
|
-
import { IMessageService as
|
|
12
|
-
import { BehaviorSubject as Ot, debounceTime as dn, map as Ht, switchMap as
|
|
13
|
-
import { DrawingRenderService as gn, DrawingCommonPanel as
|
|
14
|
-
import { jsxs as X, jsx as
|
|
15
|
-
import { useState as
|
|
16
|
-
const
|
|
7
|
+
import { DocSelectionRenderService as Me, getRichTextEditPath as Xe, getCustomBlockIdsInSelections as Kn, docDrawingPositionToTransform as en, VIEWPORT_KEY as tn, SetDocZoomRatioOperation as nn, DocPrintInterceptorService as Yn, NodePositionConvertToCursor as At, getOneTextSelectionRange as Pt, getAnchorBounding as Zn, TEXT_RANGE_LAYER_INDEX as Qn, getDocObject as Jn, DocCanvasPopManagerService as ei, IEditorService as ti } from "@univerjs/docs-ui";
|
|
8
|
+
import { IRenderManagerService as Q, DocumentEditArea as Fe, getCurrentTypeOfRenderer as ni, CURSOR_TYPE as xt, Liquid as rn, PageLayoutType as Nt, DocumentSkeletonPageType as Ut, Vector2 as ii, Rect as ri, getColor as si, TRANSFORM_CHANGE_OBSERVABLE_TYPE as oi } from "@univerjs/engine-render";
|
|
9
|
+
import { MessageType as Lt, clsx as sn, InputNumber as Be, Select as Bt, Checkbox as ai, RadioGroup as Ft, Radio as Te, render as ci, unmount as di } from "@univerjs/design";
|
|
10
|
+
import { IImageIoService as gi, IDrawingManagerService as fe, DRAWING_IMAGE_ALLOW_IMAGE_LIST as li, DRAWING_IMAGE_COUNT_LIMIT as kt, ImageUploadStatusType as mt, DRAWING_IMAGE_ALLOW_SIZE as ui, getImageSize as hi, getDrawingShapeKeyByDrawingSearch as fi, DRAWING_IMAGE_WIDTH_LIMIT as Wt, DRAWING_IMAGE_HEIGHT_LIMIT as Gt, UniverDrawingPlugin as pi } from "@univerjs/drawing";
|
|
11
|
+
import { IMessageService as mi, ILocalFileService as wi, ISidebarService as vi, CanvasFloatDomService as Ii, useDependency as we, getMenuHiddenObservable as on, MenuItemType as an, RibbonInsertGroup as _i, KeyCode as ke, ComponentManager as cn, IMenuManagerService as Si, IShortcutService as Di, PrintFloatDomSingle as Oi, connectInjector as Ti, UniverUIPlugin as Mi } from "@univerjs/ui";
|
|
12
|
+
import { BehaviorSubject as Ot, debounceTime as dn, map as Ht, switchMap as yi, of as bi, Observable as Ci, takeUntil as jt, filter as Vt } from "rxjs";
|
|
13
|
+
import { DrawingRenderService as gn, DrawingCommonPanel as Ei, ImageCropperObject as Ri, COMPONENT_IMAGE_POPUP_MENU as Ai, OpenImageCropOperation as Pi, ImageResetSizeOperation as xi, UniverDrawingUIPlugin as Ni } from "@univerjs/drawing-ui";
|
|
14
|
+
import { jsxs as X, jsx as M } from "react/jsx-runtime";
|
|
15
|
+
import { useState as re, useEffect as Tt, useMemo as Ui } from "react";
|
|
16
|
+
const Mt = {
|
|
17
17
|
id: "doc.command.remove-doc-image",
|
|
18
18
|
type: q.COMMAND,
|
|
19
19
|
// eslint-disable-next-line max-lines-per-function
|
|
20
|
-
handler: (
|
|
21
|
-
var C,
|
|
22
|
-
const t =
|
|
23
|
-
if (e == null ||
|
|
20
|
+
handler: (r, e) => {
|
|
21
|
+
var C, y, A, L;
|
|
22
|
+
const t = r.get(j), n = r.get(z), i = r.get(Q), s = n.getCurrentUniverDocInstance();
|
|
23
|
+
if (e == null || s == null)
|
|
24
24
|
return !1;
|
|
25
|
-
const
|
|
25
|
+
const o = i.getRenderById(e.unitId).with(Me), { drawings: c } = e, d = (C = o.getSegment()) != null ? C : "", a = new _t(), g = $.getInstance(), u = (A = (y = s.getSelfOrHeaderFooterModel(d).getBody()) == null ? void 0 : y.customBlocks) != null ? A : [], l = c.map((R) => u.find((v) => v.blockId === R.drawingId)).filter((R) => !!R).sort((R, v) => R.startIndex > v.startIndex ? 1 : -1), f = c[0].unitId, h = new Nn();
|
|
26
26
|
h.reset();
|
|
27
27
|
const m = l[0].startIndex, p = [
|
|
28
28
|
{
|
|
@@ -47,10 +47,10 @@ const yt = {
|
|
|
47
47
|
len: 1
|
|
48
48
|
}), h.moveCursorTo(v + 1);
|
|
49
49
|
}
|
|
50
|
-
const S = Xe(
|
|
50
|
+
const S = Xe(s, d);
|
|
51
51
|
D.push(g.editOp(a.serialize(), S));
|
|
52
52
|
for (const R of l) {
|
|
53
|
-
const { blockId: v } = R, N = ((L =
|
|
53
|
+
const { blockId: v } = R, N = ((L = s.getDrawings()) != null ? L : {})[v], x = s.getDrawingsOrder().indexOf(v), H = g.removeOp(["drawings", v], N), I = g.removeOp(["drawingsOrder", x], v);
|
|
54
54
|
D.push(H), D.push(I);
|
|
55
55
|
}
|
|
56
56
|
return w.params.actions = D.reduce((R, v) => $.compose(R, v), null), !!t.syncExecuteCommand(w.id, w.params);
|
|
@@ -58,12 +58,12 @@ const yt = {
|
|
|
58
58
|
}, ln = {
|
|
59
59
|
id: "doc.command.delete-drawing",
|
|
60
60
|
type: q.COMMAND,
|
|
61
|
-
handler: (
|
|
62
|
-
const e =
|
|
61
|
+
handler: (r) => {
|
|
62
|
+
const e = r.get(j), n = r.get(Ne).getFocusDrawings();
|
|
63
63
|
if (n.length === 0)
|
|
64
64
|
return !1;
|
|
65
|
-
const { unitId:
|
|
66
|
-
const { unitId: c, subUnitId: d, drawingId: a, drawingType: g } =
|
|
65
|
+
const { unitId: i } = n[0], s = n.map((o) => {
|
|
66
|
+
const { unitId: c, subUnitId: d, drawingId: a, drawingType: g } = o;
|
|
67
67
|
return {
|
|
68
68
|
unitId: c,
|
|
69
69
|
subUnitId: d,
|
|
@@ -71,17 +71,17 @@ const yt = {
|
|
|
71
71
|
drawingType: g
|
|
72
72
|
};
|
|
73
73
|
});
|
|
74
|
-
return e.executeCommand(
|
|
75
|
-
unitId:
|
|
76
|
-
drawings:
|
|
74
|
+
return e.executeCommand(Mt.id, {
|
|
75
|
+
unitId: i,
|
|
76
|
+
drawings: s
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}, un = {
|
|
80
80
|
id: "doc.command.group-doc-image",
|
|
81
81
|
type: q.COMMAND,
|
|
82
|
-
handler: (
|
|
83
|
-
|
|
84
|
-
const t =
|
|
82
|
+
handler: (r, e) => {
|
|
83
|
+
r.get(j), r.get(Kt);
|
|
84
|
+
const t = r.get(Ne);
|
|
85
85
|
if (!e) return !1;
|
|
86
86
|
const n = [];
|
|
87
87
|
e.forEach(({ parent: g, children: u }) => {
|
|
@@ -89,24 +89,24 @@ const yt = {
|
|
|
89
89
|
n.push(l.unitId);
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
|
-
const
|
|
92
|
+
const i = t.getGroupDrawingOp(e), { unitId: s, subUnitId: o, undo: c, redo: d, objects: a } = i;
|
|
93
93
|
return !1;
|
|
94
94
|
}
|
|
95
|
-
},
|
|
95
|
+
}, yt = {
|
|
96
96
|
id: "doc.command.insert-doc-image",
|
|
97
97
|
type: q.COMMAND,
|
|
98
98
|
// eslint-disable-next-line max-lines-per-function
|
|
99
|
-
handler: (
|
|
100
|
-
var
|
|
99
|
+
handler: (r, e) => {
|
|
100
|
+
var y, A, L, R;
|
|
101
101
|
if (e == null)
|
|
102
102
|
return !1;
|
|
103
|
-
const t =
|
|
104
|
-
if (
|
|
103
|
+
const t = r.get(j), n = r.get(Dt), i = r.get(z), s = n.getActiveTextRange(), o = i.getCurrentUniverDocInstance();
|
|
104
|
+
if (s == null || o == null)
|
|
105
105
|
return !1;
|
|
106
|
-
const c =
|
|
106
|
+
const c = o.getUnitId(), { drawings: d } = e, { collapsed: a, startOffset: g, segmentId: u } = s, l = o.getSelfOrHeaderFooterModel(u).getBody();
|
|
107
107
|
if (l == null)
|
|
108
108
|
return !1;
|
|
109
|
-
const f = new _t(), h = $.getInstance(), m = [], p = (A = (
|
|
109
|
+
const f = new _t(), h = $.getInstance(), m = [], p = (A = (y = o.getSnapshot().drawingsOrder) == null ? void 0 : y.length) != null ? A : 0;
|
|
110
110
|
let w = 0;
|
|
111
111
|
if (a)
|
|
112
112
|
g > 0 && f.push({
|
|
@@ -114,9 +114,9 @@ const yt = {
|
|
|
114
114
|
len: g
|
|
115
115
|
});
|
|
116
116
|
else {
|
|
117
|
-
const v = Un.selection.delete([
|
|
117
|
+
const v = Un.selection.delete([s], l, 0, null, !1);
|
|
118
118
|
f.push(...v);
|
|
119
|
-
const N = Kn(l, [
|
|
119
|
+
const N = Kn(l, [s]), G = (L = o.getDrawings()) != null ? L : {}, x = (R = o.getDrawingsOrder()) != null ? R : [], H = N.sort((I, _) => x.indexOf(I) > x.indexOf(_) ? -1 : x.indexOf(I) < x.indexOf(_) ? 1 : 0);
|
|
120
120
|
if (H.length > 0)
|
|
121
121
|
for (const I of H) {
|
|
122
122
|
const _ = G[I], E = x.indexOf(I);
|
|
@@ -137,7 +137,7 @@ const yt = {
|
|
|
137
137
|
},
|
|
138
138
|
len: d.length
|
|
139
139
|
});
|
|
140
|
-
const D = Xe(
|
|
140
|
+
const D = Xe(o, u), S = h.editOp(f.serialize(), D);
|
|
141
141
|
m.push(S);
|
|
142
142
|
for (const v of d) {
|
|
143
143
|
const { drawingId: N } = v, G = h.insertOp(["drawings", N], v), x = h.insertOp(["drawingsOrder", p - w], N);
|
|
@@ -156,11 +156,11 @@ const yt = {
|
|
|
156
156
|
}, hn = {
|
|
157
157
|
id: "doc.command.set-drawing-arrange",
|
|
158
158
|
type: q.COMMAND,
|
|
159
|
-
handler: (
|
|
160
|
-
const t =
|
|
159
|
+
handler: (r, e) => {
|
|
160
|
+
const t = r.get(j), n = r.get(Ne);
|
|
161
161
|
if (e == null)
|
|
162
162
|
return !1;
|
|
163
|
-
const { unitId:
|
|
163
|
+
const { unitId: i, subUnitId: s, drawingIds: o, arrangeType: c } = e, d = { unitId: i, subUnitId: s, drawingIds: o };
|
|
164
164
|
let a;
|
|
165
165
|
if (c === Ze.forward ? a = n.getForwardDrawingsOp(d) : c === Ze.backward ? a = n.getBackwardDrawingOp(d) : c === Ze.front ? a = n.getFrontDrawingsOp(d) : c === Ze.back && (a = n.getBackDrawingsOp(d)), a == null)
|
|
166
166
|
return !1;
|
|
@@ -168,12 +168,12 @@ const yt = {
|
|
|
168
168
|
if (g == null)
|
|
169
169
|
return !1;
|
|
170
170
|
const u = [];
|
|
171
|
-
let l =
|
|
171
|
+
let l = Ae.deepClone(g);
|
|
172
172
|
l = l.slice(3), l.unshift("drawingsOrder"), u.push(l);
|
|
173
173
|
const f = {
|
|
174
174
|
id: ee.id,
|
|
175
175
|
params: {
|
|
176
|
-
unitId:
|
|
176
|
+
unitId: i,
|
|
177
177
|
actions: [],
|
|
178
178
|
textRanges: null
|
|
179
179
|
}
|
|
@@ -183,9 +183,9 @@ const yt = {
|
|
|
183
183
|
}, fn = {
|
|
184
184
|
id: "doc.command.ungroup-doc-image",
|
|
185
185
|
type: q.COMMAND,
|
|
186
|
-
handler: (
|
|
187
|
-
|
|
188
|
-
const t =
|
|
186
|
+
handler: (r, e) => {
|
|
187
|
+
r.get(j), r.get(Kt);
|
|
188
|
+
const t = r.get(Ne);
|
|
189
189
|
if (!e) return !1;
|
|
190
190
|
const n = [];
|
|
191
191
|
e.forEach(({ parent: g, children: u }) => {
|
|
@@ -193,70 +193,73 @@ const yt = {
|
|
|
193
193
|
n.push(l.unitId);
|
|
194
194
|
});
|
|
195
195
|
});
|
|
196
|
-
const
|
|
196
|
+
const i = t.getUngroupDrawingOp(e), { unitId: s, subUnitId: o, undo: c, redo: d, objects: a } = i;
|
|
197
197
|
return !1;
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
200
|
class ut {
|
|
201
201
|
constructor() {
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
me(this, "_refreshDrawings$", new Ot(null));
|
|
203
|
+
me(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
|
|
204
204
|
}
|
|
205
205
|
refreshDrawings(e) {
|
|
206
206
|
this._refreshDrawings$.next(e);
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
|
-
var
|
|
210
|
-
for (var
|
|
211
|
-
(
|
|
212
|
-
return
|
|
213
|
-
}, le = (
|
|
214
|
-
let
|
|
215
|
-
constructor(
|
|
216
|
-
super(), this._context =
|
|
209
|
+
var Li = Object.getOwnPropertyDescriptor, Bi = (r, e, t, n) => {
|
|
210
|
+
for (var i = n > 1 ? void 0 : n ? Li(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
211
|
+
(o = r[s]) && (i = o(i) || i);
|
|
212
|
+
return i;
|
|
213
|
+
}, le = (r, e) => (t, n) => e(t, n, r);
|
|
214
|
+
let it = class extends xe {
|
|
215
|
+
constructor(r, e, t, n, i, s, o, c, d, a, g, u, l) {
|
|
216
|
+
super(), this._context = r, this._commandService = e, this._docSelectionManagerService = t, this._renderManagerSrv = n, this._imageIoService = i, this._docDrawingService = s, this._drawingManagerService = o, this._contextService = c, this._messageService = d, this._localeService = a, this._docSelectionRenderService = g, this._docRefreshDrawingsService = u, this._fileOpenerService = l, this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._transformDrawingListener(), this._editAreaChangeListener();
|
|
217
|
+
}
|
|
218
|
+
dispose() {
|
|
219
|
+
super.dispose(), delete this._context;
|
|
217
220
|
}
|
|
218
221
|
async insertDocImage() {
|
|
219
|
-
const
|
|
222
|
+
const r = await this._fileOpenerService.openFile({
|
|
220
223
|
multiple: !0,
|
|
221
|
-
accept:
|
|
222
|
-
}), e =
|
|
224
|
+
accept: li.map((t) => `.${t.replace("image/", "")}`).join(",")
|
|
225
|
+
}), e = r.length;
|
|
223
226
|
return e > kt ? (this._messageService.show({
|
|
224
227
|
type: Lt.Error,
|
|
225
228
|
content: this._localeService.t("update-status.exceedMaxCount", String(kt))
|
|
226
|
-
}), !1) : e === 0 ? !1 : (await this._insertFloatImages(
|
|
229
|
+
}), !1) : e === 0 ? !1 : (await this._insertFloatImages(r), !0);
|
|
227
230
|
}
|
|
228
231
|
// eslint-disable-next-line max-lines-per-function
|
|
229
|
-
async _insertFloatImages(
|
|
232
|
+
async _insertFloatImages(r) {
|
|
230
233
|
let e = [];
|
|
231
234
|
try {
|
|
232
|
-
e = await Promise.all(
|
|
233
|
-
} catch (
|
|
234
|
-
const
|
|
235
|
-
let
|
|
236
|
-
switch (
|
|
235
|
+
e = await Promise.all(r.map((i) => this._imageIoService.saveImage(i)));
|
|
236
|
+
} catch (i) {
|
|
237
|
+
const s = i.message;
|
|
238
|
+
let o = "";
|
|
239
|
+
switch (s) {
|
|
237
240
|
case mt.ERROR_EXCEED_SIZE:
|
|
238
|
-
|
|
241
|
+
o = this._localeService.t("update-status.exceedMaxSize", String(ui / (1024 * 1024)));
|
|
239
242
|
break;
|
|
240
243
|
case mt.ERROR_IMAGE_TYPE:
|
|
241
|
-
|
|
244
|
+
o = this._localeService.t("update-status.invalidImageType");
|
|
242
245
|
break;
|
|
243
246
|
case mt.ERROR_IMAGE:
|
|
244
|
-
|
|
247
|
+
o = this._localeService.t("update-status.invalidImage");
|
|
245
248
|
break;
|
|
246
249
|
}
|
|
247
250
|
this._messageService.show({
|
|
248
251
|
type: Lt.Error,
|
|
249
|
-
content:
|
|
252
|
+
content: o
|
|
250
253
|
});
|
|
251
254
|
}
|
|
252
255
|
if (e.length === 0)
|
|
253
256
|
return;
|
|
254
257
|
const { unitId: t } = this._context, n = [];
|
|
255
|
-
for (const
|
|
256
|
-
if (
|
|
258
|
+
for (const i of e) {
|
|
259
|
+
if (i == null)
|
|
257
260
|
continue;
|
|
258
|
-
const { imageId:
|
|
259
|
-
this._imageIoService.addImageSourceCache(
|
|
261
|
+
const { imageId: s, imageSourceType: o, source: c, base64Cache: d } = i, { width: a, height: g, image: u } = await hi(d || "");
|
|
262
|
+
this._imageIoService.addImageSourceCache(s, o, u);
|
|
260
263
|
let l = 1;
|
|
261
264
|
if (a > Wt || g > Gt) {
|
|
262
265
|
const p = Wt / a, w = Gt / g;
|
|
@@ -268,42 +271,42 @@ let rt = class extends Ne {
|
|
|
268
271
|
const h = {
|
|
269
272
|
unitId: t,
|
|
270
273
|
subUnitId: t,
|
|
271
|
-
drawingId:
|
|
272
|
-
drawingType:
|
|
273
|
-
imageSourceType:
|
|
274
|
+
drawingId: s,
|
|
275
|
+
drawingType: Pe.DRAWING_IMAGE,
|
|
276
|
+
imageSourceType: o,
|
|
274
277
|
source: c,
|
|
275
278
|
transform: en(f),
|
|
276
279
|
docTransform: f,
|
|
277
|
-
behindDoc:
|
|
280
|
+
behindDoc: se.FALSE,
|
|
278
281
|
title: "",
|
|
279
282
|
description: "",
|
|
280
283
|
layoutType: k.INLINE,
|
|
281
284
|
// Insert inline drawing by default.
|
|
282
|
-
wrapText:
|
|
285
|
+
wrapText: $e.BOTH_SIDES,
|
|
283
286
|
distB: 0,
|
|
284
287
|
distL: 0,
|
|
285
288
|
distR: 0,
|
|
286
289
|
distT: 0
|
|
287
290
|
};
|
|
288
|
-
this._isInsertInHeaderFooter() && (h.isMultiTransform =
|
|
291
|
+
this._isInsertInHeaderFooter() && (h.isMultiTransform = se.TRUE, h.transforms = h.transform ? [h.transform] : null), n.push(h);
|
|
289
292
|
}
|
|
290
|
-
this._commandService.executeCommand(
|
|
293
|
+
this._commandService.executeCommand(yt.id, {
|
|
291
294
|
unitId: t,
|
|
292
295
|
drawings: n
|
|
293
296
|
});
|
|
294
297
|
}
|
|
295
298
|
_isInsertInHeaderFooter() {
|
|
296
299
|
var n;
|
|
297
|
-
const { unitId:
|
|
298
|
-
return t ===
|
|
300
|
+
const { unitId: r } = this._context, e = (n = this._renderManagerSrv.getRenderById(r)) == null ? void 0 : n.with(te).getViewModel(), t = e == null ? void 0 : e.getEditArea();
|
|
301
|
+
return t === Fe.HEADER || t === Fe.FOOTER;
|
|
299
302
|
}
|
|
300
|
-
_getImagePosition(
|
|
303
|
+
_getImagePosition(r, e) {
|
|
301
304
|
const t = this._docSelectionRenderService.getActiveTextRange(), n = (t == null ? void 0 : t.getAbsolutePosition()) || {
|
|
302
305
|
left: 0
|
|
303
306
|
};
|
|
304
307
|
return {
|
|
305
308
|
size: {
|
|
306
|
-
width:
|
|
309
|
+
width: r,
|
|
307
310
|
height: e
|
|
308
311
|
},
|
|
309
312
|
positionH: {
|
|
@@ -318,34 +321,40 @@ let rt = class extends Ne {
|
|
|
318
321
|
};
|
|
319
322
|
}
|
|
320
323
|
_updateOrderListener() {
|
|
321
|
-
this.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
324
|
+
this.disposeWithMe(
|
|
325
|
+
this._drawingManagerService.featurePluginOrderUpdate$.subscribe((r) => {
|
|
326
|
+
const { unitId: e, subUnitId: t, drawingIds: n, arrangeType: i } = r;
|
|
327
|
+
this._commandService.executeCommand(hn.id, {
|
|
328
|
+
unitId: e,
|
|
329
|
+
subUnitId: t,
|
|
330
|
+
drawingIds: n,
|
|
331
|
+
arrangeType: i
|
|
332
|
+
});
|
|
333
|
+
})
|
|
334
|
+
);
|
|
330
335
|
}
|
|
331
336
|
_groupDrawingListener() {
|
|
332
|
-
this.
|
|
333
|
-
this.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
this.disposeWithMe(
|
|
338
|
+
this._drawingManagerService.featurePluginGroupUpdate$.subscribe((r) => {
|
|
339
|
+
this._commandService.executeCommand(un.id, r);
|
|
340
|
+
})
|
|
341
|
+
), this.disposeWithMe(
|
|
342
|
+
this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((r) => {
|
|
343
|
+
this._commandService.executeCommand(fn.id, r);
|
|
344
|
+
})
|
|
345
|
+
);
|
|
337
346
|
}
|
|
338
347
|
_getCurrentSceneAndTransformer() {
|
|
339
|
-
const { scene:
|
|
340
|
-
if (
|
|
348
|
+
const { scene: r, mainComponent: e } = this._context;
|
|
349
|
+
if (r == null || e == null)
|
|
341
350
|
return;
|
|
342
|
-
const t =
|
|
343
|
-
return { scene:
|
|
351
|
+
const t = r.getTransformerByCreate(), { docsLeft: n, docsTop: i } = e.getOffsetConfig();
|
|
352
|
+
return { scene: r, transformer: t, docsLeft: n, docsTop: i };
|
|
344
353
|
}
|
|
345
354
|
_transformDrawingListener() {
|
|
346
|
-
const
|
|
347
|
-
if (
|
|
348
|
-
this.disposeWithMe(
|
|
355
|
+
const r = this._getCurrentSceneAndTransformer();
|
|
356
|
+
if (r && r.transformer)
|
|
357
|
+
this.disposeWithMe(r.transformer.changeEnd$.pipe(dn(30)).subscribe((e) => {
|
|
349
358
|
this._docSelectionManagerService.refreshSelection();
|
|
350
359
|
}));
|
|
351
360
|
else
|
|
@@ -353,18 +362,18 @@ let rt = class extends Ne {
|
|
|
353
362
|
}
|
|
354
363
|
_focusDrawingListener() {
|
|
355
364
|
this.disposeWithMe(
|
|
356
|
-
this._drawingManagerService.focus$.subscribe((
|
|
357
|
-
var
|
|
358
|
-
const { transformer: e, docsLeft: t, docsTop: n } = (
|
|
359
|
-
if (
|
|
365
|
+
this._drawingManagerService.focus$.subscribe((r) => {
|
|
366
|
+
var i;
|
|
367
|
+
const { transformer: e, docsLeft: t, docsTop: n } = (i = this._getCurrentSceneAndTransformer()) != null ? i : {};
|
|
368
|
+
if (r == null || r.length === 0)
|
|
360
369
|
this._contextService.setContextValue(nt, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
|
|
361
370
|
zeroTop: 0,
|
|
362
371
|
zeroLeft: 0
|
|
363
372
|
});
|
|
364
373
|
else {
|
|
365
|
-
this._contextService.setContextValue(nt, !0), this._docDrawingService.focusDrawing(
|
|
366
|
-
const
|
|
367
|
-
|
|
374
|
+
this._contextService.setContextValue(nt, !0), this._docDrawingService.focusDrawing(r), this._setDrawingSelections(r);
|
|
375
|
+
const s = this._docSelectionRenderService.getSegment(), o = this._findSegmentIdByDrawingId(r[0].drawingId);
|
|
376
|
+
s !== o && this._docSelectionRenderService.setSegment(o), e && e.resetProps({
|
|
368
377
|
zeroTop: n,
|
|
369
378
|
zeroLeft: t
|
|
370
379
|
});
|
|
@@ -372,28 +381,28 @@ let rt = class extends Ne {
|
|
|
372
381
|
})
|
|
373
382
|
);
|
|
374
383
|
}
|
|
375
|
-
_findSegmentIdByDrawingId(
|
|
376
|
-
var
|
|
377
|
-
const { unit: e } = this._context, { body: t, headers: n = {}, footers:
|
|
378
|
-
if (((
|
|
384
|
+
_findSegmentIdByDrawingId(r) {
|
|
385
|
+
var o, c, d;
|
|
386
|
+
const { unit: e } = this._context, { body: t, headers: n = {}, footers: i = {} } = e.getSnapshot();
|
|
387
|
+
if (((o = t == null ? void 0 : t.customBlocks) != null ? o : []).some((a) => a.blockId === r))
|
|
379
388
|
return "";
|
|
380
389
|
for (const a of Object.keys(n))
|
|
381
|
-
if ((c = n[a].body.customBlocks) != null && c.some((g) => g.blockId ===
|
|
390
|
+
if ((c = n[a].body.customBlocks) != null && c.some((g) => g.blockId === r))
|
|
382
391
|
return a;
|
|
383
|
-
for (const a of Object.keys(
|
|
384
|
-
if ((d =
|
|
392
|
+
for (const a of Object.keys(i))
|
|
393
|
+
if ((d = i[a].body.customBlocks) != null && d.some((g) => g.blockId === r))
|
|
385
394
|
return a;
|
|
386
395
|
return "";
|
|
387
396
|
}
|
|
388
397
|
// Update drawings edit status and opacity. You can not edit header footer images when you are editing body. and vice verse.
|
|
389
398
|
_updateDrawingsEditStatus() {
|
|
390
399
|
var c;
|
|
391
|
-
const { unit:
|
|
392
|
-
if (n == null ||
|
|
400
|
+
const { unit: r, scene: e, unitId: t } = this._context, n = (c = this._renderManagerSrv.getRenderById(t)) == null ? void 0 : c.with(te).getViewModel();
|
|
401
|
+
if (n == null || r == null)
|
|
393
402
|
return;
|
|
394
|
-
const
|
|
395
|
-
for (const d of Object.keys(
|
|
396
|
-
const a =
|
|
403
|
+
const i = r.getSnapshot(), { drawings: s = {} } = i, o = n.getEditArea() === Fe.BODY;
|
|
404
|
+
for (const d of Object.keys(s)) {
|
|
405
|
+
const a = s[d], g = fi({ unitId: t, drawingId: a.drawingId, subUnitId: t }), u = e.fuzzyMathObjects(g, !0);
|
|
397
406
|
if (u.length)
|
|
398
407
|
for (const l of u) {
|
|
399
408
|
e.detachTransformerFrom(l);
|
|
@@ -401,7 +410,7 @@ let rt = class extends Ne {
|
|
|
401
410
|
l.setOpacity(0.5);
|
|
402
411
|
} catch {
|
|
403
412
|
}
|
|
404
|
-
if (
|
|
413
|
+
if (o && a.isMultiTransform !== se.TRUE || !o && a.isMultiTransform === se.TRUE) {
|
|
405
414
|
a.allowTransform !== !1 && e.attachTransformerTo(l);
|
|
406
415
|
try {
|
|
407
416
|
l.setOpacity(1);
|
|
@@ -413,16 +422,18 @@ let rt = class extends Ne {
|
|
|
413
422
|
}
|
|
414
423
|
_editAreaChangeListener() {
|
|
415
424
|
var t;
|
|
416
|
-
const { unitId:
|
|
425
|
+
const { unitId: r } = this._context, e = (t = this._renderManagerSrv.getRenderById(r)) == null ? void 0 : t.with(te).getViewModel();
|
|
417
426
|
e != null && (this._updateDrawingsEditStatus(), this.disposeWithMe(
|
|
418
427
|
e.editAreaChange$.subscribe(() => {
|
|
419
428
|
this._updateDrawingsEditStatus();
|
|
420
429
|
})
|
|
421
|
-
), this.
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
430
|
+
), this.disposeWithMe(
|
|
431
|
+
this._docRefreshDrawingsService.refreshDrawings$.subscribe((n) => {
|
|
432
|
+
n != null && queueMicrotask(() => {
|
|
433
|
+
this._updateDrawingsEditStatus();
|
|
434
|
+
});
|
|
435
|
+
})
|
|
436
|
+
), this.disposeWithMe(
|
|
426
437
|
this._commandService.onCommandExecuted(async (n) => {
|
|
427
438
|
n.id === ee.id && queueMicrotask(() => {
|
|
428
439
|
this._updateDrawingsEditStatus();
|
|
@@ -430,54 +441,54 @@ let rt = class extends Ne {
|
|
|
430
441
|
})
|
|
431
442
|
));
|
|
432
443
|
}
|
|
433
|
-
_setDrawingSelections(
|
|
434
|
-
var
|
|
435
|
-
const { unit: e } = this._context, t = (
|
|
436
|
-
const c =
|
|
444
|
+
_setDrawingSelections(r) {
|
|
445
|
+
var i, s;
|
|
446
|
+
const { unit: e } = this._context, t = (s = (i = e.getSnapshot().body) == null ? void 0 : i.customBlocks) != null ? s : [], n = r.map((o) => {
|
|
447
|
+
const c = o.drawingId, d = t.find((a) => a.blockId === c);
|
|
437
448
|
return d ? d.startIndex : null;
|
|
438
|
-
}).filter((
|
|
449
|
+
}).filter((o) => o !== null).map((o) => ({ startOffset: o, endOffset: o + 1 }));
|
|
439
450
|
this._docSelectionManagerService.replaceDocRanges(n);
|
|
440
451
|
}
|
|
441
452
|
};
|
|
442
|
-
|
|
453
|
+
it = Bi([
|
|
443
454
|
le(1, j),
|
|
444
455
|
le(2, Z(Dt)),
|
|
445
456
|
le(3, Q),
|
|
446
|
-
le(4,
|
|
447
|
-
le(5,
|
|
457
|
+
le(4, gi),
|
|
458
|
+
le(5, Ne),
|
|
448
459
|
le(6, fe),
|
|
449
460
|
le(7, Yt),
|
|
450
|
-
le(8,
|
|
461
|
+
le(8, mi),
|
|
451
462
|
le(9, Z(lt)),
|
|
452
463
|
le(10, Z(Me)),
|
|
453
464
|
le(11, Z(ut)),
|
|
454
|
-
le(12,
|
|
455
|
-
],
|
|
465
|
+
le(12, wi)
|
|
466
|
+
], it);
|
|
456
467
|
const pn = {
|
|
457
468
|
id: "doc.command.insert-float-image",
|
|
458
469
|
type: q.COMMAND,
|
|
459
|
-
handler: (
|
|
460
|
-
var n,
|
|
461
|
-
const e =
|
|
462
|
-
return (
|
|
470
|
+
handler: (r) => {
|
|
471
|
+
var n, i;
|
|
472
|
+
const e = r.get(z), t = r.get(Q);
|
|
473
|
+
return (i = (n = ni(ve.UNIVER_DOC, e, t)) == null ? void 0 : n.with(it).insertDocImage()) != null ? i : !1;
|
|
463
474
|
}
|
|
464
475
|
};
|
|
465
|
-
var ue = /* @__PURE__ */ ((
|
|
466
|
-
const
|
|
476
|
+
var ue = /* @__PURE__ */ ((r) => (r.INLINE = "inline", r.BEHIND_TEXT = "behindText", r.IN_FRONT_OF_TEXT = "inFrontOfText", r.WRAP_SQUARE = "wrapSquare", r.WRAP_TOP_AND_BOTTOM = "wrapTopAndBottom", r))(ue || {});
|
|
477
|
+
const Fi = {
|
|
467
478
|
inline: k.INLINE,
|
|
468
479
|
wrapSquare: k.WRAP_SQUARE,
|
|
469
480
|
wrapTopAndBottom: k.WRAP_TOP_AND_BOTTOM,
|
|
470
481
|
inFrontOfText: k.WRAP_NONE,
|
|
471
482
|
behindText: k.WRAP_NONE
|
|
472
483
|
};
|
|
473
|
-
function mn(
|
|
484
|
+
function mn(r, e, t, n, i, s, o) {
|
|
474
485
|
var f, h;
|
|
475
|
-
const c = new _t(), d = $.getInstance(), a = [], g =
|
|
486
|
+
const c = new _t(), d = $.getInstance(), a = [], g = s.getSelfOrHeaderFooterModel(e).getBody(), u = s.getSelfOrHeaderFooterModel(r).getBody();
|
|
476
487
|
if (g == null || u == null)
|
|
477
488
|
return;
|
|
478
|
-
const l = (h = (f = g.customBlocks) == null ? void 0 : f.find((m) => m.blockId ===
|
|
489
|
+
const l = (h = (f = g.customBlocks) == null ? void 0 : f.find((m) => m.blockId === i)) == null ? void 0 : h.startIndex;
|
|
479
490
|
if (l != null) {
|
|
480
|
-
if (n = Math.min(u.dataStream.length - 2, n),
|
|
491
|
+
if (n = Math.min(u.dataStream.length - 2, n), r === e) {
|
|
481
492
|
if (n < l ? (n > 0 && c.push({
|
|
482
493
|
t: Y.RETAIN,
|
|
483
494
|
len: n
|
|
@@ -487,7 +498,7 @@ function mn(i, e, t, n, r, o, s) {
|
|
|
487
498
|
dataStream: "\b",
|
|
488
499
|
customBlocks: [{
|
|
489
500
|
startIndex: 0,
|
|
490
|
-
blockId:
|
|
501
|
+
blockId: i
|
|
491
502
|
}]
|
|
492
503
|
},
|
|
493
504
|
len: 1
|
|
@@ -512,12 +523,12 @@ function mn(i, e, t, n, r, o, s) {
|
|
|
512
523
|
dataStream: "\b",
|
|
513
524
|
customBlocks: [{
|
|
514
525
|
startIndex: 0,
|
|
515
|
-
blockId:
|
|
526
|
+
blockId: i
|
|
516
527
|
}]
|
|
517
528
|
},
|
|
518
529
|
len: 1
|
|
519
530
|
})), n !== l) {
|
|
520
|
-
const m = Xe(
|
|
531
|
+
const m = Xe(s, e), p = d.editOp(c.serialize(), m);
|
|
521
532
|
a.push(p);
|
|
522
533
|
}
|
|
523
534
|
} else {
|
|
@@ -528,7 +539,7 @@ function mn(i, e, t, n, r, o, s) {
|
|
|
528
539
|
t: Y.DELETE,
|
|
529
540
|
len: 1
|
|
530
541
|
});
|
|
531
|
-
let m = Xe(
|
|
542
|
+
let m = Xe(s, e), p = d.editOp(c.serialize(), m);
|
|
532
543
|
a.push(p), c.empty(), n > 0 && c.push({
|
|
533
544
|
t: Y.RETAIN,
|
|
534
545
|
len: n
|
|
@@ -538,11 +549,11 @@ function mn(i, e, t, n, r, o, s) {
|
|
|
538
549
|
dataStream: "\b",
|
|
539
550
|
customBlocks: [{
|
|
540
551
|
startIndex: 0,
|
|
541
|
-
blockId:
|
|
552
|
+
blockId: i
|
|
542
553
|
}]
|
|
543
554
|
},
|
|
544
555
|
len: 1
|
|
545
|
-
}), m = Xe(
|
|
556
|
+
}), m = Xe(s, r), p = d.editOp(c.serialize(), m), a.push(p), o.setSegment(r), o.setSegmentPage(t);
|
|
546
557
|
}
|
|
547
558
|
return a;
|
|
548
559
|
}
|
|
@@ -551,22 +562,22 @@ const wn = {
|
|
|
551
562
|
id: "doc.command.update-doc-drawing-wrapping-style",
|
|
552
563
|
type: q.COMMAND,
|
|
553
564
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
554
|
-
handler: (
|
|
565
|
+
handler: (r, e) => {
|
|
555
566
|
var A, L;
|
|
556
567
|
if (e == null)
|
|
557
568
|
return !1;
|
|
558
|
-
const { drawings: t, wrappingStyle: n, unitId:
|
|
569
|
+
const { drawings: t, wrappingStyle: n, unitId: i } = e, s = r.get(j), o = r.get(z), d = r.get(Q).getRenderById(i), a = d == null ? void 0 : d.with(te).getSkeleton().getSkeletonData(), g = d == null ? void 0 : d.with(te).getViewModel(), u = d == null ? void 0 : d.scene, l = o.getCurrentUniverDocInstance();
|
|
559
570
|
if (l == null || a == null || u == null || g == null)
|
|
560
571
|
return !1;
|
|
561
572
|
const f = g.getEditArea(), h = u.getTransformerByCreate(), { pages: m, skeHeaders: p, skeFooters: w } = a, D = $.getInstance(), S = [], { drawings: O = {} } = l.getSnapshot();
|
|
562
573
|
for (const R of t) {
|
|
563
|
-
const { drawingId: v } = R, N = O[v].layoutType, G =
|
|
574
|
+
const { drawingId: v } = R, N = O[v].layoutType, G = Fi[n];
|
|
564
575
|
if (N !== G) {
|
|
565
576
|
const _ = D.replaceOp(["drawings", v, "layoutType"], N, G);
|
|
566
577
|
S.push(_);
|
|
567
578
|
}
|
|
568
579
|
if (n === "behindText" || n === "inFrontOfText") {
|
|
569
|
-
const _ = O[v].behindDoc, E = n === "behindText" ?
|
|
580
|
+
const _ = O[v].behindDoc, E = n === "behindText" ? se.TRUE : se.FALSE;
|
|
570
581
|
if (_ !== E) {
|
|
571
582
|
const T = D.replaceOp(["drawings", v, "behindDoc"], _, E);
|
|
572
583
|
S.push(T);
|
|
@@ -578,17 +589,17 @@ const wn = {
|
|
|
578
589
|
for (const _ of m) {
|
|
579
590
|
const { headerId: E, footerId: T, marginTop: U, marginLeft: B, marginBottom: b, pageWidth: P, pageHeight: V } = _;
|
|
580
591
|
switch (f) {
|
|
581
|
-
case
|
|
592
|
+
case Fe.HEADER: {
|
|
582
593
|
const F = (A = p.get(E)) == null ? void 0 : A.get(P);
|
|
583
594
|
F != null && F.skeDrawings.has(v) && (x = F.skeDrawings.get(v), H = F.marginTop, I = B);
|
|
584
595
|
break;
|
|
585
596
|
}
|
|
586
|
-
case
|
|
597
|
+
case Fe.FOOTER: {
|
|
587
598
|
const F = (L = w.get(T)) == null ? void 0 : L.get(P);
|
|
588
599
|
F != null && F.skeDrawings.has(v) && (x = F.skeDrawings.get(v), H = V - b + F.marginTop, I = B);
|
|
589
600
|
break;
|
|
590
601
|
}
|
|
591
|
-
case
|
|
602
|
+
case Fe.BODY: {
|
|
592
603
|
_.skeDrawings.has(v) && (x = _.skeDrawings.get(v), H = U, I = B);
|
|
593
604
|
break;
|
|
594
605
|
}
|
|
@@ -624,28 +635,28 @@ const wn = {
|
|
|
624
635
|
const C = {
|
|
625
636
|
id: ee.id,
|
|
626
637
|
params: {
|
|
627
|
-
unitId:
|
|
638
|
+
unitId: i,
|
|
628
639
|
actions: [],
|
|
629
640
|
textRanges: null
|
|
630
641
|
}
|
|
631
642
|
};
|
|
632
643
|
C.params.actions = S.reduce((R, v) => $.compose(R, v), null);
|
|
633
|
-
const
|
|
634
|
-
return h.refreshControls(), !!
|
|
644
|
+
const y = s.syncExecuteCommand(C.id, C.params);
|
|
645
|
+
return h.refreshControls(), !!y;
|
|
635
646
|
}
|
|
636
647
|
}, vn = {
|
|
637
648
|
id: "doc.command.update-doc-drawing-distance",
|
|
638
649
|
type: q.COMMAND,
|
|
639
|
-
handler: (
|
|
650
|
+
handler: (r, e) => {
|
|
640
651
|
if (e == null)
|
|
641
652
|
return !1;
|
|
642
|
-
const t =
|
|
643
|
-
if (
|
|
653
|
+
const t = r.get(j), i = r.get(z).getCurrentUniverDocInstance();
|
|
654
|
+
if (i == null)
|
|
644
655
|
return !1;
|
|
645
|
-
const { drawings:
|
|
646
|
-
for (const f of
|
|
656
|
+
const { drawings: s, dist: o, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = i.getSnapshot();
|
|
657
|
+
for (const f of s) {
|
|
647
658
|
const { drawingId: h } = f;
|
|
648
|
-
for (const [m, p] of Object.entries(
|
|
659
|
+
for (const [m, p] of Object.entries(o)) {
|
|
649
660
|
const w = g[h][m];
|
|
650
661
|
if (w !== p) {
|
|
651
662
|
const D = d.replaceOp(["drawings", h, m], w, p);
|
|
@@ -666,17 +677,17 @@ const wn = {
|
|
|
666
677
|
}, In = {
|
|
667
678
|
id: "doc.command.update-doc-drawing-wrap-text",
|
|
668
679
|
type: q.COMMAND,
|
|
669
|
-
handler: (
|
|
680
|
+
handler: (r, e) => {
|
|
670
681
|
if (e == null)
|
|
671
682
|
return !1;
|
|
672
|
-
const t =
|
|
673
|
-
if (
|
|
683
|
+
const t = r.get(j), i = r.get(z).getCurrentUniverDocInstance();
|
|
684
|
+
if (i == null)
|
|
674
685
|
return !1;
|
|
675
|
-
const { drawings:
|
|
676
|
-
for (const f of
|
|
686
|
+
const { drawings: s, wrapText: o, unitId: c } = e, d = $.getInstance(), a = [], { drawings: g = {} } = i.getSnapshot();
|
|
687
|
+
for (const f of s) {
|
|
677
688
|
const { drawingId: h } = f, m = g[h].wrapText;
|
|
678
|
-
if (m !==
|
|
679
|
-
const p = d.replaceOp(["drawings", h, "wrapText"], m,
|
|
689
|
+
if (m !== o) {
|
|
690
|
+
const p = d.replaceOp(["drawings", h, "wrapText"], m, o);
|
|
680
691
|
a.push(p);
|
|
681
692
|
}
|
|
682
693
|
}
|
|
@@ -693,19 +704,19 @@ const wn = {
|
|
|
693
704
|
}, qe = {
|
|
694
705
|
id: "doc.command.update-drawing-doc-transform",
|
|
695
706
|
type: q.COMMAND,
|
|
696
|
-
handler: (
|
|
707
|
+
handler: (r, e) => {
|
|
697
708
|
if (e == null)
|
|
698
709
|
return !1;
|
|
699
|
-
const t =
|
|
700
|
-
if (
|
|
710
|
+
const t = r.get(j), n = r.get(z), s = r.get(Q).getRenderById(e.unitId), o = s == null ? void 0 : s.scene;
|
|
711
|
+
if (o == null)
|
|
701
712
|
return !1;
|
|
702
|
-
const c =
|
|
713
|
+
const c = o.getTransformerByCreate(), d = n.getCurrentUniverDocInstance();
|
|
703
714
|
if (d == null)
|
|
704
715
|
return !1;
|
|
705
716
|
const { drawings: a, unitId: g } = e, u = $.getInstance(), l = [], { drawings: f = {} } = d.getSnapshot();
|
|
706
717
|
for (const p of a) {
|
|
707
718
|
const { drawingId: w, key: D, value: S } = p, O = f[w].docTransform[D];
|
|
708
|
-
if (!
|
|
719
|
+
if (!Ae.diffValue(O, S)) {
|
|
709
720
|
const C = u.replaceOp(["drawings", w, "docTransform", D], O, S);
|
|
710
721
|
l.push(C);
|
|
711
722
|
}
|
|
@@ -726,19 +737,19 @@ const wn = {
|
|
|
726
737
|
}, _n = {
|
|
727
738
|
id: "doc.command.move-inline-drawing",
|
|
728
739
|
type: q.COMMAND,
|
|
729
|
-
handler: (
|
|
740
|
+
handler: (r, e) => {
|
|
730
741
|
var L, R;
|
|
731
742
|
if (e == null)
|
|
732
743
|
return !1;
|
|
733
|
-
const t =
|
|
734
|
-
if (
|
|
744
|
+
const t = r.get(Q), n = (L = t.getRenderById(e.unitId)) == null ? void 0 : L.with(Me), i = r.get(ut), s = t.getRenderById(e.unitId), o = s == null ? void 0 : s.scene, c = s == null ? void 0 : s.with(te).getSkeleton();
|
|
745
|
+
if (o == null || n == null)
|
|
735
746
|
return !1;
|
|
736
|
-
const d =
|
|
747
|
+
const d = o.getTransformerByCreate(), a = r.get(j), u = r.get(z).getCurrentUniverDocInstance();
|
|
737
748
|
if (u == null)
|
|
738
749
|
return !1;
|
|
739
750
|
const { drawing: l, unitId: f, offset: h, segmentId: m, segmentPage: p, needRefreshDrawings: w } = e;
|
|
740
751
|
if (w)
|
|
741
|
-
return
|
|
752
|
+
return i.refreshDrawings(c), d.refreshControls(), !0;
|
|
742
753
|
const D = [], { drawingId: S } = l, O = (R = n.getSegment()) != null ? R : "", C = mn(
|
|
743
754
|
m,
|
|
744
755
|
O,
|
|
@@ -749,9 +760,9 @@ const wn = {
|
|
|
749
760
|
n
|
|
750
761
|
);
|
|
751
762
|
if (C == null || C.length === 0)
|
|
752
|
-
return
|
|
763
|
+
return i.refreshDrawings(c), d.refreshControls(), !1;
|
|
753
764
|
D.push(...C);
|
|
754
|
-
const
|
|
765
|
+
const y = {
|
|
755
766
|
id: ee.id,
|
|
756
767
|
params: {
|
|
757
768
|
unitId: f,
|
|
@@ -759,22 +770,22 @@ const wn = {
|
|
|
759
770
|
textRanges: null
|
|
760
771
|
}
|
|
761
772
|
};
|
|
762
|
-
|
|
763
|
-
const A = a.syncExecuteCommand(
|
|
773
|
+
y.params.actions = D.reduce((v, N) => $.compose(v, N), null);
|
|
774
|
+
const A = a.syncExecuteCommand(y.id, y.params);
|
|
764
775
|
return d.refreshControls(), !!A;
|
|
765
776
|
}
|
|
766
777
|
}, Sn = {
|
|
767
778
|
id: "doc.command.transform-non-inline-drawing",
|
|
768
779
|
type: q.COMMAND,
|
|
769
780
|
// eslint-disable-next-line max-lines-per-function
|
|
770
|
-
handler: (
|
|
781
|
+
handler: (r, e) => {
|
|
771
782
|
var x, H;
|
|
772
783
|
if (e == null)
|
|
773
784
|
return !1;
|
|
774
|
-
const t =
|
|
775
|
-
if (
|
|
785
|
+
const t = r.get(Q), n = (x = t.getRenderById(e.unitId)) == null ? void 0 : x.with(Me), i = t.getRenderById(e.unitId), s = i == null ? void 0 : i.scene;
|
|
786
|
+
if (s == null || n == null)
|
|
776
787
|
return !1;
|
|
777
|
-
const
|
|
788
|
+
const o = s.getTransformerByCreate(), c = r.get(j), a = r.get(z).getCurrentUniverDocInstance();
|
|
778
789
|
if (a == null)
|
|
779
790
|
return !1;
|
|
780
791
|
const { drawing: g, unitId: u, offset: l, docTransform: f, segmentId: h, segmentPage: m } = e, p = [], { drawingId: w } = g, D = (H = n.getSegment()) != null ? H : "", S = mn(
|
|
@@ -789,20 +800,20 @@ const wn = {
|
|
|
789
800
|
if (S == null)
|
|
790
801
|
return !1;
|
|
791
802
|
S.length > 0 && p.push(...S);
|
|
792
|
-
const O = $.getInstance(), { drawings: C = {} } = a.getSnapshot(),
|
|
793
|
-
if (!
|
|
803
|
+
const O = $.getInstance(), { drawings: C = {} } = a.getSnapshot(), y = C[w].docTransform, { positionH: A, positionV: L, size: R, angle: v } = y;
|
|
804
|
+
if (!Ae.diffValue(A, f.positionH)) {
|
|
794
805
|
const I = O.replaceOp(["drawings", w, "docTransform", "positionH"], A, f.positionH);
|
|
795
806
|
p.push(I);
|
|
796
807
|
}
|
|
797
|
-
if (!
|
|
808
|
+
if (!Ae.diffValue(L, f.positionV)) {
|
|
798
809
|
const I = O.replaceOp(["drawings", w, "docTransform", "positionV"], L, f.positionV);
|
|
799
810
|
p.push(I);
|
|
800
811
|
}
|
|
801
|
-
if (!
|
|
812
|
+
if (!Ae.diffValue(R, f.size)) {
|
|
802
813
|
const I = O.replaceOp(["drawings", w, "docTransform", "size"], R, f.size);
|
|
803
814
|
p.push(I);
|
|
804
815
|
}
|
|
805
|
-
if (!
|
|
816
|
+
if (!Ae.diffValue(v, f.angle)) {
|
|
806
817
|
const I = O.replaceOp(["drawings", w, "docTransform", "angle"], v, f.angle);
|
|
807
818
|
p.push(I);
|
|
808
819
|
}
|
|
@@ -817,28 +828,28 @@ const wn = {
|
|
|
817
828
|
};
|
|
818
829
|
N.params.actions = p.reduce((I, _) => $.compose(I, _), null);
|
|
819
830
|
const G = c.syncExecuteCommand(N.id, N.params);
|
|
820
|
-
return
|
|
831
|
+
return o.refreshControls(), !!G;
|
|
821
832
|
}
|
|
822
833
|
}, Ke = {
|
|
823
834
|
id: "doc.command.move-drawing",
|
|
824
835
|
type: q.COMMAND,
|
|
825
|
-
handler: (
|
|
826
|
-
const t =
|
|
836
|
+
handler: (r, e) => {
|
|
837
|
+
const t = r.get(j), n = r.get(Ne), i = r.get(z), s = r.get(Q), { direction: o } = e, c = n.getFocusDrawings();
|
|
827
838
|
if (c.length === 0)
|
|
828
839
|
return !1;
|
|
829
|
-
const d = c[0].unitId, a =
|
|
840
|
+
const d = c[0].unitId, a = s.getRenderById(d), g = a == null ? void 0 : a.scene;
|
|
830
841
|
if (g == null)
|
|
831
842
|
return !1;
|
|
832
|
-
const u = g.getTransformerByCreate(), l =
|
|
833
|
-
var
|
|
834
|
-
const { drawingId: p } = m, w = (
|
|
843
|
+
const u = g.getTransformerByCreate(), l = i.getUniverDocInstance(d), f = c.map((m) => {
|
|
844
|
+
var y, A, L, R, v;
|
|
845
|
+
const { drawingId: p } = m, w = (y = l == null ? void 0 : l.getSnapshot().drawings) == null ? void 0 : y[p];
|
|
835
846
|
if (w == null || w.layoutType === k.INLINE)
|
|
836
847
|
return null;
|
|
837
848
|
const { positionH: D, positionV: S } = w.docTransform, O = { ...D }, C = { ...S };
|
|
838
|
-
return
|
|
849
|
+
return o === he.UP ? C.posOffset = ((A = C.posOffset) != null ? A : 0) - 2 : o === he.DOWN ? C.posOffset = ((L = C.posOffset) != null ? L : 0) + 2 : o === he.LEFT ? O.posOffset = ((R = O.posOffset) != null ? R : 0) - 2 : o === he.RIGHT && (O.posOffset = ((v = O.posOffset) != null ? v : 0) + 2), {
|
|
839
850
|
drawingId: p,
|
|
840
|
-
key:
|
|
841
|
-
value:
|
|
851
|
+
key: o === he.UP || o === he.DOWN ? "positionV" : "positionH",
|
|
852
|
+
value: o === he.UP || o === he.DOWN ? C : O
|
|
842
853
|
};
|
|
843
854
|
}).filter((m) => m != null);
|
|
844
855
|
if (f.length === 0)
|
|
@@ -850,28 +861,28 @@ const wn = {
|
|
|
850
861
|
});
|
|
851
862
|
return u.refreshControls(), !!h;
|
|
852
863
|
}
|
|
853
|
-
},
|
|
864
|
+
}, ki = {
|
|
854
865
|
id: "doc.operation.clear-drawing-transformer",
|
|
855
866
|
type: q.MUTATION,
|
|
856
|
-
handler: (
|
|
857
|
-
const t =
|
|
867
|
+
handler: (r, e) => {
|
|
868
|
+
const t = r.get(Q);
|
|
858
869
|
return e.forEach((n) => {
|
|
859
|
-
var
|
|
860
|
-
(
|
|
870
|
+
var i, s;
|
|
871
|
+
(s = (i = t.getRenderById(n)) == null ? void 0 : i.scene.getTransformer()) == null || s.debounceRefreshControls();
|
|
861
872
|
}), !0;
|
|
862
873
|
}
|
|
863
874
|
}, Dn = "COMPONENT_DOC_DRAWING_PANEL", On = {
|
|
864
875
|
id: "sidebar.operation.doc-image",
|
|
865
876
|
type: q.COMMAND,
|
|
866
|
-
handler: async (
|
|
867
|
-
const t =
|
|
877
|
+
handler: async (r, e) => {
|
|
878
|
+
const t = r.get(vi), n = r.get(lt), i = r.get(fe);
|
|
868
879
|
switch (e.value) {
|
|
869
880
|
case "open":
|
|
870
881
|
t.open({
|
|
871
882
|
header: { title: n.t("docImage.panel.title") },
|
|
872
883
|
children: { label: Dn },
|
|
873
884
|
onClose: () => {
|
|
874
|
-
|
|
885
|
+
i.focusDrawing(null);
|
|
875
886
|
},
|
|
876
887
|
width: 360
|
|
877
888
|
});
|
|
@@ -886,23 +897,23 @@ const wn = {
|
|
|
886
897
|
}, Tn = {
|
|
887
898
|
id: "doc.operation.edit-doc-image",
|
|
888
899
|
type: q.OPERATION,
|
|
889
|
-
handler: (
|
|
890
|
-
const t =
|
|
900
|
+
handler: (r, e) => {
|
|
901
|
+
const t = r.get(fe), n = r.get(j);
|
|
891
902
|
return e == null ? !1 : (t.focusDrawing([e]), n.executeCommand(On.id, { value: "open" }), !0);
|
|
892
903
|
}
|
|
893
904
|
};
|
|
894
|
-
var
|
|
895
|
-
for (var
|
|
896
|
-
(
|
|
897
|
-
return
|
|
898
|
-
},
|
|
899
|
-
function
|
|
900
|
-
const { top:
|
|
905
|
+
var Wi = Object.getOwnPropertyDescriptor, Gi = (r, e, t, n) => {
|
|
906
|
+
for (var i = n > 1 ? void 0 : n ? Wi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
907
|
+
(o = r[s]) && (i = o(i) || i);
|
|
908
|
+
return i;
|
|
909
|
+
}, Le = (r, e) => (t, n) => e(t, n, r);
|
|
910
|
+
function Mn(r, e, t = 1, n = 0) {
|
|
911
|
+
const { top: i, left: s, bottom: o, right: c } = r, d = c - s, a = o - i, g = e.getViewport(tn.VIEW_MAIN), { viewportScrollX: u, viewportScrollY: l } = g, { scaleX: f, scaleY: h } = e.getAncestorScale();
|
|
901
912
|
return {
|
|
902
|
-
startX: (
|
|
903
|
-
startY: (
|
|
904
|
-
endX: (
|
|
905
|
-
endY: (
|
|
913
|
+
startX: (s - u) * f,
|
|
914
|
+
startY: (i - l) * h,
|
|
915
|
+
endX: (s + d - u) * f,
|
|
916
|
+
endY: (i + a - l) * h,
|
|
906
917
|
width: d * f,
|
|
907
918
|
height: a * h,
|
|
908
919
|
rotate: n,
|
|
@@ -913,15 +924,15 @@ function yn(i, e, t = 1, n = 0) {
|
|
|
913
924
|
opacity: t != null ? t : 1
|
|
914
925
|
};
|
|
915
926
|
}
|
|
916
|
-
function wt(
|
|
917
|
-
const { top: t, left: n, width:
|
|
918
|
-
return
|
|
927
|
+
function wt(r, e) {
|
|
928
|
+
const { top: t, left: n, width: i, height: s, angle: o, opacity: c } = r;
|
|
929
|
+
return Mn({ top: t, left: n, bottom: t + s, right: n + i }, e.scene, c, o);
|
|
919
930
|
}
|
|
920
|
-
let
|
|
921
|
-
constructor(e, t, n,
|
|
931
|
+
let rt = class extends xe {
|
|
932
|
+
constructor(e, t, n, i, s, o) {
|
|
922
933
|
super();
|
|
923
|
-
|
|
924
|
-
this._renderManagerService = e, this._drawingManagerService = t, this._drawingRenderService = n, this._canvasFloatDomService =
|
|
934
|
+
me(this, "_domLayerInfoMap", /* @__PURE__ */ new Map());
|
|
935
|
+
this._renderManagerService = e, this._drawingManagerService = t, this._drawingRenderService = n, this._canvasFloatDomService = i, this._univerInstanceService = s, this._commandService = o, this._initialize();
|
|
925
936
|
}
|
|
926
937
|
dispose() {
|
|
927
938
|
super.dispose();
|
|
@@ -935,8 +946,8 @@ let it = class extends Ne {
|
|
|
935
946
|
const t = this._renderManagerService.getRenderById(e);
|
|
936
947
|
if (t == null)
|
|
937
948
|
return null;
|
|
938
|
-
const n = t.scene,
|
|
939
|
-
return { scene: n, transformer:
|
|
949
|
+
const n = t.scene, i = n.getTransformerByCreate();
|
|
950
|
+
return { scene: n, transformer: i, renderUnit: t, canvas: t.engine.getCanvasElement() };
|
|
940
951
|
}
|
|
941
952
|
_drawingAddRemoveListener() {
|
|
942
953
|
this.disposeWithMe(
|
|
@@ -954,19 +965,19 @@ let it = class extends Ne {
|
|
|
954
965
|
_insertRects(e) {
|
|
955
966
|
e.forEach(async (t) => {
|
|
956
967
|
const { unitId: n } = t;
|
|
957
|
-
if (!this._univerInstanceService.getUnit(n,
|
|
968
|
+
if (!this._univerInstanceService.getUnit(n, ve.UNIVER_DOC))
|
|
958
969
|
return;
|
|
959
|
-
const
|
|
960
|
-
if (o == null)
|
|
961
|
-
return;
|
|
962
|
-
const s = this._drawingManagerService.getDrawingByParam(t);
|
|
970
|
+
const s = this._getSceneAndTransformerByDrawingSearch(n);
|
|
963
971
|
if (s == null)
|
|
964
972
|
return;
|
|
965
|
-
const
|
|
973
|
+
const o = this._drawingManagerService.getDrawingByParam(t);
|
|
974
|
+
if (o == null)
|
|
975
|
+
return;
|
|
976
|
+
const c = await this._drawingRenderService.renderFloatDom(o, s.scene);
|
|
966
977
|
if (!(c == null || c.length === 0))
|
|
967
978
|
for (const d of c) {
|
|
968
979
|
this._addHoverForRect(d);
|
|
969
|
-
const a = new Ln(), g = wt(d,
|
|
980
|
+
const a = new Ln(), g = wt(d, s.renderUnit), u = new Ot(g), l = s.canvas, f = o.data, h = {
|
|
970
981
|
dispose: a,
|
|
971
982
|
rect: d,
|
|
972
983
|
position$: u,
|
|
@@ -974,8 +985,8 @@ let it = class extends Ne {
|
|
|
974
985
|
};
|
|
975
986
|
this._canvasFloatDomService.addFloatDom({
|
|
976
987
|
position$: u,
|
|
977
|
-
id:
|
|
978
|
-
componentKey:
|
|
988
|
+
id: o.drawingId,
|
|
989
|
+
componentKey: o.componentKey,
|
|
979
990
|
onPointerDown: (p) => {
|
|
980
991
|
l.dispatchEvent(new PointerEvent(p.type, p));
|
|
981
992
|
},
|
|
@@ -992,26 +1003,26 @@ let it = class extends Ne {
|
|
|
992
1003
|
unitId: n
|
|
993
1004
|
});
|
|
994
1005
|
const m = d.onTransformChange$.subscribeEvent(() => {
|
|
995
|
-
const p = wt(d,
|
|
1006
|
+
const p = wt(d, s.renderUnit);
|
|
996
1007
|
u.next(
|
|
997
1008
|
p
|
|
998
1009
|
);
|
|
999
1010
|
});
|
|
1000
1011
|
a.add(() => {
|
|
1001
|
-
this._canvasFloatDomService.removeFloatDom(
|
|
1002
|
-
}), m && a.add(m), this._domLayerInfoMap.set(
|
|
1012
|
+
this._canvasFloatDomService.removeFloatDom(o.drawingId);
|
|
1013
|
+
}), m && a.add(m), this._domLayerInfoMap.set(o.drawingId, h);
|
|
1003
1014
|
}
|
|
1004
1015
|
});
|
|
1005
1016
|
}
|
|
1006
1017
|
_addHoverForRect(e) {
|
|
1007
1018
|
this.disposeWithMe(
|
|
1008
|
-
|
|
1019
|
+
ze(
|
|
1009
1020
|
e.onPointerEnter$.subscribeEvent(() => {
|
|
1010
1021
|
e.cursor = xt.GRAB;
|
|
1011
1022
|
})
|
|
1012
1023
|
)
|
|
1013
1024
|
), this.disposeWithMe(
|
|
1014
|
-
|
|
1025
|
+
ze(
|
|
1015
1026
|
e.onPointerLeave$.subscribeEvent(() => {
|
|
1016
1027
|
e.cursor = xt.DEFAULT;
|
|
1017
1028
|
})
|
|
@@ -1024,27 +1035,27 @@ let it = class extends Ne {
|
|
|
1024
1035
|
return;
|
|
1025
1036
|
const { unitId: n } = t;
|
|
1026
1037
|
this._domLayerInfoMap.delete(e), t.dispose.dispose();
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1038
|
+
const i = this._getSceneAndTransformerByDrawingSearch(n);
|
|
1039
|
+
i && i.scene.removeObject(t.rect);
|
|
1029
1040
|
}
|
|
1030
1041
|
_initScrollAndZoomEvent() {
|
|
1031
1042
|
const e = (t) => {
|
|
1032
1043
|
const n = this._getSceneAndTransformerByDrawingSearch(t);
|
|
1033
|
-
n && this._domLayerInfoMap.forEach((
|
|
1034
|
-
if (
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1044
|
+
n && this._domLayerInfoMap.forEach((i) => {
|
|
1045
|
+
if (i.unitId !== t) return;
|
|
1046
|
+
const s = wt(i.rect, n.renderUnit);
|
|
1047
|
+
i.position$.next(s);
|
|
1037
1048
|
});
|
|
1038
1049
|
};
|
|
1039
1050
|
this.disposeWithMe(
|
|
1040
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1051
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(ve.UNIVER_DOC).pipe(
|
|
1041
1052
|
Ht((t) => {
|
|
1042
1053
|
if (!t) return null;
|
|
1043
|
-
const n = t.getUnitId(),
|
|
1044
|
-
return
|
|
1054
|
+
const n = t.getUnitId(), i = this._renderManagerService.getRenderById(n);
|
|
1055
|
+
return i ? { render: i, unitId: n } : null;
|
|
1045
1056
|
}),
|
|
1046
|
-
|
|
1047
|
-
(t) => t ? Zt(t.render.scene.getViewport(tn.VIEW_MAIN).onScrollAfter$).pipe(Ht(() => ({ unitId: t.unitId }))) :
|
|
1057
|
+
yi(
|
|
1058
|
+
(t) => t ? Zt(t.render.scene.getViewport(tn.VIEW_MAIN).onScrollAfter$).pipe(Ht(() => ({ unitId: t.unitId }))) : bi(null)
|
|
1048
1059
|
)
|
|
1049
1060
|
).subscribe((t) => {
|
|
1050
1061
|
if (!t) return;
|
|
@@ -1053,18 +1064,18 @@ let it = class extends Ne {
|
|
|
1053
1064
|
})
|
|
1054
1065
|
), this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
|
|
1055
1066
|
if (t.id === nn.id) {
|
|
1056
|
-
const n = t.params, { unitId:
|
|
1057
|
-
e(
|
|
1067
|
+
const n = t.params, { unitId: i } = n;
|
|
1068
|
+
e(i);
|
|
1058
1069
|
}
|
|
1059
1070
|
}));
|
|
1060
1071
|
}
|
|
1061
1072
|
insertFloatDom(e, t) {
|
|
1062
1073
|
var m, p, w;
|
|
1063
|
-
const n = this._univerInstanceService.getCurrentUnitOfType(
|
|
1074
|
+
const n = this._univerInstanceService.getCurrentUnitOfType(ve.UNIVER_DOC);
|
|
1064
1075
|
if (!n) return !1;
|
|
1065
|
-
const
|
|
1066
|
-
if (!
|
|
1067
|
-
const c = (m =
|
|
1076
|
+
const i = this._getSceneAndTransformerByDrawingSearch(n.getUnitId());
|
|
1077
|
+
if (!i) return !1;
|
|
1078
|
+
const c = (m = i.renderUnit.with(te).getSkeleton().getSkeletonData()) == null ? void 0 : m.pages[0];
|
|
1068
1079
|
if (!c) return !1;
|
|
1069
1080
|
const { pageWidth: d, marginLeft: a, marginRight: g } = c, u = d - a - g, l = {
|
|
1070
1081
|
size: {
|
|
@@ -1085,7 +1096,7 @@ let it = class extends Ne {
|
|
|
1085
1096
|
drawings: [
|
|
1086
1097
|
{
|
|
1087
1098
|
drawingId: f,
|
|
1088
|
-
drawingType:
|
|
1099
|
+
drawingType: Pe.DRAWING_DOM,
|
|
1089
1100
|
subUnitId: n.getUnitId(),
|
|
1090
1101
|
unitId: n.getUnitId(),
|
|
1091
1102
|
...e,
|
|
@@ -1097,22 +1108,22 @@ let it = class extends Ne {
|
|
|
1097
1108
|
}
|
|
1098
1109
|
]
|
|
1099
1110
|
};
|
|
1100
|
-
return this._commandService.syncExecuteCommand(
|
|
1111
|
+
return this._commandService.syncExecuteCommand(yt.id, h), f;
|
|
1101
1112
|
}
|
|
1102
1113
|
};
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
],
|
|
1111
|
-
const
|
|
1112
|
-
const e =
|
|
1114
|
+
rt = Gi([
|
|
1115
|
+
Le(0, Q),
|
|
1116
|
+
Le(1, fe),
|
|
1117
|
+
Le(2, Z(gn)),
|
|
1118
|
+
Le(3, Z(Ii)),
|
|
1119
|
+
Le(4, z),
|
|
1120
|
+
Le(5, j)
|
|
1121
|
+
], rt);
|
|
1122
|
+
const Hi = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, ji = (r) => {
|
|
1123
|
+
const e = we(j), t = we(lt), n = we(fe), i = we(Q), s = we(z), { drawings: o } = r, c = o[0];
|
|
1113
1124
|
if (c == null)
|
|
1114
1125
|
return;
|
|
1115
|
-
const { unitId: d } = c, a =
|
|
1126
|
+
const { unitId: d } = c, a = s.getUniverDocInstance(d), g = a == null ? void 0 : a.getSnapshot().documentStyle.documentFlavor, u = i.getRenderById(d), l = u == null ? void 0 : u.scene;
|
|
1116
1127
|
if (l == null)
|
|
1117
1128
|
return;
|
|
1118
1129
|
const f = l.getTransformerByCreate(), h = [{
|
|
@@ -1139,13 +1150,13 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1139
1150
|
}, {
|
|
1140
1151
|
label: t.t("image-position.paragraph"),
|
|
1141
1152
|
value: String(W.PARAGRAPH)
|
|
1142
|
-
}], [p, w] =
|
|
1153
|
+
}], [p, w] = re(!0), [D, S] = re({
|
|
1143
1154
|
relativeFrom: J.PAGE,
|
|
1144
1155
|
posOffset: 0
|
|
1145
|
-
}), [O, C] =
|
|
1156
|
+
}), [O, C] = re({
|
|
1146
1157
|
relativeFrom: W.PAGE,
|
|
1147
1158
|
posOffset: 0
|
|
1148
|
-
}), [
|
|
1159
|
+
}), [y, A] = re(!0), [L, R] = re(!0);
|
|
1149
1160
|
function v(_, E) {
|
|
1150
1161
|
var b;
|
|
1151
1162
|
_ === "positionH" ? S(E) : C(E);
|
|
@@ -1166,11 +1177,11 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1166
1177
|
value: E
|
|
1167
1178
|
}))
|
|
1168
1179
|
});
|
|
1169
|
-
const B = (b =
|
|
1180
|
+
const B = (b = i.getRenderById(d)) == null ? void 0 : b.with(Me);
|
|
1170
1181
|
B && B.blur(), f.refreshControls();
|
|
1171
1182
|
}
|
|
1172
1183
|
function N(_) {
|
|
1173
|
-
var
|
|
1184
|
+
var ie, Ie, _e;
|
|
1174
1185
|
const E = D.relativeFrom, T = D.posOffset, U = Number(_);
|
|
1175
1186
|
if (E === U)
|
|
1176
1187
|
return;
|
|
@@ -1179,24 +1190,24 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1179
1190
|
return;
|
|
1180
1191
|
const b = B[0].drawingId, P = B[0].unitId;
|
|
1181
1192
|
let V = null, F = 0;
|
|
1182
|
-
const K = (
|
|
1183
|
-
if (
|
|
1193
|
+
const K = (ie = i.getRenderById(P)) == null ? void 0 : ie.with(te).getSkeleton(), oe = K == null ? void 0 : K.getSkeletonData();
|
|
1194
|
+
if (oe == null)
|
|
1184
1195
|
return;
|
|
1185
|
-
const { pages:
|
|
1186
|
-
for (const ce of
|
|
1187
|
-
const { marginLeft:
|
|
1188
|
-
if (
|
|
1189
|
-
V =
|
|
1196
|
+
const { pages: Ue, skeHeaders: ye, skeFooters: We } = oe;
|
|
1197
|
+
for (const ce of Ue) {
|
|
1198
|
+
const { marginLeft: Se, skeDrawings: De, headerId: be, footerId: Ce, pageWidth: Oe } = ce;
|
|
1199
|
+
if (De.has(b)) {
|
|
1200
|
+
V = De.get(b), F = Se;
|
|
1190
1201
|
break;
|
|
1191
1202
|
}
|
|
1192
|
-
const de = (Ie =
|
|
1203
|
+
const de = (Ie = ye.get(be)) == null ? void 0 : Ie.get(Oe);
|
|
1193
1204
|
if (de != null && de.skeDrawings.has(b)) {
|
|
1194
|
-
V = de == null ? void 0 : de.skeDrawings.get(b), F =
|
|
1205
|
+
V = de == null ? void 0 : de.skeDrawings.get(b), F = Se;
|
|
1195
1206
|
break;
|
|
1196
1207
|
}
|
|
1197
|
-
const ge = (_e =
|
|
1208
|
+
const ge = (_e = We.get(Ce)) == null ? void 0 : _e.get(Oe);
|
|
1198
1209
|
if (ge != null && ge.skeDrawings.has(b)) {
|
|
1199
|
-
V = ge == null ? void 0 : ge.skeDrawings.get(b), F =
|
|
1210
|
+
V = ge == null ? void 0 : ge.skeDrawings.get(b), F = Se;
|
|
1200
1211
|
break;
|
|
1201
1212
|
}
|
|
1202
1213
|
}
|
|
@@ -1211,26 +1222,26 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1211
1222
|
v("positionH", ne);
|
|
1212
1223
|
}
|
|
1213
1224
|
function G(_) {
|
|
1214
|
-
var
|
|
1225
|
+
var De, be, Ce, Oe, de, ge;
|
|
1215
1226
|
const E = O.relativeFrom, T = O.posOffset, U = Number(_);
|
|
1216
1227
|
if (E === U)
|
|
1217
1228
|
return;
|
|
1218
1229
|
const B = n.getFocusDrawings();
|
|
1219
1230
|
if (B.length === 0)
|
|
1220
1231
|
return;
|
|
1221
|
-
const { drawingId: b, unitId: P } = B[0], V =
|
|
1222
|
-
if (
|
|
1232
|
+
const { drawingId: b, unitId: P } = B[0], V = s.getUniverDocInstance(P), F = (De = i.getRenderById(P)) == null ? void 0 : De.with(te).getSkeleton(), K = (be = i.getRenderById(P)) == null ? void 0 : be.with(Me), oe = K == null ? void 0 : K.getSegment(), Ue = K == null ? void 0 : K.getSegmentPage(), ye = (Oe = (Ce = V == null ? void 0 : V.getSelfOrHeaderFooterModel(oe).getBody()) == null ? void 0 : Ce.customBlocks) == null ? void 0 : Oe.find((Ee) => Ee.blockId === b);
|
|
1233
|
+
if (ye == null || F == null || K == null)
|
|
1223
1234
|
return;
|
|
1224
|
-
const { startIndex:
|
|
1225
|
-
if (ae == null || ne == null || Ie == null ||
|
|
1235
|
+
const { startIndex: We } = ye, ae = F.findNodeByCharIndex(We, oe, Ue), ne = (de = ae == null ? void 0 : ae.parent) == null ? void 0 : de.parent, ie = ne == null ? void 0 : ne.parent, Ie = ie == null ? void 0 : ie.lines.find((Ee) => Ee.paragraphIndex === (ne == null ? void 0 : ne.paragraphIndex) && Ee.paragraphStart), _e = (ge = ie == null ? void 0 : ie.parent) == null ? void 0 : ge.parent;
|
|
1236
|
+
if (ae == null || ne == null || Ie == null || ie == null || _e == null)
|
|
1226
1237
|
return;
|
|
1227
1238
|
let ce = 0;
|
|
1228
1239
|
E === W.PARAGRAPH ? ce -= Ie.top : E === W.LINE ? ce -= ne.top : E === W.PAGE && (ce += _e.marginTop), U === W.PARAGRAPH ? ce += Ie.top : U === W.LINE ? ce += ne.top : U === W.PAGE && (ce -= _e.marginTop);
|
|
1229
|
-
const
|
|
1240
|
+
const Se = {
|
|
1230
1241
|
relativeFrom: U,
|
|
1231
1242
|
posOffset: (T != null ? T : 0) - ce
|
|
1232
1243
|
};
|
|
1233
|
-
v("positionV",
|
|
1244
|
+
v("positionV", Se);
|
|
1234
1245
|
}
|
|
1235
1246
|
function x(_) {
|
|
1236
1247
|
var P;
|
|
@@ -1267,22 +1278,22 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1267
1278
|
}, []), /* @__PURE__ */ X(
|
|
1268
1279
|
"div",
|
|
1269
1280
|
{
|
|
1270
|
-
className:
|
|
1281
|
+
className: sn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
1271
1282
|
"univer-hidden": !L
|
|
1272
1283
|
}),
|
|
1273
1284
|
children: [
|
|
1274
|
-
/* @__PURE__ */
|
|
1285
|
+
/* @__PURE__ */ M(
|
|
1275
1286
|
"header",
|
|
1276
1287
|
{
|
|
1277
1288
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1278
|
-
children: /* @__PURE__ */
|
|
1289
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-position.title") })
|
|
1279
1290
|
}
|
|
1280
1291
|
),
|
|
1281
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ M(
|
|
1282
1293
|
"div",
|
|
1283
1294
|
{
|
|
1284
1295
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1285
|
-
children: /* @__PURE__ */
|
|
1296
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-position.horizontal") })
|
|
1286
1297
|
}
|
|
1287
1298
|
),
|
|
1288
1299
|
/* @__PURE__ */ X(
|
|
@@ -1291,9 +1302,9 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1291
1302
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
1292
1303
|
children: [
|
|
1293
1304
|
/* @__PURE__ */ X("div", { children: [
|
|
1294
|
-
/* @__PURE__ */
|
|
1295
|
-
/* @__PURE__ */
|
|
1296
|
-
|
|
1305
|
+
/* @__PURE__ */ M("span", { children: t.t("image-position.absolutePosition") }),
|
|
1306
|
+
/* @__PURE__ */ M(
|
|
1307
|
+
Be,
|
|
1297
1308
|
{
|
|
1298
1309
|
min: zt,
|
|
1299
1310
|
max: Xt,
|
|
@@ -1310,8 +1321,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1310
1321
|
)
|
|
1311
1322
|
] }),
|
|
1312
1323
|
/* @__PURE__ */ X("div", { children: [
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ M("span", { children: t.t("image-position.toTheRightOf") }),
|
|
1325
|
+
/* @__PURE__ */ M(
|
|
1315
1326
|
Bt,
|
|
1316
1327
|
{
|
|
1317
1328
|
value: String(D.relativeFrom),
|
|
@@ -1324,11 +1335,11 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1324
1335
|
]
|
|
1325
1336
|
}
|
|
1326
1337
|
),
|
|
1327
|
-
/* @__PURE__ */
|
|
1338
|
+
/* @__PURE__ */ M(
|
|
1328
1339
|
"div",
|
|
1329
1340
|
{
|
|
1330
1341
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1331
|
-
children: /* @__PURE__ */
|
|
1342
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-position.vertical") })
|
|
1332
1343
|
}
|
|
1333
1344
|
),
|
|
1334
1345
|
/* @__PURE__ */ X(
|
|
@@ -1337,9 +1348,9 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1337
1348
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
1338
1349
|
children: [
|
|
1339
1350
|
/* @__PURE__ */ X("div", { children: [
|
|
1340
|
-
/* @__PURE__ */
|
|
1341
|
-
/* @__PURE__ */
|
|
1342
|
-
|
|
1351
|
+
/* @__PURE__ */ M("span", { children: t.t("image-position.absolutePosition") }),
|
|
1352
|
+
/* @__PURE__ */ M(
|
|
1353
|
+
Be,
|
|
1343
1354
|
{
|
|
1344
1355
|
min: zt,
|
|
1345
1356
|
max: Xt,
|
|
@@ -1356,8 +1367,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1356
1367
|
)
|
|
1357
1368
|
] }),
|
|
1358
1369
|
/* @__PURE__ */ X("div", { children: [
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ M("span", { children: t.t("image-position.bellow") }),
|
|
1371
|
+
/* @__PURE__ */ M(
|
|
1361
1372
|
Bt,
|
|
1362
1373
|
{
|
|
1363
1374
|
disabled: p,
|
|
@@ -1370,18 +1381,18 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1370
1381
|
]
|
|
1371
1382
|
}
|
|
1372
1383
|
),
|
|
1373
|
-
/* @__PURE__ */
|
|
1384
|
+
/* @__PURE__ */ M(
|
|
1374
1385
|
"div",
|
|
1375
1386
|
{
|
|
1376
1387
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1377
|
-
children: /* @__PURE__ */
|
|
1388
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-position.options") })
|
|
1378
1389
|
}
|
|
1379
1390
|
),
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
|
|
1391
|
+
/* @__PURE__ */ M("div", { children: /* @__PURE__ */ M(
|
|
1392
|
+
ai,
|
|
1382
1393
|
{
|
|
1383
1394
|
disabled: p,
|
|
1384
|
-
checked:
|
|
1395
|
+
checked: y,
|
|
1385
1396
|
onChange: I,
|
|
1386
1397
|
children: t.t("image-position.moveObjectWithText")
|
|
1387
1398
|
}
|
|
@@ -1389,19 +1400,19 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1389
1400
|
]
|
|
1390
1401
|
}
|
|
1391
1402
|
);
|
|
1392
|
-
}, Qe = 0, Je = 100,
|
|
1393
|
-
const e =
|
|
1403
|
+
}, Qe = 0, Je = 100, Vi = (r) => {
|
|
1404
|
+
const e = we(j), t = we(lt), n = we(fe), i = we(Q), s = we(z), { drawings: o } = r, c = o[0];
|
|
1394
1405
|
if (c == null)
|
|
1395
1406
|
return null;
|
|
1396
|
-
const { unitId: d } = c, a =
|
|
1407
|
+
const { unitId: d } = c, a = s.getUniverDocInstance(d), g = i.getRenderById(d);
|
|
1397
1408
|
if ((g == null ? void 0 : g.scene) == null)
|
|
1398
1409
|
return null;
|
|
1399
|
-
const [l, f] =
|
|
1410
|
+
const [l, f] = re(!0), [h, m] = re(!0), [p, w] = re(!0), [D, S] = re(ue.INLINE), [O, C] = re(""), [y, A] = re({
|
|
1400
1411
|
distT: 0,
|
|
1401
1412
|
distL: 0,
|
|
1402
1413
|
distB: 0,
|
|
1403
1414
|
distR: 0
|
|
1404
|
-
}), [L, R] =
|
|
1415
|
+
}), [L, R] = re(!0);
|
|
1405
1416
|
function v(I) {
|
|
1406
1417
|
S(I);
|
|
1407
1418
|
const _ = n.getFocusDrawings();
|
|
@@ -1439,7 +1450,7 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1439
1450
|
function G(I, _) {
|
|
1440
1451
|
if (I == null)
|
|
1441
1452
|
return;
|
|
1442
|
-
const E = { ...
|
|
1453
|
+
const E = { ...y, [_]: I };
|
|
1443
1454
|
A(E);
|
|
1444
1455
|
const T = n.getFocusDrawings();
|
|
1445
1456
|
if (T.length === 0)
|
|
@@ -1463,8 +1474,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1463
1474
|
I.length !== 0 && H(I[0]);
|
|
1464
1475
|
}
|
|
1465
1476
|
function H(I) {
|
|
1466
|
-
var K,
|
|
1467
|
-
const _ = (
|
|
1477
|
+
var K, oe;
|
|
1478
|
+
const _ = (oe = (K = a == null ? void 0 : a.getSnapshot()) == null ? void 0 : K.drawings) == null ? void 0 : oe[I.drawingId];
|
|
1468
1479
|
if (_ == null)
|
|
1469
1480
|
return;
|
|
1470
1481
|
const {
|
|
@@ -1473,8 +1484,8 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1473
1484
|
distB: U = 0,
|
|
1474
1485
|
distR: B = 0,
|
|
1475
1486
|
layoutType: b = k.INLINE,
|
|
1476
|
-
behindDoc: P =
|
|
1477
|
-
wrapText: V =
|
|
1487
|
+
behindDoc: P = se.FALSE,
|
|
1488
|
+
wrapText: V = $e.BOTH_SIDES
|
|
1478
1489
|
} = _;
|
|
1479
1490
|
if (A({
|
|
1480
1491
|
distT: E,
|
|
@@ -1482,7 +1493,7 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1482
1493
|
distB: U,
|
|
1483
1494
|
distR: B
|
|
1484
1495
|
}), C(V), f(b !== k.WRAP_SQUARE), b === k.WRAP_NONE || b === k.INLINE ? m(!0) : m(!1), b === k.WRAP_NONE || b === k.INLINE || b === k.WRAP_TOP_AND_BOTTOM ? w(!0) : w(!1), b === k.WRAP_NONE)
|
|
1485
|
-
P ===
|
|
1496
|
+
P === se.TRUE ? S(ue.BEHIND_TEXT) : S(ue.IN_FRONT_OF_TEXT);
|
|
1486
1497
|
else
|
|
1487
1498
|
switch (b) {
|
|
1488
1499
|
case k.INLINE:
|
|
@@ -1515,48 +1526,48 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1515
1526
|
}, []), /* @__PURE__ */ X(
|
|
1516
1527
|
"div",
|
|
1517
1528
|
{
|
|
1518
|
-
className:
|
|
1529
|
+
className: sn("univer-grid univer-gap-2 univer-py-2 univer-text-gray-400", {
|
|
1519
1530
|
"univer-hidden": !L
|
|
1520
1531
|
}),
|
|
1521
1532
|
children: [
|
|
1522
|
-
/* @__PURE__ */
|
|
1533
|
+
/* @__PURE__ */ M(
|
|
1523
1534
|
"header",
|
|
1524
1535
|
{
|
|
1525
1536
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1526
|
-
children: /* @__PURE__ */
|
|
1537
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.title") })
|
|
1527
1538
|
}
|
|
1528
1539
|
),
|
|
1529
|
-
/* @__PURE__ */
|
|
1540
|
+
/* @__PURE__ */ M(
|
|
1530
1541
|
"div",
|
|
1531
1542
|
{
|
|
1532
1543
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1533
|
-
children: /* @__PURE__ */
|
|
1544
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.wrappingStyle") })
|
|
1534
1545
|
}
|
|
1535
1546
|
),
|
|
1536
|
-
/* @__PURE__ */
|
|
1537
|
-
/* @__PURE__ */
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
/* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
1547
|
+
/* @__PURE__ */ M("div", { children: /* @__PURE__ */ X(Ft, { value: D, onChange: v, direction: "vertical", children: [
|
|
1548
|
+
/* @__PURE__ */ M(Te, { value: ue.INLINE, children: t.t("image-text-wrap.inline") }),
|
|
1549
|
+
/* @__PURE__ */ M(Te, { value: ue.WRAP_SQUARE, children: t.t("image-text-wrap.square") }),
|
|
1550
|
+
/* @__PURE__ */ M(Te, { value: ue.WRAP_TOP_AND_BOTTOM, children: t.t("image-text-wrap.topAndBottom") }),
|
|
1551
|
+
/* @__PURE__ */ M(Te, { value: ue.BEHIND_TEXT, children: t.t("image-text-wrap.behindText") }),
|
|
1552
|
+
/* @__PURE__ */ M(Te, { value: ue.IN_FRONT_OF_TEXT, children: t.t("image-text-wrap.inFrontText") })
|
|
1542
1553
|
] }) }),
|
|
1543
|
-
/* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ M(
|
|
1544
1555
|
"div",
|
|
1545
1556
|
{
|
|
1546
1557
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1547
|
-
children: /* @__PURE__ */
|
|
1558
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.wrapText") })
|
|
1548
1559
|
}
|
|
1549
1560
|
),
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ M("div", { children: /* @__PURE__ */ X(Ft, { disabled: l, value: O, onChange: N, direction: "horizontal", children: [
|
|
1562
|
+
/* @__PURE__ */ M(Te, { value: $e.BOTH_SIDES, children: t.t("image-text-wrap.bothSide") }),
|
|
1563
|
+
/* @__PURE__ */ M(Te, { value: $e.LEFT, children: t.t("image-text-wrap.leftOnly") }),
|
|
1564
|
+
/* @__PURE__ */ M(Te, { value: $e.RIGHT, children: t.t("image-text-wrap.rightOnly") })
|
|
1554
1565
|
] }) }),
|
|
1555
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ M(
|
|
1556
1567
|
"div",
|
|
1557
1568
|
{
|
|
1558
1569
|
className: "univer-text-gray-600 dark:!univer-text-gray-200",
|
|
1559
|
-
children: /* @__PURE__ */
|
|
1570
|
+
children: /* @__PURE__ */ M("div", { children: t.t("image-text-wrap.distanceFromText") })
|
|
1560
1571
|
}
|
|
1561
1572
|
),
|
|
1562
1573
|
/* @__PURE__ */ X(
|
|
@@ -1565,15 +1576,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1565
1576
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
1566
1577
|
children: [
|
|
1567
1578
|
/* @__PURE__ */ X("div", { children: [
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1570
|
-
|
|
1579
|
+
/* @__PURE__ */ M("span", { children: t.t("image-text-wrap.top") }),
|
|
1580
|
+
/* @__PURE__ */ M(
|
|
1581
|
+
Be,
|
|
1571
1582
|
{
|
|
1572
1583
|
min: Qe,
|
|
1573
1584
|
max: Je,
|
|
1574
1585
|
disabled: h,
|
|
1575
1586
|
precision: 1,
|
|
1576
|
-
value:
|
|
1587
|
+
value: y.distT,
|
|
1577
1588
|
onChange: (I) => {
|
|
1578
1589
|
G(I, "distT");
|
|
1579
1590
|
}
|
|
@@ -1581,15 +1592,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1581
1592
|
)
|
|
1582
1593
|
] }),
|
|
1583
1594
|
/* @__PURE__ */ X("div", { children: [
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
|
|
1595
|
+
/* @__PURE__ */ M("span", { children: t.t("image-text-wrap.left") }),
|
|
1596
|
+
/* @__PURE__ */ M(
|
|
1597
|
+
Be,
|
|
1587
1598
|
{
|
|
1588
1599
|
min: Qe,
|
|
1589
1600
|
max: Je,
|
|
1590
1601
|
disabled: p,
|
|
1591
1602
|
precision: 1,
|
|
1592
|
-
value:
|
|
1603
|
+
value: y.distL,
|
|
1593
1604
|
onChange: (I) => {
|
|
1594
1605
|
G(I, "distL");
|
|
1595
1606
|
}
|
|
@@ -1605,15 +1616,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1605
1616
|
className: "univer-grid univer-grid-cols-2 univer-gap-2 [&>div]:univer-grid [&>div]:univer-gap-2",
|
|
1606
1617
|
children: [
|
|
1607
1618
|
/* @__PURE__ */ X("div", { children: [
|
|
1608
|
-
/* @__PURE__ */
|
|
1609
|
-
/* @__PURE__ */
|
|
1610
|
-
|
|
1619
|
+
/* @__PURE__ */ M("span", { children: t.t("image-text-wrap.bottom") }),
|
|
1620
|
+
/* @__PURE__ */ M(
|
|
1621
|
+
Be,
|
|
1611
1622
|
{
|
|
1612
1623
|
min: Qe,
|
|
1613
1624
|
max: Je,
|
|
1614
1625
|
disabled: h,
|
|
1615
1626
|
precision: 1,
|
|
1616
|
-
value:
|
|
1627
|
+
value: y.distB,
|
|
1617
1628
|
onChange: (I) => {
|
|
1618
1629
|
G(I, "distB");
|
|
1619
1630
|
}
|
|
@@ -1621,15 +1632,15 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1621
1632
|
)
|
|
1622
1633
|
] }),
|
|
1623
1634
|
/* @__PURE__ */ X("div", { children: [
|
|
1624
|
-
/* @__PURE__ */
|
|
1625
|
-
/* @__PURE__ */
|
|
1626
|
-
|
|
1635
|
+
/* @__PURE__ */ M("span", { children: t.t("image-text-wrap.right") }),
|
|
1636
|
+
/* @__PURE__ */ M(
|
|
1637
|
+
Be,
|
|
1627
1638
|
{
|
|
1628
1639
|
min: Qe,
|
|
1629
1640
|
max: Je,
|
|
1630
1641
|
disabled: p,
|
|
1631
1642
|
precision: 1,
|
|
1632
|
-
value:
|
|
1643
|
+
value: y.distR,
|
|
1633
1644
|
onChange: (I) => {
|
|
1634
1645
|
G(I, "distR");
|
|
1635
1646
|
}
|
|
@@ -1642,28 +1653,28 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1642
1653
|
]
|
|
1643
1654
|
}
|
|
1644
1655
|
);
|
|
1645
|
-
}, $
|
|
1646
|
-
const
|
|
1656
|
+
}, $i = () => {
|
|
1657
|
+
const r = we(fe), e = r.getFocusDrawings(), [t, n] = re(e);
|
|
1647
1658
|
return Tt(() => {
|
|
1648
|
-
const
|
|
1649
|
-
n(
|
|
1659
|
+
const i = r.focus$.subscribe((s) => {
|
|
1660
|
+
n(s);
|
|
1650
1661
|
});
|
|
1651
1662
|
return () => {
|
|
1652
|
-
|
|
1663
|
+
i.unsubscribe();
|
|
1653
1664
|
};
|
|
1654
1665
|
}, []), !!(t != null && t.length) && /* @__PURE__ */ X("div", { className: "univer-text-sm", children: [
|
|
1655
|
-
/* @__PURE__ */
|
|
1656
|
-
/* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
1666
|
+
/* @__PURE__ */ M(Ei, { drawings: t, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }),
|
|
1667
|
+
/* @__PURE__ */ M(Vi, { drawings: t }),
|
|
1668
|
+
/* @__PURE__ */ M(ji, { drawings: t })
|
|
1658
1669
|
] });
|
|
1659
|
-
},
|
|
1660
|
-
const e =
|
|
1661
|
-
return new
|
|
1662
|
-
const
|
|
1663
|
-
var
|
|
1664
|
-
const
|
|
1665
|
-
if (
|
|
1666
|
-
const { segmentId: c, startOffset: d, endOffset: a } =
|
|
1670
|
+
}, yn = "doc.menu.image", bn = pn.id, zi = (r) => {
|
|
1671
|
+
const e = r.get(Dt), t = r.get(z);
|
|
1672
|
+
return new Ci((n) => {
|
|
1673
|
+
const i = e.textSelection$.subscribe(() => {
|
|
1674
|
+
var o;
|
|
1675
|
+
const s = e.getActiveTextRange();
|
|
1676
|
+
if (s) {
|
|
1677
|
+
const { segmentId: c, startOffset: d, endOffset: a } = s, g = t.getCurrentUniverDocInstance(), u = (o = g == null ? void 0 : g.getSelfOrHeaderFooterModel(c).getBody()) == null ? void 0 : o.tables;
|
|
1667
1678
|
if (u && u.length && u.some((l) => {
|
|
1668
1679
|
const { startIndex: f, endIndex: h } = l;
|
|
1669
1680
|
return d >= f && d < h || a >= f && a < h;
|
|
@@ -1677,160 +1688,160 @@ const Hr = "docs-drawing-ui.config", $t = {}, zt = -1e3, Xt = 1e3, jr = (i) => {
|
|
|
1677
1688
|
}
|
|
1678
1689
|
n.next(!1);
|
|
1679
1690
|
});
|
|
1680
|
-
return () =>
|
|
1691
|
+
return () => i.unsubscribe();
|
|
1681
1692
|
});
|
|
1682
1693
|
};
|
|
1683
|
-
function
|
|
1694
|
+
function Xi(r) {
|
|
1684
1695
|
return {
|
|
1685
|
-
id:
|
|
1696
|
+
id: yn,
|
|
1686
1697
|
type: an.SUBITEMS,
|
|
1687
1698
|
icon: "AddImageIcon",
|
|
1688
1699
|
tooltip: "docImage.title",
|
|
1689
|
-
disabled$:
|
|
1690
|
-
hidden$:
|
|
1700
|
+
disabled$: zi(r),
|
|
1701
|
+
hidden$: on(r, ve.UNIVER_DOC, void 0, St)
|
|
1691
1702
|
};
|
|
1692
1703
|
}
|
|
1693
|
-
function
|
|
1704
|
+
function qi(r) {
|
|
1694
1705
|
return {
|
|
1695
1706
|
id: bn,
|
|
1696
1707
|
title: "docImage.upload.float",
|
|
1697
1708
|
type: an.BUTTON,
|
|
1698
|
-
hidden$:
|
|
1709
|
+
hidden$: on(r, ve.UNIVER_DOC, void 0, St)
|
|
1699
1710
|
};
|
|
1700
1711
|
}
|
|
1701
|
-
const
|
|
1702
|
-
[
|
|
1703
|
-
[
|
|
1712
|
+
const Ki = {
|
|
1713
|
+
[_i.MEDIA]: {
|
|
1714
|
+
[yn]: {
|
|
1704
1715
|
order: 0,
|
|
1705
|
-
menuItemFactory:
|
|
1716
|
+
menuItemFactory: Xi,
|
|
1706
1717
|
[bn]: {
|
|
1707
1718
|
order: 0,
|
|
1708
|
-
menuItemFactory:
|
|
1719
|
+
menuItemFactory: qi
|
|
1709
1720
|
}
|
|
1710
1721
|
}
|
|
1711
1722
|
}
|
|
1712
1723
|
};
|
|
1713
|
-
function Ye(
|
|
1714
|
-
return
|
|
1724
|
+
function Ye(r) {
|
|
1725
|
+
return r.getContextValue(Bn) && r.getContextValue(nt);
|
|
1715
1726
|
}
|
|
1716
|
-
const
|
|
1727
|
+
const Yi = {
|
|
1717
1728
|
id: Ke.id,
|
|
1718
1729
|
description: "shortcut.drawing-move-down",
|
|
1719
1730
|
group: "4_drawing-view",
|
|
1720
|
-
binding:
|
|
1731
|
+
binding: ke.ARROW_DOWN,
|
|
1721
1732
|
priority: 100,
|
|
1722
1733
|
preconditions: Ye,
|
|
1723
1734
|
staticParameters: {
|
|
1724
1735
|
direction: he.DOWN
|
|
1725
1736
|
}
|
|
1726
|
-
},
|
|
1737
|
+
}, Zi = {
|
|
1727
1738
|
id: Ke.id,
|
|
1728
1739
|
description: "shortcut.drawing-move-up",
|
|
1729
1740
|
group: "4_drawing-view",
|
|
1730
|
-
binding:
|
|
1741
|
+
binding: ke.ARROW_UP,
|
|
1731
1742
|
priority: 100,
|
|
1732
1743
|
preconditions: Ye,
|
|
1733
1744
|
staticParameters: {
|
|
1734
1745
|
direction: he.UP
|
|
1735
1746
|
}
|
|
1736
|
-
},
|
|
1747
|
+
}, Qi = {
|
|
1737
1748
|
id: Ke.id,
|
|
1738
1749
|
description: "shortcut.drawing-move-left",
|
|
1739
1750
|
group: "4_drawing-view",
|
|
1740
|
-
binding:
|
|
1751
|
+
binding: ke.ARROW_LEFT,
|
|
1741
1752
|
priority: 100,
|
|
1742
1753
|
preconditions: Ye,
|
|
1743
1754
|
staticParameters: {
|
|
1744
1755
|
direction: he.LEFT
|
|
1745
1756
|
}
|
|
1746
|
-
},
|
|
1757
|
+
}, Ji = {
|
|
1747
1758
|
id: Ke.id,
|
|
1748
1759
|
description: "shortcut.drawing-move-right",
|
|
1749
1760
|
group: "4_drawing-view",
|
|
1750
|
-
binding:
|
|
1761
|
+
binding: ke.ARROW_RIGHT,
|
|
1751
1762
|
priority: 100,
|
|
1752
1763
|
preconditions: Ye,
|
|
1753
1764
|
staticParameters: {
|
|
1754
1765
|
direction: he.RIGHT
|
|
1755
1766
|
}
|
|
1756
|
-
},
|
|
1767
|
+
}, er = {
|
|
1757
1768
|
id: ln.id,
|
|
1758
1769
|
description: "shortcut.drawing-delete",
|
|
1759
1770
|
group: "4_drawing-view",
|
|
1760
1771
|
// when focusing on any other input tag do not trigger this shortcut
|
|
1761
1772
|
preconditions: Ye,
|
|
1762
|
-
binding:
|
|
1763
|
-
mac:
|
|
1773
|
+
binding: ke.DELETE,
|
|
1774
|
+
mac: ke.BACKSPACE
|
|
1764
1775
|
};
|
|
1765
|
-
var
|
|
1766
|
-
for (var
|
|
1767
|
-
(
|
|
1768
|
-
return
|
|
1769
|
-
}, et = (
|
|
1770
|
-
let
|
|
1771
|
-
constructor(
|
|
1772
|
-
super(), this._componentManager =
|
|
1776
|
+
var tr = Object.getOwnPropertyDescriptor, nr = (r, e, t, n) => {
|
|
1777
|
+
for (var i = n > 1 ? void 0 : n ? tr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1778
|
+
(o = r[s]) && (i = o(i) || i);
|
|
1779
|
+
return i;
|
|
1780
|
+
}, et = (r, e) => (t, n) => e(t, n, r);
|
|
1781
|
+
let st = class extends xe {
|
|
1782
|
+
constructor(r, e, t, n) {
|
|
1783
|
+
super(), this._componentManager = r, this._menuManagerService = e, this._commandService = t, this._shortcutService = n, this._init();
|
|
1773
1784
|
}
|
|
1774
1785
|
_initCustomComponents() {
|
|
1775
|
-
const
|
|
1776
|
-
this.disposeWithMe(
|
|
1786
|
+
const r = this._componentManager;
|
|
1787
|
+
this.disposeWithMe(r.register(Dn, $i));
|
|
1777
1788
|
}
|
|
1778
1789
|
_initMenus() {
|
|
1779
|
-
this._menuManagerService.mergeMenu(
|
|
1790
|
+
this._menuManagerService.mergeMenu(Ki);
|
|
1780
1791
|
}
|
|
1781
1792
|
_initCommands() {
|
|
1782
1793
|
[
|
|
1783
1794
|
pn,
|
|
1784
|
-
|
|
1795
|
+
yt,
|
|
1785
1796
|
wn,
|
|
1786
1797
|
vn,
|
|
1787
1798
|
In,
|
|
1788
1799
|
qe,
|
|
1789
1800
|
_n,
|
|
1790
1801
|
Sn,
|
|
1791
|
-
|
|
1802
|
+
Mt,
|
|
1792
1803
|
On,
|
|
1793
|
-
|
|
1804
|
+
ki,
|
|
1794
1805
|
Tn,
|
|
1795
1806
|
un,
|
|
1796
1807
|
fn,
|
|
1797
1808
|
Ke,
|
|
1798
1809
|
ln,
|
|
1799
1810
|
hn
|
|
1800
|
-
].forEach((
|
|
1811
|
+
].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r)));
|
|
1801
1812
|
}
|
|
1802
1813
|
_initShortcuts() {
|
|
1803
1814
|
[
|
|
1804
1815
|
// sheet drawing shortcuts
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
].forEach((
|
|
1811
|
-
this.disposeWithMe(this._shortcutService.registerShortcut(
|
|
1816
|
+
Yi,
|
|
1817
|
+
Zi,
|
|
1818
|
+
Qi,
|
|
1819
|
+
Ji,
|
|
1820
|
+
er
|
|
1821
|
+
].forEach((r) => {
|
|
1822
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(r));
|
|
1812
1823
|
});
|
|
1813
1824
|
}
|
|
1814
1825
|
_init() {
|
|
1815
1826
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
1816
1827
|
}
|
|
1817
1828
|
};
|
|
1818
|
-
|
|
1829
|
+
st = nr([
|
|
1819
1830
|
et(0, Z(cn)),
|
|
1820
|
-
et(1,
|
|
1831
|
+
et(1, Si),
|
|
1821
1832
|
et(2, j),
|
|
1822
|
-
et(3,
|
|
1823
|
-
],
|
|
1824
|
-
var
|
|
1825
|
-
for (var
|
|
1826
|
-
(
|
|
1827
|
-
return
|
|
1828
|
-
},
|
|
1829
|
-
function
|
|
1830
|
-
var n,
|
|
1831
|
-
if ($.isNoop(
|
|
1833
|
+
et(3, Di)
|
|
1834
|
+
], st);
|
|
1835
|
+
var ir = Object.getOwnPropertyDescriptor, rr = (r, e, t, n) => {
|
|
1836
|
+
for (var i = n > 1 ? void 0 : n ? ir(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1837
|
+
(o = r[s]) && (i = o(i) || i);
|
|
1838
|
+
return i;
|
|
1839
|
+
}, He = (r, e) => (t, n) => e(t, n, r);
|
|
1840
|
+
function sr(r) {
|
|
1841
|
+
var n, i, s, o;
|
|
1842
|
+
if ($.isNoop(r) || !Array.isArray(r))
|
|
1832
1843
|
return null;
|
|
1833
|
-
const e =
|
|
1844
|
+
const e = r.find((c) => Array.isArray(c) && (c == null ? void 0 : c[0]) === "drawings");
|
|
1834
1845
|
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")
|
|
1835
1846
|
return null;
|
|
1836
1847
|
const t = [];
|
|
@@ -1839,22 +1850,22 @@ function oi(i) {
|
|
|
1839
1850
|
Array.isArray(c) && t.push({
|
|
1840
1851
|
type: (n = c == null ? void 0 : c[1]) != null && n.i ? "add" : "remove",
|
|
1841
1852
|
drawingId: c == null ? void 0 : c[0],
|
|
1842
|
-
drawing: (
|
|
1853
|
+
drawing: (i = c == null ? void 0 : c[1]) == null ? void 0 : i.i
|
|
1843
1854
|
});
|
|
1844
1855
|
else
|
|
1845
1856
|
t.push({
|
|
1846
|
-
type: (
|
|
1857
|
+
type: (s = e[2]) != null && s.i ? "add" : "remove",
|
|
1847
1858
|
drawingId: e[1],
|
|
1848
|
-
drawing: (
|
|
1859
|
+
drawing: (o = e[2]) == null ? void 0 : o.i
|
|
1849
1860
|
});
|
|
1850
1861
|
return t;
|
|
1851
1862
|
}
|
|
1852
|
-
function
|
|
1853
|
-
if (!Array.isArray(
|
|
1863
|
+
function or(r) {
|
|
1864
|
+
if (!Array.isArray(r) || r.length < 3 || r[0] !== "drawingsOrder")
|
|
1854
1865
|
return [];
|
|
1855
1866
|
const e = [];
|
|
1856
|
-
for (let t = 1; t <
|
|
1857
|
-
const n =
|
|
1867
|
+
for (let t = 1; t < r.length; t++) {
|
|
1868
|
+
const n = r[t];
|
|
1858
1869
|
if (Array.isArray(n) && typeof n[0] == "number" && typeof n[1] == "object")
|
|
1859
1870
|
e.push(n[0]);
|
|
1860
1871
|
else {
|
|
@@ -1864,84 +1875,84 @@ function si(i) {
|
|
|
1864
1875
|
}
|
|
1865
1876
|
return e;
|
|
1866
1877
|
}
|
|
1867
|
-
let
|
|
1868
|
-
constructor(
|
|
1869
|
-
super(), this._univerInstanceService =
|
|
1878
|
+
let ot = class extends xe {
|
|
1879
|
+
constructor(r, e, t, n, i) {
|
|
1880
|
+
super(), this._univerInstanceService = r, this._commandService = e, this._drawingManagerService = t, this._docDrawingService = n, this._renderManagerService = i, this._initialize();
|
|
1870
1881
|
}
|
|
1871
1882
|
_initialize() {
|
|
1872
1883
|
this._commandExecutedListener();
|
|
1873
1884
|
}
|
|
1874
1885
|
_commandExecutedListener() {
|
|
1875
1886
|
this.disposeWithMe(
|
|
1876
|
-
this._commandService.beforeCommandExecuted((
|
|
1877
|
-
if (
|
|
1887
|
+
this._commandService.beforeCommandExecuted((r) => {
|
|
1888
|
+
if (r.id !== ee.id)
|
|
1878
1889
|
return;
|
|
1879
|
-
const e =
|
|
1880
|
-
if (
|
|
1881
|
-
for (const { type:
|
|
1882
|
-
|
|
1890
|
+
const e = r.params, { unitId: t, actions: n } = e, i = sr(n);
|
|
1891
|
+
if (i != null)
|
|
1892
|
+
for (const { type: s, drawingId: o, drawing: c } of i)
|
|
1893
|
+
s === "add" ? this._addDrawings(t, [c]) : this._removeDrawings(t, [o]);
|
|
1883
1894
|
})
|
|
1884
1895
|
), this.disposeWithMe(
|
|
1885
|
-
this._commandService.onCommandExecuted((
|
|
1886
|
-
if (
|
|
1896
|
+
this._commandService.onCommandExecuted((r) => {
|
|
1897
|
+
if (r.id !== ee.id)
|
|
1887
1898
|
return;
|
|
1888
|
-
const e =
|
|
1889
|
-
|
|
1899
|
+
const e = r.params, { unitId: t, actions: n } = e;
|
|
1900
|
+
or(n).length > 0 && this._updateDrawingsOrder(t);
|
|
1890
1901
|
})
|
|
1891
1902
|
), this.disposeWithMe(
|
|
1892
|
-
this._commandService.onCommandExecuted((
|
|
1893
|
-
var
|
|
1894
|
-
if (
|
|
1903
|
+
this._commandService.onCommandExecuted((r) => {
|
|
1904
|
+
var o;
|
|
1905
|
+
if (r.id !== Fn.id && r.id !== kn.id)
|
|
1895
1906
|
return;
|
|
1896
|
-
const e = (
|
|
1907
|
+
const e = (o = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : o.getUnitId(), t = this._drawingManagerService.getFocusDrawings();
|
|
1897
1908
|
if (e == null || t.length === 0)
|
|
1898
1909
|
return;
|
|
1899
|
-
const n = this._renderManagerService.getRenderById(e),
|
|
1900
|
-
if (
|
|
1910
|
+
const n = this._renderManagerService.getRenderById(e), i = n == null ? void 0 : n.scene;
|
|
1911
|
+
if (i == null)
|
|
1901
1912
|
return !1;
|
|
1902
|
-
|
|
1913
|
+
i.getTransformerByCreate().refreshControls();
|
|
1903
1914
|
})
|
|
1904
1915
|
);
|
|
1905
1916
|
}
|
|
1906
|
-
_addDrawings(
|
|
1907
|
-
const t = this._drawingManagerService, n = this._docDrawingService,
|
|
1908
|
-
t.applyJson1(
|
|
1917
|
+
_addDrawings(r, e) {
|
|
1918
|
+
const t = this._drawingManagerService, n = this._docDrawingService, i = this._docDrawingService.getBatchAddOp(e), { subUnitId: s, redo: o, objects: c } = i;
|
|
1919
|
+
t.applyJson1(r, s, o), n.applyJson1(r, s, o), t.addNotification(c), n.addNotification(c);
|
|
1909
1920
|
}
|
|
1910
|
-
_removeDrawings(
|
|
1911
|
-
const t = this._drawingManagerService, n = this._docDrawingService,
|
|
1912
|
-
unitId:
|
|
1913
|
-
subUnitId:
|
|
1921
|
+
_removeDrawings(r, e) {
|
|
1922
|
+
const t = this._drawingManagerService, n = this._docDrawingService, i = this._docDrawingService.getBatchRemoveOp(e.map((d) => ({
|
|
1923
|
+
unitId: r,
|
|
1924
|
+
subUnitId: r,
|
|
1914
1925
|
drawingId: d
|
|
1915
|
-
}))), { subUnitId:
|
|
1916
|
-
t.applyJson1(
|
|
1926
|
+
}))), { subUnitId: s, redo: o, objects: c } = i;
|
|
1927
|
+
t.applyJson1(r, s, o), n.applyJson1(r, s, o), t.removeNotification(c), n.removeNotification(c);
|
|
1917
1928
|
}
|
|
1918
|
-
_updateDrawingsOrder(
|
|
1919
|
-
const e = this._univerInstanceService.getUniverDocInstance(
|
|
1929
|
+
_updateDrawingsOrder(r) {
|
|
1930
|
+
const e = this._univerInstanceService.getUniverDocInstance(r);
|
|
1920
1931
|
if (e == null)
|
|
1921
1932
|
return;
|
|
1922
1933
|
const t = e.getSnapshot().drawingsOrder;
|
|
1923
1934
|
if (t == null)
|
|
1924
1935
|
return;
|
|
1925
|
-
const n = this._drawingManagerService,
|
|
1926
|
-
n.setDrawingOrder(
|
|
1927
|
-
const
|
|
1928
|
-
unitId:
|
|
1929
|
-
subUnitId:
|
|
1936
|
+
const n = this._drawingManagerService, i = this._docDrawingService;
|
|
1937
|
+
n.setDrawingOrder(r, r, t), i.setDrawingOrder(r, r, t);
|
|
1938
|
+
const s = {
|
|
1939
|
+
unitId: r,
|
|
1940
|
+
subUnitId: r,
|
|
1930
1941
|
drawingIds: t
|
|
1931
1942
|
};
|
|
1932
|
-
n.orderNotification(
|
|
1943
|
+
n.orderNotification(s), i.orderNotification(s);
|
|
1933
1944
|
}
|
|
1934
1945
|
};
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
],
|
|
1942
|
-
const
|
|
1943
|
-
const { floatDomInfos: e, scene: t, offset: n, bound:
|
|
1944
|
-
const { width: a = 0, height: g = 0, left: u = 0, top: l = 0 } = d.transform, h =
|
|
1946
|
+
ot = rr([
|
|
1947
|
+
He(0, z),
|
|
1948
|
+
He(1, j),
|
|
1949
|
+
He(2, fe),
|
|
1950
|
+
He(3, Ne),
|
|
1951
|
+
He(4, Q)
|
|
1952
|
+
], ot);
|
|
1953
|
+
const ar = (r) => {
|
|
1954
|
+
const { floatDomInfos: e, scene: t, offset: n, bound: i } = r, s = i.right - i.left, o = i.bottom - i.top, c = Ui(() => e.map((d) => {
|
|
1955
|
+
const { width: a = 0, height: g = 0, left: u = 0, top: l = 0 } = d.transform, h = Mn(
|
|
1945
1956
|
{
|
|
1946
1957
|
left: u,
|
|
1947
1958
|
right: u + a,
|
|
@@ -1966,28 +1977,28 @@ const ai = (i) => {
|
|
|
1966
1977
|
data: d.data
|
|
1967
1978
|
};
|
|
1968
1979
|
return [d.drawingId, m];
|
|
1969
|
-
}).filter(([d, a]) => !(a.position.endX < 0 || a.position.endY < 0 || a.position.startX >
|
|
1970
|
-
return /* @__PURE__ */
|
|
1980
|
+
}).filter(([d, a]) => !(a.position.endX < 0 || a.position.endY < 0 || a.position.startX > s || a.position.startY > o)), [e, t, n, s, o]);
|
|
1981
|
+
return /* @__PURE__ */ M("div", { className: "univer-absolute univer-left-0 univer-top-0", children: c.map(([d, a]) => /* @__PURE__ */ M(Oi, { layer: a, id: d, position: a.position }, d)) });
|
|
1971
1982
|
};
|
|
1972
|
-
var
|
|
1973
|
-
for (var
|
|
1974
|
-
(
|
|
1975
|
-
return
|
|
1976
|
-
},
|
|
1977
|
-
let at = class extends
|
|
1978
|
-
constructor(
|
|
1979
|
-
super(), this._docPrintInterceptorService =
|
|
1983
|
+
var cr = Object.getOwnPropertyDescriptor, dr = (r, e, t, n) => {
|
|
1984
|
+
for (var i = n > 1 ? void 0 : n ? cr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1985
|
+
(o = r[s]) && (i = o(i) || i);
|
|
1986
|
+
return i;
|
|
1987
|
+
}, je = (r, e) => (t, n) => e(t, n, r);
|
|
1988
|
+
let at = class extends xe {
|
|
1989
|
+
constructor(r, e, t, n, i) {
|
|
1990
|
+
super(), this._docPrintInterceptorService = r, this._drawingRenderService = e, this._drawingManagerService = t, this._componetManager = n, this._injector = i, this._initPrinting(), this._initPrintingDom();
|
|
1980
1991
|
}
|
|
1981
1992
|
_initPrinting() {
|
|
1982
1993
|
this.disposeWithMe(
|
|
1983
1994
|
this._docPrintInterceptorService.interceptor.intercept(
|
|
1984
1995
|
this._docPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_COMPONENT_COLLECT,
|
|
1985
1996
|
{
|
|
1986
|
-
handler: (
|
|
1987
|
-
const { unitId: n, scene:
|
|
1988
|
-
return
|
|
1989
|
-
const d =
|
|
1990
|
-
d.drawingType !==
|
|
1997
|
+
handler: (r, e, t) => {
|
|
1998
|
+
const { unitId: n, scene: i } = e, s = this._drawingManagerService.getDrawingDataForUnit(n), o = s == null ? void 0 : s[n];
|
|
1999
|
+
return o && o.order.forEach((c) => {
|
|
2000
|
+
const d = o.data[c];
|
|
2001
|
+
d.drawingType !== Pe.DRAWING_CHART && d.drawingType !== Pe.DRAWING_DOM && this._drawingRenderService.renderDrawing(d, i);
|
|
1991
2002
|
}), t();
|
|
1992
2003
|
}
|
|
1993
2004
|
}
|
|
@@ -1999,17 +2010,17 @@ let at = class extends Ne {
|
|
|
1999
2010
|
this._docPrintInterceptorService.interceptor.intercept(
|
|
2000
2011
|
this._docPrintInterceptorService.interceptor.getInterceptPoints().PRINTING_DOM_COLLECT,
|
|
2001
2012
|
{
|
|
2002
|
-
handler: (
|
|
2003
|
-
const { unitId: n } = e,
|
|
2004
|
-
if (
|
|
2005
|
-
const
|
|
2006
|
-
const a =
|
|
2007
|
-
if (a.drawingType ===
|
|
2013
|
+
handler: (r, e, t) => {
|
|
2014
|
+
const { unitId: n } = e, i = this._drawingManagerService.getDrawingDataForUnit(n), s = i == null ? void 0 : i[n];
|
|
2015
|
+
if (s) {
|
|
2016
|
+
const o = s.order.map((d) => {
|
|
2017
|
+
const a = s.data[d];
|
|
2018
|
+
if (a.drawingType === Pe.DRAWING_CHART)
|
|
2008
2019
|
return {
|
|
2009
2020
|
...a,
|
|
2010
2021
|
componentKey: this._componetManager.get(Wn)
|
|
2011
2022
|
};
|
|
2012
|
-
if (a.drawingType ===
|
|
2023
|
+
if (a.drawingType === Pe.DRAWING_DOM) {
|
|
2013
2024
|
const g = this._docPrintInterceptorService.getPrintComponent(a.componentKey);
|
|
2014
2025
|
return {
|
|
2015
2026
|
...a,
|
|
@@ -2017,13 +2028,13 @@ let at = class extends Ne {
|
|
|
2017
2028
|
};
|
|
2018
2029
|
}
|
|
2019
2030
|
return null;
|
|
2020
|
-
}).filter(Boolean), c =
|
|
2021
|
-
return
|
|
2022
|
-
/* @__PURE__ */
|
|
2031
|
+
}).filter(Boolean), c = Ti(ar, this._injector);
|
|
2032
|
+
return ci(
|
|
2033
|
+
/* @__PURE__ */ M(
|
|
2023
2034
|
c,
|
|
2024
2035
|
{
|
|
2025
2036
|
unitId: n,
|
|
2026
|
-
floatDomInfos:
|
|
2037
|
+
floatDomInfos: o,
|
|
2027
2038
|
scene: e.scene,
|
|
2028
2039
|
skeleton: e.skeleton,
|
|
2029
2040
|
offset: e.offset,
|
|
@@ -2031,9 +2042,9 @@ let at = class extends Ne {
|
|
|
2031
2042
|
}
|
|
2032
2043
|
),
|
|
2033
2044
|
e.root
|
|
2034
|
-
),
|
|
2035
|
-
|
|
2036
|
-
}), t(
|
|
2045
|
+
), r == null || r.add(() => {
|
|
2046
|
+
di(e.root);
|
|
2047
|
+
}), t(r);
|
|
2037
2048
|
}
|
|
2038
2049
|
}
|
|
2039
2050
|
}
|
|
@@ -2041,32 +2052,32 @@ let at = class extends Ne {
|
|
|
2041
2052
|
);
|
|
2042
2053
|
}
|
|
2043
2054
|
};
|
|
2044
|
-
at =
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2055
|
+
at = dr([
|
|
2056
|
+
je(0, Z(Yn)),
|
|
2057
|
+
je(1, Z(gn)),
|
|
2058
|
+
je(2, fe),
|
|
2059
|
+
je(3, Z(cn)),
|
|
2060
|
+
je(4, Z(Jt))
|
|
2050
2061
|
], at);
|
|
2051
|
-
var
|
|
2052
|
-
for (var
|
|
2053
|
-
(
|
|
2054
|
-
return
|
|
2055
|
-
}, tt = (
|
|
2056
|
-
const
|
|
2057
|
-
function qt(
|
|
2058
|
-
const { path: e } =
|
|
2062
|
+
var gr = Object.getOwnPropertyDescriptor, lr = (r, e, t, n) => {
|
|
2063
|
+
for (var i = n > 1 ? void 0 : n ? gr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2064
|
+
(o = r[s]) && (i = o(i) || i);
|
|
2065
|
+
return i;
|
|
2066
|
+
}, tt = (r, e) => (t, n) => e(t, n, r);
|
|
2067
|
+
const ur = "__InlineDrawingAnchor__";
|
|
2068
|
+
function qt(r) {
|
|
2069
|
+
const { path: e } = r;
|
|
2059
2070
|
return e.some((t) => t === "cells");
|
|
2060
2071
|
}
|
|
2061
|
-
let ct = class extends
|
|
2062
|
-
constructor(e, t, n,
|
|
2072
|
+
let ct = class extends xe {
|
|
2073
|
+
constructor(e, t, n, i) {
|
|
2063
2074
|
super();
|
|
2064
|
-
|
|
2065
|
-
|
|
2075
|
+
me(this, "_liquid", new rn());
|
|
2076
|
+
me(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
|
|
2066
2077
|
// Use to cache the drawings is under transforming or scaling.
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
this._commandService = e, this._univerInstanceService = t, this._drawingManagerService = n, this._renderManagerService =
|
|
2078
|
+
me(this, "_transformerCache", /* @__PURE__ */ new Map());
|
|
2079
|
+
me(this, "_anchorShape");
|
|
2080
|
+
this._commandService = e, this._univerInstanceService = t, this._drawingManagerService = n, this._renderManagerService = i, this._init();
|
|
2070
2081
|
}
|
|
2071
2082
|
_init() {
|
|
2072
2083
|
this._listenDrawingFocus();
|
|
@@ -2085,17 +2096,17 @@ let ct = class extends Ne {
|
|
|
2085
2096
|
// Only handle one drawing transformer change.
|
|
2086
2097
|
// eslint-disable-next-line max-lines-per-function
|
|
2087
2098
|
_listenTransformerChange(e) {
|
|
2088
|
-
var
|
|
2089
|
-
const t = (
|
|
2099
|
+
var i;
|
|
2100
|
+
const t = (i = this._getSceneAndTransformerByDrawingSearch(e)) == null ? void 0 : i.transformer;
|
|
2090
2101
|
if (t == null)
|
|
2091
2102
|
return;
|
|
2092
2103
|
this.disposeWithMe(
|
|
2093
|
-
|
|
2094
|
-
t.changeStart$.subscribe((
|
|
2104
|
+
ze(
|
|
2105
|
+
t.changeStart$.subscribe((s) => {
|
|
2095
2106
|
var c;
|
|
2096
2107
|
this._transformerCache.clear();
|
|
2097
|
-
const { objects:
|
|
2098
|
-
for (const d of
|
|
2108
|
+
const { objects: o } = s;
|
|
2109
|
+
for (const d of o.values()) {
|
|
2099
2110
|
const { oKey: a, width: g, height: u, left: l, top: f, angle: h } = d, m = this._drawingManagerService.getDrawingOKey(a);
|
|
2100
2111
|
if (m == null)
|
|
2101
2112
|
continue;
|
|
@@ -2119,13 +2130,13 @@ let ct = class extends Ne {
|
|
|
2119
2130
|
);
|
|
2120
2131
|
const n = Et(this._updateMultipleDrawingDocTransform.bind(this), 50);
|
|
2121
2132
|
Et(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
|
|
2122
|
-
|
|
2123
|
-
t.changing$.subscribe((
|
|
2124
|
-
const { objects:
|
|
2125
|
-
if (
|
|
2126
|
-
n(
|
|
2127
|
-
else if (
|
|
2128
|
-
const a = this._transformerCache.values().next().value, g =
|
|
2133
|
+
ze(
|
|
2134
|
+
t.changing$.subscribe((s) => {
|
|
2135
|
+
const { objects: o, offsetX: c, offsetY: d } = s;
|
|
2136
|
+
if (o.size > 1)
|
|
2137
|
+
n(o);
|
|
2138
|
+
else if (o.size === 1) {
|
|
2139
|
+
const a = this._transformerCache.values().next().value, g = o.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
|
|
2129
2140
|
if (a && u === a.width && l === a.height && f === a.top && h === a.left && m === a.angle)
|
|
2130
2141
|
return;
|
|
2131
2142
|
a && (a.drawing.layoutType, k.INLINE), a && a.drawing.layoutType === k.INLINE && c != null && d != null && this._updateInlineDrawingAnchor(a.drawing, c, d);
|
|
@@ -2133,11 +2144,11 @@ let ct = class extends Ne {
|
|
|
2133
2144
|
})
|
|
2134
2145
|
)
|
|
2135
2146
|
), this.disposeWithMe(
|
|
2136
|
-
|
|
2147
|
+
ze(
|
|
2137
2148
|
// eslint-disable-next-line complexity
|
|
2138
|
-
t.changeEnd$.subscribe((
|
|
2139
|
-
const { objects:
|
|
2140
|
-
for (const a of
|
|
2149
|
+
t.changeEnd$.subscribe((s) => {
|
|
2150
|
+
const { objects: o, offsetX: c, offsetY: d } = s;
|
|
2151
|
+
for (const a of o.values()) {
|
|
2141
2152
|
const g = this._drawingManagerService.getDrawingOKey(a.oKey);
|
|
2142
2153
|
if (g == null)
|
|
2143
2154
|
continue;
|
|
@@ -2148,10 +2159,10 @@ let ct = class extends Ne {
|
|
|
2148
2159
|
} catch {
|
|
2149
2160
|
}
|
|
2150
2161
|
}
|
|
2151
|
-
if (this._anchorShape && this._anchorShape.hide(),
|
|
2152
|
-
this._updateMultipleDrawingDocTransform(
|
|
2153
|
-
else if (
|
|
2154
|
-
const a = this._transformerCache.values().next().value, g =
|
|
2162
|
+
if (this._anchorShape && this._anchorShape.hide(), o.size > 1)
|
|
2163
|
+
this._updateMultipleDrawingDocTransform(o);
|
|
2164
|
+
else if (o.size === 1) {
|
|
2165
|
+
const a = this._transformerCache.values().next().value, g = o.values().next().value, { width: u, height: l, top: f, left: h, angle: m } = g;
|
|
2155
2166
|
if (a && u === a.width && l === a.height && f === a.top && h === a.left && m === a.angle)
|
|
2156
2167
|
return;
|
|
2157
2168
|
a && a.drawing.layoutType === k.INLINE ? u !== a.width || l !== a.height || m !== a.angle ? this._updateDrawingSize(a, g) : c != null && d != null && this._moveInlineDrawing(a.drawing, c, d) : a && this._nonInlineDrawingTransform(a.drawing, g);
|
|
@@ -2166,14 +2177,14 @@ let ct = class extends Ne {
|
|
|
2166
2177
|
if (e.size < 1)
|
|
2167
2178
|
return;
|
|
2168
2179
|
const t = [];
|
|
2169
|
-
let n,
|
|
2170
|
-
for (const
|
|
2171
|
-
const { oKey:
|
|
2172
|
-
let { width: g, height: u } =
|
|
2173
|
-
const l = this._drawingManagerService.getDrawingOKey(
|
|
2180
|
+
let n, i;
|
|
2181
|
+
for (const s of e.values()) {
|
|
2182
|
+
const { oKey: o, left: c, top: d, angle: a } = s;
|
|
2183
|
+
let { width: g, height: u } = s;
|
|
2184
|
+
const l = this._drawingManagerService.getDrawingOKey(o);
|
|
2174
2185
|
if (l == null)
|
|
2175
2186
|
continue;
|
|
2176
|
-
n == null && (n = l.unitId),
|
|
2187
|
+
n == null && (n = l.unitId), i == null && (i = l.subUnitId);
|
|
2177
2188
|
const f = this._transformerCache.get(l.drawingId);
|
|
2178
2189
|
if (f == null)
|
|
2179
2190
|
continue;
|
|
@@ -2190,13 +2201,13 @@ let ct = class extends Ne {
|
|
|
2190
2201
|
key: "angle",
|
|
2191
2202
|
value: a
|
|
2192
2203
|
}), m !== d || p !== c) {
|
|
2193
|
-
const
|
|
2194
|
-
|
|
2204
|
+
const y = d - m, A = c - p;
|
|
2205
|
+
y !== 0 && t.push({
|
|
2195
2206
|
drawingId: l.drawingId,
|
|
2196
2207
|
key: "positionV",
|
|
2197
2208
|
value: {
|
|
2198
2209
|
relativeFrom: h.docTransform.positionV.relativeFrom,
|
|
2199
|
-
posOffset: h.docTransform.positionV.posOffset +
|
|
2210
|
+
posOffset: h.docTransform.positionV.posOffset + y
|
|
2200
2211
|
}
|
|
2201
2212
|
}), A !== 0 && t.push({
|
|
2202
2213
|
drawingId: l.drawingId,
|
|
@@ -2208,9 +2219,9 @@ let ct = class extends Ne {
|
|
|
2208
2219
|
});
|
|
2209
2220
|
}
|
|
2210
2221
|
}
|
|
2211
|
-
t.length > 0 && n &&
|
|
2222
|
+
t.length > 0 && n && i && this._commandService.executeCommand(qe.id, {
|
|
2212
2223
|
unitId: n,
|
|
2213
|
-
subUnitId:
|
|
2224
|
+
subUnitId: i,
|
|
2214
2225
|
drawings: t
|
|
2215
2226
|
});
|
|
2216
2227
|
}
|
|
@@ -2222,18 +2233,18 @@ let ct = class extends Ne {
|
|
|
2222
2233
|
this._getDrawingAnchor(t.drawing, n);
|
|
2223
2234
|
}
|
|
2224
2235
|
_updateInlineDrawingAnchor(e, t, n) {
|
|
2225
|
-
var
|
|
2236
|
+
var s;
|
|
2226
2237
|
if (this._transformerCache.size !== 1)
|
|
2227
2238
|
return;
|
|
2228
|
-
const { contentBoxPointGroup:
|
|
2229
|
-
|
|
2239
|
+
const { contentBoxPointGroup: i } = (s = this._getInlineDrawingAnchor(e, t, n)) != null ? s : {};
|
|
2240
|
+
i != null && this._createOrUpdateInlineAnchor(e.unitId, i);
|
|
2230
2241
|
}
|
|
2231
2242
|
_getInlineDrawingAnchor(e, t, n) {
|
|
2232
2243
|
var x, H;
|
|
2233
|
-
const
|
|
2234
|
-
if (
|
|
2244
|
+
const i = this._renderManagerService.getRenderById(e.unitId), s = i == null ? void 0 : i.with(te).getSkeleton();
|
|
2245
|
+
if (i == null)
|
|
2235
2246
|
return;
|
|
2236
|
-
const { mainComponent:
|
|
2247
|
+
const { mainComponent: o, scene: c } = i, d = o, a = c.getViewports()[0], {
|
|
2237
2248
|
pageLayoutType: g = Nt.VERTICAL,
|
|
2238
2249
|
pageMarginLeft: u,
|
|
2239
2250
|
pageMarginTop: l
|
|
@@ -2245,7 +2256,7 @@ let ct = class extends Ne {
|
|
|
2245
2256
|
const S = (x = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : x.with(Me);
|
|
2246
2257
|
if (S == null)
|
|
2247
2258
|
return;
|
|
2248
|
-
const O =
|
|
2259
|
+
const O = s == null ? void 0 : s.findNodeByCoord(D, g, u, l, {
|
|
2249
2260
|
strict: !1,
|
|
2250
2261
|
segmentId: S.getSegment(),
|
|
2251
2262
|
segmentPage: S.getSegmentPage()
|
|
@@ -2256,32 +2267,32 @@ let ct = class extends Ne {
|
|
|
2256
2267
|
}
|
|
2257
2268
|
if (f == null)
|
|
2258
2269
|
return;
|
|
2259
|
-
const C =
|
|
2260
|
-
if (C == null ||
|
|
2270
|
+
const C = s == null ? void 0 : s.findPositionByGlyph(f, m), y = this._getDocObject();
|
|
2271
|
+
if (C == null || s == null || y == null || qt(C))
|
|
2261
2272
|
return;
|
|
2262
2273
|
const A = {
|
|
2263
2274
|
...C,
|
|
2264
2275
|
isBack: h
|
|
2265
|
-
}, L =
|
|
2276
|
+
}, L = y.document.getOffsetConfig(), R = new At(L, s), { cursorList: v, contentBoxPointGroup: N } = R.getRangePointData(A, A), { startOffset: G } = (H = Pt(v)) != null ? H : {};
|
|
2266
2277
|
if (G != null)
|
|
2267
2278
|
return { offset: G, contentBoxPointGroup: N, segmentId: p, segmentPage: m };
|
|
2268
2279
|
}
|
|
2269
2280
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
2270
2281
|
_getDrawingAnchor(e, t) {
|
|
2271
|
-
var Ie, _e, ce, De,
|
|
2272
|
-
const n = this._renderManagerService.getRenderById(e.unitId),
|
|
2273
|
-
if (
|
|
2282
|
+
var Ie, _e, ce, Se, De, be, Ce, Oe, de, ge, Ee;
|
|
2283
|
+
const n = this._renderManagerService.getRenderById(e.unitId), i = n == null ? void 0 : n.with(te).getSkeleton(), s = i == null ? void 0 : i.getSkeletonData();
|
|
2284
|
+
if (s == null || n == null)
|
|
2274
2285
|
return;
|
|
2275
|
-
const { pages:
|
|
2276
|
-
let { width: C, height:
|
|
2286
|
+
const { pages: o, skeHeaders: c, skeFooters: d } = s, { mainComponent: a, scene: g } = n, u = a, l = g.getViewports()[0], { pageLayoutType: f = Nt.VERTICAL, pageMarginLeft: h, pageMarginTop: m, docsLeft: p, docsTop: w } = u.getOffsetConfig(), { left: D, top: S, angle: O } = t;
|
|
2287
|
+
let { width: C, height: y } = t;
|
|
2277
2288
|
const { positionV: A, positionH: L } = e.docTransform, { width: R, height: v } = this._getPageContentSize(e);
|
|
2278
|
-
C = Math.min(C, R),
|
|
2289
|
+
C = Math.min(C, R), y = Math.min(y, v);
|
|
2279
2290
|
let N = null, G = "", x = -1;
|
|
2280
2291
|
const H = !1, I = {
|
|
2281
2292
|
...e.docTransform,
|
|
2282
2293
|
size: {
|
|
2283
2294
|
width: C,
|
|
2284
|
-
height:
|
|
2295
|
+
height: y
|
|
2285
2296
|
},
|
|
2286
2297
|
angle: O
|
|
2287
2298
|
}, { x: _, y: E } = g.getViewportScrollXY(l), T = this._getTransformCoordForDocumentOffset(u, l, D - _, S - E);
|
|
@@ -2290,7 +2301,7 @@ let ct = class extends Ne {
|
|
|
2290
2301
|
const U = (Ie = this._renderManagerService.getRenderById(e.unitId)) == null ? void 0 : Ie.with(Me);
|
|
2291
2302
|
if (U == null)
|
|
2292
2303
|
return;
|
|
2293
|
-
const B =
|
|
2304
|
+
const B = i == null ? void 0 : i.findNodeByCoord(T, f, h, m, {
|
|
2294
2305
|
strict: !1,
|
|
2295
2306
|
segmentId: U.getSegment(),
|
|
2296
2307
|
segmentPage: U.getSegmentPage()
|
|
@@ -2301,20 +2312,20 @@ let ct = class extends Ne {
|
|
|
2301
2312
|
}
|
|
2302
2313
|
if (N == null)
|
|
2303
2314
|
return;
|
|
2304
|
-
const b = (_e = N.parent) == null ? void 0 : _e.parent, P = b == null ? void 0 : b.parent, V = (ce = P == null ? void 0 : P.lines.find((pe) => pe.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && pe.paragraphStart)) != null ? ce : P == null ? void 0 : P.lines[0], F = (
|
|
2315
|
+
const b = (_e = N.parent) == null ? void 0 : _e.parent, P = b == null ? void 0 : b.parent, V = (ce = P == null ? void 0 : P.lines.find((pe) => pe.paragraphIndex === (b == null ? void 0 : b.paragraphIndex) && pe.paragraphStart)) != null ? ce : P == null ? void 0 : P.lines[0], F = (Se = P == null ? void 0 : P.parent) == null ? void 0 : Se.parent;
|
|
2305
2316
|
if (b == null || P == null || V == null || F == null)
|
|
2306
2317
|
return;
|
|
2307
2318
|
this._liquid.reset();
|
|
2308
2319
|
const K = F.type;
|
|
2309
|
-
for (const pe of
|
|
2310
|
-
const { headerId: ht, footerId: ft, pageHeight: En, pageWidth: bt, marginLeft: Ct, marginBottom: Rn } = pe, An =
|
|
2320
|
+
for (const pe of o) {
|
|
2321
|
+
const { headerId: ht, footerId: ft, pageHeight: En, pageWidth: bt, marginLeft: Ct, marginBottom: Rn } = pe, An = o.indexOf(pe);
|
|
2311
2322
|
if (x > -1 && An === x) {
|
|
2312
2323
|
switch (K) {
|
|
2313
2324
|
case Ut.HEADER: {
|
|
2314
|
-
const
|
|
2315
|
-
if (
|
|
2325
|
+
const Ge = (De = c.get(ht)) == null ? void 0 : De.get(bt);
|
|
2326
|
+
if (Ge)
|
|
2316
2327
|
this._liquid.translatePagePadding({
|
|
2317
|
-
marginTop:
|
|
2328
|
+
marginTop: Ge.marginTop,
|
|
2318
2329
|
marginLeft: Ct
|
|
2319
2330
|
});
|
|
2320
2331
|
else
|
|
@@ -2322,10 +2333,10 @@ let ct = class extends Ne {
|
|
|
2322
2333
|
break;
|
|
2323
2334
|
}
|
|
2324
2335
|
case Ut.FOOTER: {
|
|
2325
|
-
const
|
|
2326
|
-
if (
|
|
2336
|
+
const Ge = (be = d.get(ft)) == null ? void 0 : be.get(bt);
|
|
2337
|
+
if (Ge)
|
|
2327
2338
|
this._liquid.translatePagePadding({
|
|
2328
|
-
marginTop: En - Rn +
|
|
2339
|
+
marginTop: En - Rn + Ge.marginTop,
|
|
2329
2340
|
marginLeft: Ct
|
|
2330
2341
|
});
|
|
2331
2342
|
else
|
|
@@ -2339,7 +2350,7 @@ let ct = class extends Ne {
|
|
|
2339
2350
|
break;
|
|
2340
2351
|
this._liquid.restorePagePadding(pe), this._liquid.translatePage(pe, f, h, m);
|
|
2341
2352
|
}
|
|
2342
|
-
switch (A.relativeFrom === W.LINE ? N = b.divides[0].glyphGroup[0] : N = (ge = (de = (
|
|
2353
|
+
switch (A.relativeFrom === W.LINE ? N = b.divides[0].glyphGroup[0] : N = (ge = (de = (Oe = (Ce = V.divides) == null ? void 0 : Ce[0]) == null ? void 0 : Oe.glyphGroup) == null ? void 0 : de[0]) != null ? ge : N, I.positionH = {
|
|
2343
2354
|
relativeFrom: L.relativeFrom,
|
|
2344
2355
|
posOffset: D - this._liquid.x - p
|
|
2345
2356
|
}, L.relativeFrom) {
|
|
@@ -2371,30 +2382,30 @@ let ct = class extends Ne {
|
|
|
2371
2382
|
}
|
|
2372
2383
|
if (N == null)
|
|
2373
2384
|
return;
|
|
2374
|
-
const
|
|
2375
|
-
if (
|
|
2385
|
+
const oe = i == null ? void 0 : i.findPositionByGlyph(N, x), Ue = this._getDocObject();
|
|
2386
|
+
if (oe == null || i == null || Ue == null || qt(oe))
|
|
2376
2387
|
return;
|
|
2377
|
-
const
|
|
2378
|
-
...
|
|
2388
|
+
const ye = {
|
|
2389
|
+
...oe,
|
|
2379
2390
|
isBack: H
|
|
2380
|
-
},
|
|
2381
|
-
if (
|
|
2382
|
-
return { offset:
|
|
2391
|
+
}, We = Ue.document.getOffsetConfig(), ae = new At(We, i), { cursorList: ne } = ae.getRangePointData(ye, ye), { startOffset: ie } = (Ee = Pt(ne)) != null ? Ee : {};
|
|
2392
|
+
if (ie != null)
|
|
2393
|
+
return { offset: ie, docTransform: I, segmentId: G, segmentPage: x };
|
|
2383
2394
|
}
|
|
2384
2395
|
// Update drawing when use transformer to resize it.
|
|
2385
2396
|
_updateDrawingSize(e, t) {
|
|
2386
|
-
const n = [], { drawing:
|
|
2397
|
+
const n = [], { drawing: i, width: s, height: o, angle: c } = e, { unitId: d, subUnitId: a } = i;
|
|
2387
2398
|
let { width: g, height: u, angle: l } = t;
|
|
2388
|
-
const { width: f, height: h } = this._getPageContentSize(
|
|
2389
|
-
g = Math.min(f, g), u = Math.min(h, u), (g !==
|
|
2390
|
-
drawingId:
|
|
2399
|
+
const { width: f, height: h } = this._getPageContentSize(i);
|
|
2400
|
+
g = Math.min(f, g), u = Math.min(h, u), (g !== s || u !== o) && n.push({
|
|
2401
|
+
drawingId: i.drawingId,
|
|
2391
2402
|
key: "size",
|
|
2392
2403
|
value: {
|
|
2393
2404
|
width: g,
|
|
2394
2405
|
height: u
|
|
2395
2406
|
}
|
|
2396
2407
|
}), l !== c && n.push({
|
|
2397
|
-
drawingId:
|
|
2408
|
+
drawingId: i.drawingId,
|
|
2398
2409
|
key: "angle",
|
|
2399
2410
|
value: l
|
|
2400
2411
|
}), n.length > 0 && d && a && this._commandService.executeCommand(qe.id, {
|
|
@@ -2405,65 +2416,65 @@ let ct = class extends Ne {
|
|
|
2405
2416
|
}
|
|
2406
2417
|
// Update inline drawing when use transformer to move it.
|
|
2407
2418
|
_moveInlineDrawing(e, t, n) {
|
|
2408
|
-
const
|
|
2419
|
+
const i = this._getInlineDrawingAnchor(e, t, n), { offset: s, segmentId: o, segmentPage: c } = i != null ? i : {};
|
|
2409
2420
|
return this._commandService.executeCommand(_n.id, {
|
|
2410
2421
|
unitId: e.unitId,
|
|
2411
2422
|
subUnitId: e.unitId,
|
|
2412
2423
|
drawing: e,
|
|
2413
|
-
offset:
|
|
2414
|
-
segmentId:
|
|
2424
|
+
offset: s,
|
|
2425
|
+
segmentId: o,
|
|
2415
2426
|
segmentPage: c,
|
|
2416
|
-
needRefreshDrawings:
|
|
2427
|
+
needRefreshDrawings: s == null
|
|
2417
2428
|
});
|
|
2418
2429
|
}
|
|
2419
2430
|
// Limit the drawing to the page area, mainly in the vertical direction,
|
|
2420
2431
|
// and the upper and lower limits cannot exceed the page margin area.
|
|
2421
2432
|
_limitDrawingInPage(e, t) {
|
|
2422
|
-
const n = this._renderManagerService.getRenderById(e.unitId), { left:
|
|
2433
|
+
const n = this._renderManagerService.getRenderById(e.unitId), { left: i, top: s, width: o, height: c, angle: d } = t, a = n == null ? void 0 : n.with(te).getSkeleton(), g = a == null ? void 0 : a.getSkeletonData(), { pages: u } = g != null ? g : {};
|
|
2423
2434
|
if (g == null || n == null || u == null)
|
|
2424
2435
|
return {
|
|
2425
|
-
left:
|
|
2426
|
-
top:
|
|
2427
|
-
width:
|
|
2436
|
+
left: i,
|
|
2437
|
+
top: s,
|
|
2438
|
+
width: o,
|
|
2428
2439
|
height: c,
|
|
2429
2440
|
angle: d
|
|
2430
2441
|
};
|
|
2431
2442
|
const { mainComponent: l } = n, f = l, { top: h, pageLayoutType: m, pageMarginLeft: p, pageMarginTop: w } = f;
|
|
2432
|
-
let D =
|
|
2443
|
+
let D = s;
|
|
2433
2444
|
this._liquid.reset();
|
|
2434
2445
|
for (const S of u) {
|
|
2435
|
-
const { marginBottom: O, pageHeight: C } = S,
|
|
2446
|
+
const { marginBottom: O, pageHeight: C } = S, y = u.indexOf(S), A = u[y + 1];
|
|
2436
2447
|
if (A == null)
|
|
2437
2448
|
continue;
|
|
2438
|
-
if (
|
|
2439
|
-
|
|
2440
|
-
|
|
2449
|
+
if (Ae.hasIntersectionBetweenTwoRanges(
|
|
2450
|
+
s,
|
|
2451
|
+
s + c,
|
|
2441
2452
|
this._liquid.y + h + C - O,
|
|
2442
2453
|
this._liquid.y + h + C + w + A.marginTop
|
|
2443
2454
|
)) {
|
|
2444
|
-
const R =
|
|
2445
|
-
R < v ? D = Math.min(
|
|
2455
|
+
const R = s + c / 2, v = this._liquid.y + h + C + w / 2;
|
|
2456
|
+
R < v ? D = Math.min(s, this._liquid.y + h + C - O - c) : D = Math.max(s, this._liquid.y + h + C + w + A.marginTop);
|
|
2446
2457
|
}
|
|
2447
2458
|
this._liquid.translatePage(S, m, p, w);
|
|
2448
2459
|
}
|
|
2449
2460
|
return {
|
|
2450
|
-
left:
|
|
2461
|
+
left: i,
|
|
2451
2462
|
top: D,
|
|
2452
|
-
width:
|
|
2463
|
+
width: o,
|
|
2453
2464
|
height: c,
|
|
2454
2465
|
angle: d
|
|
2455
2466
|
};
|
|
2456
2467
|
}
|
|
2457
2468
|
_nonInlineDrawingTransform(e, t, n = !1) {
|
|
2458
|
-
const
|
|
2459
|
-
if (n &&
|
|
2469
|
+
const i = e.isMultiTransform === se.TRUE ? t : this._limitDrawingInPage(e, t);
|
|
2470
|
+
if (n && i.top !== t.top)
|
|
2460
2471
|
return;
|
|
2461
|
-
const
|
|
2462
|
-
return
|
|
2472
|
+
const s = this._getDrawingAnchor(e, i), { offset: o, docTransform: c, segmentId: d, segmentPage: a } = s != null ? s : {};
|
|
2473
|
+
return o == null || c == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, t]])) : this._commandService.executeCommand(Sn.id, {
|
|
2463
2474
|
unitId: e.unitId,
|
|
2464
2475
|
subUnitId: e.unitId,
|
|
2465
2476
|
drawing: e,
|
|
2466
|
-
offset:
|
|
2477
|
+
offset: o,
|
|
2467
2478
|
docTransform: c,
|
|
2468
2479
|
segmentId: d,
|
|
2469
2480
|
segmentPage: a
|
|
@@ -2475,47 +2486,47 @@ let ct = class extends Ne {
|
|
|
2475
2486
|
const t = this._renderManagerService.getRenderById(e), n = t == null ? void 0 : t.scene;
|
|
2476
2487
|
if (n == null)
|
|
2477
2488
|
return;
|
|
2478
|
-
const
|
|
2479
|
-
return { scene: n, transformer:
|
|
2489
|
+
const i = n.getTransformerByCreate();
|
|
2490
|
+
return { scene: n, transformer: i };
|
|
2480
2491
|
}
|
|
2481
|
-
_getTransformCoordForDocumentOffset(e, t, n,
|
|
2482
|
-
const { documentTransform:
|
|
2483
|
-
if (
|
|
2484
|
-
return
|
|
2492
|
+
_getTransformCoordForDocumentOffset(e, t, n, i) {
|
|
2493
|
+
const { documentTransform: s } = e.getOffsetConfig(), o = t.transformVector2SceneCoord(ii.FromArray([n, i]));
|
|
2494
|
+
if (o)
|
|
2495
|
+
return s.clone().invert().applyPoint(o);
|
|
2485
2496
|
}
|
|
2486
2497
|
_createOrUpdateInlineAnchor(e, t) {
|
|
2487
2498
|
const n = this._renderManagerService.getRenderById(e);
|
|
2488
2499
|
if (n == null)
|
|
2489
2500
|
return;
|
|
2490
|
-
const { mainComponent:
|
|
2501
|
+
const { mainComponent: i, scene: s } = n, o = i, {
|
|
2491
2502
|
docsLeft: c,
|
|
2492
2503
|
docsTop: d
|
|
2493
|
-
} =
|
|
2504
|
+
} = o.getOffsetConfig(), a = Zn(t), { left: g, top: u, height: l } = a, f = g + c, h = u + d;
|
|
2494
2505
|
if (this._anchorShape) {
|
|
2495
2506
|
this._anchorShape.transformByState({ left: f, top: h, height: l }), this._anchorShape.show();
|
|
2496
2507
|
return;
|
|
2497
2508
|
}
|
|
2498
|
-
const m = 6, p = new
|
|
2509
|
+
const m = 6, p = new ri(ur + Qt(m), {
|
|
2499
2510
|
left: f,
|
|
2500
2511
|
top: h,
|
|
2501
2512
|
height: l,
|
|
2502
2513
|
strokeWidth: 2,
|
|
2503
|
-
stroke:
|
|
2514
|
+
stroke: si(Gn.darkGray, 1),
|
|
2504
2515
|
evented: !1
|
|
2505
2516
|
});
|
|
2506
|
-
this._anchorShape = p,
|
|
2517
|
+
this._anchorShape = p, s.addObject(p, Qn);
|
|
2507
2518
|
}
|
|
2508
2519
|
_getDocObject() {
|
|
2509
2520
|
return Jn(this._univerInstanceService, this._renderManagerService);
|
|
2510
2521
|
}
|
|
2511
2522
|
_getPageContentSize(e) {
|
|
2512
|
-
const t = this._renderManagerService.getRenderById(e.unitId), n = t == null ? void 0 : t.with(te).getSkeleton(),
|
|
2513
|
-
if (
|
|
2523
|
+
const t = this._renderManagerService.getRenderById(e.unitId), n = t == null ? void 0 : t.with(te).getSkeleton(), i = 500, s = 500, o = n == null ? void 0 : n.getSkeletonData();
|
|
2524
|
+
if (o == null || t == null)
|
|
2514
2525
|
return {
|
|
2515
|
-
width:
|
|
2516
|
-
height:
|
|
2526
|
+
width: i,
|
|
2527
|
+
height: s
|
|
2517
2528
|
};
|
|
2518
|
-
const { pages: c } =
|
|
2529
|
+
const { pages: c } = o;
|
|
2519
2530
|
let d = null;
|
|
2520
2531
|
for (const a of c) {
|
|
2521
2532
|
const { skeDrawings: g } = a;
|
|
@@ -2527,39 +2538,44 @@ let ct = class extends Ne {
|
|
|
2527
2538
|
if (d) {
|
|
2528
2539
|
const { pageWidth: a, pageHeight: g, marginLeft: u, marginBottom: l, marginRight: f, marginTop: h } = d;
|
|
2529
2540
|
return {
|
|
2530
|
-
width: Math.max(
|
|
2531
|
-
height: Math.max(
|
|
2541
|
+
width: Math.max(i, a - u - f),
|
|
2542
|
+
height: Math.max(s, g - h - l)
|
|
2532
2543
|
};
|
|
2533
2544
|
} else
|
|
2534
2545
|
return {
|
|
2535
|
-
width:
|
|
2536
|
-
height:
|
|
2546
|
+
width: i,
|
|
2547
|
+
height: s
|
|
2537
2548
|
};
|
|
2538
2549
|
}
|
|
2539
2550
|
};
|
|
2540
|
-
ct =
|
|
2551
|
+
ct = lr([
|
|
2541
2552
|
tt(0, j),
|
|
2542
2553
|
tt(1, z),
|
|
2543
2554
|
tt(2, fe),
|
|
2544
2555
|
tt(3, Q)
|
|
2545
2556
|
], ct);
|
|
2546
|
-
var
|
|
2547
|
-
for (var
|
|
2548
|
-
(
|
|
2549
|
-
return
|
|
2550
|
-
},
|
|
2557
|
+
var hr = Object.getOwnPropertyDescriptor, fr = (r, e, t, n) => {
|
|
2558
|
+
for (var i = n > 1 ? void 0 : n ? hr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2559
|
+
(o = r[s]) && (i = o(i) || i);
|
|
2560
|
+
return i;
|
|
2561
|
+
}, Ve = (r, e) => (t, n) => e(t, n, r);
|
|
2551
2562
|
let dt = class extends Hn {
|
|
2552
|
-
constructor(e, t, n,
|
|
2563
|
+
constructor(e, t, n, i, s) {
|
|
2553
2564
|
super();
|
|
2554
|
-
|
|
2555
|
-
this
|
|
2565
|
+
me(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
2566
|
+
me(this, "_disposePopups", []);
|
|
2567
|
+
this._drawingManagerService = e, this._canvasPopManagerService = t, this._renderManagerService = n, this._univerInstanceService = i, this._contextService = s, this._init();
|
|
2556
2568
|
}
|
|
2557
2569
|
_init() {
|
|
2558
|
-
this.
|
|
2570
|
+
this.disposeWithMe(
|
|
2571
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(ve.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._create(e))
|
|
2572
|
+
), this.disposeWithMe(
|
|
2573
|
+
this._univerInstanceService.getTypeOfUnitDisposed$(ve.UNIVER_DOC).pipe(jt(this.dispose$)).subscribe((e) => this._dispose(e))
|
|
2574
|
+
), this._univerInstanceService.getAllUnitsForType(ve.UNIVER_DOC).forEach((e) => this._create(e));
|
|
2559
2575
|
}
|
|
2560
2576
|
_dispose(e) {
|
|
2561
2577
|
const t = e.getUnitId();
|
|
2562
|
-
this._renderManagerService.removeRender(t);
|
|
2578
|
+
this._disposePopups.length && (this._disposePopups.forEach((n) => n.dispose()), this._disposePopups.length = 0), this._renderManagerService.removeRender(t);
|
|
2563
2579
|
}
|
|
2564
2580
|
_create(e) {
|
|
2565
2581
|
if (!e)
|
|
@@ -2570,38 +2586,38 @@ let dt = class extends Hn {
|
|
|
2570
2586
|
_hasCropObject(e) {
|
|
2571
2587
|
const t = e.getAllObjects();
|
|
2572
2588
|
for (const n of t)
|
|
2573
|
-
if (n instanceof
|
|
2589
|
+
if (n instanceof Ri)
|
|
2574
2590
|
return !0;
|
|
2575
2591
|
return !1;
|
|
2576
2592
|
}
|
|
2577
2593
|
// eslint-disable-next-line max-lines-per-function
|
|
2578
2594
|
_popupMenuListener(e) {
|
|
2579
|
-
var
|
|
2580
|
-
const t = (
|
|
2595
|
+
var s;
|
|
2596
|
+
const t = (s = this._renderManagerService.getRenderById(e)) == null ? void 0 : s.scene;
|
|
2581
2597
|
if (!t)
|
|
2582
2598
|
return;
|
|
2583
2599
|
const n = t.getTransformerByCreate();
|
|
2584
2600
|
if (!n)
|
|
2585
2601
|
return;
|
|
2586
|
-
const
|
|
2602
|
+
const i = this._disposePopups;
|
|
2587
2603
|
this.disposeWithMe(
|
|
2588
|
-
|
|
2589
|
-
|
|
2604
|
+
n.createControl$.subscribe(
|
|
2605
|
+
() => {
|
|
2590
2606
|
if (this._hasCropObject(t))
|
|
2591
2607
|
return;
|
|
2592
|
-
const
|
|
2593
|
-
if (
|
|
2608
|
+
const o = n.getSelectedObjectMap();
|
|
2609
|
+
if (i.forEach((w) => w.dispose()), i.length = 0, o.size > 1)
|
|
2594
2610
|
return;
|
|
2595
|
-
const c =
|
|
2611
|
+
const c = o.values().next().value;
|
|
2596
2612
|
if (!c)
|
|
2597
2613
|
return;
|
|
2598
2614
|
const d = c.oKey, a = this._drawingManagerService.getDrawingOKey(d);
|
|
2599
|
-
if (!a || a.drawingType ===
|
|
2615
|
+
if (!a || a.drawingType === Pe.DRAWING_DOM)
|
|
2600
2616
|
return;
|
|
2601
2617
|
const { unitId: g, subUnitId: u, drawingId: l, drawingType: f } = a, h = this._canvasPopManagerService.attachPopupToObject(
|
|
2602
2618
|
c,
|
|
2603
2619
|
{
|
|
2604
|
-
componentKey:
|
|
2620
|
+
componentKey: Ai,
|
|
2605
2621
|
direction: "horizontal",
|
|
2606
2622
|
offset: [2, 0],
|
|
2607
2623
|
extraProps: {
|
|
@@ -2610,34 +2626,32 @@ let dt = class extends Hn {
|
|
|
2610
2626
|
},
|
|
2611
2627
|
g
|
|
2612
2628
|
);
|
|
2613
|
-
|
|
2629
|
+
i.push(this.disposeWithMe(h)), !this._drawingManagerService.getFocusDrawings().find((w) => w.unitId === g && w.subUnitId === u && w.drawingId === l) && this._drawingManagerService.focusDrawing([{
|
|
2614
2630
|
unitId: g,
|
|
2615
2631
|
subUnitId: u,
|
|
2616
2632
|
drawingId: l
|
|
2617
2633
|
}]);
|
|
2618
|
-
}
|
|
2634
|
+
}
|
|
2619
2635
|
)
|
|
2620
2636
|
), this.disposeWithMe(
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
}
|
|
2637
|
+
n.clearControl$.subscribe(
|
|
2638
|
+
() => {
|
|
2639
|
+
i.forEach((o) => o.dispose()), i.length = 0, this._contextService.setContextValue(nt, !1), this._drawingManagerService.focusDrawing(null);
|
|
2640
|
+
}
|
|
2625
2641
|
)
|
|
2626
2642
|
), this.disposeWithMe(
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
}
|
|
2643
|
+
n.changing$.subscribe(
|
|
2644
|
+
() => {
|
|
2645
|
+
i.forEach((o) => o.dispose()), i.length = 0;
|
|
2646
|
+
}
|
|
2631
2647
|
)
|
|
2632
2648
|
), this.disposeWithMe(
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
})
|
|
2637
|
-
)
|
|
2649
|
+
n.changeStart$.subscribe(() => {
|
|
2650
|
+
i.forEach((o) => o.dispose()), i.length = 0;
|
|
2651
|
+
})
|
|
2638
2652
|
);
|
|
2639
2653
|
}
|
|
2640
|
-
_getImageMenuItems(e, t, n,
|
|
2654
|
+
_getImageMenuItems(e, t, n, i) {
|
|
2641
2655
|
return [
|
|
2642
2656
|
{
|
|
2643
2657
|
label: "image-popup.edit",
|
|
@@ -2650,14 +2664,14 @@ let dt = class extends Hn {
|
|
|
2650
2664
|
{
|
|
2651
2665
|
label: "image-popup.delete",
|
|
2652
2666
|
index: 1,
|
|
2653
|
-
commandId:
|
|
2667
|
+
commandId: Mt.id,
|
|
2654
2668
|
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: t, drawingId: n }] },
|
|
2655
2669
|
disable: !1
|
|
2656
2670
|
},
|
|
2657
2671
|
{
|
|
2658
2672
|
label: "image-popup.crop",
|
|
2659
2673
|
index: 2,
|
|
2660
|
-
commandId:
|
|
2674
|
+
commandId: Pi.id,
|
|
2661
2675
|
commandParams: { unitId: e, subUnitId: t, drawingId: n },
|
|
2662
2676
|
disable: !0
|
|
2663
2677
|
// TODO: @JOCS, feature is not ready.
|
|
@@ -2665,7 +2679,7 @@ let dt = class extends Hn {
|
|
|
2665
2679
|
{
|
|
2666
2680
|
label: "image-popup.reset",
|
|
2667
2681
|
index: 3,
|
|
2668
|
-
commandId:
|
|
2682
|
+
commandId: xi.id,
|
|
2669
2683
|
commandParams: [{ unitId: e, subUnitId: t, drawingId: n }],
|
|
2670
2684
|
disable: !0
|
|
2671
2685
|
// TODO: @JOCS, feature is not ready.
|
|
@@ -2673,47 +2687,51 @@ let dt = class extends Hn {
|
|
|
2673
2687
|
];
|
|
2674
2688
|
}
|
|
2675
2689
|
};
|
|
2676
|
-
dt =
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2690
|
+
dt = fr([
|
|
2691
|
+
Ve(0, fe),
|
|
2692
|
+
Ve(1, Z(ei)),
|
|
2693
|
+
Ve(2, Q),
|
|
2694
|
+
Ve(3, z),
|
|
2695
|
+
Ve(4, Yt)
|
|
2682
2696
|
], dt);
|
|
2683
|
-
var
|
|
2684
|
-
for (var
|
|
2685
|
-
(
|
|
2686
|
-
return
|
|
2687
|
-
},
|
|
2688
|
-
let It = class extends
|
|
2689
|
-
constructor(e, t, n,
|
|
2697
|
+
var pr = Object.getOwnPropertyDescriptor, mr = (r, e, t, n) => {
|
|
2698
|
+
for (var i = n > 1 ? void 0 : n ? pr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2699
|
+
(o = r[s]) && (i = o(i) || i);
|
|
2700
|
+
return i;
|
|
2701
|
+
}, Re = (r, e) => (t, n) => e(t, n, r);
|
|
2702
|
+
let It = class extends xe {
|
|
2703
|
+
constructor(e, t, n, i, s, o, c, d) {
|
|
2690
2704
|
super();
|
|
2691
|
-
|
|
2692
|
-
this._context = e, this._docSkeletonManagerService = t, this._commandService = n, this._editorService =
|
|
2705
|
+
me(this, "_liquid", new rn());
|
|
2706
|
+
this._context = e, this._docSkeletonManagerService = t, this._commandService = n, this._editorService = i, this._drawingManagerService = s, this._docRefreshDrawingsService = o, this._univerInstanceService = c, this._lifecycleService = d, this._initialize(), this._commandExecutedListener();
|
|
2693
2707
|
}
|
|
2694
2708
|
_initialize() {
|
|
2695
2709
|
this._initialRenderRefresh(), this._drawingInitializeListener(), this._initResize();
|
|
2696
2710
|
}
|
|
2697
2711
|
_initialRenderRefresh() {
|
|
2698
|
-
this.
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2712
|
+
this.disposeWithMe(
|
|
2713
|
+
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
2714
|
+
e != null && this._refreshDrawing(e);
|
|
2715
|
+
})
|
|
2716
|
+
), this.disposeWithMe(
|
|
2717
|
+
this._docRefreshDrawingsService.refreshDrawings$.subscribe((e) => {
|
|
2718
|
+
e != null && this._refreshDrawing(e);
|
|
2719
|
+
})
|
|
2720
|
+
);
|
|
2703
2721
|
}
|
|
2704
2722
|
_commandExecutedListener() {
|
|
2705
2723
|
const e = [ee.id, nn.id];
|
|
2706
2724
|
this.disposeWithMe(
|
|
2707
2725
|
this._commandService.onCommandExecuted((t) => {
|
|
2708
2726
|
if (e.includes(t.id)) {
|
|
2709
|
-
const n = t.params, { unitId:
|
|
2710
|
-
if (
|
|
2727
|
+
const n = t.params, { unitId: i } = n, { unitId: s, mainComponent: o } = this._context;
|
|
2728
|
+
if (i !== s)
|
|
2711
2729
|
return;
|
|
2712
2730
|
const c = this._docSkeletonManagerService.getSkeleton();
|
|
2713
2731
|
if (c == null)
|
|
2714
2732
|
return;
|
|
2715
|
-
if (this._editorService.isEditor(
|
|
2716
|
-
|
|
2733
|
+
if (this._editorService.isEditor(s) && s !== St) {
|
|
2734
|
+
o == null || o.makeDirty();
|
|
2717
2735
|
return;
|
|
2718
2736
|
}
|
|
2719
2737
|
this._refreshDrawing(c);
|
|
@@ -2724,7 +2742,7 @@ let It = class extends Ne {
|
|
|
2724
2742
|
_initResize() {
|
|
2725
2743
|
this.disposeWithMe(
|
|
2726
2744
|
Zt(this._context.engine.onTransformChange$).pipe(
|
|
2727
|
-
Vt((e) => e.type ===
|
|
2745
|
+
Vt((e) => e.type === oi.resize),
|
|
2728
2746
|
dn(16)
|
|
2729
2747
|
).subscribe(() => {
|
|
2730
2748
|
var n;
|
|
@@ -2735,69 +2753,69 @@ let It = class extends Ne {
|
|
|
2735
2753
|
}
|
|
2736
2754
|
_refreshDrawing(e) {
|
|
2737
2755
|
var D, S;
|
|
2738
|
-
const t = e == null ? void 0 : e.getSkeletonData(), { mainComponent: n, unitId:
|
|
2756
|
+
const t = e == null ? void 0 : e.getSkeletonData(), { mainComponent: n, unitId: i } = this._context, s = n;
|
|
2739
2757
|
if (!t)
|
|
2740
2758
|
return;
|
|
2741
|
-
const { left:
|
|
2759
|
+
const { left: o, top: c, pageLayoutType: d, pageMarginLeft: a, pageMarginTop: g } = s, { pages: u, skeHeaders: l, skeFooters: f } = t, h = {};
|
|
2742
2760
|
this._liquid.reset();
|
|
2743
2761
|
for (let O = 0, C = u.length; O < C; O++) {
|
|
2744
|
-
const
|
|
2762
|
+
const y = u[O], { headerId: A, footerId: L, pageWidth: R } = y;
|
|
2745
2763
|
if (A) {
|
|
2746
2764
|
const v = (D = l.get(A)) == null ? void 0 : D.get(R);
|
|
2747
2765
|
v && this._calculateDrawingPosition(
|
|
2748
|
-
|
|
2766
|
+
i,
|
|
2749
2767
|
v,
|
|
2750
|
-
|
|
2768
|
+
o,
|
|
2751
2769
|
c,
|
|
2752
2770
|
h,
|
|
2753
2771
|
v.marginTop,
|
|
2754
|
-
|
|
2772
|
+
y.marginLeft
|
|
2755
2773
|
);
|
|
2756
2774
|
}
|
|
2757
2775
|
if (L) {
|
|
2758
2776
|
const v = (S = f.get(L)) == null ? void 0 : S.get(R);
|
|
2759
2777
|
v && this._calculateDrawingPosition(
|
|
2760
|
-
|
|
2778
|
+
i,
|
|
2761
2779
|
v,
|
|
2762
|
-
|
|
2780
|
+
o,
|
|
2763
2781
|
c,
|
|
2764
2782
|
h,
|
|
2765
|
-
|
|
2766
|
-
|
|
2783
|
+
y.pageHeight - y.marginBottom + v.marginTop,
|
|
2784
|
+
y.marginLeft
|
|
2767
2785
|
);
|
|
2768
2786
|
}
|
|
2769
|
-
this._calculateDrawingPosition(
|
|
2787
|
+
this._calculateDrawingPosition(i, y, o, c, h, y.marginTop, y.marginLeft), this._liquid.translatePage(y, d, a, g);
|
|
2770
2788
|
}
|
|
2771
2789
|
const m = Object.values(h), p = m.filter((O) => !O.isMultiTransform), w = m.filter((O) => O.isMultiTransform);
|
|
2772
2790
|
p.length > 0 && this._drawingManagerService.refreshTransform(p), this._handleMultiDrawingsTransform(w);
|
|
2773
2791
|
}
|
|
2774
2792
|
_handleMultiDrawingsTransform(e) {
|
|
2775
|
-
const { scene: t, unitId: n } = this._context,
|
|
2793
|
+
const { scene: t, unitId: n } = this._context, i = t.getTransformerByCreate();
|
|
2776
2794
|
e.forEach((d) => {
|
|
2777
2795
|
const a = this._drawingManagerService.getDrawingByParam(d);
|
|
2778
2796
|
a != null && (a.transform = d.transform, a.transforms = d.transforms, a.isMultiTransform = d.isMultiTransform);
|
|
2779
2797
|
});
|
|
2780
|
-
const
|
|
2798
|
+
const o = [...i.getSelectedObjectMap().keys()], c = Object.values(this._drawingManagerService.getDrawingData(n, n)).filter((d) => d.isMultiTransform === se.TRUE);
|
|
2781
2799
|
this._drawingManagerService.removeNotification(c), e.length > 0 && this._drawingManagerService.addNotification(e);
|
|
2782
|
-
for (const d of
|
|
2800
|
+
for (const d of o) {
|
|
2783
2801
|
const a = t.getObject(d);
|
|
2784
|
-
a &&
|
|
2802
|
+
a && i.setSelectedControl(a);
|
|
2785
2803
|
}
|
|
2786
2804
|
}
|
|
2787
|
-
_calculateDrawingPosition(e, t, n,
|
|
2805
|
+
_calculateDrawingPosition(e, t, n, i, s, o, c) {
|
|
2788
2806
|
const { skeDrawings: d } = t;
|
|
2789
2807
|
this._liquid.translatePagePadding({
|
|
2790
|
-
marginTop:
|
|
2808
|
+
marginTop: o,
|
|
2791
2809
|
marginLeft: c
|
|
2792
2810
|
}), d.forEach((a) => {
|
|
2793
|
-
const { aLeft: g, aTop: u, height: l, width: f, angle: h, drawingId: m, drawingOrigin: p } = a, w = p.layoutType === k.WRAP_NONE && p.behindDoc ===
|
|
2811
|
+
const { aLeft: g, aTop: u, height: l, width: f, angle: h, drawingId: m, drawingOrigin: p } = a, w = p.layoutType === k.WRAP_NONE && p.behindDoc === se.TRUE, { isMultiTransform: D = se.FALSE } = p, S = {
|
|
2794
2812
|
left: g + n + this._liquid.x,
|
|
2795
|
-
top: u +
|
|
2813
|
+
top: u + i + this._liquid.y,
|
|
2796
2814
|
width: f,
|
|
2797
2815
|
height: l,
|
|
2798
2816
|
angle: h
|
|
2799
2817
|
};
|
|
2800
|
-
|
|
2818
|
+
s[m] == null ? s[m] = {
|
|
2801
2819
|
unitId: e,
|
|
2802
2820
|
subUnitId: e,
|
|
2803
2821
|
drawingId: m,
|
|
@@ -2805,9 +2823,9 @@ let It = class extends Ne {
|
|
|
2805
2823
|
transform: S,
|
|
2806
2824
|
transforms: [S],
|
|
2807
2825
|
isMultiTransform: D
|
|
2808
|
-
} : D ===
|
|
2826
|
+
} : D === se.TRUE && s[m].transforms.push(S);
|
|
2809
2827
|
}), this._liquid.restorePagePadding({
|
|
2810
|
-
marginTop:
|
|
2828
|
+
marginTop: o,
|
|
2811
2829
|
marginLeft: c
|
|
2812
2830
|
});
|
|
2813
2831
|
}
|
|
@@ -2816,74 +2834,74 @@ let It = class extends Ne {
|
|
|
2816
2834
|
const t = this._docSkeletonManagerService.getSkeleton();
|
|
2817
2835
|
t != null && (this._refreshDrawing(t), this._drawingManagerService.initializeNotification(this._context.unitId));
|
|
2818
2836
|
};
|
|
2819
|
-
this._lifecycleService.stage >= Rt.Rendered ? this._docSkeletonManagerService.getSkeleton() ? e() : setTimeout(e, 500) : this._lifecycleService.lifecycle$.pipe(Vt((t) => t === Rt.Rendered)).subscribe(e);
|
|
2837
|
+
this._lifecycleService.stage >= Rt.Rendered ? this._docSkeletonManagerService.getSkeleton() ? e() : setTimeout(e, 500) : this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(Vt((t) => t === Rt.Rendered)).subscribe(e));
|
|
2820
2838
|
}
|
|
2821
2839
|
};
|
|
2822
|
-
It =
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2840
|
+
It = mr([
|
|
2841
|
+
Re(1, Z(te)),
|
|
2842
|
+
Re(2, j),
|
|
2843
|
+
Re(3, ti),
|
|
2844
|
+
Re(4, fe),
|
|
2845
|
+
Re(5, Z(ut)),
|
|
2846
|
+
Re(6, z),
|
|
2847
|
+
Re(7, Z(jn))
|
|
2830
2848
|
], It);
|
|
2831
|
-
var
|
|
2832
|
-
for (var
|
|
2833
|
-
(
|
|
2834
|
-
return
|
|
2835
|
-
}, vt = (
|
|
2836
|
-
const
|
|
2849
|
+
var wr = Object.defineProperty, vr = Object.getOwnPropertyDescriptor, Ir = (r, e, t) => e in r ? wr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, _r = (r, e, t, n) => {
|
|
2850
|
+
for (var i = n > 1 ? void 0 : n ? vr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2851
|
+
(o = r[s]) && (i = o(i) || i);
|
|
2852
|
+
return i;
|
|
2853
|
+
}, vt = (r, e) => (t, n) => e(t, n, r), Cn = (r, e, t) => Ir(r, typeof e != "symbol" ? e + "" : e, t);
|
|
2854
|
+
const Sr = "DOC_DRAWING_UI_PLUGIN";
|
|
2837
2855
|
let gt = class extends zn {
|
|
2838
|
-
constructor(
|
|
2839
|
-
super(), this._config =
|
|
2840
|
-
const { ...
|
|
2856
|
+
constructor(r = $t, e, t, n) {
|
|
2857
|
+
super(), this._config = r, this._injector = e, this._renderManagerSrv = t, this._configService = n;
|
|
2858
|
+
const { ...i } = Xn(
|
|
2841
2859
|
{},
|
|
2842
2860
|
$t,
|
|
2843
2861
|
this._config
|
|
2844
2862
|
);
|
|
2845
|
-
this._configService.setConfig(
|
|
2863
|
+
this._configService.setConfig(Hi, i);
|
|
2846
2864
|
}
|
|
2847
2865
|
onStarting() {
|
|
2848
2866
|
[
|
|
2849
|
-
[
|
|
2867
|
+
[st],
|
|
2850
2868
|
[dt],
|
|
2851
2869
|
[ct],
|
|
2852
|
-
[
|
|
2870
|
+
[ot],
|
|
2853
2871
|
[ut],
|
|
2854
|
-
[
|
|
2872
|
+
[rt],
|
|
2855
2873
|
[at]
|
|
2856
2874
|
].forEach((e) => this._injector.add(e));
|
|
2857
2875
|
}
|
|
2858
2876
|
onReady() {
|
|
2859
2877
|
[
|
|
2860
|
-
[
|
|
2878
|
+
[it],
|
|
2861
2879
|
[It]
|
|
2862
|
-
].forEach((
|
|
2880
|
+
].forEach((r) => this._renderManagerSrv.registerRenderModule(ve.UNIVER_DOC, r)), this._injector.get(ot), this._injector.get(st), this._injector.get(ct), this._injector.get(at);
|
|
2863
2881
|
}
|
|
2864
2882
|
onRendered() {
|
|
2865
|
-
this._injector.get(dt), this._injector.get(
|
|
2883
|
+
this._injector.get(dt), this._injector.get(rt);
|
|
2866
2884
|
}
|
|
2867
2885
|
};
|
|
2868
|
-
Cn(gt, "type",
|
|
2869
|
-
Cn(gt, "pluginName",
|
|
2870
|
-
gt =
|
|
2871
|
-
Vn(
|
|
2886
|
+
Cn(gt, "type", ve.UNIVER_DOC);
|
|
2887
|
+
Cn(gt, "pluginName", Sr);
|
|
2888
|
+
gt = _r([
|
|
2889
|
+
Vn(Ni, pi, qn, Mi),
|
|
2872
2890
|
vt(1, Z(Jt)),
|
|
2873
2891
|
vt(2, Q),
|
|
2874
2892
|
vt(3, $n)
|
|
2875
2893
|
], gt);
|
|
2876
2894
|
export {
|
|
2877
|
-
|
|
2878
|
-
|
|
2895
|
+
ki as ClearDocDrawingTransformerOperation,
|
|
2896
|
+
yn as DOCS_IMAGE_MENU_ID,
|
|
2879
2897
|
ln as DeleteDocDrawingsCommand,
|
|
2880
|
-
|
|
2898
|
+
rt as DocFloatDomController,
|
|
2881
2899
|
Tn as EditDocDrawingOperation,
|
|
2882
2900
|
un as GroupDocDrawingCommand,
|
|
2883
|
-
|
|
2901
|
+
yt as InsertDocDrawingCommand,
|
|
2884
2902
|
pn as InsertDocImageCommand,
|
|
2885
2903
|
Ke as MoveDocDrawingsCommand,
|
|
2886
|
-
|
|
2904
|
+
Mt as RemoveDocDrawingCommand,
|
|
2887
2905
|
hn as SetDocDrawingArrangeCommand,
|
|
2888
2906
|
On as SidebarDocDrawingOperation,
|
|
2889
2907
|
fn as UngroupDocDrawingCommand,
|