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