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