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