@univerjs/docs-drawing-ui 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var _e = (i, e,
|
|
4
|
-
import { CommandType as Y, ICommandService as $, IUniverInstanceService as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import { useDependency as re } from "@wendellhu/redi/react-bindings";
|
|
15
|
-
import d, { forwardRef as Vt, useRef as jt, createElement as $t, useState as ie, useEffect as ht } from "react";
|
|
1
|
+
var vt = Object.defineProperty;
|
|
2
|
+
var It = (i, e, n) => e in i ? vt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var _e = (i, e, n) => It(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommandType as Y, ICommandService as $, IUniverInstanceService as ne, TextX as hn, JSONX as X, MemoryCursor as _t, TextXActionType as Z, LocaleService as an, RxDisposable as Ct, UniverInstanceType as be, toDisposable as ye, FOCUSING_COMMON_DRAWINGS as rn, OnLifecycle as sn, LifecycleStages as cn, Inject as pe, IContextService as Fn, useDependency as re, PositionedObjectLayoutType as k, BooleanNumber as oe, ObjectRelativeFromH as ee, ObjectRelativeFromV as V, Tools as Pe, WrapTextType as je, Direction as ge, IUndoRedoService as kn, FOCUSING_UNIVER_EDITOR as St, Disposable as qe, Injector as Hn, UndoCommand as Dt, RedoCommand as Et, throttle as Sn, COLORS as Pt, Plugin as Ot, DependentOn as Tt } from "@univerjs/core";
|
|
5
|
+
import { ImageCropperObject as Mt, COMPONENT_IMAGE_POPUP_MENU as yt, OpenImageCropOperation as bt, ImageResetSizeOperation as Rt, DrawingCommonPanel as Nt, UniverDrawingUIPlugin as At } from "@univerjs/drawing-ui";
|
|
6
|
+
import { IDrawingManagerService as he, DRAWING_IMAGE_ALLOW_IMAGE_LIST as xt, ArrangeTypeEnum as Ye, DRAWING_IMAGE_COUNT_LIMIT as Dn, ImageUploadStatusType as gn, DRAWING_IMAGE_ALLOW_SIZE as Lt, getImageSize as Ut, DrawingTypeEnum as Bt, getDrawingShapeKeyByDrawingSearch as Ft, DRAWING_IMAGE_WIDTH_LIMIT as En, DRAWING_IMAGE_HEIGHT_LIMIT as Pn, IImageIoService as kt, UniverDrawingPlugin as Ht } from "@univerjs/drawing";
|
|
7
|
+
import { IDocDrawingService as Re, UniverDocsDrawingPlugin as Wt } from "@univerjs/docs-drawing";
|
|
8
|
+
import { ITextSelectionRenderManager as Ue, IRenderManagerService as se, DocumentEditArea as xe, Liquid as Wn, PageLayoutType as On, NodePositionConvertToCursor as Tn, getOneTextSelectionRange as Mn, DocumentSkeletonPageType as yn, Vector2 as Gt, getAnchorBounding as Vt, Rect as jt, getColor as $t, TEXT_RANGE_LAYER_INDEX as zt } from "@univerjs/engine-render";
|
|
9
|
+
import { takeUntil as bn, BehaviorSubject as qt } from "rxjs";
|
|
10
|
+
import { DocCanvasPopManagerService as Xt, docDrawingPositionToTransform as Kt } from "@univerjs/docs-ui";
|
|
11
|
+
import { RichTextEditingMutation as Q, getRichTextEditPath as $e, DocSkeletonManagerService as ae, TextSelectionManagerService as un, getRetainAndDeleteFromReplace as Yt, SetDocZoomRatioOperation as Zt, getDocObject as Qt } from "@univerjs/docs";
|
|
12
|
+
import { ISidebarService as Jt, MenuItemType as Gn, MenuPosition as ei, MenuGroup as ni, getMenuHiddenObservable as Vn, KeyCode as Le, ComponentManager as ti, IMenuService as ii, IShortcutService as ri, IMessageService as oi, IEditorService as ai } from "@univerjs/ui";
|
|
13
|
+
import d, { forwardRef as jn, useRef as $n, createElement as zn, useState as ie, useEffect as wn } from "react";
|
|
16
14
|
import j from "clsx";
|
|
17
|
-
import { RadioGroup as
|
|
18
|
-
const
|
|
15
|
+
import { RadioGroup as Rn, Radio as Ee, InputNumber as Ae, Select as Nn, Checkbox as si, MessageType as An } from "@univerjs/design";
|
|
16
|
+
const vn = {
|
|
19
17
|
id: "doc.command.remove-doc-image",
|
|
20
18
|
type: Y.COMMAND,
|
|
21
19
|
// eslint-disable-next-line max-lines-per-function
|
|
22
20
|
handler: (i, e) => {
|
|
23
21
|
var C, O, y, T;
|
|
24
|
-
const
|
|
22
|
+
const n = i.get($), t = i.get(ne), r = i.get(Ue), o = t.getCurrentUniverDocInstance();
|
|
25
23
|
if (e == null || o == null)
|
|
26
24
|
return !1;
|
|
27
|
-
const { drawings: a } = e, s = (C = r.getSegment()) != null ? C : "", l = new
|
|
25
|
+
const { drawings: a } = e, s = (C = r.getSegment()) != null ? C : "", l = new hn(), c = X.getInstance(), m = (y = (O = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : O.customBlocks) != null ? y : [], u = a.map((N) => m.find((R) => R.blockId === N.drawingId)).filter((N) => !!N).sort((N, R) => N.startIndex > R.startIndex ? 1 : -1), f = a[0].unitId, h = new _t();
|
|
28
26
|
h.reset();
|
|
29
27
|
const p = u[0].startIndex, w = [
|
|
30
28
|
{
|
|
@@ -58,18 +56,18 @@ const wt = {
|
|
|
58
56
|
const { blockId: R } = N, E = ((T = o.getDrawings()) != null ? T : {})[R], z = o.getDrawingsOrder().indexOf(R), U = c.removeOp(["drawings", R], E), B = c.removeOp(["drawingsOrder", z], R);
|
|
59
57
|
I.push(U), I.push(B);
|
|
60
58
|
}
|
|
61
|
-
return v.params.actions = I.reduce((N, R) => X.compose(N, R), null), !!
|
|
59
|
+
return v.params.actions = I.reduce((N, R) => X.compose(N, R), null), !!n.syncExecuteCommand(v.id, v.params);
|
|
62
60
|
}
|
|
63
|
-
},
|
|
61
|
+
}, qn = "COMPONENT_DOC_DRAWING_PANEL", Xn = {
|
|
64
62
|
id: "sidebar.operation.doc-image",
|
|
65
63
|
type: Y.COMMAND,
|
|
66
64
|
handler: async (i, e) => {
|
|
67
|
-
const
|
|
65
|
+
const n = i.get(Jt), t = i.get(an), r = i.get(he);
|
|
68
66
|
switch (e.value) {
|
|
69
67
|
case "open":
|
|
70
|
-
|
|
71
|
-
header: { title:
|
|
72
|
-
children: { label:
|
|
68
|
+
n.open({
|
|
69
|
+
header: { title: t.t("docImage.panel.title") },
|
|
70
|
+
children: { label: qn },
|
|
73
71
|
onClose: () => {
|
|
74
72
|
r.focusDrawing(null);
|
|
75
73
|
},
|
|
@@ -78,66 +76,66 @@ const wt = {
|
|
|
78
76
|
break;
|
|
79
77
|
case "close":
|
|
80
78
|
default:
|
|
81
|
-
|
|
79
|
+
n.close();
|
|
82
80
|
break;
|
|
83
81
|
}
|
|
84
82
|
return !0;
|
|
85
83
|
}
|
|
86
|
-
},
|
|
84
|
+
}, Kn = {
|
|
87
85
|
id: "doc.operation.edit-doc-image",
|
|
88
86
|
type: Y.OPERATION,
|
|
89
87
|
handler: (i, e) => {
|
|
90
|
-
const
|
|
91
|
-
return e == null ? !1 : (
|
|
88
|
+
const n = i.get(he), t = i.get($);
|
|
89
|
+
return e == null ? !1 : (n.focusDrawing([e]), t.executeCommand(Xn.id, { value: "open" }), !0);
|
|
92
90
|
}
|
|
93
91
|
};
|
|
94
|
-
var ci = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (i, e,
|
|
95
|
-
for (var r =
|
|
96
|
-
(a = i[o]) && (r = (
|
|
97
|
-
return
|
|
98
|
-
}, ke = (i, e) => (
|
|
99
|
-
let Je = class extends
|
|
100
|
-
constructor(e,
|
|
92
|
+
var ci = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (i, e, n, t) => {
|
|
93
|
+
for (var r = t > 1 ? void 0 : t ? li(e, n) : e, o = i.length - 1, a; o >= 0; o--)
|
|
94
|
+
(a = i[o]) && (r = (t ? a(e, n, r) : a(r)) || r);
|
|
95
|
+
return t && r && ci(e, n, r), r;
|
|
96
|
+
}, ke = (i, e) => (n, t) => e(n, t, i);
|
|
97
|
+
let Je = class extends Ct {
|
|
98
|
+
constructor(e, n, t, r, o) {
|
|
101
99
|
super();
|
|
102
100
|
_e(this, "_initImagePopupMenu", /* @__PURE__ */ new Set());
|
|
103
|
-
this._drawingManagerService = e, this._canvasPopManagerService =
|
|
101
|
+
this._drawingManagerService = e, this._canvasPopManagerService = n, this._renderManagerService = t, this._univerInstanceService = r, this._contextService = o, this._init();
|
|
104
102
|
}
|
|
105
103
|
_init() {
|
|
106
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(be.UNIVER_DOC).pipe(
|
|
104
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(be.UNIVER_DOC).pipe(bn(this.dispose$)).subscribe((e) => this._create(e)), this._univerInstanceService.getTypeOfUnitDisposed$(be.UNIVER_DOC).pipe(bn(this.dispose$)).subscribe((e) => this._dispose(e)), this._univerInstanceService.getAllUnitsForType(be.UNIVER_DOC).forEach((e) => this._create(e));
|
|
107
105
|
}
|
|
108
106
|
_dispose(e) {
|
|
109
|
-
const
|
|
110
|
-
this._renderManagerService.removeRender(
|
|
107
|
+
const n = e.getUnitId();
|
|
108
|
+
this._renderManagerService.removeRender(n);
|
|
111
109
|
}
|
|
112
110
|
_create(e) {
|
|
113
111
|
if (!e)
|
|
114
112
|
return;
|
|
115
|
-
const
|
|
116
|
-
this._renderManagerService.has(
|
|
113
|
+
const n = e.getUnitId();
|
|
114
|
+
this._renderManagerService.has(n) && !this._initImagePopupMenu.has(n) && (this._popupMenuListener(n), this._initImagePopupMenu.add(n));
|
|
117
115
|
}
|
|
118
116
|
_hasCropObject(e) {
|
|
119
|
-
const
|
|
120
|
-
for (const
|
|
121
|
-
if (
|
|
117
|
+
const n = e.getAllObjects();
|
|
118
|
+
for (const t of n)
|
|
119
|
+
if (t instanceof Mt)
|
|
122
120
|
return !0;
|
|
123
121
|
return !1;
|
|
124
122
|
}
|
|
125
123
|
// eslint-disable-next-line max-lines-per-function
|
|
126
124
|
_popupMenuListener(e) {
|
|
127
125
|
var o;
|
|
128
|
-
const
|
|
129
|
-
if (!t)
|
|
130
|
-
return;
|
|
131
|
-
const n = t.getTransformerByCreate();
|
|
126
|
+
const n = (o = this._renderManagerService.getRenderById(e)) == null ? void 0 : o.scene;
|
|
132
127
|
if (!n)
|
|
133
128
|
return;
|
|
129
|
+
const t = n.getTransformerByCreate();
|
|
130
|
+
if (!t)
|
|
131
|
+
return;
|
|
134
132
|
const r = [];
|
|
135
133
|
this.disposeWithMe(
|
|
136
134
|
ye(
|
|
137
|
-
|
|
138
|
-
if (this._hasCropObject(
|
|
135
|
+
t.createControl$.subscribe(() => {
|
|
136
|
+
if (this._hasCropObject(n))
|
|
139
137
|
return;
|
|
140
|
-
const a =
|
|
138
|
+
const a = t.getSelectedObjectMap();
|
|
141
139
|
if (r.forEach((w) => w.dispose()), r.length = 0, a.size > 1)
|
|
142
140
|
return;
|
|
143
141
|
const s = a.values().next().value;
|
|
@@ -148,7 +146,7 @@ let Je = class extends Cn {
|
|
|
148
146
|
return;
|
|
149
147
|
const { unitId: m, subUnitId: u, drawingId: f } = c;
|
|
150
148
|
r.push(this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(s, {
|
|
151
|
-
componentKey:
|
|
149
|
+
componentKey: yt,
|
|
152
150
|
direction: "horizontal",
|
|
153
151
|
offset: [2, 0],
|
|
154
152
|
extraProps: {
|
|
@@ -163,53 +161,53 @@ let Je = class extends Cn {
|
|
|
163
161
|
)
|
|
164
162
|
), this.disposeWithMe(
|
|
165
163
|
ye(
|
|
166
|
-
|
|
167
|
-
r.forEach((a) => a.dispose()), r.length = 0, this._contextService.setContextValue(
|
|
164
|
+
t.clearControl$.subscribe(() => {
|
|
165
|
+
r.forEach((a) => a.dispose()), r.length = 0, this._contextService.setContextValue(rn, !1), this._drawingManagerService.focusDrawing(null);
|
|
168
166
|
})
|
|
169
167
|
)
|
|
170
168
|
), this.disposeWithMe(
|
|
171
169
|
ye(
|
|
172
|
-
|
|
170
|
+
t.changing$.subscribe(() => {
|
|
173
171
|
r.forEach((a) => a.dispose()), r.length = 0;
|
|
174
172
|
})
|
|
175
173
|
)
|
|
176
174
|
), this.disposeWithMe(
|
|
177
175
|
ye(
|
|
178
|
-
|
|
176
|
+
t.changeStart$.subscribe(() => {
|
|
179
177
|
r.forEach((a) => a.dispose()), r.length = 0;
|
|
180
178
|
})
|
|
181
179
|
)
|
|
182
180
|
);
|
|
183
181
|
}
|
|
184
|
-
_getImageMenuItems(e,
|
|
182
|
+
_getImageMenuItems(e, n, t) {
|
|
185
183
|
return [
|
|
186
184
|
{
|
|
187
185
|
label: "image-popup.edit",
|
|
188
186
|
index: 0,
|
|
189
|
-
commandId:
|
|
190
|
-
commandParams: { unitId: e, subUnitId:
|
|
187
|
+
commandId: Kn.id,
|
|
188
|
+
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
191
189
|
disable: !1
|
|
192
190
|
},
|
|
193
191
|
{
|
|
194
192
|
label: "image-popup.delete",
|
|
195
193
|
index: 1,
|
|
196
|
-
commandId:
|
|
197
|
-
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId:
|
|
194
|
+
commandId: vn.id,
|
|
195
|
+
commandParams: { unitId: e, drawings: [{ unitId: e, subUnitId: n, drawingId: t }] },
|
|
198
196
|
disable: !1
|
|
199
197
|
},
|
|
200
198
|
{
|
|
201
199
|
label: "image-popup.crop",
|
|
202
200
|
index: 2,
|
|
203
|
-
commandId:
|
|
204
|
-
commandParams: { unitId: e, subUnitId:
|
|
201
|
+
commandId: bt.id,
|
|
202
|
+
commandParams: { unitId: e, subUnitId: n, drawingId: t },
|
|
205
203
|
disable: !0
|
|
206
204
|
// TODO: @JOCS, feature is not ready.
|
|
207
205
|
},
|
|
208
206
|
{
|
|
209
207
|
label: "image-popup.reset",
|
|
210
208
|
index: 3,
|
|
211
|
-
commandId:
|
|
212
|
-
commandParams: [{ unitId: e, subUnitId:
|
|
209
|
+
commandId: Rt.id,
|
|
210
|
+
commandParams: [{ unitId: e, subUnitId: n, drawingId: t }],
|
|
213
211
|
disable: !0
|
|
214
212
|
// TODO: @JOCS, feature is not ready.
|
|
215
213
|
}
|
|
@@ -217,115 +215,115 @@ let Je = class extends Cn {
|
|
|
217
215
|
}
|
|
218
216
|
};
|
|
219
217
|
Je = di([
|
|
220
|
-
|
|
218
|
+
sn(cn.Rendered, Je),
|
|
221
219
|
ke(0, he),
|
|
222
|
-
ke(1, pe(
|
|
220
|
+
ke(1, pe(Xt)),
|
|
223
221
|
ke(2, se),
|
|
224
|
-
ke(3,
|
|
225
|
-
ke(4,
|
|
222
|
+
ke(3, ne),
|
|
223
|
+
ke(4, Fn)
|
|
226
224
|
], Je);
|
|
227
225
|
var ue = function() {
|
|
228
226
|
return ue = Object.assign || function(i) {
|
|
229
|
-
for (var e,
|
|
230
|
-
e = arguments[
|
|
227
|
+
for (var e, n = 1, t = arguments.length; n < t; n++) {
|
|
228
|
+
e = arguments[n];
|
|
231
229
|
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = e[r]);
|
|
232
230
|
}
|
|
233
231
|
return i;
|
|
234
232
|
}, ue.apply(this, arguments);
|
|
235
233
|
}, mi = function(i, e) {
|
|
236
|
-
var
|
|
237
|
-
for (var
|
|
234
|
+
var n = {};
|
|
235
|
+
for (var t in i) Object.prototype.hasOwnProperty.call(i, t) && e.indexOf(t) < 0 && (n[t] = i[t]);
|
|
238
236
|
if (i != null && typeof Object.getOwnPropertySymbols == "function")
|
|
239
|
-
for (var r = 0,
|
|
240
|
-
e.indexOf(
|
|
241
|
-
return
|
|
242
|
-
},
|
|
243
|
-
var
|
|
244
|
-
return
|
|
237
|
+
for (var r = 0, t = Object.getOwnPropertySymbols(i); r < t.length; r++)
|
|
238
|
+
e.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(i, t[r]) && (n[t[r]] = i[t[r]]);
|
|
239
|
+
return n;
|
|
240
|
+
}, Yn = jn(function(i, e) {
|
|
241
|
+
var n = i.icon, t = i.id, r = i.className, o = i.extend, a = mi(i, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(t, " ").concat(r || "").trim(), l = $n("_".concat(fi()));
|
|
242
|
+
return Zn(n, "".concat(t), { defIds: n.defIds, idSuffix: l.current }, ue({ ref: e, className: s }, a), o);
|
|
245
243
|
});
|
|
246
|
-
function
|
|
247
|
-
return
|
|
248
|
-
return
|
|
244
|
+
function Zn(i, e, n, t, r) {
|
|
245
|
+
return zn(i.tag, ue(ue({ key: e }, gi(i, n, r)), t), (ui(i, n).children || []).map(function(o, a) {
|
|
246
|
+
return Zn(o, "".concat(e, "-").concat(i.tag, "-").concat(a), n, void 0, r);
|
|
249
247
|
}));
|
|
250
248
|
}
|
|
251
|
-
function gi(i, e,
|
|
252
|
-
var
|
|
253
|
-
|
|
249
|
+
function gi(i, e, n) {
|
|
250
|
+
var t = ue({}, i.attrs);
|
|
251
|
+
n != null && n.colorChannel1 && t.fill === "colorChannel1" && (t.fill = n.colorChannel1);
|
|
254
252
|
var r = e.defIds;
|
|
255
|
-
return !r || r.length === 0 || (i.tag === "use" &&
|
|
253
|
+
return !r || r.length === 0 || (i.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + e.idSuffix), Object.entries(t).forEach(function(o) {
|
|
256
254
|
var a = o[0], s = o[1];
|
|
257
|
-
typeof s == "string" && (
|
|
258
|
-
})),
|
|
255
|
+
typeof s == "string" && (t[a] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
256
|
+
})), t;
|
|
259
257
|
}
|
|
260
258
|
function ui(i, e) {
|
|
261
|
-
var
|
|
262
|
-
return !
|
|
263
|
-
return typeof r.attrs.id == "string" &&
|
|
259
|
+
var n, t = e.defIds;
|
|
260
|
+
return !t || t.length === 0 ? i : i.tag === "defs" && (!((n = i.children) === null || n === void 0) && n.length) ? ue(ue({}, i), { children: i.children.map(function(r) {
|
|
261
|
+
return typeof r.attrs.id == "string" && t && t.indexOf(r.attrs.id) > -1 ? ue(ue({}, r), { attrs: ue(ue({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
|
|
264
262
|
}) }) : i;
|
|
265
263
|
}
|
|
266
264
|
function fi() {
|
|
267
265
|
return Math.random().toString(36).substring(2, 8);
|
|
268
266
|
}
|
|
269
|
-
|
|
270
|
-
var pi = { 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" } }] },
|
|
271
|
-
return
|
|
267
|
+
Yn.displayName = "UniverIcon";
|
|
268
|
+
var pi = { 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" } }] }, Qn = jn(function(i, e) {
|
|
269
|
+
return zn(Yn, Object.assign({}, i, {
|
|
272
270
|
id: "add-image-single",
|
|
273
271
|
ref: e,
|
|
274
272
|
icon: pi
|
|
275
273
|
}));
|
|
276
274
|
});
|
|
277
|
-
|
|
278
|
-
const
|
|
275
|
+
Qn.displayName = "AddImageSingle";
|
|
276
|
+
const In = {
|
|
279
277
|
id: "doc.operation.insert-float-image",
|
|
280
278
|
type: Y.OPERATION,
|
|
281
279
|
handler: () => !0
|
|
282
|
-
}, hi = "univer-upload-file-menu", wi = "univer-upload-file-menu-input",
|
|
280
|
+
}, hi = "univer-upload-file-menu", wi = "univer-upload-file-menu-input", xn = {
|
|
283
281
|
uploadFileMenu: hi,
|
|
284
282
|
uploadFileMenuInput: wi
|
|
285
283
|
}, vi = () => {
|
|
286
|
-
const i = re($), e =
|
|
284
|
+
const i = re($), e = $n(null), n = () => {
|
|
287
285
|
var o;
|
|
288
286
|
(o = e.current) == null || o.click();
|
|
289
|
-
},
|
|
287
|
+
}, t = xt.map((o) => `.${o.replace("image/", "")}`).join(","), r = (o) => {
|
|
290
288
|
const a = o.target.files;
|
|
291
289
|
if (a == null)
|
|
292
290
|
return;
|
|
293
291
|
const s = Array.from(a);
|
|
294
|
-
i.executeCommand(
|
|
292
|
+
i.executeCommand(In.id, { files: s }), e.current && (e.current.value = "");
|
|
295
293
|
};
|
|
296
|
-
return /* @__PURE__ */ d.createElement("div", { onClick:
|
|
294
|
+
return /* @__PURE__ */ d.createElement("div", { onClick: n, className: xn.uploadFileMenu }, /* @__PURE__ */ d.createElement(
|
|
297
295
|
"input",
|
|
298
296
|
{
|
|
299
297
|
type: "file",
|
|
300
|
-
className:
|
|
298
|
+
className: xn.uploadFileMenuInput,
|
|
301
299
|
ref: e,
|
|
302
300
|
onChange: r,
|
|
303
|
-
accept:
|
|
301
|
+
accept: t,
|
|
304
302
|
multiple: !0
|
|
305
303
|
}
|
|
306
304
|
));
|
|
307
|
-
},
|
|
305
|
+
}, Jn = "COMPONENT_DOC_UPLOAD_FILE_MENU", et = "addition-and-subtraction-single", nt = "doc.menu.image", Ii = "doc.menu.image.upload.float";
|
|
308
306
|
function _i(i) {
|
|
309
307
|
return {
|
|
310
|
-
id:
|
|
311
|
-
type:
|
|
308
|
+
id: nt,
|
|
309
|
+
type: Gn.SUBITEMS,
|
|
312
310
|
positions: [ei.TOOLBAR_START],
|
|
313
|
-
group:
|
|
314
|
-
icon:
|
|
311
|
+
group: ni.TOOLBAR_LAYOUT,
|
|
312
|
+
icon: et,
|
|
315
313
|
tooltip: "docImage.title",
|
|
316
|
-
hidden$:
|
|
314
|
+
hidden$: Vn(i, be.UNIVER_DOC)
|
|
317
315
|
};
|
|
318
316
|
}
|
|
319
317
|
function Ci(i) {
|
|
320
318
|
return {
|
|
321
319
|
id: Ii,
|
|
322
320
|
title: "docImage.upload.float",
|
|
323
|
-
type:
|
|
321
|
+
type: Gn.SELECTOR,
|
|
324
322
|
label: {
|
|
325
|
-
name:
|
|
323
|
+
name: Jn
|
|
326
324
|
},
|
|
327
|
-
positions: [
|
|
328
|
-
hidden$:
|
|
325
|
+
positions: [nt],
|
|
326
|
+
hidden$: Vn(i, be.UNIVER_DOC)
|
|
329
327
|
};
|
|
330
328
|
}
|
|
331
329
|
const Si = "univer-image-common-panel", Di = "univer-image-common-panel-grid", Ei = "univer-image-common-panel-border", Pi = "univer-image-common-panel-title", Oi = "univer-image-common-panel-subtitle", Ti = "univer-image-common-panel-row", Mi = "univer-image-common-panel-row-vertical", yi = "univer-image-common-panel-column", bi = "univer-image-common-panel-column-center", Ri = "univer-image-common-panel-inline", Ni = "univer-image-common-panel-span2", Ai = "univer-image-common-panel-span3", xi = "univer-image-common-panel-input", Li = "univer-sheet-image-menu", Ui = "univer-sheet-image-menu-input", g = {
|
|
@@ -345,9 +343,9 @@ const Si = "univer-image-common-panel", Di = "univer-image-common-panel-grid", E
|
|
|
345
343
|
sheetImageMenu: Li,
|
|
346
344
|
sheetImageMenuInput: Ui
|
|
347
345
|
};
|
|
348
|
-
class
|
|
346
|
+
class ln {
|
|
349
347
|
constructor() {
|
|
350
|
-
_e(this, "_refreshDrawings$", new
|
|
348
|
+
_e(this, "_refreshDrawings$", new qt(null));
|
|
351
349
|
_e(this, "refreshDrawings$", this._refreshDrawings$.asObservable());
|
|
352
350
|
}
|
|
353
351
|
refreshDrawings(e) {
|
|
@@ -362,17 +360,17 @@ const Bi = {
|
|
|
362
360
|
inFrontOfText: k.WRAP_NONE,
|
|
363
361
|
behindText: k.WRAP_NONE
|
|
364
362
|
};
|
|
365
|
-
function
|
|
363
|
+
function tt(i, e, n, t, r, o, a) {
|
|
366
364
|
var h, p;
|
|
367
|
-
const s = new
|
|
365
|
+
const s = new hn(), l = X.getInstance(), c = [], m = o.getSelfOrHeaderFooterModel(e).getBody(), u = o.getSelfOrHeaderFooterModel(i).getBody();
|
|
368
366
|
if (m == null || u == null)
|
|
369
367
|
return;
|
|
370
368
|
const f = (p = (h = m.customBlocks) == null ? void 0 : h.find((w) => w.blockId === r)) == null ? void 0 : p.startIndex;
|
|
371
369
|
if (f != null) {
|
|
372
|
-
if (
|
|
373
|
-
if (
|
|
370
|
+
if (t = Math.min(u.dataStream.length - 2, t), i === e) {
|
|
371
|
+
if (t < f ? (t > 0 && s.push({
|
|
374
372
|
t: Z.RETAIN,
|
|
375
|
-
len:
|
|
373
|
+
len: t,
|
|
376
374
|
segmentId: e
|
|
377
375
|
}), s.push({
|
|
378
376
|
t: Z.INSERT,
|
|
@@ -388,7 +386,7 @@ function tn(i, e, t, n, r, o, a) {
|
|
|
388
386
|
segmentId: e
|
|
389
387
|
}), s.push({
|
|
390
388
|
t: Z.RETAIN,
|
|
391
|
-
len: f -
|
|
389
|
+
len: f - t,
|
|
392
390
|
segmentId: e
|
|
393
391
|
}), s.push({
|
|
394
392
|
t: Z.DELETE,
|
|
@@ -404,9 +402,9 @@ function tn(i, e, t, n, r, o, a) {
|
|
|
404
402
|
len: 1,
|
|
405
403
|
line: 0,
|
|
406
404
|
segmentId: ""
|
|
407
|
-
}),
|
|
405
|
+
}), t - f - 1 > 0 && s.push({
|
|
408
406
|
t: Z.RETAIN,
|
|
409
|
-
len:
|
|
407
|
+
len: t - f - 1,
|
|
410
408
|
segmentId: e
|
|
411
409
|
}), s.push({
|
|
412
410
|
t: Z.INSERT,
|
|
@@ -420,7 +418,7 @@ function tn(i, e, t, n, r, o, a) {
|
|
|
420
418
|
len: 1,
|
|
421
419
|
line: 0,
|
|
422
420
|
segmentId: e
|
|
423
|
-
})),
|
|
421
|
+
})), t !== f) {
|
|
424
422
|
const w = $e(o, e), v = l.editOp(s.serialize(), w);
|
|
425
423
|
c.push(v);
|
|
426
424
|
}
|
|
@@ -436,9 +434,9 @@ function tn(i, e, t, n, r, o, a) {
|
|
|
436
434
|
segmentId: ""
|
|
437
435
|
});
|
|
438
436
|
let w = $e(o, e), v = l.editOp(s.serialize(), w);
|
|
439
|
-
c.push(v), s.empty(),
|
|
437
|
+
c.push(v), s.empty(), t > 0 && s.push({
|
|
440
438
|
t: Z.RETAIN,
|
|
441
|
-
len:
|
|
439
|
+
len: t,
|
|
442
440
|
segmentId: i
|
|
443
441
|
}), s.push({
|
|
444
442
|
t: Z.INSERT,
|
|
@@ -452,12 +450,12 @@ function tn(i, e, t, n, r, o, a) {
|
|
|
452
450
|
len: 1,
|
|
453
451
|
line: 0,
|
|
454
452
|
segmentId: i
|
|
455
|
-
}), w = $e(o, i), v = l.editOp(s.serialize(), w), c.push(v), a.setSegment(i), a.setSegmentPage(
|
|
453
|
+
}), w = $e(o, i), v = l.editOp(s.serialize(), w), c.push(v), a.setSegment(i), a.setSegmentPage(n);
|
|
456
454
|
}
|
|
457
455
|
return c;
|
|
458
456
|
}
|
|
459
457
|
}
|
|
460
|
-
const
|
|
458
|
+
const it = {
|
|
461
459
|
id: "doc.command.update-doc-drawing-wrapping-style",
|
|
462
460
|
type: Y.COMMAND,
|
|
463
461
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
@@ -465,24 +463,24 @@ const nn = {
|
|
|
465
463
|
var T, N;
|
|
466
464
|
if (e == null)
|
|
467
465
|
return !1;
|
|
468
|
-
const { drawings:
|
|
466
|
+
const { drawings: n, wrappingStyle: t, unitId: r } = e, o = i.get($), a = i.get(ne), l = i.get(se).getRenderById(r), c = l == null ? void 0 : l.with(ae).getSkeleton().getSkeletonData(), m = l == null ? void 0 : l.with(ae).getViewModel(), u = l == null ? void 0 : l.scene, f = a.getCurrentUniverDocInstance();
|
|
469
467
|
if (f == null || c == null || u == null || m == null)
|
|
470
468
|
return !1;
|
|
471
469
|
const h = m.getEditArea(), p = u.getTransformerByCreate(), { pages: w, skeHeaders: v, skeFooters: I } = c, D = X.getInstance(), _ = [], { drawings: C = {} } = f.getSnapshot();
|
|
472
|
-
for (const R of
|
|
473
|
-
const { drawingId: E } = R, H = C[E].layoutType, z = Bi[
|
|
470
|
+
for (const R of n) {
|
|
471
|
+
const { drawingId: E } = R, H = C[E].layoutType, z = Bi[t];
|
|
474
472
|
if (H !== z) {
|
|
475
473
|
const S = D.replaceOp(["drawings", E, "layoutType"], H, z);
|
|
476
474
|
_.push(S);
|
|
477
475
|
}
|
|
478
|
-
if (
|
|
479
|
-
const S = C[E].behindDoc, A =
|
|
476
|
+
if (t === "behindText" || t === "inFrontOfText") {
|
|
477
|
+
const S = C[E].behindDoc, A = t === "behindText" ? oe.TRUE : oe.FALSE;
|
|
480
478
|
if (S !== A) {
|
|
481
479
|
const P = D.replaceOp(["drawings", E, "behindDoc"], S, A);
|
|
482
480
|
_.push(P);
|
|
483
481
|
}
|
|
484
482
|
}
|
|
485
|
-
if (
|
|
483
|
+
if (t === "inline")
|
|
486
484
|
continue;
|
|
487
485
|
let U = null, B = 0, b = 0;
|
|
488
486
|
for (const S of w) {
|
|
@@ -543,13 +541,13 @@ const nn = {
|
|
|
543
541
|
const y = o.syncExecuteCommand(O.id, O.params);
|
|
544
542
|
return p.refreshControls(), !!y;
|
|
545
543
|
}
|
|
546
|
-
},
|
|
544
|
+
}, rt = {
|
|
547
545
|
id: "doc.command.update-doc-drawing-distance",
|
|
548
546
|
type: Y.COMMAND,
|
|
549
547
|
handler: (i, e) => {
|
|
550
548
|
if (e == null)
|
|
551
549
|
return !1;
|
|
552
|
-
const
|
|
550
|
+
const n = i.get($), r = i.get(ne).getCurrentUniverDocInstance();
|
|
553
551
|
if (r == null)
|
|
554
552
|
return !1;
|
|
555
553
|
const { drawings: o, dist: a, unitId: s } = e, l = X.getInstance(), c = [], { drawings: m = {} } = r.getSnapshot();
|
|
@@ -571,15 +569,15 @@ const nn = {
|
|
|
571
569
|
textRanges: null
|
|
572
570
|
}
|
|
573
571
|
};
|
|
574
|
-
return u.params.actions = c.reduce((h, p) => X.compose(h, p), null), !!
|
|
572
|
+
return u.params.actions = c.reduce((h, p) => X.compose(h, p), null), !!n.syncExecuteCommand(u.id, u.params);
|
|
575
573
|
}
|
|
576
|
-
},
|
|
574
|
+
}, ot = {
|
|
577
575
|
id: "doc.command.update-doc-drawing-wrap-text",
|
|
578
576
|
type: Y.COMMAND,
|
|
579
577
|
handler: (i, e) => {
|
|
580
578
|
if (e == null)
|
|
581
579
|
return !1;
|
|
582
|
-
const
|
|
580
|
+
const n = i.get($), r = i.get(ne).getCurrentUniverDocInstance();
|
|
583
581
|
if (r == null)
|
|
584
582
|
return !1;
|
|
585
583
|
const { drawings: o, wrapText: a, unitId: s } = e, l = X.getInstance(), c = [], { drawings: m = {} } = r.getSnapshot();
|
|
@@ -598,7 +596,7 @@ const nn = {
|
|
|
598
596
|
textRanges: null
|
|
599
597
|
}
|
|
600
598
|
};
|
|
601
|
-
return u.params.actions = c.reduce((h, p) => X.compose(h, p), null), !!
|
|
599
|
+
return u.params.actions = c.reduce((h, p) => X.compose(h, p), null), !!n.syncExecuteCommand(u.id, u.params);
|
|
602
600
|
}
|
|
603
601
|
}, ze = {
|
|
604
602
|
id: "doc.command.update-drawing-doc-transform",
|
|
@@ -606,10 +604,10 @@ const nn = {
|
|
|
606
604
|
handler: (i, e) => {
|
|
607
605
|
if (e == null)
|
|
608
606
|
return !1;
|
|
609
|
-
const
|
|
607
|
+
const n = i.get($), t = i.get(ne), o = i.get(se).getRenderById(e.unitId), a = o == null ? void 0 : o.scene;
|
|
610
608
|
if (a == null)
|
|
611
609
|
return !1;
|
|
612
|
-
const s = a.getTransformerByCreate(), l =
|
|
610
|
+
const s = a.getTransformerByCreate(), l = t.getCurrentUniverDocInstance();
|
|
613
611
|
if (l == null)
|
|
614
612
|
return !1;
|
|
615
613
|
const { drawings: c, unitId: m } = e, u = X.getInstance(), f = [], { drawings: h = {} } = l.getSnapshot();
|
|
@@ -630,30 +628,30 @@ const nn = {
|
|
|
630
628
|
}
|
|
631
629
|
};
|
|
632
630
|
p.params.actions = f.reduce((v, I) => X.compose(v, I), null);
|
|
633
|
-
const w =
|
|
631
|
+
const w = n.syncExecuteCommand(p.id, p.params);
|
|
634
632
|
return s.refreshControls(), !!w;
|
|
635
633
|
}
|
|
636
|
-
},
|
|
634
|
+
}, at = {
|
|
637
635
|
id: "doc.command.move-inline-drawing",
|
|
638
636
|
type: Y.COMMAND,
|
|
639
637
|
handler: (i, e) => {
|
|
640
638
|
var T;
|
|
641
639
|
if (e == null)
|
|
642
640
|
return !1;
|
|
643
|
-
const
|
|
641
|
+
const n = i.get(se), t = i.get(Ue), r = i.get(ln), o = n.getRenderById(e.unitId), a = o == null ? void 0 : o.scene, s = o == null ? void 0 : o.with(ae).getSkeleton();
|
|
644
642
|
if (a == null)
|
|
645
643
|
return !1;
|
|
646
|
-
const l = a.getTransformerByCreate(), c = i.get($), u = i.get(
|
|
644
|
+
const l = a.getTransformerByCreate(), c = i.get($), u = i.get(ne).getCurrentUniverDocInstance();
|
|
647
645
|
if (u == null)
|
|
648
646
|
return !1;
|
|
649
|
-
const { drawing: f, unitId: h, offset: p, segmentId: w, segmentPage: v } = e, I = [], { drawingId: D } = f, _ = (T =
|
|
647
|
+
const { drawing: f, unitId: h, offset: p, segmentId: w, segmentPage: v } = e, I = [], { drawingId: D } = f, _ = (T = t.getSegment()) != null ? T : "", C = tt(
|
|
650
648
|
w,
|
|
651
649
|
_,
|
|
652
650
|
v,
|
|
653
651
|
p,
|
|
654
652
|
D,
|
|
655
653
|
u,
|
|
656
|
-
|
|
654
|
+
t
|
|
657
655
|
);
|
|
658
656
|
if (C == null || C.length === 0)
|
|
659
657
|
return r.refreshDrawings(s), l.refreshControls(), !1;
|
|
@@ -670,7 +668,7 @@ const nn = {
|
|
|
670
668
|
const y = c.syncExecuteCommand(O.id, O.params);
|
|
671
669
|
return l.refreshControls(), !!y;
|
|
672
670
|
}
|
|
673
|
-
},
|
|
671
|
+
}, st = {
|
|
674
672
|
id: "doc.command.transform-non-inline-drawing",
|
|
675
673
|
type: Y.COMMAND,
|
|
676
674
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -678,20 +676,20 @@ const nn = {
|
|
|
678
676
|
var U;
|
|
679
677
|
if (e == null)
|
|
680
678
|
return !1;
|
|
681
|
-
const
|
|
679
|
+
const n = i.get(Ue), r = i.get(se).getRenderById(e.unitId), o = r == null ? void 0 : r.scene;
|
|
682
680
|
if (o == null)
|
|
683
681
|
return !1;
|
|
684
|
-
const a = o.getTransformerByCreate(), s = i.get($), c = i.get(
|
|
682
|
+
const a = o.getTransformerByCreate(), s = i.get($), c = i.get(ne).getCurrentUniverDocInstance();
|
|
685
683
|
if (c == null)
|
|
686
684
|
return !1;
|
|
687
|
-
const { drawing: m, unitId: u, offset: f, docTransform: h, segmentId: p, segmentPage: w } = e, v = [], { drawingId: I } = m, D = (U =
|
|
685
|
+
const { drawing: m, unitId: u, offset: f, docTransform: h, segmentId: p, segmentPage: w } = e, v = [], { drawingId: I } = m, D = (U = n.getSegment()) != null ? U : "", _ = tt(
|
|
688
686
|
p,
|
|
689
687
|
D,
|
|
690
688
|
w,
|
|
691
689
|
f,
|
|
692
690
|
I,
|
|
693
691
|
c,
|
|
694
|
-
|
|
692
|
+
n
|
|
695
693
|
);
|
|
696
694
|
if (_ == null)
|
|
697
695
|
return !1;
|
|
@@ -727,7 +725,7 @@ const nn = {
|
|
|
727
725
|
return a.refreshControls(), !!z;
|
|
728
726
|
}
|
|
729
727
|
}, Ze = 0, Qe = 100, Fi = (i) => {
|
|
730
|
-
const e = re($),
|
|
728
|
+
const e = re($), n = re(an), t = re(he), r = re(se), o = re(ne), { drawings: a } = i, s = a[0];
|
|
731
729
|
if (s == null)
|
|
732
730
|
return null;
|
|
733
731
|
const { unitId: l } = s, c = o.getUniverDocInstance(l), m = r.getRenderById(l);
|
|
@@ -741,7 +739,7 @@ const nn = {
|
|
|
741
739
|
}), [N, R] = ie(!0);
|
|
742
740
|
function E(b) {
|
|
743
741
|
_(b);
|
|
744
|
-
const S =
|
|
742
|
+
const S = t.getFocusDrawings();
|
|
745
743
|
if (S.length === 0)
|
|
746
744
|
return;
|
|
747
745
|
const { unitId: A, subUnitId: P } = S[0], L = S.map(({ unitId: x, subUnitId: M, drawingId: W }) => ({
|
|
@@ -749,7 +747,7 @@ const nn = {
|
|
|
749
747
|
subUnitId: M,
|
|
750
748
|
drawingId: W
|
|
751
749
|
}));
|
|
752
|
-
e.executeCommand(
|
|
750
|
+
e.executeCommand(it.id, {
|
|
753
751
|
unitId: A,
|
|
754
752
|
subUnitId: P,
|
|
755
753
|
drawings: L,
|
|
@@ -758,7 +756,7 @@ const nn = {
|
|
|
758
756
|
}
|
|
759
757
|
function H(b) {
|
|
760
758
|
O(b);
|
|
761
|
-
const S =
|
|
759
|
+
const S = t.getFocusDrawings();
|
|
762
760
|
if (S.length === 0)
|
|
763
761
|
return;
|
|
764
762
|
const A = S.map((P) => ({
|
|
@@ -766,7 +764,7 @@ const nn = {
|
|
|
766
764
|
subUnitId: P.subUnitId,
|
|
767
765
|
drawingId: P.drawingId
|
|
768
766
|
}));
|
|
769
|
-
e.executeCommand(
|
|
767
|
+
e.executeCommand(ot.id, {
|
|
770
768
|
unitId: S[0].unitId,
|
|
771
769
|
subUnitId: S[0].unitId,
|
|
772
770
|
drawings: A,
|
|
@@ -778,7 +776,7 @@ const nn = {
|
|
|
778
776
|
return;
|
|
779
777
|
const A = { ...y, [S]: b };
|
|
780
778
|
T(A);
|
|
781
|
-
const P =
|
|
779
|
+
const P = t.getFocusDrawings();
|
|
782
780
|
if (P.length === 0)
|
|
783
781
|
return;
|
|
784
782
|
const L = P.map((x) => ({
|
|
@@ -786,7 +784,7 @@ const nn = {
|
|
|
786
784
|
subUnitId: x.subUnitId,
|
|
787
785
|
drawingId: x.drawingId
|
|
788
786
|
}));
|
|
789
|
-
e.executeCommand(
|
|
787
|
+
e.executeCommand(rt.id, {
|
|
790
788
|
unitId: P[0].unitId,
|
|
791
789
|
subUnitId: P[0].unitId,
|
|
792
790
|
drawings: L,
|
|
@@ -796,7 +794,7 @@ const nn = {
|
|
|
796
794
|
});
|
|
797
795
|
}
|
|
798
796
|
function U() {
|
|
799
|
-
const b =
|
|
797
|
+
const b = t.getFocusDrawings();
|
|
800
798
|
b.length !== 0 && B(b[0]);
|
|
801
799
|
}
|
|
802
800
|
function B(b) {
|
|
@@ -835,9 +833,9 @@ const nn = {
|
|
|
835
833
|
throw new Error(`Unsupported layout type: ${M}`);
|
|
836
834
|
}
|
|
837
835
|
}
|
|
838
|
-
return
|
|
836
|
+
return wn(() => {
|
|
839
837
|
U();
|
|
840
|
-
const b =
|
|
838
|
+
const b = t.focus$.subscribe((A) => {
|
|
841
839
|
if (A.length === 0) {
|
|
842
840
|
R(!1);
|
|
843
841
|
return;
|
|
@@ -849,7 +847,7 @@ const nn = {
|
|
|
849
847
|
return () => {
|
|
850
848
|
b.unsubscribe(), S.dispose();
|
|
851
849
|
};
|
|
852
|
-
}, []), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelGrid, g.imageCommonPanelBorder), style: { display: N ? "block" : "none" } }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelTitle) }, /* @__PURE__ */ d.createElement("div", null,
|
|
850
|
+
}, []), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelGrid, g.imageCommonPanelBorder), style: { display: N ? "block" : "none" } }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelTitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-text-wrap.title")))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-text-wrap.wrappingStyle")))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelRow) }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn) }, /* @__PURE__ */ d.createElement(Rn, { value: D, onChange: E, direction: "vertical" }, /* @__PURE__ */ d.createElement(Ee, { value: me.INLINE }, n.t("image-text-wrap.inline")), /* @__PURE__ */ d.createElement(Ee, { value: me.WRAP_SQUARE }, n.t("image-text-wrap.square")), /* @__PURE__ */ d.createElement(Ee, { value: me.WRAP_TOP_AND_BOTTOM }, n.t("image-text-wrap.topAndBottom")), /* @__PURE__ */ d.createElement(Ee, { value: me.BEHIND_TEXT }, n.t("image-text-wrap.behindText")), /* @__PURE__ */ d.createElement(Ee, { value: me.IN_FRONT_OF_TEXT }, n.t("image-text-wrap.inFrontText"))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-text-wrap.wrapText")))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelRow) }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn) }, /* @__PURE__ */ d.createElement(Rn, { disabled: f, value: C, onChange: H, direction: "horizontal" }, /* @__PURE__ */ d.createElement(Ee, { value: je.BOTH_SIDES }, n.t("image-text-wrap.bothSide")), /* @__PURE__ */ d.createElement(Ee, { value: je.LEFT }, n.t("image-text-wrap.leftOnly")), /* @__PURE__ */ d.createElement(Ee, { value: je.RIGHT }, n.t("image-text-wrap.rightOnly"))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-text-wrap.distanceFromText")))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-text-wrap.top"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
853
851
|
Ae,
|
|
854
852
|
{
|
|
855
853
|
min: Ze,
|
|
@@ -862,7 +860,7 @@ const nn = {
|
|
|
862
860
|
},
|
|
863
861
|
className: g.imageCommonPanelInput
|
|
864
862
|
}
|
|
865
|
-
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn },
|
|
863
|
+
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-text-wrap.left"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
866
864
|
Ae,
|
|
867
865
|
{
|
|
868
866
|
min: Ze,
|
|
@@ -875,7 +873,7 @@ const nn = {
|
|
|
875
873
|
},
|
|
876
874
|
className: g.imageCommonPanelInput
|
|
877
875
|
}
|
|
878
|
-
)))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn },
|
|
876
|
+
)))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-text-wrap.bottom"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
879
877
|
Ae,
|
|
880
878
|
{
|
|
881
879
|
min: Ze,
|
|
@@ -888,7 +886,7 @@ const nn = {
|
|
|
888
886
|
},
|
|
889
887
|
className: g.imageCommonPanelInput
|
|
890
888
|
}
|
|
891
|
-
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn },
|
|
889
|
+
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-text-wrap.right"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
892
890
|
Ae,
|
|
893
891
|
{
|
|
894
892
|
min: Ze,
|
|
@@ -902,33 +900,33 @@ const nn = {
|
|
|
902
900
|
className: g.imageCommonPanelInput
|
|
903
901
|
}
|
|
904
902
|
)))))));
|
|
905
|
-
},
|
|
906
|
-
const e = re($),
|
|
903
|
+
}, Ln = -1e3, Un = 1e3, ki = (i) => {
|
|
904
|
+
const e = re($), n = re(an), t = re(he), r = re(se), o = re(ne), a = re(Ue), { drawings: s } = i, l = s[0];
|
|
907
905
|
if (l == null)
|
|
908
906
|
return;
|
|
909
907
|
const { unitId: c } = l, m = o.getUniverDocInstance(c), u = r.getRenderById(c), f = u == null ? void 0 : u.scene;
|
|
910
908
|
if (f == null)
|
|
911
909
|
return;
|
|
912
910
|
const h = f.getTransformerByCreate(), p = [{
|
|
913
|
-
label:
|
|
911
|
+
label: n.t("image-position.column"),
|
|
914
912
|
value: String(ee.COLUMN)
|
|
915
913
|
}, {
|
|
916
|
-
label:
|
|
914
|
+
label: n.t("image-position.page"),
|
|
917
915
|
value: String(ee.PAGE)
|
|
918
916
|
}, {
|
|
919
|
-
label:
|
|
917
|
+
label: n.t("image-position.margin"),
|
|
920
918
|
value: String(ee.MARGIN)
|
|
921
919
|
}], w = [{
|
|
922
|
-
label:
|
|
920
|
+
label: n.t("image-position.line"),
|
|
923
921
|
value: String(V.LINE)
|
|
924
922
|
}, {
|
|
925
|
-
label:
|
|
923
|
+
label: n.t("image-position.page"),
|
|
926
924
|
value: String(V.PAGE)
|
|
927
925
|
}, {
|
|
928
|
-
label:
|
|
926
|
+
label: n.t("image-position.margin"),
|
|
929
927
|
value: String(V.MARGIN)
|
|
930
928
|
}, {
|
|
931
|
-
label:
|
|
929
|
+
label: n.t("image-position.paragraph"),
|
|
932
930
|
value: String(V.PARAGRAPH)
|
|
933
931
|
}], [v, I] = ie(!0), [D, _] = ie({
|
|
934
932
|
relativeFrom: ee.PAGE,
|
|
@@ -939,7 +937,7 @@ const nn = {
|
|
|
939
937
|
}), [y, T] = ie(!0), [N, R] = ie(!0);
|
|
940
938
|
function E(S, A) {
|
|
941
939
|
S === "positionH" ? _(A) : O(A);
|
|
942
|
-
const P =
|
|
940
|
+
const P = t.getFocusDrawings();
|
|
943
941
|
if (P.length === 0)
|
|
944
942
|
return;
|
|
945
943
|
const L = P.map((x) => ({
|
|
@@ -958,11 +956,11 @@ const nn = {
|
|
|
958
956
|
}), a.blur(), h.refreshControls();
|
|
959
957
|
}
|
|
960
958
|
function H(S) {
|
|
961
|
-
var we, ve,
|
|
959
|
+
var we, ve, te;
|
|
962
960
|
const A = D.relativeFrom, P = D.posOffset, L = Number(S);
|
|
963
961
|
if (A === L)
|
|
964
962
|
return;
|
|
965
|
-
const x =
|
|
963
|
+
const x = t.getFocusDrawings();
|
|
966
964
|
if (x.length === 0)
|
|
967
965
|
return;
|
|
968
966
|
const M = x[0].drawingId, W = x[0].unitId;
|
|
@@ -982,7 +980,7 @@ const nn = {
|
|
|
982
980
|
G = J == null ? void 0 : J.skeDrawings.get(M), F = Ie;
|
|
983
981
|
break;
|
|
984
982
|
}
|
|
985
|
-
const q = (
|
|
983
|
+
const q = (te = Ce.get(Me)) == null ? void 0 : te.get(De);
|
|
986
984
|
if (q != null && q.skeDrawings.has(M)) {
|
|
987
985
|
G = q == null ? void 0 : q.skeDrawings.get(M), F = Ie;
|
|
988
986
|
break;
|
|
@@ -1003,7 +1001,7 @@ const nn = {
|
|
|
1003
1001
|
const A = C.relativeFrom, P = C.posOffset, L = Number(S);
|
|
1004
1002
|
if (A === L)
|
|
1005
1003
|
return;
|
|
1006
|
-
const x =
|
|
1004
|
+
const x = t.getFocusDrawings();
|
|
1007
1005
|
if (x.length === 0)
|
|
1008
1006
|
return;
|
|
1009
1007
|
const { drawingId: M, unitId: W } = x[0], G = o.getUniverDocInstance(W), F = (Ie = r.getRenderById(W)) == null ? void 0 : Ie.with(ae).getSkeleton(), ce = a.getSegment(), fe = a.getSegmentPage(), Oe = (Te = (Se = G == null ? void 0 : G.getSelfOrHeaderFooterModel(ce).getBody()) == null ? void 0 : Se.customBlocks) == null ? void 0 : Te.find((J) => J.blockId === M);
|
|
@@ -1012,11 +1010,11 @@ const nn = {
|
|
|
1012
1010
|
const { startIndex: Be } = Oe, Ce = F.findNodeByCharIndex(Be, ce, fe), K = (Me = Ce == null ? void 0 : Ce.parent) == null ? void 0 : Me.parent, le = K == null ? void 0 : K.parent, we = le == null ? void 0 : le.lines.find((J) => J.paragraphIndex === (K == null ? void 0 : K.paragraphIndex) && J.paragraphStart), ve = (De = le == null ? void 0 : le.parent) == null ? void 0 : De.parent;
|
|
1013
1011
|
if (Ce == null || K == null || we == null || le == null || ve == null)
|
|
1014
1012
|
return;
|
|
1015
|
-
let
|
|
1016
|
-
A === V.PARAGRAPH ?
|
|
1013
|
+
let te = 0;
|
|
1014
|
+
A === V.PARAGRAPH ? te -= we.top : A === V.LINE ? te -= K.top : A === V.PAGE && (te += ve.marginTop), L === V.PARAGRAPH ? te += we.top : L === V.LINE ? te += K.top : L === V.PAGE && (te -= ve.marginTop);
|
|
1017
1015
|
const Ne = {
|
|
1018
1016
|
relativeFrom: L,
|
|
1019
|
-
posOffset: (P != null ? P : 0) -
|
|
1017
|
+
posOffset: (P != null ? P : 0) - te
|
|
1020
1018
|
};
|
|
1021
1019
|
E("positionV", Ne);
|
|
1022
1020
|
}
|
|
@@ -1032,15 +1030,15 @@ const nn = {
|
|
|
1032
1030
|
_(x), O(M), I(L === k.INLINE), T(M.relativeFrom === V.PARAGRAPH || M.relativeFrom === V.LINE);
|
|
1033
1031
|
}
|
|
1034
1032
|
function B() {
|
|
1035
|
-
const S =
|
|
1033
|
+
const S = t.getFocusDrawings();
|
|
1036
1034
|
S.length !== 0 && U(S[0]);
|
|
1037
1035
|
}
|
|
1038
1036
|
function b(S) {
|
|
1039
1037
|
T(S), z(String(S ? V.PARAGRAPH : V.PAGE));
|
|
1040
1038
|
}
|
|
1041
|
-
return
|
|
1039
|
+
return wn(() => {
|
|
1042
1040
|
B();
|
|
1043
|
-
const S =
|
|
1041
|
+
const S = t.focus$.subscribe((P) => {
|
|
1044
1042
|
if (P.length === 0) {
|
|
1045
1043
|
R(!1);
|
|
1046
1044
|
return;
|
|
@@ -1052,11 +1050,11 @@ const nn = {
|
|
|
1052
1050
|
return () => {
|
|
1053
1051
|
S.unsubscribe(), A.dispose();
|
|
1054
1052
|
};
|
|
1055
|
-
}, []), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelGrid, g.imageCommonPanelBorder), style: { display: N ? "block" : "none" } }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelTitle) }, /* @__PURE__ */ d.createElement("div", null,
|
|
1053
|
+
}, []), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelGrid, g.imageCommonPanelBorder), style: { display: N ? "block" : "none" } }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelTitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-position.title")))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-position.horizontal")))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-position.absolutePosition"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
1056
1054
|
Ae,
|
|
1057
1055
|
{
|
|
1058
|
-
min:
|
|
1059
|
-
max:
|
|
1056
|
+
min: Ln,
|
|
1057
|
+
max: Un,
|
|
1060
1058
|
precision: 1,
|
|
1061
1059
|
disabled: v,
|
|
1062
1060
|
value: D.posOffset,
|
|
@@ -1068,19 +1066,19 @@ const nn = {
|
|
|
1068
1066
|
},
|
|
1069
1067
|
className: g.imageCommonPanelInput
|
|
1070
1068
|
}
|
|
1071
|
-
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn },
|
|
1072
|
-
|
|
1069
|
+
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-position.toTheRightOf"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
1070
|
+
Nn,
|
|
1073
1071
|
{
|
|
1074
1072
|
value: String(D.relativeFrom),
|
|
1075
1073
|
disabled: v,
|
|
1076
1074
|
options: p,
|
|
1077
1075
|
onChange: H
|
|
1078
1076
|
}
|
|
1079
|
-
)))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null,
|
|
1077
|
+
)))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-position.vertical")))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-position.absolutePosition"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
1080
1078
|
Ae,
|
|
1081
1079
|
{
|
|
1082
|
-
min:
|
|
1083
|
-
max:
|
|
1080
|
+
min: Ln,
|
|
1081
|
+
max: Un,
|
|
1084
1082
|
precision: 1,
|
|
1085
1083
|
disabled: v,
|
|
1086
1084
|
value: C.posOffset,
|
|
@@ -1092,40 +1090,40 @@ const nn = {
|
|
|
1092
1090
|
},
|
|
1093
1091
|
className: g.imageCommonPanelInput
|
|
1094
1092
|
}
|
|
1095
|
-
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn },
|
|
1096
|
-
|
|
1093
|
+
))))), /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSpan2) }, /* @__PURE__ */ d.createElement("label", null, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, n.t("image-position.bellow"))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(
|
|
1094
|
+
Nn,
|
|
1097
1095
|
{
|
|
1098
1096
|
disabled: v,
|
|
1099
1097
|
value: String(C.relativeFrom),
|
|
1100
1098
|
options: w,
|
|
1101
1099
|
onChange: z
|
|
1102
1100
|
}
|
|
1103
|
-
)))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null,
|
|
1101
|
+
)))))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow }, /* @__PURE__ */ d.createElement("div", { className: j(g.imageCommonPanelColumn, g.imageCommonPanelSubtitle) }, /* @__PURE__ */ d.createElement("div", null, n.t("image-position.options")))), /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelRow, style: { marginBottom: "50px" } }, /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanelColumn }, /* @__PURE__ */ d.createElement(si, { disabled: v, checked: y, onChange: b }, n.t("image-position.moveObjectWithText")))));
|
|
1104
1102
|
}, Hi = () => {
|
|
1105
|
-
const i = re(he), e = i.getFocusDrawings(), [
|
|
1106
|
-
return
|
|
1103
|
+
const i = re(he), e = i.getFocusDrawings(), [n, t] = ie(e);
|
|
1104
|
+
return wn(() => {
|
|
1107
1105
|
const r = i.focus$.subscribe((o) => {
|
|
1108
|
-
|
|
1106
|
+
t(o);
|
|
1109
1107
|
});
|
|
1110
1108
|
return () => {
|
|
1111
1109
|
r.unsubscribe();
|
|
1112
1110
|
};
|
|
1113
|
-
}, []), !!(
|
|
1111
|
+
}, []), !!(n != null && n.length) && /* @__PURE__ */ d.createElement("div", { className: g.imageCommonPanel }, /* @__PURE__ */ d.createElement(Nt, { drawings: n, hasAlign: !1, hasCropper: !1, hasGroup: !1, hasTransform: !1 }), /* @__PURE__ */ d.createElement(Fi, { drawings: n }), /* @__PURE__ */ d.createElement(ki, { drawings: n }));
|
|
1114
1112
|
}, Wi = {
|
|
1115
1113
|
id: "doc.operation.clear-drawing-transformer",
|
|
1116
1114
|
type: Y.MUTATION,
|
|
1117
1115
|
handler: (i, e) => {
|
|
1118
|
-
const
|
|
1119
|
-
return e.forEach((
|
|
1116
|
+
const n = i.get(se);
|
|
1117
|
+
return e.forEach((t) => {
|
|
1120
1118
|
var r, o;
|
|
1121
|
-
(o = (r =
|
|
1119
|
+
(o = (r = n.getRenderById(t)) == null ? void 0 : r.scene.getTransformer()) == null || o.debounceRefreshControls();
|
|
1122
1120
|
}), !0;
|
|
1123
1121
|
}
|
|
1124
1122
|
}, Xe = {
|
|
1125
1123
|
id: "doc.command.move-drawing",
|
|
1126
1124
|
type: Y.COMMAND,
|
|
1127
1125
|
handler: (i, e) => {
|
|
1128
|
-
const
|
|
1126
|
+
const n = i.get($), t = i.get(Re), r = i.get(ne), o = i.get(se), { direction: a } = e, s = t.getFocusDrawings();
|
|
1129
1127
|
if (s.length === 0)
|
|
1130
1128
|
return !1;
|
|
1131
1129
|
const l = s[0].unitId, c = o.getRenderById(l), m = c == null ? void 0 : c.scene;
|
|
@@ -1145,21 +1143,21 @@ const nn = {
|
|
|
1145
1143
|
}).filter((w) => w != null);
|
|
1146
1144
|
if (h.length === 0)
|
|
1147
1145
|
return !1;
|
|
1148
|
-
const p =
|
|
1146
|
+
const p = n.syncExecuteCommand(ze.id, {
|
|
1149
1147
|
unitId: l,
|
|
1150
1148
|
subUnitId: l,
|
|
1151
1149
|
drawings: h
|
|
1152
1150
|
});
|
|
1153
1151
|
return u.refreshControls(), !!p;
|
|
1154
1152
|
}
|
|
1155
|
-
},
|
|
1153
|
+
}, ct = {
|
|
1156
1154
|
id: "doc.command.delete-drawing",
|
|
1157
1155
|
type: Y.COMMAND,
|
|
1158
1156
|
handler: (i) => {
|
|
1159
|
-
const e = i.get($),
|
|
1160
|
-
if (
|
|
1157
|
+
const e = i.get($), t = i.get(Re).getFocusDrawings();
|
|
1158
|
+
if (t.length === 0)
|
|
1161
1159
|
return !1;
|
|
1162
|
-
const { unitId: r } =
|
|
1160
|
+
const { unitId: r } = t[0], o = t.map((a) => {
|
|
1163
1161
|
const { unitId: s, subUnitId: l, drawingId: c, drawingType: m } = a;
|
|
1164
1162
|
return {
|
|
1165
1163
|
unitId: s,
|
|
@@ -1168,21 +1166,21 @@ const nn = {
|
|
|
1168
1166
|
drawingType: m
|
|
1169
1167
|
};
|
|
1170
1168
|
});
|
|
1171
|
-
return e.executeCommand(
|
|
1169
|
+
return e.executeCommand(vn.id, {
|
|
1172
1170
|
unitId: r,
|
|
1173
1171
|
drawings: o
|
|
1174
1172
|
});
|
|
1175
1173
|
}
|
|
1176
|
-
},
|
|
1174
|
+
}, lt = {
|
|
1177
1175
|
id: "doc.command.set-drawing-arrange",
|
|
1178
1176
|
type: Y.COMMAND,
|
|
1179
1177
|
handler: (i, e) => {
|
|
1180
|
-
const
|
|
1178
|
+
const n = i.get($), t = i.get(Re);
|
|
1181
1179
|
if (e == null)
|
|
1182
1180
|
return !1;
|
|
1183
1181
|
const { unitId: r, subUnitId: o, drawingIds: a, arrangeType: s } = e, l = { unitId: r, subUnitId: o, drawingIds: a };
|
|
1184
1182
|
let c;
|
|
1185
|
-
if (s === Ye.forward ? c =
|
|
1183
|
+
if (s === Ye.forward ? c = t.getForwardDrawingsOp(l) : s === Ye.backward ? c = t.getBackwardDrawingOp(l) : s === Ye.front ? c = t.getFrontDrawingsOp(l) : s === Ye.back && (c = t.getBackDrawingsOp(l)), c == null)
|
|
1186
1184
|
return !1;
|
|
1187
1185
|
const { redo: m } = c;
|
|
1188
1186
|
if (m == null)
|
|
@@ -1198,37 +1196,37 @@ const nn = {
|
|
|
1198
1196
|
textRanges: null
|
|
1199
1197
|
}
|
|
1200
1198
|
};
|
|
1201
|
-
return h.params.actions = u.reduce((w, v) => X.compose(w, v), null), !!
|
|
1199
|
+
return h.params.actions = u.reduce((w, v) => X.compose(w, v), null), !!n.syncExecuteCommand(h.id, h.params);
|
|
1202
1200
|
}
|
|
1203
|
-
},
|
|
1201
|
+
}, dt = {
|
|
1204
1202
|
id: "doc.command.ungroup-doc-image",
|
|
1205
1203
|
type: Y.COMMAND,
|
|
1206
1204
|
handler: (i, e) => {
|
|
1207
|
-
i.get($), i.get(
|
|
1208
|
-
const
|
|
1205
|
+
i.get($), i.get(kn);
|
|
1206
|
+
const n = i.get(Re);
|
|
1209
1207
|
if (!e) return !1;
|
|
1210
|
-
const
|
|
1208
|
+
const t = [];
|
|
1211
1209
|
return e.forEach(({ parent: r, children: o }) => {
|
|
1212
|
-
|
|
1213
|
-
|
|
1210
|
+
t.push(r.unitId), o.forEach((a) => {
|
|
1211
|
+
t.push(a.unitId);
|
|
1214
1212
|
});
|
|
1215
|
-
}),
|
|
1213
|
+
}), n.getUngroupDrawingOp(e), !1;
|
|
1216
1214
|
}
|
|
1217
|
-
},
|
|
1215
|
+
}, mt = {
|
|
1218
1216
|
id: "doc.command.group-doc-image",
|
|
1219
1217
|
type: Y.COMMAND,
|
|
1220
1218
|
handler: (i, e) => {
|
|
1221
|
-
i.get($), i.get(
|
|
1222
|
-
const
|
|
1219
|
+
i.get($), i.get(kn);
|
|
1220
|
+
const n = i.get(Re);
|
|
1223
1221
|
if (!e) return !1;
|
|
1224
|
-
const
|
|
1222
|
+
const t = [];
|
|
1225
1223
|
return e.forEach(({ parent: r, children: o }) => {
|
|
1226
|
-
|
|
1227
|
-
|
|
1224
|
+
t.push(r.unitId), o.forEach((a) => {
|
|
1225
|
+
t.push(a.unitId);
|
|
1228
1226
|
});
|
|
1229
|
-
}),
|
|
1227
|
+
}), n.getGroupDrawingOp(e), !1;
|
|
1230
1228
|
}
|
|
1231
|
-
},
|
|
1229
|
+
}, gt = {
|
|
1232
1230
|
id: "doc.command.insert-doc-image",
|
|
1233
1231
|
type: Y.COMMAND,
|
|
1234
1232
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -1236,13 +1234,13 @@ const nn = {
|
|
|
1236
1234
|
var O, y;
|
|
1237
1235
|
if (e == null)
|
|
1238
1236
|
return !1;
|
|
1239
|
-
const
|
|
1237
|
+
const n = i.get($), t = i.get(un), r = i.get(ne), o = t.getActiveRange(), a = r.getCurrentUniverDocInstance();
|
|
1240
1238
|
if (o == null || a == null)
|
|
1241
1239
|
return !1;
|
|
1242
1240
|
const s = a.getUnitId(), { drawings: l } = e, { collapsed: c, startOffset: m, segmentId: u } = o, f = a.getSelfOrHeaderFooterModel(u).getBody();
|
|
1243
1241
|
if (f == null)
|
|
1244
1242
|
return !1;
|
|
1245
|
-
const h = new
|
|
1243
|
+
const h = new hn(), p = X.getInstance(), w = [], v = (y = (O = a.getSnapshot().drawingsOrder) == null ? void 0 : O.length) != null ? y : 0;
|
|
1246
1244
|
if (c)
|
|
1247
1245
|
m > 0 && h.push({
|
|
1248
1246
|
t: Z.RETAIN,
|
|
@@ -1250,7 +1248,7 @@ const nn = {
|
|
|
1250
1248
|
segmentId: u
|
|
1251
1249
|
});
|
|
1252
1250
|
else {
|
|
1253
|
-
const { dos: T } =
|
|
1251
|
+
const { dos: T } = Yt(o, u, 0, f);
|
|
1254
1252
|
h.push(...T);
|
|
1255
1253
|
}
|
|
1256
1254
|
h.push({
|
|
@@ -1280,11 +1278,11 @@ const nn = {
|
|
|
1280
1278
|
textRanges: []
|
|
1281
1279
|
}
|
|
1282
1280
|
};
|
|
1283
|
-
return _.params.actions = w.reduce((T, N) => X.compose(T, N), null), !!
|
|
1281
|
+
return _.params.actions = w.reduce((T, N) => X.compose(T, N), null), !!n.syncExecuteCommand(_.id, _.params);
|
|
1284
1282
|
}
|
|
1285
1283
|
};
|
|
1286
1284
|
function Ke(i) {
|
|
1287
|
-
return i.getContextValue(
|
|
1285
|
+
return i.getContextValue(St) && i.getContextValue(rn);
|
|
1288
1286
|
}
|
|
1289
1287
|
const Gi = {
|
|
1290
1288
|
id: Xe.id,
|
|
@@ -1327,7 +1325,7 @@ const Gi = {
|
|
|
1327
1325
|
direction: ge.RIGHT
|
|
1328
1326
|
}
|
|
1329
1327
|
}, zi = {
|
|
1330
|
-
id:
|
|
1328
|
+
id: ct.id,
|
|
1331
1329
|
description: "shortcut.doc.drawing-delete",
|
|
1332
1330
|
group: "4_doc-drawing-view",
|
|
1333
1331
|
// when focusing on any other input tag do not trigger this shortcut
|
|
@@ -1335,18 +1333,18 @@ const Gi = {
|
|
|
1335
1333
|
binding: Le.DELETE,
|
|
1336
1334
|
mac: Le.BACKSPACE
|
|
1337
1335
|
};
|
|
1338
|
-
var qi = Object.defineProperty, Xi = Object.getOwnPropertyDescriptor, Ki = (i, e,
|
|
1339
|
-
for (var r =
|
|
1340
|
-
(a = i[o]) && (r = (
|
|
1341
|
-
return
|
|
1342
|
-
}, He = (i, e) => (
|
|
1343
|
-
let
|
|
1344
|
-
constructor(i, e,
|
|
1345
|
-
super(), this._injector = i, this._componentManager = e, this._menuService =
|
|
1336
|
+
var qi = Object.defineProperty, Xi = Object.getOwnPropertyDescriptor, Ki = (i, e, n, t) => {
|
|
1337
|
+
for (var r = t > 1 ? void 0 : t ? Xi(e, n) : e, o = i.length - 1, a; o >= 0; o--)
|
|
1338
|
+
(a = i[o]) && (r = (t ? a(e, n, r) : a(r)) || r);
|
|
1339
|
+
return t && r && qi(e, n, r), r;
|
|
1340
|
+
}, He = (i, e) => (n, t) => e(n, t, i);
|
|
1341
|
+
let en = class extends qe {
|
|
1342
|
+
constructor(i, e, n, t, r) {
|
|
1343
|
+
super(), this._injector = i, this._componentManager = e, this._menuService = n, this._commandService = t, this._shortcutService = r, this._init();
|
|
1346
1344
|
}
|
|
1347
1345
|
_initCustomComponents() {
|
|
1348
1346
|
const i = this._componentManager;
|
|
1349
|
-
this.disposeWithMe(i.register(
|
|
1347
|
+
this.disposeWithMe(i.register(et, Qn)), this.disposeWithMe(i.register(Jn, vi)), this.disposeWithMe(i.register(qn, Hi));
|
|
1350
1348
|
}
|
|
1351
1349
|
_initMenus() {
|
|
1352
1350
|
[
|
|
@@ -1358,23 +1356,23 @@ let et = class extends qe {
|
|
|
1358
1356
|
}
|
|
1359
1357
|
_initCommands() {
|
|
1360
1358
|
[
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1359
|
+
In,
|
|
1360
|
+
gt,
|
|
1361
|
+
it,
|
|
1362
|
+
rt,
|
|
1363
|
+
ot,
|
|
1366
1364
|
ze,
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1365
|
+
at,
|
|
1366
|
+
st,
|
|
1367
|
+
vn,
|
|
1368
|
+
Xn,
|
|
1371
1369
|
Wi,
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1370
|
+
Kn,
|
|
1371
|
+
mt,
|
|
1372
|
+
dt,
|
|
1375
1373
|
Xe,
|
|
1376
|
-
|
|
1377
|
-
|
|
1374
|
+
ct,
|
|
1375
|
+
lt
|
|
1378
1376
|
].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i)));
|
|
1379
1377
|
}
|
|
1380
1378
|
_initShortcuts() {
|
|
@@ -1393,22 +1391,22 @@ let et = class extends qe {
|
|
|
1393
1391
|
this._initCommands(), this._initCustomComponents(), this._initMenus(), this._initShortcuts();
|
|
1394
1392
|
}
|
|
1395
1393
|
};
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
He(0, pe(
|
|
1399
|
-
He(1, pe(
|
|
1394
|
+
en = Ki([
|
|
1395
|
+
sn(cn.Ready, en),
|
|
1396
|
+
He(0, pe(Hn)),
|
|
1397
|
+
He(1, pe(ti)),
|
|
1400
1398
|
He(2, ii),
|
|
1401
1399
|
He(3, $),
|
|
1402
1400
|
He(4, ri)
|
|
1403
|
-
],
|
|
1404
|
-
var Yi = Object.defineProperty, Zi = Object.getOwnPropertyDescriptor, Qi = (i, e,
|
|
1405
|
-
for (var r =
|
|
1406
|
-
(a = i[o]) && (r = (
|
|
1407
|
-
return
|
|
1408
|
-
}, de = (i, e) => (
|
|
1409
|
-
let
|
|
1410
|
-
constructor(i, e,
|
|
1411
|
-
super(), this._context = i, this._commandService = e, this._textSelectionManagerService =
|
|
1401
|
+
], en);
|
|
1402
|
+
var Yi = Object.defineProperty, Zi = Object.getOwnPropertyDescriptor, Qi = (i, e, n, t) => {
|
|
1403
|
+
for (var r = t > 1 ? void 0 : t ? Zi(e, n) : e, o = i.length - 1, a; o >= 0; o--)
|
|
1404
|
+
(a = i[o]) && (r = (t ? a(e, n, r) : a(r)) || r);
|
|
1405
|
+
return t && r && Yi(e, n, r), r;
|
|
1406
|
+
}, de = (i, e) => (n, t) => e(n, t, i);
|
|
1407
|
+
let fn = class extends qe {
|
|
1408
|
+
constructor(i, e, n, t, r, o, a, s, l, c, m, u, f) {
|
|
1409
|
+
super(), this._context = i, this._commandService = e, this._textSelectionManagerService = n, this._renderManagerSrv = t, this._imageIoService = r, this._docDrawingService = o, this._drawingManagerService = a, this._contextService = s, this._messageService = l, this._localeService = c, this._textSelectionManager = m, this._textSelectionRenderManager = u, this._docRefreshDrawingsService = f, this._initCommandListeners(), this._updateDrawingListener(), this._updateOrderListener(), this._groupDrawingListener(), this._focusDrawingListener(), this._editAreaChangeListener();
|
|
1412
1410
|
}
|
|
1413
1411
|
/**
|
|
1414
1412
|
* Upload image to cell or float image
|
|
@@ -1416,19 +1414,19 @@ let ut = class extends qe {
|
|
|
1416
1414
|
_initCommandListeners() {
|
|
1417
1415
|
this.disposeWithMe(
|
|
1418
1416
|
this._commandService.onCommandExecuted(async (i) => {
|
|
1419
|
-
if (i.id ===
|
|
1417
|
+
if (i.id === In.id) {
|
|
1420
1418
|
const e = i.params;
|
|
1421
1419
|
if (e.files == null)
|
|
1422
1420
|
return;
|
|
1423
|
-
const
|
|
1424
|
-
if (
|
|
1421
|
+
const n = e.files.length;
|
|
1422
|
+
if (n > Dn) {
|
|
1425
1423
|
this._messageService.show({
|
|
1426
|
-
type:
|
|
1427
|
-
content: this._localeService.t("update-status.exceedMaxCount", String(
|
|
1424
|
+
type: An.Error,
|
|
1425
|
+
content: this._localeService.t("update-status.exceedMaxCount", String(Dn))
|
|
1428
1426
|
});
|
|
1429
1427
|
return;
|
|
1430
1428
|
}
|
|
1431
|
-
this._imageIoService.setWaitCount(
|
|
1429
|
+
this._imageIoService.setWaitCount(n), await this._insertFloatImages(e.files);
|
|
1432
1430
|
}
|
|
1433
1431
|
})
|
|
1434
1432
|
);
|
|
@@ -1442,45 +1440,45 @@ let ut = class extends qe {
|
|
|
1442
1440
|
const o = r.message;
|
|
1443
1441
|
let a = "";
|
|
1444
1442
|
switch (o) {
|
|
1445
|
-
case
|
|
1446
|
-
a = this._localeService.t("update-status.exceedMaxSize", String(
|
|
1443
|
+
case gn.ERROR_EXCEED_SIZE:
|
|
1444
|
+
a = this._localeService.t("update-status.exceedMaxSize", String(Lt / (1024 * 1024)));
|
|
1447
1445
|
break;
|
|
1448
|
-
case
|
|
1446
|
+
case gn.ERROR_IMAGE_TYPE:
|
|
1449
1447
|
a = this._localeService.t("update-status.invalidImageType");
|
|
1450
1448
|
break;
|
|
1451
|
-
case
|
|
1449
|
+
case gn.ERROR_IMAGE:
|
|
1452
1450
|
a = this._localeService.t("update-status.invalidImage");
|
|
1453
1451
|
break;
|
|
1454
1452
|
}
|
|
1455
1453
|
this._messageService.show({
|
|
1456
|
-
type:
|
|
1454
|
+
type: An.Error,
|
|
1457
1455
|
content: a
|
|
1458
1456
|
});
|
|
1459
1457
|
}
|
|
1460
1458
|
if (e.length === 0)
|
|
1461
1459
|
return;
|
|
1462
|
-
const { unitId:
|
|
1460
|
+
const { unitId: n } = this._context, t = [];
|
|
1463
1461
|
for (const r of e) {
|
|
1464
1462
|
if (r == null)
|
|
1465
1463
|
continue;
|
|
1466
|
-
const { imageId: o, imageSourceType: a, source: s, base64Cache: l } = r, { width: c, height: m, image: u } = await
|
|
1464
|
+
const { imageId: o, imageSourceType: a, source: s, base64Cache: l } = r, { width: c, height: m, image: u } = await Ut(l || "");
|
|
1467
1465
|
this._imageIoService.addImageSourceCache(o, a, u);
|
|
1468
1466
|
let f = 1;
|
|
1469
|
-
if (c >
|
|
1470
|
-
const v =
|
|
1467
|
+
if (c > En || m > Pn) {
|
|
1468
|
+
const v = En / c, I = Pn / m;
|
|
1471
1469
|
f = Math.min(v, I);
|
|
1472
1470
|
}
|
|
1473
1471
|
const h = this._getImagePosition(c * f, m * f);
|
|
1474
1472
|
if (h == null)
|
|
1475
1473
|
return;
|
|
1476
1474
|
const p = {
|
|
1477
|
-
unitId:
|
|
1478
|
-
subUnitId:
|
|
1475
|
+
unitId: n,
|
|
1476
|
+
subUnitId: n,
|
|
1479
1477
|
drawingId: o,
|
|
1480
|
-
drawingType:
|
|
1478
|
+
drawingType: Bt.DRAWING_IMAGE,
|
|
1481
1479
|
imageSourceType: a,
|
|
1482
1480
|
source: s,
|
|
1483
|
-
transform:
|
|
1481
|
+
transform: Kt(h),
|
|
1484
1482
|
docTransform: h,
|
|
1485
1483
|
behindDoc: oe.FALSE,
|
|
1486
1484
|
title: "",
|
|
@@ -1493,20 +1491,20 @@ let ut = class extends qe {
|
|
|
1493
1491
|
distR: 0,
|
|
1494
1492
|
distT: 0
|
|
1495
1493
|
};
|
|
1496
|
-
this._isInsertInHeaderFooter() && (p.isMultiTransform = oe.TRUE, p.transforms = p.transform ? [p.transform] : null),
|
|
1494
|
+
this._isInsertInHeaderFooter() && (p.isMultiTransform = oe.TRUE, p.transforms = p.transform ? [p.transform] : null), t.push(p);
|
|
1497
1495
|
}
|
|
1498
|
-
this._commandService.executeCommand(
|
|
1499
|
-
unitId:
|
|
1500
|
-
drawings:
|
|
1496
|
+
this._commandService.executeCommand(gt.id, {
|
|
1497
|
+
unitId: n,
|
|
1498
|
+
drawings: t
|
|
1501
1499
|
});
|
|
1502
1500
|
}
|
|
1503
1501
|
_isInsertInHeaderFooter() {
|
|
1504
|
-
var
|
|
1505
|
-
const { unitId: i } = this._context, e = (
|
|
1506
|
-
return
|
|
1502
|
+
var t;
|
|
1503
|
+
const { unitId: i } = this._context, e = (t = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : t.with(ae).getViewModel(), n = e == null ? void 0 : e.getEditArea();
|
|
1504
|
+
return n === xe.HEADER || n === xe.FOOTER;
|
|
1507
1505
|
}
|
|
1508
1506
|
_getImagePosition(i, e) {
|
|
1509
|
-
const
|
|
1507
|
+
const n = this._textSelectionManagerService.getActiveTextRange(), t = (n == null ? void 0 : n.getAbsolutePosition()) || {
|
|
1510
1508
|
left: 0,
|
|
1511
1509
|
top: 0
|
|
1512
1510
|
};
|
|
@@ -1517,22 +1515,22 @@ let ut = class extends qe {
|
|
|
1517
1515
|
},
|
|
1518
1516
|
positionH: {
|
|
1519
1517
|
relativeFrom: ee.PAGE,
|
|
1520
|
-
posOffset:
|
|
1518
|
+
posOffset: t.left
|
|
1521
1519
|
},
|
|
1522
1520
|
positionV: {
|
|
1523
1521
|
relativeFrom: V.MARGIN,
|
|
1524
|
-
posOffset:
|
|
1522
|
+
posOffset: t.top
|
|
1525
1523
|
},
|
|
1526
1524
|
angle: 0
|
|
1527
1525
|
};
|
|
1528
1526
|
}
|
|
1529
1527
|
_updateOrderListener() {
|
|
1530
1528
|
this._drawingManagerService.featurePluginOrderUpdate$.subscribe((i) => {
|
|
1531
|
-
const { unitId: e, subUnitId:
|
|
1532
|
-
this._commandService.executeCommand(
|
|
1529
|
+
const { unitId: e, subUnitId: n, drawingIds: t, arrangeType: r } = i;
|
|
1530
|
+
this._commandService.executeCommand(lt.id, {
|
|
1533
1531
|
unitId: e,
|
|
1534
|
-
subUnitId:
|
|
1535
|
-
drawingIds:
|
|
1532
|
+
subUnitId: n,
|
|
1533
|
+
drawingIds: t,
|
|
1536
1534
|
arrangeType: r
|
|
1537
1535
|
});
|
|
1538
1536
|
});
|
|
@@ -1543,34 +1541,34 @@ let ut = class extends qe {
|
|
|
1543
1541
|
}
|
|
1544
1542
|
_groupDrawingListener() {
|
|
1545
1543
|
this._drawingManagerService.featurePluginGroupUpdate$.subscribe((i) => {
|
|
1546
|
-
this._commandService.executeCommand(
|
|
1544
|
+
this._commandService.executeCommand(mt.id, i);
|
|
1547
1545
|
}), this._drawingManagerService.featurePluginUngroupUpdate$.subscribe((i) => {
|
|
1548
|
-
this._commandService.executeCommand(
|
|
1546
|
+
this._commandService.executeCommand(dt.id, i);
|
|
1549
1547
|
});
|
|
1550
1548
|
}
|
|
1551
1549
|
_getCurrentSceneAndTransformer() {
|
|
1552
1550
|
const { scene: i, mainComponent: e } = this._context;
|
|
1553
1551
|
if (i == null || e == null)
|
|
1554
1552
|
return;
|
|
1555
|
-
const
|
|
1556
|
-
return { scene: i, transformer:
|
|
1553
|
+
const n = i.getTransformerByCreate(), { docsLeft: t, docsTop: r } = e.getOffsetConfig();
|
|
1554
|
+
return { scene: i, transformer: n, docsLeft: t, docsTop: r };
|
|
1557
1555
|
}
|
|
1558
1556
|
_focusDrawingListener() {
|
|
1559
1557
|
this.disposeWithMe(
|
|
1560
1558
|
this._drawingManagerService.focus$.subscribe((i) => {
|
|
1561
1559
|
var r;
|
|
1562
|
-
const { transformer: e, docsLeft:
|
|
1560
|
+
const { transformer: e, docsLeft: n, docsTop: t } = (r = this._getCurrentSceneAndTransformer()) != null ? r : {};
|
|
1563
1561
|
if (i == null || i.length === 0)
|
|
1564
|
-
this._contextService.setContextValue(
|
|
1562
|
+
this._contextService.setContextValue(rn, !1), this._docDrawingService.focusDrawing([]), e && e.resetProps({
|
|
1565
1563
|
zeroTop: 0,
|
|
1566
1564
|
zeroLeft: 0
|
|
1567
1565
|
});
|
|
1568
1566
|
else {
|
|
1569
|
-
this._contextService.setContextValue(
|
|
1567
|
+
this._contextService.setContextValue(rn, !0), this._docDrawingService.focusDrawing(i), this._textSelectionManager.getActiveTextRange() && this._textSelectionManager.replaceTextRanges([]);
|
|
1570
1568
|
const a = this._textSelectionRenderManager.getSegment(), s = this._findSegmentIdByDrawingId(i[0].drawingId);
|
|
1571
1569
|
a !== s && this._textSelectionRenderManager.setSegment(s), e && e.resetProps({
|
|
1572
|
-
zeroTop:
|
|
1573
|
-
zeroLeft:
|
|
1570
|
+
zeroTop: t,
|
|
1571
|
+
zeroLeft: n
|
|
1574
1572
|
});
|
|
1575
1573
|
}
|
|
1576
1574
|
})
|
|
@@ -1578,11 +1576,11 @@ let ut = class extends qe {
|
|
|
1578
1576
|
}
|
|
1579
1577
|
_findSegmentIdByDrawingId(i) {
|
|
1580
1578
|
var a, s, l;
|
|
1581
|
-
const { unit: e } = this._context, { body:
|
|
1582
|
-
if (((a =
|
|
1579
|
+
const { unit: e } = this._context, { body: n, headers: t = {}, footers: r = {} } = e.getSnapshot();
|
|
1580
|
+
if (((a = n == null ? void 0 : n.customBlocks) != null ? a : []).some((c) => c.blockId === i))
|
|
1583
1581
|
return "";
|
|
1584
|
-
for (const c of Object.keys(
|
|
1585
|
-
if ((s =
|
|
1582
|
+
for (const c of Object.keys(t))
|
|
1583
|
+
if ((s = t[c].body.customBlocks) != null && s.some((m) => m.blockId === i))
|
|
1586
1584
|
return c;
|
|
1587
1585
|
for (const c of Object.keys(r))
|
|
1588
1586
|
if ((l = r[c].body.customBlocks) != null && l.some((m) => m.blockId === i))
|
|
@@ -1592,61 +1590,61 @@ let ut = class extends qe {
|
|
|
1592
1590
|
// Update drawings edit status and opacity. You can not edit header footer images when you are editing body. and vice verse.
|
|
1593
1591
|
_updateDrawingsEditStatus() {
|
|
1594
1592
|
var s;
|
|
1595
|
-
const { unit: i, scene: e, unitId:
|
|
1596
|
-
if (
|
|
1593
|
+
const { unit: i, scene: e, unitId: n } = this._context, t = (s = this._renderManagerSrv.getRenderById(n)) == null ? void 0 : s.with(ae).getViewModel();
|
|
1594
|
+
if (t == null || i == null)
|
|
1597
1595
|
return;
|
|
1598
|
-
const r = i.getSnapshot(), { drawings: o = {} } = r, a =
|
|
1596
|
+
const r = i.getSnapshot(), { drawings: o = {} } = r, a = t.getEditArea() === xe.BODY;
|
|
1599
1597
|
for (const l of Object.keys(o)) {
|
|
1600
|
-
const c = o[l], m =
|
|
1598
|
+
const c = o[l], m = Ft({ unitId: n, drawingId: c.drawingId, subUnitId: n }), u = e.fuzzyMathObjects(m, !0);
|
|
1601
1599
|
if (u.length)
|
|
1602
1600
|
for (const f of u)
|
|
1603
1601
|
e.detachTransformerFrom(f), f.setOpacity(0.5), (a && c.isMultiTransform !== oe.TRUE || !a && c.isMultiTransform === oe.TRUE) && (e.attachTransformerTo(f), f.setOpacity(1));
|
|
1604
1602
|
}
|
|
1605
1603
|
}
|
|
1606
1604
|
_editAreaChangeListener() {
|
|
1607
|
-
var
|
|
1608
|
-
const { unitId: i } = this._context, e = (
|
|
1605
|
+
var n;
|
|
1606
|
+
const { unitId: i } = this._context, e = (n = this._renderManagerSrv.getRenderById(i)) == null ? void 0 : n.with(ae).getViewModel();
|
|
1609
1607
|
e != null && (this._updateDrawingsEditStatus(), this.disposeWithMe(
|
|
1610
1608
|
e.editAreaChange$.subscribe(() => {
|
|
1611
1609
|
this._updateDrawingsEditStatus();
|
|
1612
1610
|
})
|
|
1613
|
-
), this._docRefreshDrawingsService.refreshDrawings$.subscribe((
|
|
1614
|
-
|
|
1611
|
+
), this._docRefreshDrawingsService.refreshDrawings$.subscribe((t) => {
|
|
1612
|
+
t != null && queueMicrotask(() => {
|
|
1615
1613
|
this._updateDrawingsEditStatus();
|
|
1616
1614
|
});
|
|
1617
1615
|
}), this.disposeWithMe(
|
|
1618
|
-
this._commandService.onCommandExecuted(async (
|
|
1619
|
-
|
|
1616
|
+
this._commandService.onCommandExecuted(async (t) => {
|
|
1617
|
+
t.id === Q.id && queueMicrotask(() => {
|
|
1620
1618
|
this._updateDrawingsEditStatus();
|
|
1621
1619
|
});
|
|
1622
1620
|
})
|
|
1623
1621
|
));
|
|
1624
1622
|
}
|
|
1625
1623
|
};
|
|
1626
|
-
|
|
1624
|
+
fn = Qi([
|
|
1627
1625
|
de(1, $),
|
|
1628
|
-
de(2, pe(
|
|
1626
|
+
de(2, pe(un)),
|
|
1629
1627
|
de(3, se),
|
|
1630
|
-
de(4,
|
|
1628
|
+
de(4, kt),
|
|
1631
1629
|
de(5, Re),
|
|
1632
1630
|
de(6, he),
|
|
1633
|
-
de(7,
|
|
1631
|
+
de(7, Fn),
|
|
1634
1632
|
de(8, oi),
|
|
1635
|
-
de(9, pe(
|
|
1636
|
-
de(10, pe(
|
|
1633
|
+
de(9, pe(an)),
|
|
1634
|
+
de(10, pe(un)),
|
|
1637
1635
|
de(11, Ue),
|
|
1638
|
-
de(12, pe(
|
|
1639
|
-
],
|
|
1640
|
-
var Ji = Object.defineProperty, er = Object.getOwnPropertyDescriptor,
|
|
1641
|
-
for (var r =
|
|
1642
|
-
(a = i[o]) && (r = (
|
|
1643
|
-
return
|
|
1644
|
-
}, We = (i, e) => (
|
|
1645
|
-
let
|
|
1646
|
-
constructor(e,
|
|
1636
|
+
de(12, pe(ln))
|
|
1637
|
+
], fn);
|
|
1638
|
+
var Ji = Object.defineProperty, er = Object.getOwnPropertyDescriptor, nr = (i, e, n, t) => {
|
|
1639
|
+
for (var r = t > 1 ? void 0 : t ? er(e, n) : e, o = i.length - 1, a; o >= 0; o--)
|
|
1640
|
+
(a = i[o]) && (r = (t ? a(e, n, r) : a(r)) || r);
|
|
1641
|
+
return t && r && Ji(e, n, r), r;
|
|
1642
|
+
}, We = (i, e) => (n, t) => e(n, t, i);
|
|
1643
|
+
let pn = class extends qe {
|
|
1644
|
+
constructor(e, n, t, r, o, a) {
|
|
1647
1645
|
super();
|
|
1648
|
-
_e(this, "_liquid", new
|
|
1649
|
-
this._context = e, this._docSkeletonManagerService =
|
|
1646
|
+
_e(this, "_liquid", new Wn());
|
|
1647
|
+
this._context = e, this._docSkeletonManagerService = n, this._commandService = t, this._editorService = r, this._drawingManagerService = o, this._docRefreshDrawingsService = a, this._initialize(), this._commandExecutedListener();
|
|
1650
1648
|
}
|
|
1651
1649
|
_initialize() {
|
|
1652
1650
|
this._initialRenderRefresh();
|
|
@@ -1659,11 +1657,11 @@ let ft = class extends qe {
|
|
|
1659
1657
|
});
|
|
1660
1658
|
}
|
|
1661
1659
|
_commandExecutedListener() {
|
|
1662
|
-
const e = [Q.id,
|
|
1660
|
+
const e = [Q.id, Zt.id];
|
|
1663
1661
|
this.disposeWithMe(
|
|
1664
|
-
this._commandService.onCommandExecuted((
|
|
1665
|
-
if (e.includes(
|
|
1666
|
-
const
|
|
1662
|
+
this._commandService.onCommandExecuted((n) => {
|
|
1663
|
+
if (e.includes(n.id)) {
|
|
1664
|
+
const t = n.params, { unitId: r } = t, { unitId: o, mainComponent: a } = this._context;
|
|
1667
1665
|
if (r !== o)
|
|
1668
1666
|
return;
|
|
1669
1667
|
const s = this._docSkeletonManagerService.getSkeleton();
|
|
@@ -1680,10 +1678,10 @@ let ft = class extends qe {
|
|
|
1680
1678
|
}
|
|
1681
1679
|
_refreshDrawing(e) {
|
|
1682
1680
|
var D, _;
|
|
1683
|
-
const
|
|
1684
|
-
if (!
|
|
1681
|
+
const n = e == null ? void 0 : e.getSkeletonData(), { mainComponent: t, unitId: r } = this._context, o = t;
|
|
1682
|
+
if (!n)
|
|
1685
1683
|
return;
|
|
1686
|
-
const { left: a, top: s, pageLayoutType: l, pageMarginLeft: c, pageMarginTop: m } = o, { pages: u, skeHeaders: f, skeFooters: h } =
|
|
1684
|
+
const { left: a, top: s, pageLayoutType: l, pageMarginLeft: c, pageMarginTop: m } = o, { pages: u, skeHeaders: f, skeFooters: h } = n, p = {};
|
|
1687
1685
|
this._liquid.reset();
|
|
1688
1686
|
for (let C = 0, O = u.length; C < O; C++) {
|
|
1689
1687
|
const y = u[C], { headerId: T, footerId: N, pageWidth: R } = y;
|
|
@@ -1717,26 +1715,26 @@ let ft = class extends qe {
|
|
|
1717
1715
|
v.length > 0 && this._drawingManagerService.refreshTransform(v), I.length > 0 && this._handleMultiDrawingsTransform(I);
|
|
1718
1716
|
}
|
|
1719
1717
|
_handleMultiDrawingsTransform(e) {
|
|
1720
|
-
const { scene:
|
|
1718
|
+
const { scene: n, unitId: t } = this._context, r = n.getTransformerByCreate();
|
|
1721
1719
|
e.forEach((l) => {
|
|
1722
1720
|
const c = this._drawingManagerService.getDrawingByParam(l);
|
|
1723
1721
|
c != null && (c.transform = l.transform, c.transforms = l.transforms, c.isMultiTransform = l.isMultiTransform);
|
|
1724
1722
|
});
|
|
1725
|
-
const a = [...r.getSelectedObjectMap().keys()], s = Object.values(this._drawingManagerService.getDrawingData(
|
|
1723
|
+
const a = [...r.getSelectedObjectMap().keys()], s = Object.values(this._drawingManagerService.getDrawingData(t, t)).filter((l) => l.isMultiTransform === oe.TRUE);
|
|
1726
1724
|
this._drawingManagerService.removeNotification(s), this._drawingManagerService.addNotification(e);
|
|
1727
1725
|
for (const l of a) {
|
|
1728
|
-
const c =
|
|
1726
|
+
const c = n.getObject(l);
|
|
1729
1727
|
c && r.setSelectedControl(c);
|
|
1730
1728
|
}
|
|
1731
1729
|
}
|
|
1732
|
-
_calculateDrawingPosition(e,
|
|
1733
|
-
const { skeDrawings: l } =
|
|
1730
|
+
_calculateDrawingPosition(e, n, t, r, o, a, s) {
|
|
1731
|
+
const { skeDrawings: l } = n;
|
|
1734
1732
|
this._liquid.translatePagePadding({
|
|
1735
1733
|
marginTop: a,
|
|
1736
1734
|
marginLeft: s
|
|
1737
1735
|
}), l.forEach((c) => {
|
|
1738
1736
|
const { aLeft: m, aTop: u, height: f, width: h, angle: p, drawingId: w, drawingOrigin: v } = c, I = v.layoutType === k.WRAP_NONE && v.behindDoc === oe.TRUE, { isMultiTransform: D = oe.FALSE } = v, _ = {
|
|
1739
|
-
left: m +
|
|
1737
|
+
left: m + t + this._liquid.x,
|
|
1740
1738
|
top: u + r + this._liquid.y,
|
|
1741
1739
|
width: h,
|
|
1742
1740
|
height: f,
|
|
@@ -1757,49 +1755,49 @@ let ft = class extends qe {
|
|
|
1757
1755
|
});
|
|
1758
1756
|
}
|
|
1759
1757
|
};
|
|
1760
|
-
|
|
1758
|
+
pn = nr([
|
|
1761
1759
|
We(1, pe(ae)),
|
|
1762
1760
|
We(2, $),
|
|
1763
1761
|
We(3, ai),
|
|
1764
1762
|
We(4, he),
|
|
1765
|
-
We(5, pe(
|
|
1766
|
-
],
|
|
1767
|
-
var
|
|
1768
|
-
for (var r =
|
|
1769
|
-
(a = i[o]) && (r = (
|
|
1770
|
-
return
|
|
1771
|
-
}, Ge = (i, e) => (
|
|
1763
|
+
We(5, pe(ln))
|
|
1764
|
+
], pn);
|
|
1765
|
+
var tr = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, rr = (i, e, n, t) => {
|
|
1766
|
+
for (var r = t > 1 ? void 0 : t ? ir(e, n) : e, o = i.length - 1, a; o >= 0; o--)
|
|
1767
|
+
(a = i[o]) && (r = (t ? a(e, n, r) : a(r)) || r);
|
|
1768
|
+
return t && r && tr(e, n, r), r;
|
|
1769
|
+
}, Ge = (i, e) => (n, t) => e(n, t, i);
|
|
1772
1770
|
function or(i) {
|
|
1773
|
-
var
|
|
1771
|
+
var t, r, o, a;
|
|
1774
1772
|
if (X.isNoop(i) || !Array.isArray(i))
|
|
1775
1773
|
return null;
|
|
1776
1774
|
const e = i.find((s) => Array.isArray(s) && (s == null ? void 0 : s[0]) === "drawings");
|
|
1777
1775
|
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")
|
|
1778
1776
|
return null;
|
|
1779
|
-
const
|
|
1777
|
+
const n = [];
|
|
1780
1778
|
if (Array.isArray(e == null ? void 0 : e[1]))
|
|
1781
1779
|
for (const s of e)
|
|
1782
|
-
Array.isArray(s) &&
|
|
1783
|
-
type: (
|
|
1780
|
+
Array.isArray(s) && n.push({
|
|
1781
|
+
type: (t = s == null ? void 0 : s[1]) != null && t.i ? "add" : "remove",
|
|
1784
1782
|
drawingId: s == null ? void 0 : s[0],
|
|
1785
1783
|
drawing: (r = s == null ? void 0 : s[1]) == null ? void 0 : r.i
|
|
1786
1784
|
});
|
|
1787
1785
|
else
|
|
1788
|
-
|
|
1786
|
+
n.push({
|
|
1789
1787
|
type: (o = e[2]) != null && o.i ? "add" : "remove",
|
|
1790
1788
|
drawingId: e[1],
|
|
1791
1789
|
drawing: (a = e[2]) == null ? void 0 : a.i
|
|
1792
1790
|
});
|
|
1793
|
-
return
|
|
1791
|
+
return n;
|
|
1794
1792
|
}
|
|
1795
1793
|
function ar(i) {
|
|
1796
1794
|
if (!Array.isArray(i) || i.length < 3 || i[0] !== "drawingsOrder")
|
|
1797
1795
|
return [];
|
|
1798
1796
|
const e = [];
|
|
1799
|
-
for (let
|
|
1800
|
-
const
|
|
1801
|
-
if (Array.isArray(
|
|
1802
|
-
e.push(
|
|
1797
|
+
for (let n = 1; n < i.length; n++) {
|
|
1798
|
+
const t = i[n];
|
|
1799
|
+
if (Array.isArray(t) && typeof t[0] == "number" && typeof t[1] == "object")
|
|
1800
|
+
e.push(t[0]);
|
|
1803
1801
|
else {
|
|
1804
1802
|
e.length = 0;
|
|
1805
1803
|
break;
|
|
@@ -1807,9 +1805,9 @@ function ar(i) {
|
|
|
1807
1805
|
}
|
|
1808
1806
|
return e;
|
|
1809
1807
|
}
|
|
1810
|
-
let
|
|
1811
|
-
constructor(i, e,
|
|
1812
|
-
super(), this._univerInstanceService = i, this._commandService = e, this._drawingManagerService =
|
|
1808
|
+
let nn = class extends qe {
|
|
1809
|
+
constructor(i, e, n, t, r) {
|
|
1810
|
+
super(), this._univerInstanceService = i, this._commandService = e, this._drawingManagerService = n, this._docDrawingService = t, this._renderManagerService = r, this._initialize();
|
|
1813
1811
|
}
|
|
1814
1812
|
_initialize() {
|
|
1815
1813
|
this._commandExecutedListener();
|
|
@@ -1819,27 +1817,27 @@ let tt = class extends qe {
|
|
|
1819
1817
|
this._commandService.beforeCommandExecuted((i) => {
|
|
1820
1818
|
if (i.id !== Q.id)
|
|
1821
1819
|
return;
|
|
1822
|
-
const e = i.params, { unitId:
|
|
1820
|
+
const e = i.params, { unitId: n, actions: t } = e, r = or(t);
|
|
1823
1821
|
if (r != null)
|
|
1824
1822
|
for (const { type: o, drawingId: a, drawing: s } of r)
|
|
1825
|
-
o === "add" ? this._addDrawings(
|
|
1823
|
+
o === "add" ? this._addDrawings(n, [s]) : this._removeDrawings(n, [a]);
|
|
1826
1824
|
})
|
|
1827
1825
|
), this.disposeWithMe(
|
|
1828
1826
|
this._commandService.onCommandExecuted((i) => {
|
|
1829
1827
|
if (i.id !== Q.id)
|
|
1830
1828
|
return;
|
|
1831
|
-
const e = i.params, { unitId:
|
|
1832
|
-
ar(
|
|
1829
|
+
const e = i.params, { unitId: n, actions: t } = e;
|
|
1830
|
+
ar(t).length > 0 && this._updateDrawingsOrder(n);
|
|
1833
1831
|
})
|
|
1834
1832
|
), this.disposeWithMe(
|
|
1835
1833
|
this._commandService.onCommandExecuted((i) => {
|
|
1836
1834
|
var a;
|
|
1837
|
-
if (i.id !==
|
|
1835
|
+
if (i.id !== Dt.id && i.id !== Et.id)
|
|
1838
1836
|
return;
|
|
1839
|
-
const e = (a = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : a.getUnitId(),
|
|
1840
|
-
if (e == null ||
|
|
1837
|
+
const e = (a = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : a.getUnitId(), n = this._drawingManagerService.getFocusDrawings();
|
|
1838
|
+
if (e == null || n.length === 0)
|
|
1841
1839
|
return;
|
|
1842
|
-
const
|
|
1840
|
+
const t = this._renderManagerService.getRenderById(e), r = t == null ? void 0 : t.scene;
|
|
1843
1841
|
if (r == null)
|
|
1844
1842
|
return !1;
|
|
1845
1843
|
r.getTransformerByCreate().refreshControls();
|
|
@@ -1847,57 +1845,57 @@ let tt = class extends qe {
|
|
|
1847
1845
|
);
|
|
1848
1846
|
}
|
|
1849
1847
|
_addDrawings(i, e) {
|
|
1850
|
-
const
|
|
1851
|
-
|
|
1848
|
+
const n = this._drawingManagerService, t = this._docDrawingService, r = this._docDrawingService.getBatchAddOp(e), { subUnitId: o, redo: a, objects: s } = r;
|
|
1849
|
+
n.applyJson1(i, o, a), t.applyJson1(i, o, a), n.addNotification(s), t.addNotification(s);
|
|
1852
1850
|
}
|
|
1853
1851
|
_removeDrawings(i, e) {
|
|
1854
|
-
const
|
|
1852
|
+
const n = this._drawingManagerService, t = this._docDrawingService, r = this._docDrawingService.getBatchRemoveOp(e.map((l) => ({
|
|
1855
1853
|
unitId: i,
|
|
1856
1854
|
subUnitId: i,
|
|
1857
1855
|
drawingId: l
|
|
1858
1856
|
}))), { subUnitId: o, redo: a, objects: s } = r;
|
|
1859
|
-
|
|
1857
|
+
n.applyJson1(i, o, a), t.applyJson1(i, o, a), n.removeNotification(s), t.removeNotification(s);
|
|
1860
1858
|
}
|
|
1861
1859
|
_updateDrawingsOrder(i) {
|
|
1862
1860
|
const e = this._univerInstanceService.getUniverDocInstance(i);
|
|
1863
1861
|
if (e == null)
|
|
1864
1862
|
return;
|
|
1865
|
-
const
|
|
1866
|
-
if (
|
|
1863
|
+
const n = e.getSnapshot().drawingsOrder;
|
|
1864
|
+
if (n == null)
|
|
1867
1865
|
return;
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1866
|
+
const t = this._drawingManagerService, r = this._docDrawingService;
|
|
1867
|
+
t.setDrawingOrder(i, i, n), r.setDrawingOrder(i, i, n);
|
|
1870
1868
|
const o = {
|
|
1871
1869
|
unitId: i,
|
|
1872
1870
|
subUnitId: i,
|
|
1873
|
-
drawingIds:
|
|
1871
|
+
drawingIds: n
|
|
1874
1872
|
};
|
|
1875
|
-
|
|
1873
|
+
t.orderNotification(o), r.orderNotification(o);
|
|
1876
1874
|
}
|
|
1877
1875
|
};
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
Ge(0,
|
|
1876
|
+
nn = rr([
|
|
1877
|
+
sn(cn.Steady, nn),
|
|
1878
|
+
Ge(0, ne),
|
|
1881
1879
|
Ge(1, $),
|
|
1882
1880
|
Ge(2, he),
|
|
1883
1881
|
Ge(3, Re),
|
|
1884
1882
|
Ge(4, se)
|
|
1885
|
-
],
|
|
1886
|
-
var sr = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, lr = (i, e,
|
|
1887
|
-
for (var r =
|
|
1888
|
-
(a = i[o]) && (r = (
|
|
1889
|
-
return
|
|
1890
|
-
}, Ve = (i, e) => (
|
|
1883
|
+
], nn);
|
|
1884
|
+
var sr = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, lr = (i, e, n, t) => {
|
|
1885
|
+
for (var r = t > 1 ? void 0 : t ? cr(e, n) : e, o = i.length - 1, a; o >= 0; o--)
|
|
1886
|
+
(a = i[o]) && (r = (t ? a(e, n, r) : a(r)) || r);
|
|
1887
|
+
return t && r && sr(e, n, r), r;
|
|
1888
|
+
}, Ve = (i, e) => (n, t) => e(n, t, i);
|
|
1891
1889
|
const dr = "__InlineDrawingAnchor__";
|
|
1892
|
-
let
|
|
1893
|
-
constructor(e,
|
|
1890
|
+
let tn = class extends qe {
|
|
1891
|
+
constructor(e, n, t, r, o) {
|
|
1894
1892
|
super();
|
|
1895
|
-
_e(this, "_liquid", new
|
|
1893
|
+
_e(this, "_liquid", new Wn());
|
|
1896
1894
|
_e(this, "_listenerOnImageMap", /* @__PURE__ */ new Set());
|
|
1897
1895
|
// Use to cache the drawings is under transforming or scaling.
|
|
1898
1896
|
_e(this, "_transformerCache", /* @__PURE__ */ new Map());
|
|
1899
1897
|
_e(this, "_anchorShape");
|
|
1900
|
-
this._commandService = e, this._univerInstanceService =
|
|
1898
|
+
this._commandService = e, this._univerInstanceService = n, this._drawingManagerService = t, this._renderManagerService = r, this._textSelectionRenderManager = o, this._init();
|
|
1901
1899
|
}
|
|
1902
1900
|
_init() {
|
|
1903
1901
|
this._listenDrawingFocus();
|
|
@@ -1906,9 +1904,9 @@ let nt = class extends qe {
|
|
|
1906
1904
|
this.disposeWithMe(
|
|
1907
1905
|
this._drawingManagerService.add$.subscribe((e) => {
|
|
1908
1906
|
if (e.length !== 0)
|
|
1909
|
-
for (const
|
|
1910
|
-
const { unitId:
|
|
1911
|
-
this._listenerOnImageMap.has(
|
|
1907
|
+
for (const n of e) {
|
|
1908
|
+
const { unitId: t } = n;
|
|
1909
|
+
this._listenerOnImageMap.has(t) || (this._listenTransformerChange(t), this._listenerOnImageMap.add(t));
|
|
1912
1910
|
}
|
|
1913
1911
|
})
|
|
1914
1912
|
);
|
|
@@ -1917,12 +1915,12 @@ let nt = class extends qe {
|
|
|
1917
1915
|
// eslint-disable-next-line max-lines-per-function
|
|
1918
1916
|
_listenTransformerChange(e) {
|
|
1919
1917
|
var r;
|
|
1920
|
-
const
|
|
1921
|
-
if (
|
|
1918
|
+
const n = (r = this._getSceneAndTransformerByDrawingSearch(e)) == null ? void 0 : r.transformer;
|
|
1919
|
+
if (n == null)
|
|
1922
1920
|
return;
|
|
1923
1921
|
this.disposeWithMe(
|
|
1924
1922
|
ye(
|
|
1925
|
-
|
|
1923
|
+
n.changeStart$.subscribe((o) => {
|
|
1926
1924
|
var s;
|
|
1927
1925
|
this._transformerCache.clear();
|
|
1928
1926
|
const { objects: a } = o;
|
|
@@ -1943,13 +1941,13 @@ let nt = class extends qe {
|
|
|
1943
1941
|
})
|
|
1944
1942
|
)
|
|
1945
1943
|
);
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1944
|
+
const t = Sn(this._updateMultipleDrawingDocTransform.bind(this), 50);
|
|
1945
|
+
Sn(this._nonInlineDrawingTransform.bind(this), 50), this.disposeWithMe(
|
|
1948
1946
|
ye(
|
|
1949
|
-
|
|
1947
|
+
n.changing$.subscribe((o) => {
|
|
1950
1948
|
const { objects: a, offsetX: s, offsetY: l } = o;
|
|
1951
1949
|
if (a.size > 1)
|
|
1952
|
-
|
|
1950
|
+
t(a);
|
|
1953
1951
|
else if (a.size === 1) {
|
|
1954
1952
|
const c = this._transformerCache.values().next().value, m = a.values().next().value, { width: u, height: f, top: h, left: p, angle: w } = m;
|
|
1955
1953
|
if (u === c.width && f === c.height && h === c.top && p === c.left && w === c.angle)
|
|
@@ -1960,7 +1958,7 @@ let nt = class extends qe {
|
|
|
1960
1958
|
)
|
|
1961
1959
|
), this.disposeWithMe(
|
|
1962
1960
|
ye(
|
|
1963
|
-
|
|
1961
|
+
n.changeEnd$.subscribe((o) => {
|
|
1964
1962
|
const { objects: a, offsetX: s, offsetY: l } = o;
|
|
1965
1963
|
for (const c of a.values()) {
|
|
1966
1964
|
const m = this._drawingManagerService.getDrawingOKey(c.oKey);
|
|
@@ -1986,40 +1984,40 @@ let nt = class extends qe {
|
|
|
1986
1984
|
_updateMultipleDrawingDocTransform(e) {
|
|
1987
1985
|
if (e.size < 1)
|
|
1988
1986
|
return;
|
|
1989
|
-
const
|
|
1990
|
-
let
|
|
1987
|
+
const n = [];
|
|
1988
|
+
let t, r;
|
|
1991
1989
|
for (const o of e.values()) {
|
|
1992
1990
|
const { oKey: a, left: s, top: l, angle: c } = o;
|
|
1993
1991
|
let { width: m, height: u } = o;
|
|
1994
1992
|
const f = this._drawingManagerService.getDrawingOKey(a);
|
|
1995
1993
|
if (f == null)
|
|
1996
1994
|
continue;
|
|
1997
|
-
|
|
1995
|
+
t == null && (t = f.unitId), r == null && (r = f.subUnitId);
|
|
1998
1996
|
const h = this._transformerCache.get(f.drawingId);
|
|
1999
1997
|
if (h == null)
|
|
2000
1998
|
continue;
|
|
2001
1999
|
const { drawing: p, top: w, left: v, width: I, height: D, angle: _ } = h, { width: C, height: O } = this._getPageContentSize(p);
|
|
2002
|
-
if (m = Math.min(m, C), u = Math.min(u, O), (I !== m || D !== u) &&
|
|
2000
|
+
if (m = Math.min(m, C), u = Math.min(u, O), (I !== m || D !== u) && n.push({
|
|
2003
2001
|
drawingId: f.drawingId,
|
|
2004
2002
|
key: "size",
|
|
2005
2003
|
value: {
|
|
2006
2004
|
width: m,
|
|
2007
2005
|
height: u
|
|
2008
2006
|
}
|
|
2009
|
-
}), _ !== c &&
|
|
2007
|
+
}), _ !== c && n.push({
|
|
2010
2008
|
drawingId: f.drawingId,
|
|
2011
2009
|
key: "angle",
|
|
2012
2010
|
value: c
|
|
2013
2011
|
}), w !== l || v !== s) {
|
|
2014
2012
|
const y = l - w, T = s - v;
|
|
2015
|
-
y !== 0 &&
|
|
2013
|
+
y !== 0 && n.push({
|
|
2016
2014
|
drawingId: f.drawingId,
|
|
2017
2015
|
key: "positionV",
|
|
2018
2016
|
value: {
|
|
2019
2017
|
relativeFrom: p.docTransform.positionV.relativeFrom,
|
|
2020
2018
|
posOffset: p.docTransform.positionV.posOffset + y
|
|
2021
2019
|
}
|
|
2022
|
-
}), T !== 0 &&
|
|
2020
|
+
}), T !== 0 && n.push({
|
|
2023
2021
|
drawingId: f.drawingId,
|
|
2024
2022
|
key: "positionH",
|
|
2025
2023
|
value: {
|
|
@@ -2029,38 +2027,38 @@ let nt = class extends qe {
|
|
|
2029
2027
|
});
|
|
2030
2028
|
}
|
|
2031
2029
|
}
|
|
2032
|
-
|
|
2033
|
-
unitId:
|
|
2030
|
+
n.length > 0 && t && r && this._commandService.executeCommand(ze.id, {
|
|
2031
|
+
unitId: t,
|
|
2034
2032
|
subUnitId: r,
|
|
2035
|
-
drawings:
|
|
2033
|
+
drawings: n
|
|
2036
2034
|
});
|
|
2037
2035
|
}
|
|
2038
2036
|
// TODO: @JOCS, Use to draw and update the drawing anchor.
|
|
2039
2037
|
_updateDrawingAnchor(e) {
|
|
2040
2038
|
if (this._transformerCache.size !== 1)
|
|
2041
2039
|
return;
|
|
2042
|
-
const
|
|
2043
|
-
this._getDrawingAnchor(
|
|
2040
|
+
const n = this._transformerCache.values().next().value, t = e.values().next().value;
|
|
2041
|
+
this._getDrawingAnchor(n.drawing, t);
|
|
2044
2042
|
}
|
|
2045
|
-
_updateInlineDrawingAnchor(e,
|
|
2043
|
+
_updateInlineDrawingAnchor(e, n, t) {
|
|
2046
2044
|
var o;
|
|
2047
2045
|
if (this._transformerCache.size !== 1)
|
|
2048
2046
|
return;
|
|
2049
|
-
const { contentBoxPointGroup: r } = (o = this._getInlineDrawingAnchor(e,
|
|
2047
|
+
const { contentBoxPointGroup: r } = (o = this._getInlineDrawingAnchor(e, n, t)) != null ? o : {};
|
|
2050
2048
|
r != null && this._createOrUpdateInlineAnchor(e.unitId, r);
|
|
2051
2049
|
}
|
|
2052
|
-
_getInlineDrawingAnchor(e,
|
|
2050
|
+
_getInlineDrawingAnchor(e, n, t) {
|
|
2053
2051
|
var z;
|
|
2054
2052
|
const r = this._renderManagerService.getRenderById(e.unitId), o = r == null ? void 0 : r.with(ae).getSkeleton();
|
|
2055
2053
|
if (r == null)
|
|
2056
2054
|
return;
|
|
2057
2055
|
const { mainComponent: a, scene: s } = r, l = a, c = s.getViewports()[0], {
|
|
2058
|
-
pageLayoutType: m =
|
|
2056
|
+
pageLayoutType: m = On.VERTICAL,
|
|
2059
2057
|
pageMarginLeft: u,
|
|
2060
2058
|
pageMarginTop: f
|
|
2061
2059
|
} = l.getOffsetConfig();
|
|
2062
2060
|
let h = null, p = !1, w = -1, v = "";
|
|
2063
|
-
const I = 0.5, D = this._getTransformCoordForDocumentOffset(l, c,
|
|
2061
|
+
const I = 0.5, D = this._getTransformCoordForDocumentOffset(l, c, n, t);
|
|
2064
2062
|
if (D == null)
|
|
2065
2063
|
return;
|
|
2066
2064
|
const _ = o == null ? void 0 : o.findNodeByCoord(
|
|
@@ -2086,18 +2084,18 @@ let nt = class extends qe {
|
|
|
2086
2084
|
const y = {
|
|
2087
2085
|
...C,
|
|
2088
2086
|
isBack: p
|
|
2089
|
-
}, T = O.document.getOffsetConfig(), N = new
|
|
2087
|
+
}, T = O.document.getOffsetConfig(), N = new Tn(T, o), { cursorList: R, contentBoxPointGroup: E } = N.getRangePointData(y, y), { startOffset: H } = (z = Mn(R)) != null ? z : {};
|
|
2090
2088
|
if (H != null)
|
|
2091
2089
|
return { offset: H, contentBoxPointGroup: E, segmentId: v, segmentPage: w };
|
|
2092
2090
|
}
|
|
2093
2091
|
// eslint-disable-next-line max-lines-per-function, complexity
|
|
2094
|
-
_getDrawingAnchor(e,
|
|
2095
|
-
var we, ve,
|
|
2096
|
-
const
|
|
2097
|
-
if (o == null ||
|
|
2092
|
+
_getDrawingAnchor(e, n) {
|
|
2093
|
+
var we, ve, te, Ne, Ie, Se, Te, Me, De, J;
|
|
2094
|
+
const t = this._renderManagerService.getRenderById(e.unitId), r = t == null ? void 0 : t.with(ae).getSkeleton(), o = r == null ? void 0 : r.getSkeletonData();
|
|
2095
|
+
if (o == null || t == null)
|
|
2098
2096
|
return;
|
|
2099
|
-
const { pages: a, skeHeaders: s, skeFooters: l } = o, { mainComponent: c, scene: m } =
|
|
2100
|
-
let { width: O, height: y } =
|
|
2097
|
+
const { pages: a, skeHeaders: s, skeFooters: l } = o, { mainComponent: c, scene: m } = t, u = c, f = m.getViewports()[0], { pageLayoutType: h = On.VERTICAL, pageMarginLeft: p, pageMarginTop: w, docsLeft: v, docsTop: I } = u.getOffsetConfig(), { left: D, top: _, angle: C } = n;
|
|
2098
|
+
let { width: O, height: y } = n;
|
|
2101
2099
|
const { positionV: T, positionH: N } = e.docTransform, { width: R, height: E } = this._getPageContentSize(e);
|
|
2102
2100
|
O = Math.min(O, R), y = Math.min(y, E);
|
|
2103
2101
|
let H = null, z = "", U = -1;
|
|
@@ -2117,37 +2115,37 @@ let nt = class extends qe {
|
|
|
2117
2115
|
segmentPage: this._textSelectionRenderManager.getSegmentPage()
|
|
2118
2116
|
});
|
|
2119
2117
|
if (L) {
|
|
2120
|
-
const { node: q, segmentPage:
|
|
2121
|
-
H = q, U =
|
|
2118
|
+
const { node: q, segmentPage: dn, segmentId: mn } = L;
|
|
2119
|
+
H = q, U = dn, z = mn;
|
|
2122
2120
|
}
|
|
2123
2121
|
if (H == null)
|
|
2124
2122
|
return;
|
|
2125
|
-
const x = (we = H.parent) == null ? void 0 : we.parent, M = x == null ? void 0 : x.parent, W = (ve = M == null ? void 0 : M.lines.find((q) => q.paragraphIndex === (x == null ? void 0 : x.paragraphIndex) && q.paragraphStart)) != null ? ve : M == null ? void 0 : M.lines[0], G = (
|
|
2123
|
+
const x = (we = H.parent) == null ? void 0 : we.parent, M = x == null ? void 0 : x.parent, W = (ve = M == null ? void 0 : M.lines.find((q) => q.paragraphIndex === (x == null ? void 0 : x.paragraphIndex) && q.paragraphStart)) != null ? ve : M == null ? void 0 : M.lines[0], G = (te = M == null ? void 0 : M.parent) == null ? void 0 : te.parent;
|
|
2126
2124
|
if (x == null || M == null || W == null || G == null)
|
|
2127
2125
|
return;
|
|
2128
2126
|
this._liquid.reset();
|
|
2129
2127
|
const F = G.type;
|
|
2130
2128
|
for (const q of a) {
|
|
2131
|
-
const { headerId:
|
|
2132
|
-
if (U > -1 &&
|
|
2129
|
+
const { headerId: dn, footerId: mn, pageHeight: pt, pageWidth: _n, marginLeft: Cn, marginBottom: ht } = q, wt = a.indexOf(q);
|
|
2130
|
+
if (U > -1 && wt === U) {
|
|
2133
2131
|
switch (F) {
|
|
2134
|
-
case
|
|
2135
|
-
const Fe = (Ne = s.get(
|
|
2132
|
+
case yn.HEADER: {
|
|
2133
|
+
const Fe = (Ne = s.get(dn)) == null ? void 0 : Ne.get(_n);
|
|
2136
2134
|
if (Fe)
|
|
2137
2135
|
this._liquid.translatePagePadding({
|
|
2138
2136
|
marginTop: Fe.marginTop,
|
|
2139
|
-
marginLeft:
|
|
2137
|
+
marginLeft: Cn
|
|
2140
2138
|
});
|
|
2141
2139
|
else
|
|
2142
2140
|
throw new Error("header skeleton not found");
|
|
2143
2141
|
break;
|
|
2144
2142
|
}
|
|
2145
|
-
case
|
|
2146
|
-
const Fe = (Ie = l.get(
|
|
2143
|
+
case yn.FOOTER: {
|
|
2144
|
+
const Fe = (Ie = l.get(mn)) == null ? void 0 : Ie.get(_n);
|
|
2147
2145
|
if (Fe)
|
|
2148
2146
|
this._liquid.translatePagePadding({
|
|
2149
|
-
marginTop:
|
|
2150
|
-
marginLeft:
|
|
2147
|
+
marginTop: pt - ht + Fe.marginTop,
|
|
2148
|
+
marginLeft: Cn
|
|
2151
2149
|
});
|
|
2152
2150
|
else
|
|
2153
2151
|
throw new Error("footer skeleton not found");
|
|
@@ -2198,37 +2196,37 @@ let nt = class extends qe {
|
|
|
2198
2196
|
const Oe = {
|
|
2199
2197
|
...ce,
|
|
2200
2198
|
isBack: B
|
|
2201
|
-
}, Be = fe.document.getOffsetConfig(), Ce = new
|
|
2199
|
+
}, Be = fe.document.getOffsetConfig(), Ce = new Tn(Be, r), { cursorList: K } = Ce.getRangePointData(Oe, Oe), { startOffset: le } = (J = Mn(K)) != null ? J : {};
|
|
2202
2200
|
if (le != null)
|
|
2203
2201
|
return { offset: le, docTransform: b, segmentId: z, segmentPage: U };
|
|
2204
2202
|
}
|
|
2205
2203
|
// Update drawing when use transformer to resize it.
|
|
2206
|
-
_updateDrawingSize(e,
|
|
2207
|
-
const
|
|
2208
|
-
let { width: m, height: u, angle: f } =
|
|
2204
|
+
_updateDrawingSize(e, n) {
|
|
2205
|
+
const t = [], { drawing: r, width: o, height: a, angle: s } = e, { unitId: l, subUnitId: c } = r;
|
|
2206
|
+
let { width: m, height: u, angle: f } = n;
|
|
2209
2207
|
const { width: h, height: p } = this._getPageContentSize(r);
|
|
2210
|
-
m = Math.min(h, m), u = Math.min(p, u), (m !== o || u !== a) &&
|
|
2208
|
+
m = Math.min(h, m), u = Math.min(p, u), (m !== o || u !== a) && t.push({
|
|
2211
2209
|
drawingId: r.drawingId,
|
|
2212
2210
|
key: "size",
|
|
2213
2211
|
value: {
|
|
2214
2212
|
width: m,
|
|
2215
2213
|
height: u
|
|
2216
2214
|
}
|
|
2217
|
-
}), f !== s &&
|
|
2215
|
+
}), f !== s && t.push({
|
|
2218
2216
|
drawingId: r.drawingId,
|
|
2219
2217
|
key: "angle",
|
|
2220
2218
|
value: f
|
|
2221
|
-
}),
|
|
2219
|
+
}), t.length > 0 && l && c && this._commandService.executeCommand(ze.id, {
|
|
2222
2220
|
unitId: l,
|
|
2223
2221
|
subUnitId: c,
|
|
2224
|
-
drawings:
|
|
2222
|
+
drawings: t
|
|
2225
2223
|
});
|
|
2226
2224
|
}
|
|
2227
2225
|
// Update inline drawing when use transformer to move it.
|
|
2228
|
-
_moveInlineDrawing(e,
|
|
2229
|
-
const r = this._getInlineDrawingAnchor(e,
|
|
2226
|
+
_moveInlineDrawing(e, n, t) {
|
|
2227
|
+
const r = this._getInlineDrawingAnchor(e, n, t), { offset: o, segmentId: a, segmentPage: s } = r != null ? r : {};
|
|
2230
2228
|
if (o != null)
|
|
2231
|
-
return this._commandService.executeCommand(
|
|
2229
|
+
return this._commandService.executeCommand(at.id, {
|
|
2232
2230
|
unitId: e.unitId,
|
|
2233
2231
|
subUnitId: e.unitId,
|
|
2234
2232
|
drawing: e,
|
|
@@ -2239,9 +2237,9 @@ let nt = class extends qe {
|
|
|
2239
2237
|
}
|
|
2240
2238
|
// Limit the drawing to the page area, mainly in the vertical direction,
|
|
2241
2239
|
// and the upper and lower limits cannot exceed the page margin area.
|
|
2242
|
-
_limitDrawingInPage(e,
|
|
2243
|
-
const
|
|
2244
|
-
if (m == null ||
|
|
2240
|
+
_limitDrawingInPage(e, n) {
|
|
2241
|
+
const t = this._renderManagerService.getRenderById(e.unitId), { left: r, top: o, width: a, height: s, angle: l } = n, c = t == null ? void 0 : t.with(ae).getSkeleton(), m = c == null ? void 0 : c.getSkeletonData(), { pages: u } = m != null ? m : {};
|
|
2242
|
+
if (m == null || t == null || u == null)
|
|
2245
2243
|
return {
|
|
2246
2244
|
left: r,
|
|
2247
2245
|
top: o,
|
|
@@ -2249,7 +2247,7 @@ let nt = class extends qe {
|
|
|
2249
2247
|
height: s,
|
|
2250
2248
|
angle: l
|
|
2251
2249
|
};
|
|
2252
|
-
const { mainComponent: f } =
|
|
2250
|
+
const { mainComponent: f } = t, h = f, { top: p, pageLayoutType: w, pageMarginLeft: v, pageMarginTop: I } = h;
|
|
2253
2251
|
let D = o;
|
|
2254
2252
|
this._liquid.reset();
|
|
2255
2253
|
for (const _ of u) {
|
|
@@ -2275,12 +2273,12 @@ let nt = class extends qe {
|
|
|
2275
2273
|
angle: l
|
|
2276
2274
|
};
|
|
2277
2275
|
}
|
|
2278
|
-
_nonInlineDrawingTransform(e,
|
|
2279
|
-
const r = e.isMultiTransform === oe.TRUE ?
|
|
2280
|
-
if (
|
|
2276
|
+
_nonInlineDrawingTransform(e, n, t = !1) {
|
|
2277
|
+
const r = e.isMultiTransform === oe.TRUE ? n : this._limitDrawingInPage(e, n);
|
|
2278
|
+
if (t && r.top !== n.top)
|
|
2281
2279
|
return;
|
|
2282
2280
|
const o = this._getDrawingAnchor(e, r), { offset: a, docTransform: s, segmentId: l, segmentPage: c } = o != null ? o : {};
|
|
2283
|
-
return a == null || s == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId,
|
|
2281
|
+
return a == null || s == null ? this._updateMultipleDrawingDocTransform(/* @__PURE__ */ new Map([[e.drawingId, n]])) : this._commandService.executeCommand(st.id, {
|
|
2284
2282
|
unitId: e.unitId,
|
|
2285
2283
|
subUnitId: e.unitId,
|
|
2286
2284
|
drawing: e,
|
|
@@ -2293,45 +2291,45 @@ let nt = class extends qe {
|
|
|
2293
2291
|
_getSceneAndTransformerByDrawingSearch(e) {
|
|
2294
2292
|
if (e == null)
|
|
2295
2293
|
return;
|
|
2296
|
-
const
|
|
2297
|
-
if (
|
|
2294
|
+
const n = this._renderManagerService.getRenderById(e), t = n == null ? void 0 : n.scene;
|
|
2295
|
+
if (t == null)
|
|
2298
2296
|
return;
|
|
2299
|
-
const r =
|
|
2300
|
-
return { scene:
|
|
2297
|
+
const r = t.getTransformerByCreate();
|
|
2298
|
+
return { scene: t, transformer: r };
|
|
2301
2299
|
}
|
|
2302
|
-
_getTransformCoordForDocumentOffset(e,
|
|
2303
|
-
const { documentTransform: o } = e.getOffsetConfig(), a =
|
|
2300
|
+
_getTransformCoordForDocumentOffset(e, n, t, r) {
|
|
2301
|
+
const { documentTransform: o } = e.getOffsetConfig(), a = n.transformVector2SceneCoord(Gt.FromArray([t, r]));
|
|
2304
2302
|
if (a)
|
|
2305
2303
|
return o.clone().invert().applyPoint(a);
|
|
2306
2304
|
}
|
|
2307
|
-
_createOrUpdateInlineAnchor(e,
|
|
2308
|
-
const
|
|
2309
|
-
if (
|
|
2305
|
+
_createOrUpdateInlineAnchor(e, n) {
|
|
2306
|
+
const t = this._renderManagerService.getRenderById(e);
|
|
2307
|
+
if (t == null)
|
|
2310
2308
|
return;
|
|
2311
|
-
const { mainComponent: r, scene: o } =
|
|
2309
|
+
const { mainComponent: r, scene: o } = t, a = r, {
|
|
2312
2310
|
docsLeft: s,
|
|
2313
2311
|
docsTop: l
|
|
2314
|
-
} = a.getOffsetConfig(), c =
|
|
2312
|
+
} = a.getOffsetConfig(), c = Vt(n), { left: m, top: u, height: f } = c, h = m + s, p = u + l;
|
|
2315
2313
|
if (this._anchorShape) {
|
|
2316
2314
|
this._anchorShape.transformByState({ left: h, top: p, height: f }), this._anchorShape.show();
|
|
2317
2315
|
return;
|
|
2318
2316
|
}
|
|
2319
|
-
const w = 6, v = new
|
|
2317
|
+
const w = 6, v = new jt(dr + Pe.generateRandomId(w), {
|
|
2320
2318
|
left: h,
|
|
2321
2319
|
top: p,
|
|
2322
2320
|
height: f,
|
|
2323
2321
|
strokeWidth: 2,
|
|
2324
|
-
stroke: $
|
|
2322
|
+
stroke: $t(Pt.darkGray, 1),
|
|
2325
2323
|
evented: !1
|
|
2326
2324
|
});
|
|
2327
|
-
this._anchorShape = v, o.addObject(v,
|
|
2325
|
+
this._anchorShape = v, o.addObject(v, zt);
|
|
2328
2326
|
}
|
|
2329
2327
|
_getDocObject() {
|
|
2330
|
-
return
|
|
2328
|
+
return Qt(this._univerInstanceService, this._renderManagerService);
|
|
2331
2329
|
}
|
|
2332
2330
|
_getPageContentSize(e) {
|
|
2333
|
-
const
|
|
2334
|
-
if (a == null ||
|
|
2331
|
+
const n = this._renderManagerService.getRenderById(e.unitId), t = n == null ? void 0 : n.with(ae).getSkeleton(), r = 500, o = 500, a = t == null ? void 0 : t.getSkeletonData();
|
|
2332
|
+
if (a == null || n == null)
|
|
2335
2333
|
return {
|
|
2336
2334
|
width: r,
|
|
2337
2335
|
height: o
|
|
@@ -2358,58 +2356,58 @@ let nt = class extends qe {
|
|
|
2358
2356
|
};
|
|
2359
2357
|
}
|
|
2360
2358
|
};
|
|
2361
|
-
|
|
2362
|
-
|
|
2359
|
+
tn = lr([
|
|
2360
|
+
sn(cn.Rendered, tn),
|
|
2363
2361
|
Ve(0, $),
|
|
2364
|
-
Ve(1,
|
|
2362
|
+
Ve(1, ne),
|
|
2365
2363
|
Ve(2, he),
|
|
2366
2364
|
Ve(3, se),
|
|
2367
2365
|
Ve(4, Ue)
|
|
2368
|
-
],
|
|
2369
|
-
var
|
|
2370
|
-
for (var r =
|
|
2371
|
-
(a = i[o]) && (r = (
|
|
2372
|
-
return
|
|
2373
|
-
},
|
|
2366
|
+
], tn);
|
|
2367
|
+
var ut = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, gr = (i, e, n) => e in i ? ut(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n, ur = (i, e, n, t) => {
|
|
2368
|
+
for (var r = t > 1 ? void 0 : t ? mr(e, n) : e, o = i.length - 1, a; o >= 0; o--)
|
|
2369
|
+
(a = i[o]) && (r = (t ? a(e, n, r) : a(r)) || r);
|
|
2370
|
+
return t && r && ut(e, n, r), r;
|
|
2371
|
+
}, Bn = (i, e) => (n, t) => e(n, t, i), ft = (i, e, n) => gr(i, typeof e != "symbol" ? e + "" : e, n);
|
|
2374
2372
|
const fr = "DOCS_DRAWING_UI_PLUGIN";
|
|
2375
|
-
let
|
|
2376
|
-
constructor(i, e,
|
|
2377
|
-
super(), this._injector = e, this._renderManagerSrv =
|
|
2373
|
+
let on = class extends Ot {
|
|
2374
|
+
constructor(i, e, n) {
|
|
2375
|
+
super(), this._injector = e, this._renderManagerSrv = n;
|
|
2378
2376
|
}
|
|
2379
2377
|
onStarting(i) {
|
|
2380
2378
|
[
|
|
2381
|
-
[
|
|
2379
|
+
[en],
|
|
2382
2380
|
[Je],
|
|
2383
|
-
[
|
|
2384
|
-
[
|
|
2385
|
-
[
|
|
2386
|
-
].forEach((
|
|
2381
|
+
[tn],
|
|
2382
|
+
[nn],
|
|
2383
|
+
[ln]
|
|
2384
|
+
].forEach((n) => i.add(n));
|
|
2387
2385
|
}
|
|
2388
2386
|
onReady() {
|
|
2389
2387
|
[
|
|
2390
|
-
[
|
|
2391
|
-
[
|
|
2388
|
+
[fn],
|
|
2389
|
+
[pn]
|
|
2392
2390
|
].forEach((i) => this._renderManagerSrv.registerRenderModule(be.UNIVER_DOC, i));
|
|
2393
2391
|
}
|
|
2394
2392
|
};
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
],
|
|
2393
|
+
ft(on, "type", be.UNIVER_DOC);
|
|
2394
|
+
ft(on, "pluginName", fr);
|
|
2395
|
+
on = ur([
|
|
2396
|
+
Tt(At, Ht, Wt),
|
|
2397
|
+
Bn(1, pe(Hn)),
|
|
2398
|
+
Bn(2, se)
|
|
2399
|
+
], on);
|
|
2402
2400
|
export {
|
|
2403
2401
|
Wi as ClearDocDrawingTransformerOperation,
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2402
|
+
ct as DeleteDocDrawingsCommand,
|
|
2403
|
+
Kn as EditDocDrawingOperation,
|
|
2404
|
+
mt as GroupDocDrawingCommand,
|
|
2405
|
+
gt as InsertDocDrawingCommand,
|
|
2406
|
+
In as InsertDocImageOperation,
|
|
2409
2407
|
Xe as MoveDocDrawingsCommand,
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2408
|
+
vn as RemoveDocDrawingCommand,
|
|
2409
|
+
lt as SetDocDrawingArrangeCommand,
|
|
2410
|
+
Xn as SidebarDocDrawingOperation,
|
|
2411
|
+
dt as UngroupDocDrawingCommand,
|
|
2412
|
+
on as UniverDocsDrawingUIPlugin
|
|
2415
2413
|
};
|