@univerjs/docs-ui 0.2.4-alpha.0 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +4 -4
- package/lib/es/index.js +1441 -1089
- package/lib/index.css +1 -1
- package/lib/types/controllers/doc-ui.controller.d.ts +8 -3
- package/lib/types/controllers/menu/context-menu.d.ts +7 -0
- package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +18 -0
- package/lib/types/controllers/render-controllers/doc-hover.render-controller.d.ts +11 -0
- package/lib/types/controllers/render-controllers/doc-resize.render-controller.d.ts +12 -0
- package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +4 -3
- package/lib/types/controllers/shortcut/toolbar.shortcut.d.ts +14 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/doc-hover-manager.service.d.ts +18 -0
- package/lib/types/services/doc-page-layout.service.d.ts +8 -0
- package/lib/types/views/count-bar/CountBar.d.ts +8 -0
- package/lib/types/views/count-bar/ZoomSlider.d.ts +3 -0
- package/lib/types/views/count-bar/index.d.ts +16 -0
- package/lib/types/views/doc-footer/DocFooter.d.ts +3 -0
- package/lib/types/views/doc-footer/index.d.ts +16 -0
- package/lib/umd/index.js +4 -4
- package/package.json +12 -12
- package/lib/types/services/doc-mark-selection.service.d.ts +0 -27
package/lib/es/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { FOCUSING_DOC as
|
|
5
|
-
import { IClipboardInterfaceService as
|
|
6
|
-
import { TextSelectionManagerService as
|
|
7
|
-
import { pixelToPt as
|
|
8
|
-
import { takeUntil as
|
|
9
|
-
import
|
|
10
|
-
import { Checkbox as
|
|
11
|
-
import
|
|
12
|
-
function
|
|
13
|
-
return t.getContextValue(
|
|
1
|
+
var eo = Object.defineProperty;
|
|
2
|
+
var to = (t, e, n) => e in t ? eo(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var I = (t, e, n) => to(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { FOCUSING_DOC as $e, FOCUSING_UNIVER_EDITOR as vt, FOCUSING_COMMON_DRAWINGS as un, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as no, Tools as K, LRUMap as oo, BaselineOffset as ue, BooleanNumber as R, ColorKit as yt, DataStreamTreeTokenType as Ne, CustomRangeType as hn, skipParseTagNames as io, createIdentifier as ro, Inject as M, IUniverInstanceService as L, ILogService as gn, ICommandService as E, Disposable as z, SliceBodyType as Pt, normalizeBody as so, UniverInstanceType as v, toDisposable as _n, RxDisposable as Te, Direction as ee, EDITOR_ACTIVATED as pn, LocaleService as _e, Injector as Be, Optional as ao, useDependency as Y, useObservable as co, CommandType as pe, DocumentFlavor as lo, JSONX as it, ThemeService as fn, HorizontalAlign as He, connectInjector as uo, OnLifecycle as Ve, LifecycleStages as je, IContextService as ho, checkForSubstrings as go, IConfigService as _o, isInternalEditorID as po, DisposableCollection as At, DEFAULT_EMPTY_DOCUMENT_VALUE as mn, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Sn, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as vn, DOCS_ZEN_EDITOR_UNIT_ID_KEY as fo, fromEventSubject as rt, Plugin as mo, ObjectRelativeFromH as So, ObjectRelativeFromV as vo } from "@univerjs/core";
|
|
5
|
+
import { IClipboardInterfaceService as Ct, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as Co, HTML_CLIPBOARD_MIME_TYPE as Ro, IEditorService as oe, KeyCode as D, MetaKeys as x, ILayoutService as Cn, ISidebarService as Oo, ComponentManager as Rn, MenuGroup as F, MenuItemType as y, MenuPosition as P, getMenuHiddenObservable as U, FONT_FAMILY_LIST as Nt, FONT_SIZE_LIST as To, getHeaderFooterMenuHiddenObservable as Eo, CopyCommand as Io, CutCommand as Mo, PasteCommand as bo, FontFamily as xo, FontFamilyItem as Do, FontSize as yo, BuiltInUIPart as Po, IMenuService as Ao, IUIPartsService as No, IShortcutService as On, SetEditorResizeOperation as Fo, ICanvasPopupService as Uo, IContextMenuService as Lo } from "@univerjs/ui";
|
|
6
|
+
import { TextSelectionManagerService as Z, DocCustomRangeService as wo, CutContentCommand as Tn, InnerPasteCommand as En, getDeleteSelection as $o, DocSkeletonManagerService as $, VIEWPORT_KEY as J, getDocObject as Bo, MoveCursorOperation as We, MoveSelectionOperation as ze, SelectAllOperation as Ho, SetDocZoomRatioOperation as he, neoGetDocObject as Q, RichTextEditingMutation as Ge, SetInlineFormatBoldCommand as In, SetTextSelectionsOperation as G, SetInlineFormatCommand as fe, SetInlineFormatItalicCommand as Mn, SetInlineFormatUnderlineCommand as bn, SetInlineFormatStrikethroughCommand as xn, SetInlineFormatSubscriptCommand as Dn, SetInlineFormatSuperscriptCommand as yn, SetInlineFormatFontFamilyCommand as Ft, SetInlineFormatFontSizeCommand as Ut, SetInlineFormatTextColorCommand as Lt, AlignLeftCommand as Pn, AlignOperationCommand as ke, AlignCenterCommand as An, AlignRightCommand as Nn, AlignJustifyCommand as Fn, OrderListCommand as Un, BulletListCommand as Ln, ResetInlineFormatTextBackgroundColorCommand as Vo, SetInlineFormatTextBackgroundColorCommand as st, DeleteLeftCommand as wn, BreakLineCommand as jo, DeleteRightCommand as Wo, CoverContentCommand as zo, DOCS_COMPONENT_MAIN_LAYER_INDEX as Je, DOCS_COMPONENT_HEADER_LAYER_INDEX as Go, DOCS_VIEW_KEY as se, DOCS_COMPONENT_DEFAULT_Z_INDEX as wt, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX as ko, SetDocZoomRatioCommand as Yo, DocInterceptorService as Xo } from "@univerjs/docs";
|
|
7
|
+
import { pixelToPt as Ko, ptToPixel as $t, NodePositionConvertToCursor as $n, getAnchorBounding as Zo, IRenderManagerService as X, ITextSelectionRenderManager as ie, Shape as Jo, DocumentEditArea as w, PageLayoutType as Oe, Vector2 as Rt, Rect as qe, Path as Bt, ScrollBar as at, Viewport as qo, Layer as Ht, Documents as Qo, DocBackground as ei, CURSOR_TYPE as Vt, pxToNum as jt, getLineBounding as ti, TRANSFORM_CHANGE_OBSERVABLE_TYPE as ni } from "@univerjs/engine-render";
|
|
8
|
+
import { takeUntil as de, Observable as B, combineLatest as oi, fromEvent as Wt, BehaviorSubject as Fe, map as ii, filter as ri, throttleTime as Bn, debounceTime as si } from "rxjs";
|
|
9
|
+
import ai, { useMemo as ci, useCallback as li, useState as Ot, useEffect as Tt } from "react";
|
|
10
|
+
import { Slider as di, Checkbox as zt, InputNumber as Gt, Button as ui, ColorPicker as hi } from "@univerjs/design";
|
|
11
|
+
import gi from "clsx";
|
|
12
|
+
function A(t) {
|
|
13
|
+
return t.getContextValue($e) && t.getContextValue(vt) && !t.getContextValue(un);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return t.getContextValue(
|
|
15
|
+
function _i(t) {
|
|
16
|
+
return t.getContextValue($e) && t.getContextValue(vt) && !t.getContextValue(no) && !t.getContextValue(un);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
function
|
|
20
|
-
return
|
|
18
|
+
const pi = 10, fi = 6;
|
|
19
|
+
function mi() {
|
|
20
|
+
return K.generateRandomId(fi);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Si(t) {
|
|
23
23
|
const e = t.match(/data-copy-id="([^\s]+)"/);
|
|
24
24
|
return e && e[1] ? e[1] : null;
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class vi {
|
|
27
27
|
constructor() {
|
|
28
|
-
|
|
28
|
+
I(this, "_cache", new oo(pi));
|
|
29
29
|
}
|
|
30
30
|
set(e, n) {
|
|
31
31
|
this._cache.set(e, n);
|
|
@@ -37,77 +37,77 @@ class $o {
|
|
|
37
37
|
this._cache.clear();
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
function
|
|
40
|
+
const kt = new vi();
|
|
41
|
+
function Et(t) {
|
|
42
42
|
const e = t.style, n = {}, o = t.tagName.toLowerCase();
|
|
43
43
|
switch (o) {
|
|
44
44
|
case "b":
|
|
45
45
|
case "em":
|
|
46
46
|
case "strong": {
|
|
47
|
-
n.bl =
|
|
47
|
+
n.bl = R.TRUE;
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
case "s": {
|
|
51
51
|
n.st = {
|
|
52
|
-
s:
|
|
52
|
+
s: R.TRUE
|
|
53
53
|
};
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
case "u": {
|
|
57
57
|
n.ul = {
|
|
58
|
-
s:
|
|
58
|
+
s: R.TRUE
|
|
59
59
|
};
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
62
|
case "i": {
|
|
63
|
-
n.it =
|
|
63
|
+
n.it = R.TRUE;
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
case "sub":
|
|
67
67
|
case "sup": {
|
|
68
|
-
n.va = o === "sup" ?
|
|
68
|
+
n.va = o === "sup" ? ue.SUPERSCRIPT : ue.SUBSCRIPT;
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
for (let
|
|
73
|
-
const
|
|
74
|
-
switch (
|
|
72
|
+
for (let i = 0; i < e.length; i++) {
|
|
73
|
+
const r = e[i], s = e.getPropertyValue(r);
|
|
74
|
+
switch (r) {
|
|
75
75
|
case "font-family": {
|
|
76
76
|
n.ff = s;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
case "font-size": {
|
|
80
80
|
const a = Number.parseInt(s);
|
|
81
|
-
Number.isNaN(a) || (s.endsWith("pt") ? n.fs = a : s.endsWith("px") && (n.fs =
|
|
81
|
+
Number.isNaN(a) || (s.endsWith("pt") ? n.fs = a : s.endsWith("px") && (n.fs = Ko(a)));
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
case "font-style": {
|
|
85
|
-
s === "italic" && (n.it =
|
|
85
|
+
s === "italic" && (n.it = R.TRUE);
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
case "font-weight": {
|
|
89
|
-
(Number(s) > 400 || String(s) === "bold") && (n.bl =
|
|
89
|
+
(Number(s) > 400 || String(s) === "bold") && (n.bl = R.TRUE);
|
|
90
90
|
break;
|
|
91
91
|
}
|
|
92
92
|
case "text-decoration": {
|
|
93
93
|
/underline/.test(s) ? n.ul = {
|
|
94
|
-
s:
|
|
94
|
+
s: R.TRUE
|
|
95
95
|
} : /overline/.test(s) ? n.ol = {
|
|
96
|
-
s:
|
|
96
|
+
s: R.TRUE
|
|
97
97
|
} : /line-through/.test(s) && (n.st = {
|
|
98
|
-
s:
|
|
98
|
+
s: R.TRUE
|
|
99
99
|
});
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
case "color": {
|
|
103
|
-
const a = new
|
|
103
|
+
const a = new yt(s);
|
|
104
104
|
a.isValid && (n.cl = {
|
|
105
105
|
rgb: a.toRgbString()
|
|
106
106
|
});
|
|
107
107
|
break;
|
|
108
108
|
}
|
|
109
109
|
case "background-color": {
|
|
110
|
-
const a = new
|
|
110
|
+
const a = new yt(s);
|
|
111
111
|
a.isValid && (n.bg = {
|
|
112
112
|
rgb: a.toRgbString()
|
|
113
113
|
});
|
|
@@ -117,19 +117,19 @@ function gt(t) {
|
|
|
117
117
|
}
|
|
118
118
|
return n;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function Ci(t) {
|
|
121
121
|
const e = new DOMParser(), n = `<x-univer id="univer-root">${t}</x-univer>`;
|
|
122
122
|
return e.parseFromString(n, "text/html").querySelector("#univer-root");
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Yt(t, e) {
|
|
125
125
|
const n = t.tagName.toLowerCase();
|
|
126
126
|
return typeof e == "string" ? n === e : Array.isArray(e) ? e.some((o) => o === n) : e(t);
|
|
127
127
|
}
|
|
128
|
-
const
|
|
128
|
+
const we = class we {
|
|
129
129
|
constructor() {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
I(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
131
|
+
I(this, "_styleRules", []);
|
|
132
|
+
I(this, "_afterProcessRules", []);
|
|
133
133
|
}
|
|
134
134
|
static use(e) {
|
|
135
135
|
if (this._pluginList.includes(e))
|
|
@@ -137,28 +137,28 @@ const Fe = class Fe {
|
|
|
137
137
|
this._pluginList.push(e);
|
|
138
138
|
}
|
|
139
139
|
convert(e) {
|
|
140
|
-
const n =
|
|
140
|
+
const n = we._pluginList.find((r) => r.checkPasteType(e)), o = Ci(e), i = {
|
|
141
141
|
dataStream: "",
|
|
142
142
|
textRuns: []
|
|
143
143
|
};
|
|
144
|
-
return n && (this._styleRules = [...n.stylesRules], this._afterProcessRules = [...n.afterProcessRules]), this._styleCache.clear(), this._process(null, o == null ? void 0 : o.childNodes,
|
|
144
|
+
return n && (this._styleRules = [...n.stylesRules], this._afterProcessRules = [...n.afterProcessRules]), this._styleCache.clear(), this._process(null, o == null ? void 0 : o.childNodes, i), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], i;
|
|
145
145
|
}
|
|
146
146
|
_process(e, n, o) {
|
|
147
|
-
var
|
|
147
|
+
var i, r, s;
|
|
148
148
|
for (const a of n)
|
|
149
149
|
if (a.nodeType === Node.TEXT_NODE) {
|
|
150
|
-
if (((
|
|
150
|
+
if (((i = a.nodeValue) == null ? void 0 : i.trim()) === "")
|
|
151
151
|
continue;
|
|
152
|
-
let c = (
|
|
152
|
+
let c = (r = a.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, ""), d;
|
|
153
153
|
if (e && e.nodeType === Node.ELEMENT_NODE && e.tagName.toUpperCase() === "A") {
|
|
154
|
-
const g =
|
|
155
|
-
c = `${
|
|
154
|
+
const g = K.generateRandomId();
|
|
155
|
+
c = `${Ne.CUSTOM_RANGE_START}${c}${Ne.CUSTOM_RANGE_END}`, o.customRanges = [
|
|
156
156
|
...(s = o.customRanges) != null ? s : [],
|
|
157
157
|
{
|
|
158
158
|
startIndex: o.dataStream.length,
|
|
159
159
|
endIndex: o.dataStream.length + c.length - 1,
|
|
160
160
|
rangeId: g,
|
|
161
|
-
rangeType:
|
|
161
|
+
rangeType: hn.HYPERLINK
|
|
162
162
|
}
|
|
163
163
|
], o.payloads = {
|
|
164
164
|
...o.payloads,
|
|
@@ -171,24 +171,24 @@ const Fe = class Fe {
|
|
|
171
171
|
ts: d
|
|
172
172
|
});
|
|
173
173
|
} else {
|
|
174
|
-
if (
|
|
174
|
+
if (io.includes(a.nodeName.toLowerCase()))
|
|
175
175
|
continue;
|
|
176
176
|
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
177
|
-
const c = e ? this._styleCache.get(e) : {}, d = this._styleRules.find(({ filter: l }) =>
|
|
177
|
+
const c = e ? this._styleCache.get(e) : {}, d = this._styleRules.find(({ filter: l }) => Yt(a, l)), g = d ? d.getStyle(a) : Et(a);
|
|
178
178
|
this._styleCache.set(a, { ...c, ...g });
|
|
179
179
|
const { childNodes: h } = a;
|
|
180
180
|
this._process(a, h, o);
|
|
181
|
-
const
|
|
182
|
-
({ filter: l }) =>
|
|
181
|
+
const _ = this._afterProcessRules.find(
|
|
182
|
+
({ filter: l }) => Yt(a, l)
|
|
183
183
|
);
|
|
184
|
-
|
|
184
|
+
_ && _.handler(o, a);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
|
|
190
|
-
let
|
|
191
|
-
const
|
|
189
|
+
I(we, "_pluginList", []);
|
|
190
|
+
let ge = we;
|
|
191
|
+
const Ri = {
|
|
192
192
|
name: "univer-doc-paste-plugin-lark",
|
|
193
193
|
checkPasteType(t) {
|
|
194
194
|
return /lark-record-clipboard/i.test(t);
|
|
@@ -198,10 +198,10 @@ const Vo = {
|
|
|
198
198
|
{
|
|
199
199
|
filter: ["s"],
|
|
200
200
|
getStyle(t) {
|
|
201
|
-
const e =
|
|
201
|
+
const e = Et(t);
|
|
202
202
|
return {
|
|
203
203
|
st: {
|
|
204
|
-
s:
|
|
204
|
+
s: R.TRUE
|
|
205
205
|
},
|
|
206
206
|
...e
|
|
207
207
|
};
|
|
@@ -220,24 +220,24 @@ const Vo = {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
]
|
|
223
|
-
},
|
|
224
|
-
function
|
|
223
|
+
}, Oi = Ri;
|
|
224
|
+
function Hn(t) {
|
|
225
225
|
const e = t.style, n = {};
|
|
226
226
|
for (let o = 0; o < e.length; o++) {
|
|
227
|
-
const
|
|
228
|
-
switch (
|
|
227
|
+
const i = e[o], r = e.getPropertyValue(i);
|
|
228
|
+
switch (i) {
|
|
229
229
|
case "margin-top": {
|
|
230
|
-
const s = Number.parseInt(
|
|
231
|
-
n.spaceAbove = { v: /pt/.test(
|
|
230
|
+
const s = Number.parseInt(r);
|
|
231
|
+
n.spaceAbove = { v: /pt/.test(r) ? $t(s) : s };
|
|
232
232
|
break;
|
|
233
233
|
}
|
|
234
234
|
case "margin-bottom": {
|
|
235
|
-
const s = Number.parseInt(
|
|
236
|
-
n.spaceBelow = { v: /pt/.test(
|
|
235
|
+
const s = Number.parseInt(r);
|
|
236
|
+
n.spaceBelow = { v: /pt/.test(r) ? $t(s) : s };
|
|
237
237
|
break;
|
|
238
238
|
}
|
|
239
239
|
case "line-height": {
|
|
240
|
-
const s = Number.parseFloat(
|
|
240
|
+
const s = Number.parseFloat(r);
|
|
241
241
|
n.lineSpacing = s;
|
|
242
242
|
break;
|
|
243
243
|
}
|
|
@@ -245,7 +245,7 @@ function ln(t) {
|
|
|
245
245
|
}
|
|
246
246
|
return Object.getOwnPropertyNames(n).length ? n : null;
|
|
247
247
|
}
|
|
248
|
-
const
|
|
248
|
+
const Ti = {
|
|
249
249
|
name: "univer-doc-paste-plugin-word",
|
|
250
250
|
checkPasteType(t) {
|
|
251
251
|
return /word|mso/i.test(t);
|
|
@@ -254,8 +254,8 @@ const Wo = {
|
|
|
254
254
|
{
|
|
255
255
|
filter: ["b"],
|
|
256
256
|
getStyle(t) {
|
|
257
|
-
const e =
|
|
258
|
-
return { bl:
|
|
257
|
+
const e = Et(t);
|
|
258
|
+
return { bl: R.TRUE, ...e };
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
],
|
|
@@ -268,12 +268,12 @@ const Wo = {
|
|
|
268
268
|
t.paragraphs == null && (t.paragraphs = []);
|
|
269
269
|
const n = {
|
|
270
270
|
startIndex: t.dataStream.length
|
|
271
|
-
}, o =
|
|
271
|
+
}, o = Hn(e);
|
|
272
272
|
o && (n.paragraphStyle = o), t.paragraphs.push(n), t.dataStream += "\r";
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
]
|
|
276
|
-
},
|
|
276
|
+
}, Ei = Ti, Ii = {
|
|
277
277
|
name: "univer-doc-paste-plugin-univer",
|
|
278
278
|
checkPasteType(t) {
|
|
279
279
|
return /UniverNormal/i.test(t);
|
|
@@ -288,84 +288,84 @@ const Wo = {
|
|
|
288
288
|
t.paragraphs == null && (t.paragraphs = []);
|
|
289
289
|
const n = {
|
|
290
290
|
startIndex: t.dataStream.length
|
|
291
|
-
}, o =
|
|
291
|
+
}, o = Hn(e);
|
|
292
292
|
o && (n.paragraphStyle = o), t.paragraphs.push(n), t.dataStream += "\r";
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
295
|
]
|
|
296
|
-
},
|
|
297
|
-
function
|
|
298
|
-
const { st: n, ed: o, ts:
|
|
296
|
+
}, Mi = Ii;
|
|
297
|
+
function Xt(t, e) {
|
|
298
|
+
const { st: n, ed: o, ts: i = {} } = e, { ff: r, fs: s, it: a, bl: c, ul: d, st: g, ol: h, bg: _, cl: l, va: p } = i;
|
|
299
299
|
let u = t.slice(n, o);
|
|
300
300
|
const f = [];
|
|
301
|
-
return a ===
|
|
301
|
+
return a === R.TRUE && (u = `<i>${u}</i>`), p === ue.SUPERSCRIPT ? u = `<sup>${u}</sup>` : p === ue.SUBSCRIPT && (u = `<sub>${u}</sub>`), (d == null ? void 0 : d.s) === R.TRUE && (u = `<u>${u}</u>`), (g == null ? void 0 : g.s) === R.TRUE && (u = `<s>${u}</s>`), c === R.TRUE && (u = `<strong>${u}</strong>`), r && f.push(`font-family: ${r}`), l && f.push(`color: ${l.rgb}`), s && f.push(`font-size: ${s}pt`), h && f.push("text-decoration: overline"), _ && f.push(`background: ${_.rgb}`), f.length ? `<span style="${f.join("; ")};">${u}</span>` : u;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
const { dataStream: o, textRuns:
|
|
305
|
-
let
|
|
303
|
+
function Qe(t, e, n) {
|
|
304
|
+
const { dataStream: o, textRuns: i = [] } = t;
|
|
305
|
+
let r = e;
|
|
306
306
|
const s = [];
|
|
307
|
-
for (const a of
|
|
307
|
+
for (const a of i) {
|
|
308
308
|
const { st: c, ed: d } = a;
|
|
309
|
-
|
|
309
|
+
K.hasIntersectionBetweenTwoRanges(e, n, c, d) && (c > r ? (s.push(o.slice(r, c)), s.push(Xt(o, {
|
|
310
310
|
...a,
|
|
311
311
|
ed: Math.min(d, n)
|
|
312
|
-
}))) : s.push(
|
|
312
|
+
}))) : s.push(Xt(o, {
|
|
313
313
|
...a,
|
|
314
|
-
st:
|
|
314
|
+
st: r,
|
|
315
315
|
ed: Math.min(d, n)
|
|
316
|
-
}))),
|
|
316
|
+
}))), r = Math.max(e, Math.min(d, n));
|
|
317
317
|
}
|
|
318
|
-
return
|
|
318
|
+
return r !== n && s.push(o.slice(r, n)), s.join("");
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Kt(t, e = !0) {
|
|
321
321
|
var n;
|
|
322
322
|
if (e && ((n = t.paragraphs) != null && n.length)) {
|
|
323
|
-
const { dataStream: o, paragraphs:
|
|
324
|
-
let
|
|
325
|
-
for (const a of
|
|
326
|
-
const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: g, spaceBelow: h, lineSpacing:
|
|
327
|
-
g != null && (typeof g == "number" ? l.push(`margin-top: ${g}px`) : l.push(`margin-top: ${g.v}px`)), h != null && (typeof h == "number" ? l.push(`margin-bottom: ${h}px`) : l.push(`margin-bottom: ${h.v}px`)),
|
|
323
|
+
const { dataStream: o, paragraphs: i = [] } = t;
|
|
324
|
+
let r = "", s = -1;
|
|
325
|
+
for (const a of i) {
|
|
326
|
+
const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: g, spaceBelow: h, lineSpacing: _ } = d, l = [];
|
|
327
|
+
g != null && (typeof g == "number" ? l.push(`margin-top: ${g}px`) : l.push(`margin-top: ${g.v}px`)), h != null && (typeof h == "number" ? l.push(`margin-bottom: ${h}px`) : l.push(`margin-bottom: ${h.v}px`)), _ != null && l.push(`line-height: ${_}`), c > s + 1 ? r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}>${Qe(t, s + 1, c)}</p>` : r += `<p class="UniverNormal" ${l.length ? `style="${l.join("; ")};"` : ""}></p>`, s = c;
|
|
328
328
|
}
|
|
329
|
-
return s !== o.length && (
|
|
329
|
+
return s !== o.length && (r += Qe(t, s, o.length)), r;
|
|
330
330
|
} else
|
|
331
|
-
return
|
|
331
|
+
return Qe(t, 0, t.dataStream.length);
|
|
332
332
|
}
|
|
333
|
-
class
|
|
333
|
+
class bi {
|
|
334
334
|
convert(e) {
|
|
335
335
|
if (e.length === 0)
|
|
336
336
|
throw new Error("The bodyList length at least to be 1");
|
|
337
337
|
if (e.length === 1)
|
|
338
|
-
return
|
|
338
|
+
return Kt(e[0]);
|
|
339
339
|
let n = "";
|
|
340
340
|
for (const o of e)
|
|
341
|
-
n += '<p className="UniverNormal">', n +=
|
|
341
|
+
n += '<p className="UniverNormal">', n += Kt(o, !1), n += "</p>";
|
|
342
342
|
return n;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
var
|
|
346
|
-
for (var
|
|
347
|
-
(s = t[
|
|
348
|
-
return o &&
|
|
349
|
-
},
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
const
|
|
354
|
-
let
|
|
355
|
-
constructor(e, n, o,
|
|
345
|
+
var xi = Object.defineProperty, Di = Object.getOwnPropertyDescriptor, yi = (t, e, n, o) => {
|
|
346
|
+
for (var i = o > 1 ? void 0 : o ? Di(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
347
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
348
|
+
return o && i && xi(e, n, i), i;
|
|
349
|
+
}, ae = (t, e) => (n, o) => e(n, o, t);
|
|
350
|
+
ge.use(Ei);
|
|
351
|
+
ge.use(Oi);
|
|
352
|
+
ge.use(Mi);
|
|
353
|
+
const Ee = ro("doc.clipboard-service");
|
|
354
|
+
let ct = class extends z {
|
|
355
|
+
constructor(e, n, o, i, r, s) {
|
|
356
356
|
super();
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
this._univerInstanceService = e, this._logService = n, this._commandService = o, this._clipboardInterfaceService =
|
|
357
|
+
I(this, "_clipboardHooks", []);
|
|
358
|
+
I(this, "_htmlToUDM", new ge());
|
|
359
|
+
I(this, "_umdToHtml", new bi());
|
|
360
|
+
this._univerInstanceService = e, this._logService = n, this._commandService = o, this._clipboardInterfaceService = i, this._textSelectionManagerService = r, this._docCustomRangeService = s;
|
|
361
361
|
}
|
|
362
|
-
async copy(e =
|
|
362
|
+
async copy(e = Pt.copy) {
|
|
363
363
|
const n = this._getDocumentBodyInRanges(e);
|
|
364
364
|
if (n.length === 0)
|
|
365
365
|
return !1;
|
|
366
366
|
try {
|
|
367
|
-
const o = this._textSelectionManagerService.getActiveRange(),
|
|
368
|
-
this._setClipboardData(n, !
|
|
367
|
+
const o = this._textSelectionManagerService.getActiveRange(), i = !!(o != null && o.segmentId);
|
|
368
|
+
this._setClipboardData(n, !i);
|
|
369
369
|
} catch (o) {
|
|
370
370
|
return this._logService.error("[DocClipboardService] copy failed", o), !1;
|
|
371
371
|
}
|
|
@@ -383,18 +383,18 @@ let nt = class extends Q {
|
|
|
383
383
|
return this._paste(o);
|
|
384
384
|
}
|
|
385
385
|
async _cut() {
|
|
386
|
-
var
|
|
386
|
+
var r;
|
|
387
387
|
const {
|
|
388
388
|
segmentId: e,
|
|
389
389
|
endOffset: n,
|
|
390
390
|
style: o
|
|
391
|
-
} = (
|
|
392
|
-
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), n == null ||
|
|
391
|
+
} = (r = this._textSelectionManagerService.getActiveRange()) != null ? r : {}, i = this._textSelectionManagerService.getCurrentSelections();
|
|
392
|
+
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), n == null || i == null)
|
|
393
393
|
return !1;
|
|
394
|
-
this.copy(
|
|
394
|
+
this.copy(Pt.cut);
|
|
395
395
|
try {
|
|
396
396
|
let s = n;
|
|
397
|
-
for (const c of
|
|
397
|
+
for (const c of i) {
|
|
398
398
|
const { startOffset: d, endOffset: g } = c;
|
|
399
399
|
d == null || g == null || g <= n && (s -= g - d);
|
|
400
400
|
}
|
|
@@ -405,85 +405,85 @@ let nt = class extends Q {
|
|
|
405
405
|
style: o
|
|
406
406
|
}
|
|
407
407
|
];
|
|
408
|
-
return this._commandService.executeCommand(
|
|
408
|
+
return this._commandService.executeCommand(Tn.id, { segmentId: e, textRanges: a });
|
|
409
409
|
} catch {
|
|
410
410
|
return this._logService.error("[DocClipboardController] cut content failed"), !1;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
async _paste(e) {
|
|
414
414
|
var d, g;
|
|
415
|
-
let n =
|
|
415
|
+
let n = so(e);
|
|
416
416
|
const o = (d = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC)) == null ? void 0 : d.getUnitId();
|
|
417
417
|
if (!o)
|
|
418
418
|
return !1;
|
|
419
419
|
this._clipboardHooks.forEach((h) => {
|
|
420
420
|
h.onBeforePaste && (n = h.onBeforePaste(n));
|
|
421
421
|
}), n.customRanges = (g = n.customRanges) == null ? void 0 : g.map((h) => this._docCustomRangeService.copyCustomRange(o, h));
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
422
|
+
const i = this._textSelectionManagerService.getActiveRange(), { segmentId: r, endOffset: s, style: a } = i || {}, c = this._textSelectionManagerService.getCurrentSelections();
|
|
423
|
+
if (r == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), s == null || c == null)
|
|
424
424
|
return !1;
|
|
425
425
|
try {
|
|
426
426
|
let h = s;
|
|
427
427
|
for (const l of c) {
|
|
428
|
-
const { startOffset:
|
|
429
|
-
|
|
428
|
+
const { startOffset: p, endOffset: u } = l;
|
|
429
|
+
p == null || u == null || u <= s && (h += n.dataStream.length - (u - p));
|
|
430
430
|
}
|
|
431
|
-
const
|
|
431
|
+
const _ = [
|
|
432
432
|
{
|
|
433
433
|
startOffset: h,
|
|
434
434
|
endOffset: h,
|
|
435
435
|
style: a
|
|
436
436
|
}
|
|
437
437
|
];
|
|
438
|
-
return this._commandService.executeCommand(
|
|
438
|
+
return this._commandService.executeCommand(En.id, { body: n, segmentId: r, textRanges: _ });
|
|
439
439
|
} catch {
|
|
440
440
|
return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
async _setClipboardData(e, n = !0) {
|
|
444
|
-
const o =
|
|
444
|
+
const o = mi(), i = e.length > 1 ? e.map((s) => s.dataStream).join(`
|
|
445
445
|
`) : e[0].dataStream;
|
|
446
|
-
let
|
|
447
|
-
return e.length === 1 && n && (
|
|
446
|
+
let r = this._umdToHtml.convert(e);
|
|
447
|
+
return e.length === 1 && n && (r = r.replace(/(<[a-z]+)/, (s, a) => `${a} data-copy-id="${o}"`), kt.set(o, e[0])), this._clipboardInterfaceService.write(i, r);
|
|
448
448
|
}
|
|
449
449
|
addClipboardHook(e) {
|
|
450
|
-
return this._clipboardHooks.push(e),
|
|
450
|
+
return this._clipboardHooks.push(e), _n(() => {
|
|
451
451
|
const n = this._clipboardHooks.indexOf(e);
|
|
452
452
|
n > -1 && this._clipboardHooks.splice(n, 1);
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
_getDocumentBodyInRanges(e) {
|
|
456
|
-
const n = this._textSelectionManagerService.getCurrentSelections(), o = this._textSelectionManagerService.getActiveRange(),
|
|
457
|
-
if (n == null ||
|
|
458
|
-
return
|
|
456
|
+
const n = this._textSelectionManagerService.getCurrentSelections(), o = this._textSelectionManagerService.getActiveRange(), i = this._univerInstanceService.getCurrentUniverDocInstance(), r = [], s = i == null ? void 0 : i.getBody();
|
|
457
|
+
if (n == null || i == null || s == null || o == null)
|
|
458
|
+
return r;
|
|
459
459
|
const { segmentId: a } = o;
|
|
460
460
|
for (const c of n) {
|
|
461
461
|
const { startOffset: d, endOffset: g, collapsed: h } = c;
|
|
462
462
|
if (h || d == null || g == null)
|
|
463
463
|
continue;
|
|
464
|
-
const
|
|
464
|
+
const _ = $o({ startOffset: d, endOffset: g, collapsed: h }, s), l = i.getSelfOrHeaderFooterModel(a).sliceBody(_.startOffset, _.endOffset, e);
|
|
465
465
|
if (l != null) {
|
|
466
466
|
if (l.customRanges) {
|
|
467
|
-
const
|
|
467
|
+
const p = [];
|
|
468
468
|
l.customRanges.forEach((m) => {
|
|
469
|
-
m.startIndex === m.endIndex &&
|
|
470
|
-
}), l.customRanges = l.customRanges.filter((m) =>
|
|
469
|
+
m.startIndex === m.endIndex && p.push(m);
|
|
470
|
+
}), l.customRanges = l.customRanges.filter((m) => p.indexOf(m) === -1);
|
|
471
471
|
let u = "", f = 0;
|
|
472
|
-
|
|
472
|
+
p.forEach((m) => {
|
|
473
473
|
u += l.dataStream.slice(f, m.endIndex), f = m.endIndex + 1;
|
|
474
474
|
}), u += l.dataStream.slice(f, l.dataStream.length), l.dataStream = u;
|
|
475
475
|
}
|
|
476
|
-
|
|
476
|
+
r.push(l);
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
return
|
|
479
|
+
return r;
|
|
480
480
|
}
|
|
481
481
|
async _generateBodyFromClipboardItems(e) {
|
|
482
482
|
try {
|
|
483
483
|
let n = "", o = "";
|
|
484
|
-
for (const
|
|
485
|
-
for (const
|
|
486
|
-
|
|
484
|
+
for (const i of e)
|
|
485
|
+
for (const r of i.types)
|
|
486
|
+
r === Co ? o = await i.getType(r).then((s) => s && s.text()) : r === Ro && (n = await i.getType(r).then((s) => s && s.text()));
|
|
487
487
|
return this._generateBodyFromHtmlAndText(n, o);
|
|
488
488
|
} catch (n) {
|
|
489
489
|
return Promise.reject(n);
|
|
@@ -491,25 +491,25 @@ let nt = class extends Q {
|
|
|
491
491
|
}
|
|
492
492
|
_generateBody(e) {
|
|
493
493
|
const n = e.replace(/\n/g, "\r");
|
|
494
|
-
if (!e.includes("\r") &&
|
|
495
|
-
const
|
|
496
|
-
|
|
494
|
+
if (!e.includes("\r") && K.isLegalUrl(e)) {
|
|
495
|
+
const i = K.generateRandomId(), r = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC), s = `${Ne.CUSTOM_RANGE_START}${n}${Ne.CUSTOM_RANGE_END}`, a = this._docCustomRangeService.copyCustomRange(
|
|
496
|
+
r.getUnitId(),
|
|
497
497
|
{
|
|
498
498
|
startIndex: 0,
|
|
499
|
-
endIndex:
|
|
500
|
-
rangeId:
|
|
501
|
-
rangeType:
|
|
499
|
+
endIndex: s.length - 1,
|
|
500
|
+
rangeId: i,
|
|
501
|
+
rangeType: hn.HYPERLINK,
|
|
502
502
|
data: e
|
|
503
503
|
}
|
|
504
504
|
);
|
|
505
505
|
return {
|
|
506
|
-
dataStream:
|
|
507
|
-
customRanges: [
|
|
506
|
+
dataStream: s,
|
|
507
|
+
customRanges: [a]
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
510
|
const o = [];
|
|
511
|
-
for (let
|
|
512
|
-
n[
|
|
511
|
+
for (let i = 0; i < n.length; i++)
|
|
512
|
+
n[i] === "\r" && o.push({ startIndex: i });
|
|
513
513
|
return {
|
|
514
514
|
dataStream: n,
|
|
515
515
|
paragraphs: o
|
|
@@ -521,35 +521,35 @@ let nt = class extends Q {
|
|
|
521
521
|
return this._generateBody(n);
|
|
522
522
|
throw new Error("[DocClipboardService] html and text cannot be both empty!");
|
|
523
523
|
}
|
|
524
|
-
const o =
|
|
524
|
+
const o = Si(e);
|
|
525
525
|
if (o) {
|
|
526
|
-
const
|
|
527
|
-
if (
|
|
528
|
-
return
|
|
526
|
+
const i = kt.get(o);
|
|
527
|
+
if (i)
|
|
528
|
+
return i;
|
|
529
529
|
}
|
|
530
530
|
return this._htmlToUDM.convert(e);
|
|
531
531
|
}
|
|
532
532
|
};
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
],
|
|
541
|
-
var
|
|
542
|
-
for (var
|
|
543
|
-
(s = t[
|
|
544
|
-
return o &&
|
|
545
|
-
},
|
|
546
|
-
const
|
|
547
|
-
let
|
|
548
|
-
constructor(t, e, n, o,
|
|
549
|
-
super(), this._context = t, this._textSelectionManagerService = e, this._editorService = n, this._univerInstanceService = o, this._renderManagerService =
|
|
533
|
+
ct = yi([
|
|
534
|
+
ae(0, L),
|
|
535
|
+
ae(1, gn),
|
|
536
|
+
ae(2, E),
|
|
537
|
+
ae(3, Ct),
|
|
538
|
+
ae(4, M(Z)),
|
|
539
|
+
ae(5, M(wo))
|
|
540
|
+
], ct);
|
|
541
|
+
var Pi = Object.defineProperty, Ai = Object.getOwnPropertyDescriptor, Ni = (t, e, n, o) => {
|
|
542
|
+
for (var i = o > 1 ? void 0 : o ? Ai(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
543
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
544
|
+
return o && i && Pi(e, n, i), i;
|
|
545
|
+
}, Ie = (t, e) => (n, o) => e(n, o, t);
|
|
546
|
+
const Zt = 1.5;
|
|
547
|
+
let lt = class extends Te {
|
|
548
|
+
constructor(t, e, n, o, i) {
|
|
549
|
+
super(), this._context = t, this._textSelectionManagerService = e, this._editorService = n, this._univerInstanceService = o, this._renderManagerService = i, this._init();
|
|
550
550
|
}
|
|
551
551
|
_init() {
|
|
552
|
-
this._textSelectionManagerService.textSelection$.pipe(
|
|
552
|
+
this._textSelectionManagerService.textSelection$.pipe(de(this.dispose$)).subscribe((t) => {
|
|
553
553
|
if (t == null)
|
|
554
554
|
return;
|
|
555
555
|
const { isEditing: e, unitId: n } = t;
|
|
@@ -558,31 +558,31 @@ let ot = class extends Se {
|
|
|
558
558
|
}
|
|
559
559
|
scrollToRange(t, e) {
|
|
560
560
|
var s;
|
|
561
|
-
const n = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.with(
|
|
561
|
+
const n = (s = this._renderManagerService.getRenderById(t)) == null ? void 0 : s.with($), o = n == null ? void 0 : n.getSkeleton();
|
|
562
562
|
if (!o)
|
|
563
563
|
return;
|
|
564
|
-
const { startOffset:
|
|
565
|
-
this.scrollToNode(t,
|
|
564
|
+
const { startOffset: i } = e, r = o.findNodePositionByCharIndex(i);
|
|
565
|
+
this.scrollToNode(t, r);
|
|
566
566
|
}
|
|
567
567
|
scrollToNode(t, e) {
|
|
568
|
-
var
|
|
569
|
-
const n = this._getDocObject(), o = (
|
|
570
|
-
if (n == null ||
|
|
568
|
+
var W;
|
|
569
|
+
const n = this._getDocObject(), o = (W = this._renderManagerService.getRenderById(t)) == null ? void 0 : W.with($), i = o == null ? void 0 : o.getSkeleton();
|
|
570
|
+
if (n == null || i == null)
|
|
571
571
|
return;
|
|
572
|
-
const
|
|
572
|
+
const r = n.document.getOffsetConfig(), { docsLeft: s, docsTop: a } = r, c = new $n(r, i), { contentBoxPointGroup: d } = c.getRangePointData(e, e), { left: g, top: h, height: _ } = Zo(d), l = g + s, p = h + a, u = n.scene.getViewport(J.VIEW_MAIN), f = !!this._editorService.getEditor(t);
|
|
573
573
|
if (u == null)
|
|
574
574
|
return;
|
|
575
575
|
const {
|
|
576
576
|
left: m,
|
|
577
|
-
top:
|
|
578
|
-
right:
|
|
579
|
-
bottom:
|
|
577
|
+
top: S,
|
|
578
|
+
right: O,
|
|
579
|
+
bottom: T
|
|
580
580
|
} = u.getBounding().viewBound;
|
|
581
|
-
let
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
const
|
|
585
|
-
u.
|
|
581
|
+
let C = 0, N = 0;
|
|
582
|
+
const k = f ? 0 : 100;
|
|
583
|
+
p < S ? C = p - S - k : p > T - _ && (C = p - T + _ + k), l < m ? N = l - m : l > O - Zt && (N = l - O + Zt);
|
|
584
|
+
const V = u.transViewportScroll2ScrollValue(N, C);
|
|
585
|
+
u.scrollByBarDeltaValue(V);
|
|
586
586
|
}
|
|
587
587
|
// Let the selection show on the current screen.
|
|
588
588
|
_scrollToSelection(t) {
|
|
@@ -593,16 +593,16 @@ let ot = class extends Se {
|
|
|
593
593
|
n && this.scrollToNode(t, o);
|
|
594
594
|
}
|
|
595
595
|
_getDocObject() {
|
|
596
|
-
return
|
|
596
|
+
return Bo(this._univerInstanceService, this._renderManagerService);
|
|
597
597
|
}
|
|
598
598
|
};
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
],
|
|
605
|
-
const
|
|
599
|
+
lt = Ni([
|
|
600
|
+
Ie(1, M(Z)),
|
|
601
|
+
Ie(2, oe),
|
|
602
|
+
Ie(3, M(L)),
|
|
603
|
+
Ie(4, X)
|
|
604
|
+
], lt);
|
|
605
|
+
const Fi = {
|
|
606
606
|
undo: !0,
|
|
607
607
|
redo: !0,
|
|
608
608
|
// Undo redo
|
|
@@ -630,7 +630,7 @@ const er = {
|
|
|
630
630
|
// 'Wrap mode'
|
|
631
631
|
textRotateMode: !0
|
|
632
632
|
// 'Text Rotation Mode'
|
|
633
|
-
},
|
|
633
|
+
}, Ui = {
|
|
634
634
|
outerLeft: !1,
|
|
635
635
|
outerRight: !1,
|
|
636
636
|
header: !0,
|
|
@@ -643,82 +643,82 @@ const er = {
|
|
|
643
643
|
frozenContent: !1,
|
|
644
644
|
infoBar: !0,
|
|
645
645
|
toolbar: !0
|
|
646
|
-
},
|
|
646
|
+
}, Li = {
|
|
647
647
|
layout: {
|
|
648
|
-
docContainerConfig:
|
|
649
|
-
toolbarConfig:
|
|
648
|
+
docContainerConfig: Ui,
|
|
649
|
+
toolbarConfig: Fi
|
|
650
650
|
}
|
|
651
|
-
},
|
|
652
|
-
id:
|
|
653
|
-
binding:
|
|
654
|
-
preconditions:
|
|
651
|
+
}, wi = "DocUI", $i = {
|
|
652
|
+
id: We.id,
|
|
653
|
+
binding: D.ARROW_UP,
|
|
654
|
+
preconditions: A,
|
|
655
655
|
staticParameters: {
|
|
656
|
-
direction:
|
|
656
|
+
direction: ee.UP
|
|
657
657
|
}
|
|
658
|
-
},
|
|
659
|
-
id:
|
|
660
|
-
binding:
|
|
661
|
-
preconditions:
|
|
658
|
+
}, Bi = {
|
|
659
|
+
id: We.id,
|
|
660
|
+
binding: D.ARROW_DOWN,
|
|
661
|
+
preconditions: A,
|
|
662
662
|
staticParameters: {
|
|
663
|
-
direction:
|
|
663
|
+
direction: ee.DOWN
|
|
664
664
|
}
|
|
665
|
-
},
|
|
666
|
-
id:
|
|
667
|
-
binding:
|
|
668
|
-
preconditions:
|
|
665
|
+
}, Hi = {
|
|
666
|
+
id: We.id,
|
|
667
|
+
binding: D.ARROW_LEFT,
|
|
668
|
+
preconditions: A,
|
|
669
669
|
staticParameters: {
|
|
670
|
-
direction:
|
|
670
|
+
direction: ee.LEFT
|
|
671
671
|
}
|
|
672
|
-
},
|
|
673
|
-
id:
|
|
674
|
-
binding:
|
|
675
|
-
preconditions:
|
|
672
|
+
}, Vi = {
|
|
673
|
+
id: We.id,
|
|
674
|
+
binding: D.ARROW_RIGHT,
|
|
675
|
+
preconditions: A,
|
|
676
676
|
staticParameters: {
|
|
677
|
-
direction:
|
|
677
|
+
direction: ee.RIGHT
|
|
678
678
|
}
|
|
679
|
-
},
|
|
680
|
-
id:
|
|
681
|
-
binding:
|
|
682
|
-
preconditions:
|
|
679
|
+
}, ji = {
|
|
680
|
+
id: ze.id,
|
|
681
|
+
binding: D.ARROW_UP | x.SHIFT,
|
|
682
|
+
preconditions: A,
|
|
683
683
|
staticParameters: {
|
|
684
|
-
direction:
|
|
684
|
+
direction: ee.UP
|
|
685
685
|
}
|
|
686
|
-
},
|
|
687
|
-
id:
|
|
688
|
-
binding:
|
|
689
|
-
preconditions:
|
|
686
|
+
}, Wi = {
|
|
687
|
+
id: ze.id,
|
|
688
|
+
binding: D.ARROW_DOWN | x.SHIFT,
|
|
689
|
+
preconditions: A,
|
|
690
690
|
staticParameters: {
|
|
691
|
-
direction:
|
|
691
|
+
direction: ee.DOWN
|
|
692
692
|
}
|
|
693
|
-
},
|
|
694
|
-
id:
|
|
695
|
-
binding:
|
|
696
|
-
preconditions:
|
|
693
|
+
}, zi = {
|
|
694
|
+
id: ze.id,
|
|
695
|
+
binding: D.ARROW_LEFT | x.SHIFT,
|
|
696
|
+
preconditions: A,
|
|
697
697
|
staticParameters: {
|
|
698
|
-
direction:
|
|
698
|
+
direction: ee.LEFT
|
|
699
699
|
}
|
|
700
|
-
},
|
|
701
|
-
id:
|
|
702
|
-
binding:
|
|
703
|
-
preconditions:
|
|
700
|
+
}, Gi = {
|
|
701
|
+
id: ze.id,
|
|
702
|
+
binding: D.ARROW_RIGHT | x.SHIFT,
|
|
703
|
+
preconditions: A,
|
|
704
704
|
staticParameters: {
|
|
705
|
-
direction:
|
|
705
|
+
direction: ee.RIGHT
|
|
706
706
|
}
|
|
707
|
-
},
|
|
708
|
-
id:
|
|
709
|
-
binding:
|
|
710
|
-
preconditions: (t) => t.getContextValue(
|
|
707
|
+
}, ki = {
|
|
708
|
+
id: Ho.id,
|
|
709
|
+
binding: D.A | x.CTRL_COMMAND,
|
|
710
|
+
preconditions: (t) => t.getContextValue(vt) && (t.getContextValue($e) || t.getContextValue(pn))
|
|
711
711
|
};
|
|
712
|
-
var
|
|
713
|
-
for (var
|
|
714
|
-
(s = t[
|
|
715
|
-
return o &&
|
|
716
|
-
},
|
|
717
|
-
let
|
|
712
|
+
var Yi = Object.defineProperty, Xi = Object.getOwnPropertyDescriptor, Ki = (t, e, n, o) => {
|
|
713
|
+
for (var i = o > 1 ? void 0 : o ? Xi(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
714
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
715
|
+
return o && i && Yi(e, n, i), i;
|
|
716
|
+
}, Jt = (t, e) => (n, o) => e(n, o, t);
|
|
717
|
+
let dt = class {
|
|
718
718
|
constructor(t, e, n) {
|
|
719
|
-
|
|
719
|
+
I(this, "_docContainer");
|
|
720
720
|
// 获取SheetContainer组件
|
|
721
|
-
|
|
721
|
+
I(this, "getComponent", (t) => {
|
|
722
722
|
if (this._docContainer = t, !t.getContentRef().current)
|
|
723
723
|
throw new Error("container is not ready");
|
|
724
724
|
});
|
|
@@ -729,7 +729,7 @@ let rt = class {
|
|
|
729
729
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
730
730
|
*
|
|
731
731
|
*/
|
|
732
|
-
|
|
732
|
+
I(this, "changeLocale", (t) => {
|
|
733
733
|
this._localeService.setLocale(t);
|
|
734
734
|
});
|
|
735
735
|
this._config = t, this._localeService = e, this._injector = n;
|
|
@@ -753,19 +753,19 @@ let rt = class {
|
|
|
753
753
|
return this._docContainer;
|
|
754
754
|
}
|
|
755
755
|
};
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
],
|
|
760
|
-
var
|
|
761
|
-
for (var
|
|
762
|
-
(s = t[
|
|
763
|
-
return o &&
|
|
764
|
-
},
|
|
765
|
-
let
|
|
766
|
-
constructor(e, n, o,
|
|
756
|
+
dt = Ki([
|
|
757
|
+
Jt(1, M(_e)),
|
|
758
|
+
Jt(2, M(Be))
|
|
759
|
+
], dt);
|
|
760
|
+
var Zi = Object.defineProperty, Ji = Object.getOwnPropertyDescriptor, qi = (t, e, n, o) => {
|
|
761
|
+
for (var i = o > 1 ? void 0 : o ? Ji(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
762
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
763
|
+
return o && i && Zi(e, n, i), i;
|
|
764
|
+
}, Me = (t, e) => (n, o) => e(n, o, t);
|
|
765
|
+
let Ce = class extends Te {
|
|
766
|
+
constructor(e, n, o, i, r) {
|
|
767
767
|
super();
|
|
768
|
-
|
|
768
|
+
I(this, "_docContainerController");
|
|
769
769
|
/**
|
|
770
770
|
* Change language
|
|
771
771
|
* @param {string} locale new language
|
|
@@ -773,10 +773,10 @@ let fe = class extends Se {
|
|
|
773
773
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
774
774
|
*
|
|
775
775
|
*/
|
|
776
|
-
|
|
776
|
+
I(this, "changeLocale", (e) => {
|
|
777
777
|
this._localeService.setLocale(e);
|
|
778
778
|
});
|
|
779
|
-
this._localeService = n, this._injector = o, this._textSelectionRenderManager =
|
|
779
|
+
this._localeService = n, this._injector = o, this._textSelectionRenderManager = i, this._layoutService = r, this._docContainerController = this._injector.createInstance(dt, e), this._registerContainer();
|
|
780
780
|
}
|
|
781
781
|
_registerContainer() {
|
|
782
782
|
this._layoutService && this.disposeWithMe(
|
|
@@ -788,47 +788,114 @@ let fe = class extends Se {
|
|
|
788
788
|
return this._docContainerController;
|
|
789
789
|
}
|
|
790
790
|
};
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
],
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
791
|
+
Ce = qi([
|
|
792
|
+
Me(1, M(_e)),
|
|
793
|
+
Me(2, M(Be)),
|
|
794
|
+
Me(3, ie),
|
|
795
|
+
Me(4, ao(Cn))
|
|
796
|
+
], Ce);
|
|
797
|
+
const Ye = "UI_PLUGIN_DOCS", It = `${Ye}_COLOR_PICKER_COMPONENT`, Vn = `${Ye}_FONT_FAMILY_COMPONENT`, jn = `${Ye}_FONT_FAMILY_ITEM_COMPONENT`, Wn = `${Ye}_FONT_SIZE_COMPONENT`;
|
|
798
|
+
var zn = { exports: {} }, Xe = {};
|
|
799
|
+
/**
|
|
800
|
+
* @license React
|
|
801
|
+
* react-jsx-runtime.production.min.js
|
|
802
|
+
*
|
|
803
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
804
|
+
*
|
|
805
|
+
* This source code is licensed under the MIT license found in the
|
|
806
|
+
* LICENSE file in the root directory of this source tree.
|
|
807
|
+
*/
|
|
808
|
+
var Qi = ai, er = Symbol.for("react.element"), tr = Symbol.for("react.fragment"), nr = Object.prototype.hasOwnProperty, or = Qi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, ir = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
809
|
+
function Gn(t, e, n) {
|
|
810
|
+
var o, i = {}, r = null, s = null;
|
|
811
|
+
n !== void 0 && (r = "" + n), e.key !== void 0 && (r = "" + e.key), e.ref !== void 0 && (s = e.ref);
|
|
812
|
+
for (o in e) nr.call(e, o) && !ir.hasOwnProperty(o) && (i[o] = e[o]);
|
|
813
|
+
if (t && t.defaultProps) for (o in e = t.defaultProps, e) i[o] === void 0 && (i[o] = e[o]);
|
|
814
|
+
return { $$typeof: er, type: t, key: r, ref: s, props: i, _owner: or.current };
|
|
803
815
|
}
|
|
804
|
-
|
|
816
|
+
Xe.Fragment = tr;
|
|
817
|
+
Xe.jsx = Gn;
|
|
818
|
+
Xe.jsxs = Gn;
|
|
819
|
+
zn.exports = Xe;
|
|
820
|
+
var b = zn.exports;
|
|
821
|
+
const rr = "univer-doc-count-bar", sr = {
|
|
822
|
+
docCountBar: rr
|
|
823
|
+
}, ar = [50, 80, 100, 130, 150, 170, 200, 400], cr = [10, 400];
|
|
824
|
+
function lr() {
|
|
825
|
+
const t = Y(E), e = Y(L), n = ci(() => e.getCurrentTypeOfUnit$(v.UNIVER_DOC), []), o = co(n), i = li(() => {
|
|
826
|
+
var d, g;
|
|
827
|
+
if (!o) return 100;
|
|
828
|
+
const c = ((g = (d = o.getSettings()) == null ? void 0 : d.zoomRatio) != null ? g : 1) * 100;
|
|
829
|
+
return Math.round(c);
|
|
830
|
+
}, [o]), [r, s] = Ot(() => i());
|
|
831
|
+
Tt(() => (s(i()), t.onCommandExecuted((d) => {
|
|
832
|
+
if (d.id === he.id) {
|
|
833
|
+
const g = i();
|
|
834
|
+
s(g);
|
|
835
|
+
}
|
|
836
|
+
}).dispose), [t, i]);
|
|
837
|
+
function a(c) {
|
|
838
|
+
if (s(c), o == null)
|
|
839
|
+
return;
|
|
840
|
+
const d = c / 100;
|
|
841
|
+
t.executeCommand(he.id, {
|
|
842
|
+
unitId: o.getUnitId(),
|
|
843
|
+
zoomRatio: d
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
return /* @__PURE__ */ b.jsx(
|
|
847
|
+
di,
|
|
848
|
+
{
|
|
849
|
+
min: cr[0],
|
|
850
|
+
value: r,
|
|
851
|
+
shortcuts: ar,
|
|
852
|
+
onChange: a
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
function dr(t) {
|
|
857
|
+
return /* @__PURE__ */ b.jsx("section", { className: sr.docCountBar, children: /* @__PURE__ */ b.jsx(lr, {}) });
|
|
858
|
+
}
|
|
859
|
+
const ur = "univer-doc-footer-container", hr = {
|
|
860
|
+
docFooterContainer: ur
|
|
861
|
+
}, gr = () => /* @__PURE__ */ b.jsxs("div", { className: hr.docFooterContainer, children: [
|
|
862
|
+
/* @__PURE__ */ b.jsx("div", {}),
|
|
863
|
+
/* @__PURE__ */ b.jsx(dr, {})
|
|
864
|
+
] }), qt = 18, Qt = 200, et = 6, _r = 4;
|
|
865
|
+
function pr(t, e) {
|
|
866
|
+
let { radius: n, width: o, height: i } = e;
|
|
867
|
+
n = n != null ? n : 0, o = o != null ? o : 30, i = i != null ? i : 30;
|
|
868
|
+
let r = 0;
|
|
869
|
+
r = Math.min(n, o / 2, i / 2), t.beginPath(), t.moveTo(0, 0), t.lineTo(o, 0), t.lineTo(o, i - r), t.arc(o - r, i - r, r, 0, Math.PI / 2, !1), t.lineTo(0, i), t.lineTo(0, 0), t.closePath(), e.fill && (t.save(), t.fillStyle = e.fill, e.fillRule === "evenodd" ? t.fill("evenodd") : t.fill(), t.restore());
|
|
870
|
+
}
|
|
871
|
+
class Ue extends Jo {
|
|
805
872
|
constructor(n, o) {
|
|
806
873
|
super(n, o);
|
|
807
|
-
|
|
808
|
-
|
|
874
|
+
I(this, "color");
|
|
875
|
+
I(this, "text");
|
|
809
876
|
this.color = o == null ? void 0 : o.color, this.text = o == null ? void 0 : o.text;
|
|
810
877
|
}
|
|
811
878
|
static drawWith(n, o) {
|
|
812
|
-
const { text:
|
|
879
|
+
const { text: i, color: r } = o;
|
|
813
880
|
n.save(), n.font = "13px Source Han Sans CN";
|
|
814
|
-
const s = n.measureText(
|
|
815
|
-
s + 2 *
|
|
816
|
-
|
|
881
|
+
const s = n.measureText(i).width, a = Math.min(
|
|
882
|
+
s + 2 * et,
|
|
883
|
+
Qt
|
|
817
884
|
);
|
|
818
|
-
|
|
819
|
-
height:
|
|
885
|
+
pr(n, {
|
|
886
|
+
height: qt,
|
|
820
887
|
width: a,
|
|
821
888
|
radius: 4,
|
|
822
|
-
fill:
|
|
889
|
+
fill: r,
|
|
823
890
|
evented: !1
|
|
824
891
|
}), n.fillStyle = "rgba(58, 96, 247, 1)";
|
|
825
|
-
const c =
|
|
892
|
+
const c = et, d = qt - _r, g = Qt - 2 * et;
|
|
826
893
|
if (s > g) {
|
|
827
|
-
let h = "",
|
|
828
|
-
for (const l of
|
|
829
|
-
const
|
|
830
|
-
if (
|
|
831
|
-
h += l,
|
|
894
|
+
let h = "", _ = 0;
|
|
895
|
+
for (const l of i) {
|
|
896
|
+
const p = n.measureText(l).width;
|
|
897
|
+
if (_ + p <= g - n.measureText("...").width)
|
|
898
|
+
h += l, _ += p;
|
|
832
899
|
else {
|
|
833
900
|
h += "...";
|
|
834
901
|
break;
|
|
@@ -836,115 +903,94 @@ class Ne extends Eo {
|
|
|
836
903
|
}
|
|
837
904
|
n.fillText(h, c, d);
|
|
838
905
|
} else
|
|
839
|
-
n.fillText(
|
|
906
|
+
n.fillText(i, c, d);
|
|
840
907
|
n.restore();
|
|
841
908
|
}
|
|
842
909
|
_draw(n) {
|
|
843
|
-
|
|
910
|
+
Ue.drawWith(n, this);
|
|
844
911
|
}
|
|
845
912
|
}
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
function _n(t, e, n) {
|
|
859
|
-
var o, r = {}, i = null, s = null;
|
|
860
|
-
n !== void 0 && (i = "" + n), e.key !== void 0 && (i = "" + e.key), e.ref !== void 0 && (s = e.ref);
|
|
861
|
-
for (o in e) Tr.call(e, o) && !br.hasOwnProperty(o) && (r[o] = e[o]);
|
|
862
|
-
if (t && t.defaultProps) for (o in e = t.defaultProps, e) r[o] === void 0 && (r[o] = e[o]);
|
|
863
|
-
return { $$typeof: Cr, type: t, key: i, ref: s, props: r, _owner: Ir.current };
|
|
864
|
-
}
|
|
865
|
-
ke.Fragment = Er;
|
|
866
|
-
ke.jsx = _n;
|
|
867
|
-
ke.jsxs = _n;
|
|
868
|
-
pn.exports = ke;
|
|
869
|
-
var M = pn.exports;
|
|
870
|
-
const Mr = "univer-panel", yr = "univer-options-section", xr = "univer-options-form-item", Pr = "univer-options-input", Dr = "univer-options-margin-setting", $ = {
|
|
871
|
-
panel: Mr,
|
|
872
|
-
optionsSection: yr,
|
|
873
|
-
optionsFormItem: xr,
|
|
874
|
-
optionsInput: Pr,
|
|
875
|
-
optionsMarginSetting: Dr
|
|
876
|
-
}, Ar = (t) => {
|
|
877
|
-
const e = z(le), n = z(w), o = z(W), r = z(O), i = z(ne), s = z(te), { unitId: a } = t, [c, d] = an({}), g = (l, _) => {
|
|
878
|
-
var N;
|
|
879
|
-
d((Y) => ({
|
|
880
|
-
...Y,
|
|
881
|
-
[_]: l ? S.TRUE : S.FALSE
|
|
913
|
+
const kn = "COMPONENT_DOC_HEADER_FOOTER_PANEL", fr = "univer-panel", mr = "univer-options-section", Sr = "univer-options-form-item", vr = "univer-options-input", Cr = "univer-options-margin-setting", j = {
|
|
914
|
+
panel: fr,
|
|
915
|
+
optionsSection: mr,
|
|
916
|
+
optionsFormItem: Sr,
|
|
917
|
+
optionsInput: vr,
|
|
918
|
+
optionsMarginSetting: Cr
|
|
919
|
+
}, Rr = (t) => {
|
|
920
|
+
const e = Y(_e), n = Y(L), o = Y(X), i = Y(E), r = Y(ie), s = Y(Z), { unitId: a } = t, [c, d] = Ot({}), g = (l, p) => {
|
|
921
|
+
var k;
|
|
922
|
+
d((V) => ({
|
|
923
|
+
...V,
|
|
924
|
+
[p]: l ? R.TRUE : R.FALSE
|
|
882
925
|
}));
|
|
883
|
-
const u = n.getUniverDocInstance(a), f = u == null ? void 0 : u.getSnapshot().documentStyle, m = (
|
|
884
|
-
if (f == null ||
|
|
926
|
+
const u = n.getUniverDocInstance(a), f = u == null ? void 0 : u.getSnapshot().documentStyle, m = (k = o.getRenderById(a)) == null ? void 0 : k.with($), S = m == null ? void 0 : m.getViewModel();
|
|
927
|
+
if (f == null || S == null)
|
|
885
928
|
return;
|
|
886
|
-
const
|
|
887
|
-
let
|
|
888
|
-
const
|
|
889
|
-
let
|
|
890
|
-
if (
|
|
891
|
-
const
|
|
892
|
-
|
|
929
|
+
const O = S.getEditArea();
|
|
930
|
+
let T = !1;
|
|
931
|
+
const C = r.getSegmentPage();
|
|
932
|
+
let N = !1;
|
|
933
|
+
if (p === "useFirstPageHeaderFooter" && l === !0 && ((O === w.HEADER && !f.firstPageHeaderId || O === w.FOOTER && !f.firstPageFooterId) && (T = !0), T && C === 0 && (N = !0)), p === "evenAndOddHeaders" && l === !0 && ((O === w.HEADER && !f.evenPageHeaderId || O === w.FOOTER && !f.evenPageFooterId) && (T = !0), T && C % 2 === 1 && (N = !0)), T) {
|
|
934
|
+
const W = K.generateRandomId(6);
|
|
935
|
+
N && r.setSegment(W), i.executeCommand(De, {
|
|
893
936
|
unitId: a,
|
|
894
|
-
segmentId:
|
|
937
|
+
segmentId: W,
|
|
895
938
|
headerFooterProps: {
|
|
896
|
-
[
|
|
939
|
+
[p]: l ? R.TRUE : R.FALSE
|
|
897
940
|
}
|
|
898
941
|
});
|
|
899
942
|
} else
|
|
900
|
-
|
|
943
|
+
i.executeCommand(De, {
|
|
901
944
|
unitId: a,
|
|
902
945
|
headerFooterProps: {
|
|
903
|
-
[
|
|
946
|
+
[p]: l ? R.TRUE : R.FALSE
|
|
904
947
|
}
|
|
905
948
|
});
|
|
906
|
-
}, h = async (l,
|
|
949
|
+
}, h = async (l, p) => {
|
|
907
950
|
d((u) => ({
|
|
908
951
|
...u,
|
|
909
|
-
[
|
|
910
|
-
})), await
|
|
952
|
+
[p]: l
|
|
953
|
+
})), await i.executeCommand(De, {
|
|
911
954
|
unitId: a,
|
|
912
955
|
headerFooterProps: {
|
|
913
|
-
[
|
|
956
|
+
[p]: l
|
|
914
957
|
}
|
|
915
|
-
}),
|
|
916
|
-
},
|
|
917
|
-
var
|
|
918
|
-
const l =
|
|
919
|
-
|
|
958
|
+
}), r.removeAllTextRanges(), r.blur();
|
|
959
|
+
}, _ = () => {
|
|
960
|
+
var T;
|
|
961
|
+
const l = o.getRenderById(a);
|
|
962
|
+
if (l == null)
|
|
963
|
+
return;
|
|
964
|
+
const { scene: p } = l, u = p.getTransformerByCreate(), f = l.with($), m = f == null ? void 0 : f.getSkeleton(), S = f == null ? void 0 : f.getViewModel(), O = o.getRenderById(a);
|
|
965
|
+
O == null || S == null || m == null || (s.replaceTextRanges([]), u.clearSelectedObjects(), r.setSegment(""), r.setSegmentPage(-1), S.setEditArea(w.BODY), m.calculate(), (T = O.mainComponent) == null || T.makeDirty(!0));
|
|
920
966
|
};
|
|
921
|
-
return
|
|
922
|
-
const l = n.getUniverDocInstance(a),
|
|
923
|
-
if (
|
|
924
|
-
const { marginHeader: u, marginFooter: f, useFirstPageHeaderFooter: m, evenAndOddHeaders:
|
|
967
|
+
return Tt(() => {
|
|
968
|
+
const l = n.getUniverDocInstance(a), p = l == null ? void 0 : l.getSnapshot().documentStyle;
|
|
969
|
+
if (p) {
|
|
970
|
+
const { marginHeader: u, marginFooter: f, useFirstPageHeaderFooter: m, evenAndOddHeaders: S } = p;
|
|
925
971
|
d({
|
|
926
972
|
marginHeader: u,
|
|
927
973
|
marginFooter: f,
|
|
928
974
|
useFirstPageHeaderFooter: m,
|
|
929
|
-
evenAndOddHeaders:
|
|
975
|
+
evenAndOddHeaders: S
|
|
930
976
|
});
|
|
931
977
|
}
|
|
932
|
-
}, [a]), /* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
/* @__PURE__ */
|
|
935
|
-
|
|
978
|
+
}, [a]), /* @__PURE__ */ b.jsxs("div", { className: j.options, children: [
|
|
979
|
+
/* @__PURE__ */ b.jsxs("div", { className: j.optionsSection, children: [
|
|
980
|
+
/* @__PURE__ */ b.jsx("div", { className: j.optionsFormItem, children: /* @__PURE__ */ b.jsx(
|
|
981
|
+
zt,
|
|
936
982
|
{
|
|
937
|
-
checked: c.useFirstPageHeaderFooter ===
|
|
983
|
+
checked: c.useFirstPageHeaderFooter === R.TRUE,
|
|
938
984
|
onChange: (l) => {
|
|
939
985
|
g(l, "useFirstPageHeaderFooter");
|
|
940
986
|
},
|
|
941
987
|
children: e.t("headerFooter.firstPageCheckBox")
|
|
942
988
|
}
|
|
943
989
|
) }),
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
|
|
990
|
+
/* @__PURE__ */ b.jsx("div", { className: j.optionsFormItem, children: /* @__PURE__ */ b.jsx(
|
|
991
|
+
zt,
|
|
946
992
|
{
|
|
947
|
-
checked: c.evenAndOddHeaders ===
|
|
993
|
+
checked: c.evenAndOddHeaders === R.TRUE,
|
|
948
994
|
onChange: (l) => {
|
|
949
995
|
g(l, "evenAndOddHeaders");
|
|
950
996
|
},
|
|
@@ -952,11 +998,11 @@ const Mr = "univer-panel", yr = "univer-options-section", xr = "univer-options-f
|
|
|
952
998
|
}
|
|
953
999
|
) })
|
|
954
1000
|
] }),
|
|
955
|
-
/* @__PURE__ */
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
|
|
1001
|
+
/* @__PURE__ */ b.jsxs("div", { className: gi(j.optionsSection, j.optionsMarginSetting), children: [
|
|
1002
|
+
/* @__PURE__ */ b.jsxs("div", { className: j.optionsMarginItem, children: [
|
|
1003
|
+
/* @__PURE__ */ b.jsx("span", { children: e.t("headerFooter.headerTopMargin") }),
|
|
1004
|
+
/* @__PURE__ */ b.jsx(
|
|
1005
|
+
Gt,
|
|
960
1006
|
{
|
|
961
1007
|
min: 0,
|
|
962
1008
|
max: 200,
|
|
@@ -965,14 +1011,14 @@ const Mr = "univer-panel", yr = "univer-options-section", xr = "univer-options-f
|
|
|
965
1011
|
onChange: (l) => {
|
|
966
1012
|
h(l, "marginHeader");
|
|
967
1013
|
},
|
|
968
|
-
className:
|
|
1014
|
+
className: j.optionsInput
|
|
969
1015
|
}
|
|
970
1016
|
)
|
|
971
1017
|
] }),
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
|
|
1018
|
+
/* @__PURE__ */ b.jsxs("div", { className: j.optionsMarginItem, children: [
|
|
1019
|
+
/* @__PURE__ */ b.jsx("span", { children: e.t("headerFooter.footerBottomMargin") }),
|
|
1020
|
+
/* @__PURE__ */ b.jsx(
|
|
1021
|
+
Gt,
|
|
976
1022
|
{
|
|
977
1023
|
min: 0,
|
|
978
1024
|
max: 200,
|
|
@@ -981,36 +1027,36 @@ const Mr = "univer-panel", yr = "univer-options-section", xr = "univer-options-f
|
|
|
981
1027
|
onChange: (l) => {
|
|
982
1028
|
h(l, "marginFooter");
|
|
983
1029
|
},
|
|
984
|
-
className:
|
|
1030
|
+
className: j.optionsInput
|
|
985
1031
|
}
|
|
986
1032
|
)
|
|
987
1033
|
] })
|
|
988
1034
|
] }),
|
|
989
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ b.jsx("div", { className: j.optionsSection, children: /* @__PURE__ */ b.jsx(ui, { onClick: _, children: e.t("headerFooter.closeHeaderFooter") }) })
|
|
990
1036
|
] });
|
|
991
|
-
},
|
|
1037
|
+
}, Or = () => {
|
|
992
1038
|
var d;
|
|
993
|
-
const t =
|
|
994
|
-
return
|
|
1039
|
+
const t = Y(_e), e = Y(X), i = Y(L).getCurrentUniverDocInstance().getUnitId(), s = ((d = e.getRenderById(i)) == null ? void 0 : d.with($)).getViewModel(), [a, c] = Ot(!0);
|
|
1040
|
+
return Tt(() => {
|
|
995
1041
|
const g = s.getEditArea();
|
|
996
|
-
c(g !==
|
|
997
|
-
const h = s.editAreaChange$.subscribe((
|
|
998
|
-
|
|
1042
|
+
c(g !== w.BODY);
|
|
1043
|
+
const h = s.editAreaChange$.subscribe((_) => {
|
|
1044
|
+
_ != null && c(_ !== w.BODY);
|
|
999
1045
|
});
|
|
1000
1046
|
return () => {
|
|
1001
1047
|
h.unsubscribe();
|
|
1002
1048
|
};
|
|
1003
|
-
}, []), /* @__PURE__ */
|
|
1004
|
-
},
|
|
1049
|
+
}, []), /* @__PURE__ */ b.jsx("div", { className: j.panel, children: a ? /* @__PURE__ */ b.jsx(Rr, { unitId: i }) : /* @__PURE__ */ b.jsx("div", { className: j.panelDisableText, children: t.t("headerFooter.disableText") }) });
|
|
1050
|
+
}, Yn = {
|
|
1005
1051
|
id: "sidebar.operation.doc-header-footer-panel",
|
|
1006
|
-
type:
|
|
1052
|
+
type: pe.COMMAND,
|
|
1007
1053
|
handler: async (t, e) => {
|
|
1008
|
-
const n = t.get(
|
|
1054
|
+
const n = t.get(Oo), o = t.get(_e);
|
|
1009
1055
|
switch (e.value) {
|
|
1010
1056
|
case "open":
|
|
1011
1057
|
n.open({
|
|
1012
1058
|
header: { title: o.t("headerFooter.panel") },
|
|
1013
|
-
children: { label:
|
|
1059
|
+
children: { label: kn },
|
|
1014
1060
|
onClose: () => {
|
|
1015
1061
|
},
|
|
1016
1062
|
width: 400
|
|
@@ -1024,17 +1070,17 @@ const Mr = "univer-panel", yr = "univer-options-section", xr = "univer-options-f
|
|
|
1024
1070
|
return !0;
|
|
1025
1071
|
}
|
|
1026
1072
|
};
|
|
1027
|
-
var
|
|
1028
|
-
for (var
|
|
1029
|
-
(s = t[
|
|
1030
|
-
return o &&
|
|
1031
|
-
},
|
|
1032
|
-
const
|
|
1033
|
-
var
|
|
1034
|
-
function
|
|
1073
|
+
var Tr = Object.defineProperty, Er = Object.getOwnPropertyDescriptor, Ir = (t, e, n, o) => {
|
|
1074
|
+
for (var i = o > 1 ? void 0 : o ? Er(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
1075
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
1076
|
+
return o && i && Tr(e, n, i), i;
|
|
1077
|
+
}, q = (t, e) => (n, o) => e(n, o, t);
|
|
1078
|
+
const en = "rgba(58, 96, 247, 1)", tn = "rgba(58, 96, 247, 0.08)";
|
|
1079
|
+
var H = /* @__PURE__ */ ((t) => (t[t.FIRST_PAGE_HEADER = 0] = "FIRST_PAGE_HEADER", t[t.FIRST_PAGE_FOOTER = 1] = "FIRST_PAGE_FOOTER", t[t.DEFAULT_HEADER = 2] = "DEFAULT_HEADER", t[t.DEFAULT_FOOTER = 3] = "DEFAULT_FOOTER", t[t.EVEN_PAGE_HEADER = 4] = "EVEN_PAGE_HEADER", t[t.EVEN_PAGE_FOOTER = 5] = "EVEN_PAGE_FOOTER", t))(H || {});
|
|
1080
|
+
function Mr(t, e, n) {
|
|
1035
1081
|
const { documentStyle: o } = t.getDataModel().getSnapshot(), {
|
|
1036
|
-
defaultHeaderId:
|
|
1037
|
-
defaultFooterId:
|
|
1082
|
+
defaultHeaderId: i,
|
|
1083
|
+
defaultFooterId: r,
|
|
1038
1084
|
evenPageHeaderId: s,
|
|
1039
1085
|
evenPageFooterId: a,
|
|
1040
1086
|
firstPageHeaderId: c,
|
|
@@ -1043,35 +1089,35 @@ function wr(t, e, n) {
|
|
|
1043
1089
|
useFirstPageHeaderFooter: h
|
|
1044
1090
|
} = o;
|
|
1045
1091
|
switch (e) {
|
|
1046
|
-
case
|
|
1092
|
+
case w.BODY:
|
|
1047
1093
|
return {
|
|
1048
1094
|
createType: null,
|
|
1049
1095
|
headerFooterId: null
|
|
1050
1096
|
};
|
|
1051
|
-
case
|
|
1052
|
-
return h ===
|
|
1097
|
+
case w.HEADER:
|
|
1098
|
+
return h === R.TRUE && !c ? {
|
|
1053
1099
|
createType: 0,
|
|
1054
1100
|
headerFooterId: null
|
|
1055
|
-
} : g ===
|
|
1101
|
+
} : g === R.TRUE && n % 2 === 0 && !s ? {
|
|
1056
1102
|
createType: 4,
|
|
1057
1103
|
headerFooterId: null
|
|
1058
|
-
} :
|
|
1104
|
+
} : i ? {
|
|
1059
1105
|
createType: null,
|
|
1060
|
-
headerFooterId:
|
|
1106
|
+
headerFooterId: i
|
|
1061
1107
|
} : {
|
|
1062
1108
|
createType: 2,
|
|
1063
1109
|
headerFooterId: null
|
|
1064
1110
|
};
|
|
1065
|
-
case
|
|
1066
|
-
return h ===
|
|
1111
|
+
case w.FOOTER:
|
|
1112
|
+
return h === R.TRUE && !d ? {
|
|
1067
1113
|
createType: 1,
|
|
1068
1114
|
headerFooterId: null
|
|
1069
|
-
} : g ===
|
|
1115
|
+
} : g === R.TRUE && n % 2 === 0 && !a ? {
|
|
1070
1116
|
createType: 5,
|
|
1071
1117
|
headerFooterId: null
|
|
1072
|
-
} :
|
|
1118
|
+
} : r ? {
|
|
1073
1119
|
createType: null,
|
|
1074
|
-
headerFooterId:
|
|
1120
|
+
headerFooterId: r
|
|
1075
1121
|
} : {
|
|
1076
1122
|
createType: 3,
|
|
1077
1123
|
headerFooterId: null
|
|
@@ -1080,69 +1126,69 @@ function wr(t, e, n) {
|
|
|
1080
1126
|
throw new Error(`Invalid editArea: ${e}`);
|
|
1081
1127
|
}
|
|
1082
1128
|
}
|
|
1083
|
-
let
|
|
1084
|
-
constructor(e, n, o,
|
|
1129
|
+
let ut = class extends z {
|
|
1130
|
+
constructor(e, n, o, i, r, s, a, c, d) {
|
|
1085
1131
|
super();
|
|
1086
|
-
|
|
1087
|
-
this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv =
|
|
1132
|
+
I(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
1133
|
+
this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = i, this._renderManagerService = r, this._docSkeletonManagerService = s, this._textSelectionRenderManager = a, this._localeService = c, this._componentManager = d, this._initialize();
|
|
1088
1134
|
}
|
|
1089
1135
|
_initialize() {
|
|
1090
|
-
this._context.unit.getSnapshot().documentStyle.documentFlavor ===
|
|
1136
|
+
this._context.unit.getSnapshot().documentStyle.documentFlavor === lo.TRADITIONAL && (this._init(), this._drawHeaderFooterLabel(), this._registerCommands(), this._initCustomComponents());
|
|
1091
1137
|
}
|
|
1092
1138
|
_registerCommands() {
|
|
1093
1139
|
[
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1140
|
+
on,
|
|
1141
|
+
Xn,
|
|
1142
|
+
Yn
|
|
1097
1143
|
].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e)));
|
|
1098
1144
|
}
|
|
1099
1145
|
_initCustomComponents() {
|
|
1100
1146
|
const e = this._componentManager;
|
|
1101
|
-
this.disposeWithMe(e.register(
|
|
1147
|
+
this.disposeWithMe(e.register(kn, Or));
|
|
1102
1148
|
}
|
|
1103
1149
|
_init() {
|
|
1104
|
-
const { unitId: e } = this._context, n =
|
|
1150
|
+
const { unitId: e } = this._context, n = Q(this._context);
|
|
1105
1151
|
n == null || n.document == null || this._loadedMap.has(n.document) || (this._initialMain(e), this._loadedMap.add(n.document));
|
|
1106
1152
|
}
|
|
1107
1153
|
_initialMain(e) {
|
|
1108
|
-
const n =
|
|
1109
|
-
this.disposeWithMe(o.onDblclick$.subscribeEvent(async (
|
|
1154
|
+
const n = Q(this._context), { document: o } = n;
|
|
1155
|
+
this.disposeWithMe(o.onDblclick$.subscribeEvent(async (i) => {
|
|
1110
1156
|
if (this._isEditorReadOnly(e))
|
|
1111
1157
|
return;
|
|
1112
|
-
const { offsetX:
|
|
1113
|
-
pageLayoutType: a =
|
|
1158
|
+
const { offsetX: r, offsetY: s } = i, {
|
|
1159
|
+
pageLayoutType: a = Oe.VERTICAL,
|
|
1114
1160
|
pageMarginLeft: c,
|
|
1115
1161
|
pageMarginTop: d
|
|
1116
|
-
} = o.getOffsetConfig(), g = this._getTransformCoordForDocumentOffset(
|
|
1162
|
+
} = o.getOffsetConfig(), g = this._getTransformCoordForDocumentOffset(r, s);
|
|
1117
1163
|
if (g == null)
|
|
1118
1164
|
return;
|
|
1119
|
-
const h = this._docSkeletonManagerService.getViewModel(),
|
|
1165
|
+
const h = this._docSkeletonManagerService.getViewModel(), _ = this._docSkeletonManagerService.getSkeleton(), l = h.getEditArea(), { editArea: p, pageNumber: u } = _.findEditAreaByCoord(
|
|
1120
1166
|
g,
|
|
1121
1167
|
a,
|
|
1122
1168
|
c,
|
|
1123
1169
|
d
|
|
1124
1170
|
);
|
|
1125
|
-
if (l ===
|
|
1171
|
+
if (l === p)
|
|
1126
1172
|
return;
|
|
1127
|
-
h.setEditArea(
|
|
1128
|
-
const { createType: f, headerFooterId: m } =
|
|
1129
|
-
if (
|
|
1130
|
-
this._textSelectionRenderManager.setSegment(""), this._textSelectionRenderManager.setSegmentPage(-1), this._textSelectionRenderManager.setCursorManually(
|
|
1173
|
+
h.setEditArea(p);
|
|
1174
|
+
const { createType: f, headerFooterId: m } = Mr(h, p, u);
|
|
1175
|
+
if (p === w.BODY)
|
|
1176
|
+
this._textSelectionRenderManager.setSegment(""), this._textSelectionRenderManager.setSegmentPage(-1), this._textSelectionRenderManager.setCursorManually(r, s);
|
|
1131
1177
|
else if (f != null) {
|
|
1132
|
-
const
|
|
1133
|
-
this._textSelectionRenderManager.setSegment(
|
|
1178
|
+
const O = K.generateRandomId(6);
|
|
1179
|
+
this._textSelectionRenderManager.setSegment(O), this._textSelectionRenderManager.setSegmentPage(u), await this._commandService.executeCommand(on.id, {
|
|
1134
1180
|
unitId: e,
|
|
1135
1181
|
createType: f,
|
|
1136
|
-
segmentId:
|
|
1182
|
+
segmentId: O
|
|
1137
1183
|
});
|
|
1138
|
-
} else m != null && (this._textSelectionRenderManager.setSegment(m), this._textSelectionRenderManager.setSegmentPage(u), this._textSelectionRenderManager.setCursorManually(
|
|
1184
|
+
} else m != null && (this._textSelectionRenderManager.setSegment(m), this._textSelectionRenderManager.setSegmentPage(u), this._textSelectionRenderManager.setCursorManually(r, s));
|
|
1139
1185
|
}));
|
|
1140
1186
|
}
|
|
1141
1187
|
_getTransformCoordForDocumentOffset(e, n) {
|
|
1142
|
-
const o =
|
|
1188
|
+
const o = Q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
|
|
1143
1189
|
if (a == null)
|
|
1144
1190
|
return;
|
|
1145
|
-
const c = a.transformVector2SceneCoord(
|
|
1191
|
+
const c = a.transformVector2SceneCoord(Rt.FromArray([e, n]));
|
|
1146
1192
|
return s.clone().invert().applyPoint(c);
|
|
1147
1193
|
}
|
|
1148
1194
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -1154,60 +1200,60 @@ let it = class extends Q {
|
|
|
1154
1200
|
const o = this._renderManagerService.getRenderById(n);
|
|
1155
1201
|
if (this._editorService.isEditor(n) || this._instanceSrv.getUniverDocInstance(n) == null || o == null)
|
|
1156
1202
|
return;
|
|
1157
|
-
const { mainComponent:
|
|
1203
|
+
const { mainComponent: i } = o, r = i;
|
|
1158
1204
|
this.disposeWithMe(
|
|
1159
|
-
|
|
1205
|
+
_n(
|
|
1160
1206
|
// eslint-disable-next-line max-lines-per-function
|
|
1161
|
-
|
|
1207
|
+
r.pageRender$.subscribe((s) => {
|
|
1162
1208
|
if (this._editorService.isEditor(n))
|
|
1163
1209
|
return;
|
|
1164
|
-
const d = this._docSkeletonManagerService.getViewModel().getEditArea() ===
|
|
1165
|
-
if (l.save(), l.translate(h - 0.5,
|
|
1210
|
+
const d = this._docSkeletonManagerService.getViewModel().getEditArea() === w.BODY, { page: g, pageLeft: h, pageTop: _, ctx: l } = s, { pageWidth: p, pageHeight: u, marginTop: f, marginBottom: m } = g;
|
|
1211
|
+
if (l.save(), l.translate(h - 0.5, _ - 0.5), d ? (qe.drawWith(l, {
|
|
1166
1212
|
left: 0,
|
|
1167
1213
|
top: 0,
|
|
1168
|
-
width:
|
|
1214
|
+
width: p,
|
|
1169
1215
|
height: f,
|
|
1170
1216
|
fill: "rgba(255, 255, 255, 0.5)"
|
|
1171
|
-
}), l.save(), l.translate(0, u - m),
|
|
1217
|
+
}), l.save(), l.translate(0, u - m), qe.drawWith(l, {
|
|
1172
1218
|
left: 0,
|
|
1173
1219
|
top: 0,
|
|
1174
|
-
width:
|
|
1220
|
+
width: p,
|
|
1175
1221
|
height: m,
|
|
1176
1222
|
fill: "rgba(255, 255, 255, 0.5)"
|
|
1177
|
-
}), l.restore()) : (l.save(), l.translate(0, f),
|
|
1223
|
+
}), l.restore()) : (l.save(), l.translate(0, f), qe.drawWith(l, {
|
|
1178
1224
|
left: 0,
|
|
1179
1225
|
top: f,
|
|
1180
|
-
width:
|
|
1226
|
+
width: p,
|
|
1181
1227
|
height: u - f - m,
|
|
1182
1228
|
fill: "rgba(255, 255, 255, 0.5)"
|
|
1183
1229
|
}), l.restore()), !d) {
|
|
1184
|
-
const
|
|
1230
|
+
const S = {
|
|
1185
1231
|
dataArray: [{
|
|
1186
1232
|
command: "M",
|
|
1187
1233
|
points: [0, f]
|
|
1188
1234
|
}, {
|
|
1189
1235
|
command: "L",
|
|
1190
|
-
points: [
|
|
1236
|
+
points: [p, f]
|
|
1191
1237
|
}],
|
|
1192
1238
|
strokeWidth: 1,
|
|
1193
|
-
stroke:
|
|
1194
|
-
},
|
|
1239
|
+
stroke: en
|
|
1240
|
+
}, O = {
|
|
1195
1241
|
dataArray: [{
|
|
1196
1242
|
command: "M",
|
|
1197
1243
|
points: [0, u - m]
|
|
1198
1244
|
}, {
|
|
1199
1245
|
command: "L",
|
|
1200
|
-
points: [
|
|
1246
|
+
points: [p, u - m]
|
|
1201
1247
|
}],
|
|
1202
1248
|
strokeWidth: 1,
|
|
1203
|
-
stroke:
|
|
1249
|
+
stroke: en
|
|
1204
1250
|
};
|
|
1205
|
-
|
|
1251
|
+
Bt.drawWith(l, S), Bt.drawWith(l, O), l.translate(0, f + 1), Ue.drawWith(l, {
|
|
1206
1252
|
text: e.t("headerFooter.header"),
|
|
1207
|
-
color:
|
|
1208
|
-
}), l.translate(0, u - f - m),
|
|
1253
|
+
color: tn
|
|
1254
|
+
}), l.translate(0, u - f - m), Ue.drawWith(l, {
|
|
1209
1255
|
text: e.t("headerFooter.footer"),
|
|
1210
|
-
color:
|
|
1256
|
+
color: tn
|
|
1211
1257
|
});
|
|
1212
1258
|
}
|
|
1213
1259
|
l.restore();
|
|
@@ -1224,17 +1270,17 @@ let it = class extends Q {
|
|
|
1224
1270
|
return this._context.unit;
|
|
1225
1271
|
}
|
|
1226
1272
|
};
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
],
|
|
1237
|
-
function
|
|
1273
|
+
ut = Ir([
|
|
1274
|
+
q(1, E),
|
|
1275
|
+
q(2, oe),
|
|
1276
|
+
q(3, L),
|
|
1277
|
+
q(4, X),
|
|
1278
|
+
q(5, M($)),
|
|
1279
|
+
q(6, ie),
|
|
1280
|
+
q(7, M(_e)),
|
|
1281
|
+
q(8, M(Rn))
|
|
1282
|
+
], ut);
|
|
1283
|
+
function nn() {
|
|
1238
1284
|
return {
|
|
1239
1285
|
dataStream: `\r
|
|
1240
1286
|
`,
|
|
@@ -1264,296 +1310,296 @@ function jt() {
|
|
|
1264
1310
|
]
|
|
1265
1311
|
};
|
|
1266
1312
|
}
|
|
1267
|
-
function
|
|
1268
|
-
const
|
|
1313
|
+
function tt(t, e, n, o) {
|
|
1314
|
+
const i = it.getInstance(), r = 6, s = t != null ? t : K.generateRandomId(r), a = e === H.DEFAULT_HEADER || e === H.FIRST_PAGE_HEADER || e === H.EVEN_PAGE_HEADER, c = i.insertOp([a ? "headers" : "footers", s], {
|
|
1269
1315
|
[a ? "headerId" : "footerId"]: s,
|
|
1270
|
-
body:
|
|
1316
|
+
body: nn()
|
|
1271
1317
|
});
|
|
1272
1318
|
o.push(c);
|
|
1273
|
-
const d =
|
|
1319
|
+
const d = K.generateRandomId(r), g = i.insertOp([a ? "footers" : "headers", d], {
|
|
1274
1320
|
[a ? "footers" : "headers"]: d,
|
|
1275
|
-
body:
|
|
1321
|
+
body: nn()
|
|
1276
1322
|
});
|
|
1277
1323
|
o.push(g);
|
|
1278
|
-
let h = "defaultHeaderId",
|
|
1324
|
+
let h = "defaultHeaderId", _ = "defaultFooterId";
|
|
1279
1325
|
switch (e) {
|
|
1280
|
-
case
|
|
1281
|
-
h = "defaultHeaderId",
|
|
1326
|
+
case H.DEFAULT_HEADER:
|
|
1327
|
+
h = "defaultHeaderId", _ = "defaultFooterId";
|
|
1282
1328
|
break;
|
|
1283
|
-
case
|
|
1284
|
-
h = "defaultFooterId",
|
|
1329
|
+
case H.DEFAULT_FOOTER:
|
|
1330
|
+
h = "defaultFooterId", _ = "defaultHeaderId";
|
|
1285
1331
|
break;
|
|
1286
|
-
case
|
|
1287
|
-
h = "firstPageHeaderId",
|
|
1332
|
+
case H.FIRST_PAGE_HEADER:
|
|
1333
|
+
h = "firstPageHeaderId", _ = "firstPageFooterId";
|
|
1288
1334
|
break;
|
|
1289
|
-
case
|
|
1290
|
-
h = "firstPageFooterId",
|
|
1335
|
+
case H.FIRST_PAGE_FOOTER:
|
|
1336
|
+
h = "firstPageFooterId", _ = "firstPageHeaderId";
|
|
1291
1337
|
break;
|
|
1292
|
-
case
|
|
1293
|
-
h = "evenPageHeaderId",
|
|
1338
|
+
case H.EVEN_PAGE_HEADER:
|
|
1339
|
+
h = "evenPageHeaderId", _ = "evenPageFooterId";
|
|
1294
1340
|
break;
|
|
1295
|
-
case
|
|
1296
|
-
h = "evenPageFooterId",
|
|
1341
|
+
case H.EVEN_PAGE_FOOTER:
|
|
1342
|
+
h = "evenPageFooterId", _ = "evenPageHeaderId";
|
|
1297
1343
|
break;
|
|
1298
1344
|
default:
|
|
1299
1345
|
throw new Error(`Unknown header footer type: ${e}`);
|
|
1300
1346
|
}
|
|
1301
|
-
for (const [l,
|
|
1347
|
+
for (const [l, p] of [[h, s], [_, d]])
|
|
1302
1348
|
if (n[l] != null) {
|
|
1303
|
-
const u =
|
|
1349
|
+
const u = i.replaceOp(["documentStyle", l], n[l], p);
|
|
1304
1350
|
o.push(u);
|
|
1305
1351
|
} else {
|
|
1306
|
-
const u =
|
|
1352
|
+
const u = i.insertOp(["documentStyle", l], p);
|
|
1307
1353
|
o.push(u);
|
|
1308
1354
|
}
|
|
1309
1355
|
return o;
|
|
1310
1356
|
}
|
|
1311
|
-
const
|
|
1312
|
-
id:
|
|
1313
|
-
type:
|
|
1357
|
+
const De = "doc.command.core-header-footer", on = {
|
|
1358
|
+
id: De,
|
|
1359
|
+
type: pe.COMMAND,
|
|
1314
1360
|
// eslint-disable-next-line max-lines-per-function
|
|
1315
1361
|
handler: async (t, e) => {
|
|
1316
|
-
var
|
|
1317
|
-
const n = t.get(
|
|
1362
|
+
var T;
|
|
1363
|
+
const n = t.get(E), o = t.get(L), i = t.get(X), { unitId: r, segmentId: s, createType: a, headerFooterProps: c } = e, d = (T = i.getRenderById(r)) == null ? void 0 : T.with($), g = o.getUniverDocInstance(r), h = d == null ? void 0 : d.getViewModel();
|
|
1318
1364
|
if (g == null || h == null)
|
|
1319
1365
|
return !1;
|
|
1320
|
-
const
|
|
1366
|
+
const _ = h.getEditArea(), { documentStyle: l } = g.getSnapshot(), p = (c == null ? void 0 : c.marginFooter) != null || (c == null ? void 0 : c.marginHeader) != null, u = [{
|
|
1321
1367
|
startOffset: 0,
|
|
1322
1368
|
endOffset: 0,
|
|
1323
1369
|
collapsed: !0
|
|
1324
1370
|
}], f = {
|
|
1325
|
-
id:
|
|
1371
|
+
id: Ge.id,
|
|
1326
1372
|
params: {
|
|
1327
|
-
unitId:
|
|
1373
|
+
unitId: r,
|
|
1328
1374
|
actions: [],
|
|
1329
1375
|
textRanges: u,
|
|
1330
1376
|
debounce: !0
|
|
1331
1377
|
}
|
|
1332
1378
|
};
|
|
1333
|
-
|
|
1334
|
-
const m =
|
|
1335
|
-
return a != null &&
|
|
1336
|
-
const
|
|
1337
|
-
if (
|
|
1379
|
+
p && (f.params.noNeedSetTextRange = !0);
|
|
1380
|
+
const m = it.getInstance(), S = [];
|
|
1381
|
+
return a != null && tt(s, a, l, S), c != null && Object.keys(c).forEach((C) => {
|
|
1382
|
+
const N = c[C], k = l[C];
|
|
1383
|
+
if (N === k)
|
|
1338
1384
|
return;
|
|
1339
|
-
let
|
|
1340
|
-
if (
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1343
|
-
} else if (
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1385
|
+
let V;
|
|
1386
|
+
if (k === void 0 ? V = m.insertOp(["documentStyle", C], N) : V = m.replaceOp(["documentStyle", C], k, N), S.push(V), C === "useFirstPageHeaderFooter" && N === R.TRUE && !l.firstPageHeaderId) {
|
|
1387
|
+
const W = _ === w.HEADER ? H.FIRST_PAGE_HEADER : H.FIRST_PAGE_FOOTER;
|
|
1388
|
+
tt(s, W, l, S);
|
|
1389
|
+
} else if (C === "evenAndOddHeaders" && N === R.TRUE && !l.evenPageHeaderId) {
|
|
1390
|
+
const W = _ === w.HEADER ? H.EVEN_PAGE_HEADER : H.EVEN_PAGE_FOOTER;
|
|
1391
|
+
tt(s, W, l, S);
|
|
1346
1392
|
}
|
|
1347
|
-
}),
|
|
1393
|
+
}), S.length === 0 ? !1 : (f.params.actions = S.reduce((C, N) => it.compose(C, N), null), !!n.syncExecuteCommand(f.id, f.params));
|
|
1348
1394
|
}
|
|
1349
|
-
},
|
|
1395
|
+
}, Xn = {
|
|
1350
1396
|
id: "doc.command.open-header-footer-panel",
|
|
1351
|
-
type:
|
|
1352
|
-
handler: async (t, e) => t.get(
|
|
1397
|
+
type: pe.COMMAND,
|
|
1398
|
+
handler: async (t, e) => t.get(E).executeCommand(Yn.id, { value: "open" })
|
|
1353
1399
|
};
|
|
1354
|
-
function
|
|
1355
|
-
const e = t.get(
|
|
1400
|
+
function br(t) {
|
|
1401
|
+
const e = t.get(E);
|
|
1356
1402
|
return {
|
|
1357
|
-
id:
|
|
1358
|
-
group:
|
|
1403
|
+
id: In.id,
|
|
1404
|
+
group: F.TOOLBAR_FORMAT,
|
|
1359
1405
|
type: y.BUTTON,
|
|
1360
1406
|
icon: "BoldSingle",
|
|
1361
1407
|
title: "Set bold",
|
|
1362
1408
|
tooltip: "toolbar.bold",
|
|
1363
1409
|
positions: [P.TOOLBAR_START],
|
|
1364
1410
|
activated$: new B((n) => {
|
|
1365
|
-
const o = e.onCommandExecuted((
|
|
1411
|
+
const o = e.onCommandExecuted((i) => {
|
|
1366
1412
|
var s;
|
|
1367
|
-
const
|
|
1368
|
-
if (
|
|
1369
|
-
const a =
|
|
1413
|
+
const r = i.id;
|
|
1414
|
+
if (r === G.id || r === fe.id) {
|
|
1415
|
+
const a = te(t);
|
|
1370
1416
|
if (a == null)
|
|
1371
1417
|
return;
|
|
1372
1418
|
const c = (s = a.ts) == null ? void 0 : s.bl;
|
|
1373
|
-
n.next(c ===
|
|
1419
|
+
n.next(c === R.TRUE);
|
|
1374
1420
|
}
|
|
1375
1421
|
});
|
|
1376
1422
|
return n.next(!1), o.dispose;
|
|
1377
1423
|
}),
|
|
1378
|
-
hidden$:
|
|
1424
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1379
1425
|
};
|
|
1380
1426
|
}
|
|
1381
|
-
function
|
|
1382
|
-
const e = t.get(
|
|
1427
|
+
function xr(t) {
|
|
1428
|
+
const e = t.get(E);
|
|
1383
1429
|
return {
|
|
1384
|
-
id:
|
|
1385
|
-
group:
|
|
1430
|
+
id: Mn.id,
|
|
1431
|
+
group: F.TOOLBAR_FORMAT,
|
|
1386
1432
|
type: y.BUTTON,
|
|
1387
1433
|
icon: "ItalicSingle",
|
|
1388
1434
|
title: "Set italic",
|
|
1389
1435
|
tooltip: "toolbar.italic",
|
|
1390
1436
|
positions: [P.TOOLBAR_START],
|
|
1391
1437
|
activated$: new B((n) => {
|
|
1392
|
-
const o = e.onCommandExecuted((
|
|
1438
|
+
const o = e.onCommandExecuted((i) => {
|
|
1393
1439
|
var s;
|
|
1394
|
-
const
|
|
1395
|
-
if (
|
|
1396
|
-
const a =
|
|
1440
|
+
const r = i.id;
|
|
1441
|
+
if (r === G.id || r === fe.id) {
|
|
1442
|
+
const a = te(t);
|
|
1397
1443
|
if (a == null)
|
|
1398
1444
|
return;
|
|
1399
1445
|
const c = (s = a.ts) == null ? void 0 : s.it;
|
|
1400
|
-
n.next(c ===
|
|
1446
|
+
n.next(c === R.TRUE);
|
|
1401
1447
|
}
|
|
1402
1448
|
});
|
|
1403
1449
|
return n.next(!1), o.dispose;
|
|
1404
1450
|
}),
|
|
1405
|
-
hidden$:
|
|
1451
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1406
1452
|
};
|
|
1407
1453
|
}
|
|
1408
|
-
function
|
|
1409
|
-
const e = t.get(
|
|
1454
|
+
function Dr(t) {
|
|
1455
|
+
const e = t.get(E);
|
|
1410
1456
|
return {
|
|
1411
|
-
id:
|
|
1412
|
-
group:
|
|
1457
|
+
id: bn.id,
|
|
1458
|
+
group: F.TOOLBAR_FORMAT,
|
|
1413
1459
|
type: y.BUTTON,
|
|
1414
1460
|
icon: "UnderlineSingle",
|
|
1415
1461
|
title: "Set underline",
|
|
1416
1462
|
tooltip: "toolbar.underline",
|
|
1417
1463
|
positions: [P.TOOLBAR_START],
|
|
1418
1464
|
activated$: new B((n) => {
|
|
1419
|
-
const o = e.onCommandExecuted((
|
|
1465
|
+
const o = e.onCommandExecuted((i) => {
|
|
1420
1466
|
var s;
|
|
1421
|
-
const
|
|
1422
|
-
if (
|
|
1423
|
-
const a =
|
|
1467
|
+
const r = i.id;
|
|
1468
|
+
if (r === G.id || r === fe.id) {
|
|
1469
|
+
const a = te(t);
|
|
1424
1470
|
if (a == null)
|
|
1425
1471
|
return;
|
|
1426
1472
|
const c = (s = a.ts) == null ? void 0 : s.ul;
|
|
1427
|
-
n.next((c == null ? void 0 : c.s) ===
|
|
1473
|
+
n.next((c == null ? void 0 : c.s) === R.TRUE);
|
|
1428
1474
|
}
|
|
1429
1475
|
});
|
|
1430
1476
|
return n.next(!1), o.dispose;
|
|
1431
1477
|
}),
|
|
1432
|
-
hidden$:
|
|
1478
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1433
1479
|
};
|
|
1434
1480
|
}
|
|
1435
|
-
function
|
|
1436
|
-
const e = t.get(
|
|
1481
|
+
function yr(t) {
|
|
1482
|
+
const e = t.get(E);
|
|
1437
1483
|
return {
|
|
1438
|
-
id:
|
|
1439
|
-
group:
|
|
1484
|
+
id: xn.id,
|
|
1485
|
+
group: F.TOOLBAR_FORMAT,
|
|
1440
1486
|
type: y.BUTTON,
|
|
1441
1487
|
icon: "StrikethroughSingle",
|
|
1442
1488
|
title: "Set strike through",
|
|
1443
1489
|
tooltip: "toolbar.strikethrough",
|
|
1444
1490
|
positions: [P.TOOLBAR_START],
|
|
1445
1491
|
activated$: new B((n) => {
|
|
1446
|
-
const o = e.onCommandExecuted((
|
|
1492
|
+
const o = e.onCommandExecuted((i) => {
|
|
1447
1493
|
var s;
|
|
1448
|
-
const
|
|
1449
|
-
if (
|
|
1450
|
-
const a =
|
|
1494
|
+
const r = i.id;
|
|
1495
|
+
if (r === G.id || r === fe.id) {
|
|
1496
|
+
const a = te(t);
|
|
1451
1497
|
if (a == null)
|
|
1452
1498
|
return;
|
|
1453
1499
|
const c = (s = a.ts) == null ? void 0 : s.st;
|
|
1454
|
-
n.next((c == null ? void 0 : c.s) ===
|
|
1500
|
+
n.next((c == null ? void 0 : c.s) === R.TRUE);
|
|
1455
1501
|
}
|
|
1456
1502
|
});
|
|
1457
1503
|
return n.next(!1), o.dispose;
|
|
1458
1504
|
}),
|
|
1459
|
-
hidden$:
|
|
1505
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1460
1506
|
};
|
|
1461
1507
|
}
|
|
1462
|
-
function
|
|
1463
|
-
const e = t.get(
|
|
1508
|
+
function Pr(t) {
|
|
1509
|
+
const e = t.get(E);
|
|
1464
1510
|
return {
|
|
1465
|
-
id:
|
|
1466
|
-
group:
|
|
1511
|
+
id: Dn.id,
|
|
1512
|
+
group: F.TOOLBAR_FORMAT,
|
|
1467
1513
|
type: y.BUTTON,
|
|
1468
1514
|
icon: "SubscriptSingle",
|
|
1469
1515
|
tooltip: "toolbar.subscript",
|
|
1470
1516
|
positions: [P.TOOLBAR_START],
|
|
1471
1517
|
activated$: new B((n) => {
|
|
1472
|
-
const o = e.onCommandExecuted((
|
|
1518
|
+
const o = e.onCommandExecuted((i) => {
|
|
1473
1519
|
var s;
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
const a =
|
|
1520
|
+
const r = i.id;
|
|
1521
|
+
if (r === G.id || r === fe.id) {
|
|
1522
|
+
const a = te(t);
|
|
1477
1523
|
if (a == null)
|
|
1478
1524
|
return;
|
|
1479
1525
|
const c = (s = a.ts) == null ? void 0 : s.va;
|
|
1480
|
-
n.next(c ===
|
|
1526
|
+
n.next(c === ue.SUBSCRIPT);
|
|
1481
1527
|
}
|
|
1482
1528
|
});
|
|
1483
1529
|
return n.next(!1), o.dispose;
|
|
1484
1530
|
}),
|
|
1485
|
-
hidden$:
|
|
1531
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1486
1532
|
};
|
|
1487
1533
|
}
|
|
1488
|
-
function
|
|
1489
|
-
const e = t.get(
|
|
1534
|
+
function Ar(t) {
|
|
1535
|
+
const e = t.get(E);
|
|
1490
1536
|
return {
|
|
1491
|
-
id:
|
|
1492
|
-
group:
|
|
1537
|
+
id: yn.id,
|
|
1538
|
+
group: F.TOOLBAR_FORMAT,
|
|
1493
1539
|
type: y.BUTTON,
|
|
1494
1540
|
icon: "SuperscriptSingle",
|
|
1495
1541
|
tooltip: "toolbar.superscript",
|
|
1496
1542
|
positions: [P.TOOLBAR_START],
|
|
1497
1543
|
activated$: new B((n) => {
|
|
1498
|
-
const o = e.onCommandExecuted((
|
|
1544
|
+
const o = e.onCommandExecuted((i) => {
|
|
1499
1545
|
var s;
|
|
1500
|
-
const
|
|
1501
|
-
if (
|
|
1502
|
-
const a =
|
|
1546
|
+
const r = i.id;
|
|
1547
|
+
if (r === G.id || r === fe.id) {
|
|
1548
|
+
const a = te(t);
|
|
1503
1549
|
if (a == null)
|
|
1504
1550
|
return;
|
|
1505
1551
|
const c = (s = a.ts) == null ? void 0 : s.va;
|
|
1506
|
-
n.next(c ===
|
|
1552
|
+
n.next(c === ue.SUPERSCRIPT);
|
|
1507
1553
|
}
|
|
1508
1554
|
});
|
|
1509
1555
|
return n.next(!1), o.dispose;
|
|
1510
1556
|
}),
|
|
1511
|
-
hidden$:
|
|
1557
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1512
1558
|
};
|
|
1513
1559
|
}
|
|
1514
|
-
function
|
|
1515
|
-
const e = t.get(
|
|
1560
|
+
function Nr(t) {
|
|
1561
|
+
const e = t.get(E);
|
|
1516
1562
|
return {
|
|
1517
|
-
id:
|
|
1563
|
+
id: Ft.id,
|
|
1518
1564
|
tooltip: "toolbar.font",
|
|
1519
|
-
group:
|
|
1565
|
+
group: F.TOOLBAR_FORMAT,
|
|
1520
1566
|
type: y.SELECTOR,
|
|
1521
|
-
label:
|
|
1567
|
+
label: Vn,
|
|
1522
1568
|
positions: [P.TOOLBAR_START],
|
|
1523
|
-
selections:
|
|
1569
|
+
selections: Nt.map((n) => ({
|
|
1524
1570
|
label: {
|
|
1525
|
-
name:
|
|
1571
|
+
name: jn,
|
|
1526
1572
|
hoverable: !0
|
|
1527
1573
|
},
|
|
1528
1574
|
value: n.value
|
|
1529
1575
|
})),
|
|
1530
1576
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
1531
1577
|
value$: new B((n) => {
|
|
1532
|
-
const o =
|
|
1578
|
+
const o = Nt[0].value, i = e.onCommandExecuted((r) => {
|
|
1533
1579
|
var a;
|
|
1534
|
-
const s =
|
|
1535
|
-
if (s ===
|
|
1536
|
-
const c =
|
|
1580
|
+
const s = r.id;
|
|
1581
|
+
if (s === G.id || s === Ft.id) {
|
|
1582
|
+
const c = te(t);
|
|
1537
1583
|
if (c == null)
|
|
1538
1584
|
return;
|
|
1539
1585
|
const d = (a = c.ts) == null ? void 0 : a.ff;
|
|
1540
1586
|
n.next(d != null ? d : o);
|
|
1541
1587
|
}
|
|
1542
1588
|
});
|
|
1543
|
-
return n.next(o),
|
|
1589
|
+
return n.next(o), i.dispose;
|
|
1544
1590
|
}),
|
|
1545
|
-
hidden$:
|
|
1591
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1546
1592
|
};
|
|
1547
1593
|
}
|
|
1548
|
-
function
|
|
1549
|
-
const e = t.get(
|
|
1594
|
+
function Fr(t) {
|
|
1595
|
+
const e = t.get(E);
|
|
1550
1596
|
return {
|
|
1551
|
-
id:
|
|
1552
|
-
group:
|
|
1597
|
+
id: Ut.id,
|
|
1598
|
+
group: F.TOOLBAR_FORMAT,
|
|
1553
1599
|
type: y.SELECTOR,
|
|
1554
1600
|
tooltip: "toolbar.fontSize",
|
|
1555
1601
|
label: {
|
|
1556
|
-
name:
|
|
1602
|
+
name: Wn,
|
|
1557
1603
|
props: {
|
|
1558
1604
|
min: 1,
|
|
1559
1605
|
max: 400
|
|
@@ -1561,411 +1607,539 @@ function Gr(t) {
|
|
|
1561
1607
|
}
|
|
1562
1608
|
},
|
|
1563
1609
|
positions: [P.TOOLBAR_START],
|
|
1564
|
-
selections:
|
|
1610
|
+
selections: To,
|
|
1565
1611
|
// disabled$,
|
|
1566
1612
|
value$: new B((n) => {
|
|
1567
|
-
const
|
|
1613
|
+
const i = e.onCommandExecuted((r) => {
|
|
1568
1614
|
var a;
|
|
1569
|
-
const s =
|
|
1570
|
-
if (s ===
|
|
1571
|
-
const c =
|
|
1615
|
+
const s = r.id;
|
|
1616
|
+
if (s === G.id || s === Ut.id) {
|
|
1617
|
+
const c = te(t);
|
|
1572
1618
|
if (c == null)
|
|
1573
1619
|
return;
|
|
1574
1620
|
const d = (a = c.ts) == null ? void 0 : a.fs;
|
|
1575
1621
|
n.next(d != null ? d : 14);
|
|
1576
1622
|
}
|
|
1577
1623
|
});
|
|
1578
|
-
return n.next(14),
|
|
1624
|
+
return n.next(14), i.dispose;
|
|
1579
1625
|
}),
|
|
1580
|
-
hidden$:
|
|
1626
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1581
1627
|
};
|
|
1582
1628
|
}
|
|
1583
|
-
function
|
|
1584
|
-
const e = t.get(
|
|
1629
|
+
function Ur(t) {
|
|
1630
|
+
const e = t.get(E), n = t.get(fn);
|
|
1585
1631
|
return {
|
|
1586
|
-
id:
|
|
1632
|
+
id: Lt.id,
|
|
1587
1633
|
icon: "FontColor",
|
|
1588
1634
|
tooltip: "toolbar.textColor.main",
|
|
1589
|
-
group:
|
|
1635
|
+
group: F.TOOLBAR_FORMAT,
|
|
1590
1636
|
type: y.BUTTON_SELECTOR,
|
|
1591
1637
|
positions: [P.TOOLBAR_START],
|
|
1592
1638
|
selections: [
|
|
1593
1639
|
{
|
|
1594
1640
|
label: {
|
|
1595
|
-
name:
|
|
1641
|
+
name: It,
|
|
1596
1642
|
hoverable: !1
|
|
1597
1643
|
}
|
|
1598
1644
|
}
|
|
1599
1645
|
],
|
|
1600
1646
|
value$: new B((o) => {
|
|
1601
|
-
const
|
|
1602
|
-
if (s.id ===
|
|
1647
|
+
const i = n.getCurrentTheme().textColor, r = e.onCommandExecuted((s) => {
|
|
1648
|
+
if (s.id === Lt.id) {
|
|
1603
1649
|
const a = s.params.value;
|
|
1604
|
-
o.next(a != null ? a :
|
|
1650
|
+
o.next(a != null ? a : i);
|
|
1605
1651
|
}
|
|
1606
1652
|
});
|
|
1607
|
-
return o.next(
|
|
1653
|
+
return o.next(i), r.dispose;
|
|
1608
1654
|
}),
|
|
1609
|
-
hidden$:
|
|
1655
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1610
1656
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
1611
1657
|
};
|
|
1612
1658
|
}
|
|
1613
|
-
function
|
|
1659
|
+
function Lr(t) {
|
|
1614
1660
|
return {
|
|
1615
|
-
id:
|
|
1616
|
-
group:
|
|
1661
|
+
id: Xn.id,
|
|
1662
|
+
group: F.TOOLBAR_OTHERS,
|
|
1617
1663
|
type: y.BUTTON,
|
|
1618
1664
|
icon: "FreezeRowSingle",
|
|
1619
1665
|
tooltip: "toolbar.headerFooter",
|
|
1620
1666
|
positions: [P.TOOLBAR_START],
|
|
1621
|
-
hidden$:
|
|
1667
|
+
hidden$: oi(U(t, v.UNIVER_DOC), Eo(t), (e, n) => e || n)
|
|
1622
1668
|
};
|
|
1623
1669
|
}
|
|
1624
|
-
function
|
|
1625
|
-
const e = t.get(
|
|
1670
|
+
function wr(t) {
|
|
1671
|
+
const e = t.get(E);
|
|
1626
1672
|
return {
|
|
1627
|
-
id:
|
|
1628
|
-
group:
|
|
1673
|
+
id: Pn.id,
|
|
1674
|
+
group: F.TOOLBAR_LAYOUT,
|
|
1629
1675
|
type: y.BUTTON,
|
|
1630
1676
|
icon: "LeftJustifyingSingle",
|
|
1631
1677
|
tooltip: "toolbar.alignLeft",
|
|
1632
1678
|
positions: [P.TOOLBAR_START],
|
|
1633
1679
|
activated$: new B((n) => {
|
|
1634
|
-
const o = e.onCommandExecuted((
|
|
1680
|
+
const o = e.onCommandExecuted((i) => {
|
|
1635
1681
|
var s;
|
|
1636
|
-
const
|
|
1637
|
-
if (
|
|
1638
|
-
const a =
|
|
1682
|
+
const r = i.id;
|
|
1683
|
+
if (r === G.id || r === ke.id) {
|
|
1684
|
+
const a = Ke(t);
|
|
1639
1685
|
if (a == null)
|
|
1640
1686
|
return;
|
|
1641
1687
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
1642
|
-
n.next(c ===
|
|
1688
|
+
n.next(c === He.LEFT);
|
|
1643
1689
|
}
|
|
1644
1690
|
});
|
|
1645
1691
|
return n.next(!1), o.dispose;
|
|
1646
1692
|
}),
|
|
1647
|
-
hidden$:
|
|
1693
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1648
1694
|
};
|
|
1649
1695
|
}
|
|
1650
|
-
function
|
|
1651
|
-
const e = t.get(
|
|
1696
|
+
function $r(t) {
|
|
1697
|
+
const e = t.get(E);
|
|
1652
1698
|
return {
|
|
1653
|
-
id:
|
|
1654
|
-
group:
|
|
1699
|
+
id: An.id,
|
|
1700
|
+
group: F.TOOLBAR_LAYOUT,
|
|
1655
1701
|
type: y.BUTTON,
|
|
1656
1702
|
icon: "HorizontallySingle",
|
|
1657
1703
|
tooltip: "toolbar.alignCenter",
|
|
1658
1704
|
positions: [P.TOOLBAR_START],
|
|
1659
1705
|
activated$: new B((n) => {
|
|
1660
|
-
const o = e.onCommandExecuted((
|
|
1706
|
+
const o = e.onCommandExecuted((i) => {
|
|
1661
1707
|
var s;
|
|
1662
|
-
const
|
|
1663
|
-
if (
|
|
1664
|
-
const a =
|
|
1708
|
+
const r = i.id;
|
|
1709
|
+
if (r === G.id || r === ke.id) {
|
|
1710
|
+
const a = Ke(t);
|
|
1665
1711
|
if (a == null)
|
|
1666
1712
|
return;
|
|
1667
1713
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
1668
|
-
n.next(c ===
|
|
1714
|
+
n.next(c === He.CENTER);
|
|
1669
1715
|
}
|
|
1670
1716
|
});
|
|
1671
1717
|
return n.next(!1), o.dispose;
|
|
1672
1718
|
}),
|
|
1673
|
-
hidden$:
|
|
1719
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1674
1720
|
};
|
|
1675
1721
|
}
|
|
1676
|
-
function
|
|
1677
|
-
const e = t.get(
|
|
1722
|
+
function Br(t) {
|
|
1723
|
+
const e = t.get(E);
|
|
1678
1724
|
return {
|
|
1679
|
-
id:
|
|
1680
|
-
group:
|
|
1725
|
+
id: Nn.id,
|
|
1726
|
+
group: F.TOOLBAR_LAYOUT,
|
|
1681
1727
|
type: y.BUTTON,
|
|
1682
1728
|
icon: "RightJustifyingSingle",
|
|
1683
1729
|
tooltip: "toolbar.alignRight",
|
|
1684
1730
|
positions: [P.TOOLBAR_START],
|
|
1685
1731
|
activated$: new B((n) => {
|
|
1686
|
-
const o = e.onCommandExecuted((
|
|
1732
|
+
const o = e.onCommandExecuted((i) => {
|
|
1687
1733
|
var s;
|
|
1688
|
-
const
|
|
1689
|
-
if (
|
|
1690
|
-
const a =
|
|
1734
|
+
const r = i.id;
|
|
1735
|
+
if (r === G.id || r === ke.id) {
|
|
1736
|
+
const a = Ke(t);
|
|
1691
1737
|
if (a == null)
|
|
1692
1738
|
return;
|
|
1693
1739
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
1694
|
-
n.next(c ===
|
|
1740
|
+
n.next(c === He.RIGHT);
|
|
1695
1741
|
}
|
|
1696
1742
|
});
|
|
1697
1743
|
return n.next(!1), o.dispose;
|
|
1698
1744
|
}),
|
|
1699
|
-
hidden$:
|
|
1745
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1700
1746
|
};
|
|
1701
1747
|
}
|
|
1702
|
-
function
|
|
1703
|
-
const e = t.get(
|
|
1748
|
+
function Hr(t) {
|
|
1749
|
+
const e = t.get(E);
|
|
1704
1750
|
return {
|
|
1705
|
-
id:
|
|
1706
|
-
group:
|
|
1751
|
+
id: Fn.id,
|
|
1752
|
+
group: F.TOOLBAR_LAYOUT,
|
|
1707
1753
|
type: y.BUTTON,
|
|
1708
1754
|
icon: "AlignTextBothSingle",
|
|
1709
1755
|
tooltip: "toolbar.alignJustify",
|
|
1710
1756
|
positions: [P.TOOLBAR_START],
|
|
1711
1757
|
activated$: new B((n) => {
|
|
1712
|
-
const o = e.onCommandExecuted((
|
|
1758
|
+
const o = e.onCommandExecuted((i) => {
|
|
1713
1759
|
var s;
|
|
1714
|
-
const
|
|
1715
|
-
if (
|
|
1716
|
-
const a =
|
|
1760
|
+
const r = i.id;
|
|
1761
|
+
if (r === G.id || r === ke.id) {
|
|
1762
|
+
const a = Ke(t);
|
|
1717
1763
|
if (a == null)
|
|
1718
1764
|
return;
|
|
1719
1765
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
1720
|
-
n.next(c ===
|
|
1766
|
+
n.next(c === He.JUSTIFIED);
|
|
1721
1767
|
}
|
|
1722
1768
|
});
|
|
1723
1769
|
return n.next(!1), o.dispose;
|
|
1724
1770
|
}),
|
|
1725
|
-
hidden$:
|
|
1771
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1726
1772
|
};
|
|
1727
1773
|
}
|
|
1728
|
-
function
|
|
1774
|
+
function Vr(t) {
|
|
1729
1775
|
return {
|
|
1730
|
-
id:
|
|
1731
|
-
group:
|
|
1776
|
+
id: Un.id,
|
|
1777
|
+
group: F.TOOLBAR_LAYOUT,
|
|
1732
1778
|
type: y.BUTTON,
|
|
1733
1779
|
icon: "OrderSingle",
|
|
1734
1780
|
tooltip: "toolbar.order",
|
|
1735
1781
|
positions: [P.TOOLBAR_START],
|
|
1736
|
-
hidden$:
|
|
1782
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1737
1783
|
};
|
|
1738
1784
|
}
|
|
1739
|
-
function
|
|
1785
|
+
function jr(t) {
|
|
1740
1786
|
return {
|
|
1741
|
-
id:
|
|
1742
|
-
group:
|
|
1787
|
+
id: Ln.id,
|
|
1788
|
+
group: F.TOOLBAR_LAYOUT,
|
|
1743
1789
|
type: y.BUTTON,
|
|
1744
1790
|
icon: "UnorderSingle",
|
|
1745
1791
|
tooltip: "toolbar.unorder",
|
|
1746
1792
|
positions: [P.TOOLBAR_START],
|
|
1747
|
-
hidden$:
|
|
1793
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1748
1794
|
};
|
|
1749
1795
|
}
|
|
1750
|
-
function
|
|
1796
|
+
function Wr(t) {
|
|
1751
1797
|
return {
|
|
1752
|
-
id:
|
|
1798
|
+
id: Vo.id,
|
|
1753
1799
|
type: y.BUTTON,
|
|
1754
1800
|
title: "toolbar.resetColor",
|
|
1755
1801
|
icon: "NoColor",
|
|
1756
|
-
positions:
|
|
1802
|
+
positions: st.id
|
|
1757
1803
|
};
|
|
1758
1804
|
}
|
|
1759
|
-
function
|
|
1760
|
-
const e = t.get(
|
|
1805
|
+
function zr(t) {
|
|
1806
|
+
const e = t.get(E), n = t.get(fn);
|
|
1761
1807
|
return {
|
|
1762
|
-
id:
|
|
1808
|
+
id: st.id,
|
|
1763
1809
|
tooltip: "toolbar.fillColor.main",
|
|
1764
|
-
group:
|
|
1810
|
+
group: F.TOOLBAR_FORMAT,
|
|
1765
1811
|
type: y.BUTTON_SELECTOR,
|
|
1766
1812
|
positions: [P.TOOLBAR_START],
|
|
1767
1813
|
icon: "PaintBucket",
|
|
1768
1814
|
selections: [
|
|
1769
1815
|
{
|
|
1770
1816
|
label: {
|
|
1771
|
-
name:
|
|
1817
|
+
name: It,
|
|
1772
1818
|
hoverable: !1
|
|
1773
1819
|
}
|
|
1774
1820
|
}
|
|
1775
1821
|
],
|
|
1776
1822
|
value$: new B((o) => {
|
|
1777
|
-
const
|
|
1778
|
-
if (s.id ===
|
|
1823
|
+
const i = n.getCurrentTheme().primaryColor, r = e.onCommandExecuted((s) => {
|
|
1824
|
+
if (s.id === st.id) {
|
|
1779
1825
|
const a = s.params.value;
|
|
1780
|
-
o.next(a != null ? a :
|
|
1826
|
+
o.next(a != null ? a : i);
|
|
1781
1827
|
}
|
|
1782
1828
|
});
|
|
1783
|
-
return o.next(
|
|
1829
|
+
return o.next(i), r.dispose;
|
|
1784
1830
|
}),
|
|
1785
|
-
hidden$:
|
|
1831
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1786
1832
|
};
|
|
1787
1833
|
}
|
|
1788
|
-
function
|
|
1834
|
+
function te(t) {
|
|
1789
1835
|
var d;
|
|
1790
|
-
const e = t.get(
|
|
1791
|
-
if (o == null ||
|
|
1836
|
+
const e = t.get(L), n = t.get(Z), o = e.getCurrentUniverDocInstance(), i = n.getActiveRange();
|
|
1837
|
+
if (o == null || i == null)
|
|
1792
1838
|
return;
|
|
1793
|
-
const { startOffset:
|
|
1839
|
+
const { startOffset: r, segmentId: s } = i, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.textRuns;
|
|
1794
1840
|
if (a == null)
|
|
1795
1841
|
return;
|
|
1796
1842
|
let c;
|
|
1797
1843
|
for (let g = 0; g < a.length; g++) {
|
|
1798
|
-
const h = a[g],
|
|
1799
|
-
if (
|
|
1800
|
-
c =
|
|
1844
|
+
const h = a[g], _ = a[g + 1];
|
|
1845
|
+
if (_ && _.st === _.ed && r === _.st) {
|
|
1846
|
+
c = _;
|
|
1801
1847
|
break;
|
|
1802
1848
|
}
|
|
1803
|
-
if (h.st <=
|
|
1849
|
+
if (h.st <= r && r <= h.ed) {
|
|
1804
1850
|
c = h;
|
|
1805
1851
|
break;
|
|
1806
1852
|
}
|
|
1807
1853
|
}
|
|
1808
1854
|
return c;
|
|
1809
1855
|
}
|
|
1810
|
-
function
|
|
1856
|
+
function Ke(t) {
|
|
1811
1857
|
var d;
|
|
1812
|
-
const e = t.get(
|
|
1813
|
-
if (o == null ||
|
|
1858
|
+
const e = t.get(L), n = t.get(Z), o = e.getCurrentUniverDocInstance(), i = n.getActiveRange();
|
|
1859
|
+
if (o == null || i == null)
|
|
1814
1860
|
return;
|
|
1815
|
-
const { startOffset:
|
|
1861
|
+
const { startOffset: r, segmentId: s } = i, a = (d = o.getSelfOrHeaderFooterModel(s).getBody()) == null ? void 0 : d.paragraphs;
|
|
1816
1862
|
if (a == null)
|
|
1817
1863
|
return;
|
|
1818
1864
|
let c = -1;
|
|
1819
1865
|
for (const g of a) {
|
|
1820
1866
|
const { startIndex: h } = g;
|
|
1821
|
-
if (
|
|
1867
|
+
if (r > c && r <= h)
|
|
1822
1868
|
return g;
|
|
1823
1869
|
c = h;
|
|
1824
1870
|
}
|
|
1825
1871
|
return null;
|
|
1826
1872
|
}
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1873
|
+
function Ze(t) {
|
|
1874
|
+
return t.getContextValue($e) || t.getContextValue(pn);
|
|
1875
|
+
}
|
|
1876
|
+
const Mt = 999, Kn = {
|
|
1877
|
+
id: Io.id,
|
|
1878
|
+
name: "doc.command.copy",
|
|
1879
|
+
type: pe.COMMAND,
|
|
1880
|
+
multi: !0,
|
|
1881
|
+
priority: Mt,
|
|
1882
|
+
preconditions: Ze,
|
|
1883
|
+
handler: async (t) => t.get(Ee).copy()
|
|
1884
|
+
}, Zn = {
|
|
1885
|
+
id: Mo.id,
|
|
1886
|
+
name: "doc.command.cut",
|
|
1887
|
+
type: pe.COMMAND,
|
|
1888
|
+
multi: !0,
|
|
1889
|
+
priority: Mt,
|
|
1890
|
+
preconditions: Ze,
|
|
1891
|
+
handler: async (t) => t.get(Ee).cut()
|
|
1892
|
+
}, Jn = {
|
|
1893
|
+
id: bo.id,
|
|
1894
|
+
name: "doc.command.paste",
|
|
1895
|
+
type: pe.COMMAND,
|
|
1896
|
+
multi: !0,
|
|
1897
|
+
priority: Mt,
|
|
1898
|
+
preconditions: Ze,
|
|
1899
|
+
handler: async (t) => {
|
|
1900
|
+
const e = t.get(Ee), o = await t.get(Ct).read();
|
|
1901
|
+
return o.length === 0 ? !1 : e.paste(o);
|
|
1902
|
+
}
|
|
1903
|
+
}, bt = (t) => {
|
|
1904
|
+
const e = t.get(Z);
|
|
1905
|
+
return new B((n) => {
|
|
1906
|
+
const o = e.textSelection$.subscribe((i) => {
|
|
1907
|
+
const r = e.getActiveRange();
|
|
1908
|
+
r && !r.collapsed ? n.next(!1) : n.next(!0);
|
|
1909
|
+
});
|
|
1910
|
+
return () => o.unsubscribe();
|
|
1911
|
+
});
|
|
1912
|
+
}, Gr = (t) => ({
|
|
1913
|
+
id: Kn.id,
|
|
1914
|
+
group: F.CONTEXT_MENU_FORMAT,
|
|
1915
|
+
type: y.BUTTON,
|
|
1916
|
+
icon: "Copy",
|
|
1917
|
+
title: "rightClick.copy",
|
|
1918
|
+
positions: [P.CONTEXT_MENU],
|
|
1919
|
+
disabled$: bt(t),
|
|
1920
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1921
|
+
}), kr = (t) => ({
|
|
1922
|
+
id: Zn.id,
|
|
1923
|
+
group: F.CONTEXT_MENU_FORMAT,
|
|
1924
|
+
type: y.BUTTON,
|
|
1925
|
+
icon: "Copy",
|
|
1926
|
+
title: "rightClick.cut",
|
|
1927
|
+
positions: [P.CONTEXT_MENU],
|
|
1928
|
+
disabled$: bt(t),
|
|
1929
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1930
|
+
}), Yr = (t) => ({
|
|
1931
|
+
id: Jn.id,
|
|
1932
|
+
group: F.CONTEXT_MENU_FORMAT,
|
|
1933
|
+
type: y.BUTTON,
|
|
1934
|
+
icon: "PasteSpecial",
|
|
1935
|
+
title: "rightClick.paste",
|
|
1936
|
+
positions: [P.CONTEXT_MENU],
|
|
1937
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1938
|
+
}), Xr = (t) => ({
|
|
1939
|
+
id: wn.id,
|
|
1940
|
+
group: F.CONTEXT_MENU_FORMAT,
|
|
1941
|
+
type: y.BUTTON,
|
|
1942
|
+
icon: "PasteSpecial",
|
|
1943
|
+
title: "rightClick.delete",
|
|
1944
|
+
positions: [P.CONTEXT_MENU],
|
|
1945
|
+
disabled$: bt(t),
|
|
1946
|
+
hidden$: U(t, v.UNIVER_DOC)
|
|
1947
|
+
}), Kr = {
|
|
1948
|
+
id: In.id,
|
|
1949
|
+
binding: D.B | x.CTRL_COMMAND,
|
|
1950
|
+
preconditions: A
|
|
1951
|
+
}, Zr = {
|
|
1952
|
+
id: Mn.id,
|
|
1953
|
+
binding: D.I | x.CTRL_COMMAND,
|
|
1954
|
+
preconditions: A
|
|
1955
|
+
}, Jr = {
|
|
1956
|
+
id: bn.id,
|
|
1957
|
+
binding: D.U | x.CTRL_COMMAND,
|
|
1958
|
+
preconditions: A
|
|
1959
|
+
}, qr = {
|
|
1960
|
+
id: xn.id,
|
|
1961
|
+
binding: D.X | x.SHIFT | x.CTRL_COMMAND,
|
|
1962
|
+
preconditions: A
|
|
1963
|
+
}, Qr = {
|
|
1964
|
+
id: Dn.id,
|
|
1965
|
+
binding: D.COMMA | x.CTRL_COMMAND,
|
|
1966
|
+
preconditions: A
|
|
1967
|
+
}, es = {
|
|
1968
|
+
id: yn.id,
|
|
1969
|
+
binding: D.PERIOD | x.CTRL_COMMAND,
|
|
1970
|
+
preconditions: A
|
|
1971
|
+
}, ts = {
|
|
1972
|
+
id: Pn.id,
|
|
1973
|
+
binding: D.L | x.CTRL_COMMAND | x.SHIFT,
|
|
1974
|
+
preconditions: A
|
|
1975
|
+
}, ns = {
|
|
1976
|
+
id: Nn.id,
|
|
1977
|
+
binding: D.R | x.CTRL_COMMAND | x.SHIFT,
|
|
1978
|
+
preconditions: A
|
|
1979
|
+
}, os = {
|
|
1980
|
+
id: An.id,
|
|
1981
|
+
binding: D.E | x.CTRL_COMMAND | x.SHIFT,
|
|
1982
|
+
preconditions: A
|
|
1983
|
+
}, is = {
|
|
1984
|
+
id: Fn.id,
|
|
1985
|
+
binding: D.J | x.CTRL_COMMAND | x.SHIFT,
|
|
1986
|
+
preconditions: A
|
|
1987
|
+
}, rs = {
|
|
1988
|
+
id: Un.id,
|
|
1989
|
+
binding: D.Digit7 | x.CTRL_COMMAND | x.SHIFT,
|
|
1990
|
+
preconditions: A
|
|
1991
|
+
}, ss = {
|
|
1992
|
+
id: Ln.id,
|
|
1993
|
+
binding: D.Digit8 | x.CTRL_COMMAND | x.SHIFT,
|
|
1994
|
+
preconditions: A
|
|
1995
|
+
};
|
|
1996
|
+
var as = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, ls = (t, e, n, o) => {
|
|
1997
|
+
for (var i = o > 1 ? void 0 : o ? cs(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
1998
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
1999
|
+
return o && i && as(e, n, i), i;
|
|
2000
|
+
}, ne = (t, e) => (n, o) => e(n, o, t);
|
|
2001
|
+
let Re = class extends z {
|
|
2002
|
+
constructor(t, e, n, o, i, r, s, a) {
|
|
2003
|
+
super(), this._config = t, this._injector = e, this._componentManager = n, this._layoutService = o, this._menuService = i, this._uiPartsService = r, this._univerInstanceService = s, this._shortcutService = a, this._init();
|
|
1835
2004
|
}
|
|
1836
2005
|
_initCustomComponents() {
|
|
1837
2006
|
const t = this._componentManager;
|
|
1838
|
-
this.disposeWithMe(t.register(
|
|
2007
|
+
this.disposeWithMe(t.register(It, hi)), this.disposeWithMe(t.register(Vn, xo)), this.disposeWithMe(t.register(jn, Do)), this.disposeWithMe(t.register(Wn, yo));
|
|
2008
|
+
}
|
|
2009
|
+
_initUiParts() {
|
|
2010
|
+
var e, n;
|
|
2011
|
+
const t = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_SHEET);
|
|
2012
|
+
(n = (e = this._config.layout) == null ? void 0 : e.docContainerConfig) != null && n.footer && !t && this.disposeWithMe(this._uiPartsService.registerComponent(Po.FOOTER, () => uo(gr, this._injector)));
|
|
1839
2013
|
}
|
|
1840
2014
|
_initMenus() {
|
|
1841
2015
|
const { menu: t = {} } = this._config;
|
|
1842
2016
|
[
|
|
1843
|
-
|
|
2017
|
+
br,
|
|
2018
|
+
xr,
|
|
2019
|
+
Dr,
|
|
2020
|
+
yr,
|
|
2021
|
+
Pr,
|
|
2022
|
+
Ar,
|
|
2023
|
+
Fr,
|
|
2024
|
+
Nr,
|
|
2025
|
+
Ur,
|
|
2026
|
+
Lr,
|
|
2027
|
+
wr,
|
|
1844
2028
|
$r,
|
|
2029
|
+
Br,
|
|
1845
2030
|
Hr,
|
|
1846
2031
|
Vr,
|
|
1847
2032
|
jr,
|
|
1848
2033
|
Wr,
|
|
2034
|
+
zr
|
|
2035
|
+
].forEach((e) => {
|
|
2036
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e), t));
|
|
2037
|
+
}), [
|
|
1849
2038
|
Gr,
|
|
1850
2039
|
kr,
|
|
1851
|
-
zr,
|
|
1852
2040
|
Yr,
|
|
1853
|
-
Xr
|
|
2041
|
+
Xr
|
|
2042
|
+
].forEach((e) => {
|
|
2043
|
+
try {
|
|
2044
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e), t));
|
|
2045
|
+
} catch {
|
|
2046
|
+
}
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2049
|
+
_initShortCut() {
|
|
2050
|
+
[
|
|
1854
2051
|
Kr,
|
|
1855
2052
|
Zr,
|
|
1856
2053
|
Jr,
|
|
1857
2054
|
qr,
|
|
1858
2055
|
Qr,
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
2056
|
+
es,
|
|
2057
|
+
os,
|
|
2058
|
+
is,
|
|
2059
|
+
ns,
|
|
2060
|
+
ts,
|
|
2061
|
+
rs,
|
|
2062
|
+
ss
|
|
2063
|
+
].forEach((t) => {
|
|
2064
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(t));
|
|
1863
2065
|
});
|
|
1864
2066
|
}
|
|
1865
2067
|
_init() {
|
|
1866
|
-
this._initCustomComponents(), this._initMenus(), this._initFocusHandler();
|
|
2068
|
+
this._initCustomComponents(), this._initMenus(), this._initFocusHandler(), this._initUiParts(), this._initShortCut();
|
|
1867
2069
|
}
|
|
1868
2070
|
_initFocusHandler() {
|
|
1869
2071
|
this.disposeWithMe(
|
|
1870
2072
|
this._layoutService.registerFocusHandler(v.UNIVER_DOC, () => {
|
|
1871
|
-
this._injector.get(
|
|
2073
|
+
this._injector.get(ie).focus();
|
|
1872
2074
|
})
|
|
1873
2075
|
);
|
|
1874
2076
|
}
|
|
1875
2077
|
};
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
}
|
|
1899
|
-
const _t = 999, ci = {
|
|
1900
|
-
id: Wn.id,
|
|
1901
|
-
name: "doc.command.copy",
|
|
1902
|
-
type: de.COMMAND,
|
|
1903
|
-
multi: !0,
|
|
1904
|
-
priority: _t,
|
|
1905
|
-
preconditions: ze,
|
|
1906
|
-
handler: async (t) => t.get(Re).copy()
|
|
1907
|
-
}, li = {
|
|
1908
|
-
id: kn.id,
|
|
1909
|
-
name: "doc.command.cut",
|
|
1910
|
-
type: de.COMMAND,
|
|
1911
|
-
multi: !0,
|
|
1912
|
-
priority: _t,
|
|
1913
|
-
preconditions: ze,
|
|
1914
|
-
handler: async (t) => t.get(Re).cut()
|
|
1915
|
-
}, di = {
|
|
1916
|
-
id: Gn.id,
|
|
1917
|
-
name: "doc.command.paste",
|
|
1918
|
-
type: de.COMMAND,
|
|
1919
|
-
multi: !0,
|
|
1920
|
-
priority: _t,
|
|
1921
|
-
preconditions: ze,
|
|
1922
|
-
handler: async (t) => {
|
|
1923
|
-
const e = t.get(Re), o = await t.get(ut).read();
|
|
1924
|
-
return o.length === 0 ? !1 : e.paste(o);
|
|
1925
|
-
}
|
|
2078
|
+
Re = ls([
|
|
2079
|
+
Ve(je.Rendered, Re),
|
|
2080
|
+
ne(1, M(Be)),
|
|
2081
|
+
ne(2, M(Rn)),
|
|
2082
|
+
ne(3, Cn),
|
|
2083
|
+
ne(4, Ao),
|
|
2084
|
+
ne(5, No),
|
|
2085
|
+
ne(6, L),
|
|
2086
|
+
ne(7, On)
|
|
2087
|
+
], Re);
|
|
2088
|
+
const ds = {
|
|
2089
|
+
id: jo.id,
|
|
2090
|
+
preconditions: _i,
|
|
2091
|
+
binding: D.ENTER
|
|
2092
|
+
}, us = {
|
|
2093
|
+
id: wn.id,
|
|
2094
|
+
preconditions: A,
|
|
2095
|
+
binding: D.BACKSPACE
|
|
2096
|
+
}, hs = {
|
|
2097
|
+
id: Wo.id,
|
|
2098
|
+
preconditions: A,
|
|
2099
|
+
binding: D.DELETE
|
|
1926
2100
|
};
|
|
1927
|
-
var
|
|
1928
|
-
for (var
|
|
1929
|
-
(s = t[
|
|
1930
|
-
return o &&
|
|
1931
|
-
},
|
|
1932
|
-
let
|
|
1933
|
-
constructor(t, e, n, o,
|
|
1934
|
-
super(), this._commandService = t, this._clipboardInterfaceService = e, this._docClipboardService = n, this._textSelectionRenderManager = o, this._contextService =
|
|
2101
|
+
var gs = Object.defineProperty, _s = Object.getOwnPropertyDescriptor, ps = (t, e, n, o) => {
|
|
2102
|
+
for (var i = o > 1 ? void 0 : o ? _s(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2103
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2104
|
+
return o && i && gs(e, n, i), i;
|
|
2105
|
+
}, me = (t, e) => (n, o) => e(n, o, t);
|
|
2106
|
+
let ye = class extends Te {
|
|
2107
|
+
constructor(t, e, n, o, i) {
|
|
2108
|
+
super(), this._commandService = t, this._clipboardInterfaceService = e, this._docClipboardService = n, this._textSelectionRenderManager = o, this._contextService = i, this._init();
|
|
1935
2109
|
}
|
|
1936
2110
|
_init() {
|
|
1937
|
-
[
|
|
2111
|
+
[Kn, Zn, Jn].forEach((t) => this.disposeWithMe(this._commandService.registerMultipleCommand(t))), [En, Tn].forEach((t) => this.disposeWithMe(this._commandService.registerCommand(t))), this._initLegacyPasteCommand();
|
|
1938
2112
|
}
|
|
1939
2113
|
_initLegacyPasteCommand() {
|
|
1940
2114
|
var t;
|
|
1941
|
-
(t = this._textSelectionRenderManager) == null || t.onPaste$.pipe(
|
|
1942
|
-
var
|
|
1943
|
-
if (!
|
|
2115
|
+
(t = this._textSelectionRenderManager) == null || t.onPaste$.pipe(de(this.dispose$)).subscribe((e) => {
|
|
2116
|
+
var r, s;
|
|
2117
|
+
if (!Ze(this._contextService))
|
|
1944
2118
|
return;
|
|
1945
2119
|
e.event.preventDefault();
|
|
1946
|
-
const n = e.event, o = (
|
|
1947
|
-
this._docClipboardService.legacyPaste(o,
|
|
2120
|
+
const n = e.event, o = (r = n.clipboardData) == null ? void 0 : r.getData("text/html"), i = (s = n.clipboardData) == null ? void 0 : s.getData("text/plain");
|
|
2121
|
+
this._docClipboardService.legacyPaste(o, i);
|
|
1948
2122
|
});
|
|
1949
2123
|
}
|
|
1950
2124
|
};
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
],
|
|
1959
|
-
var
|
|
1960
|
-
for (var
|
|
1961
|
-
(s = t[
|
|
1962
|
-
return o &&
|
|
1963
|
-
},
|
|
1964
|
-
let
|
|
1965
|
-
constructor(e, n, o,
|
|
2125
|
+
ye = ps([
|
|
2126
|
+
Ve(je.Rendered, ye),
|
|
2127
|
+
me(0, E),
|
|
2128
|
+
me(1, Ct),
|
|
2129
|
+
me(2, Ee),
|
|
2130
|
+
me(3, ie),
|
|
2131
|
+
me(4, ho)
|
|
2132
|
+
], ye);
|
|
2133
|
+
var fs = Object.defineProperty, ms = Object.getOwnPropertyDescriptor, Ss = (t, e, n, o) => {
|
|
2134
|
+
for (var i = o > 1 ? void 0 : o ? ms(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2135
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2136
|
+
return o && i && fs(e, n, i), i;
|
|
2137
|
+
}, Se = (t, e) => (n, o) => e(n, o, t);
|
|
2138
|
+
let Pe = class extends z {
|
|
2139
|
+
constructor(e, n, o, i, r) {
|
|
1966
2140
|
super();
|
|
1967
|
-
|
|
1968
|
-
this._univerInstanceService = e, this._editorService = n, this._commandService = o, this._textSelectionRenderManager =
|
|
2141
|
+
I(this, "_initialEditors", /* @__PURE__ */ new Set());
|
|
2142
|
+
this._univerInstanceService = e, this._editorService = n, this._commandService = o, this._textSelectionRenderManager = i, this._renderManagerService = r, this._initialize();
|
|
1969
2143
|
}
|
|
1970
2144
|
_initialize() {
|
|
1971
2145
|
this.disposeWithMe(
|
|
@@ -1978,7 +2152,7 @@ let ye = class extends Q {
|
|
|
1978
2152
|
}), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
|
|
1979
2153
|
}
|
|
1980
2154
|
_resize(e) {
|
|
1981
|
-
var
|
|
2155
|
+
var O, T, C;
|
|
1982
2156
|
if (e == null)
|
|
1983
2157
|
return;
|
|
1984
2158
|
const n = this._editorService.getEditor(e);
|
|
@@ -1987,25 +2161,25 @@ let ye = class extends Q {
|
|
|
1987
2161
|
const o = this._univerInstanceService.getUniverDocInstance(e);
|
|
1988
2162
|
if (!o)
|
|
1989
2163
|
return;
|
|
1990
|
-
const
|
|
1991
|
-
if (n == null || n.render == null ||
|
|
2164
|
+
const i = (O = this._renderManagerService.getRenderById(o.getUnitId())) == null ? void 0 : O.with($).getSkeleton();
|
|
2165
|
+
if (n == null || n.render == null || i == null || o == null)
|
|
1992
2166
|
return;
|
|
1993
|
-
|
|
1994
|
-
const { marginTop:
|
|
1995
|
-
let { actualHeight: h, actualWidth:
|
|
1996
|
-
h +=
|
|
1997
|
-
const { width: l, height:
|
|
2167
|
+
i.calculate();
|
|
2168
|
+
const { marginTop: r = 0, marginBottom: s = 0, marginLeft: a = 0, marginRight: c = 0 } = o.getSnapshot().documentStyle, { scene: d, mainComponent: g } = n.render;
|
|
2169
|
+
let { actualHeight: h, actualWidth: _ } = i.getActualSize();
|
|
2170
|
+
h += r + s, _ += a + c;
|
|
2171
|
+
const { width: l, height: p } = n.getBoundingClientRect(), u = d.getViewport(J.VIEW_MAIN);
|
|
1998
2172
|
let f = u == null ? void 0 : u.getScrollBar();
|
|
1999
|
-
const m = Math.max(
|
|
2173
|
+
const m = Math.max(_, l), S = Math.max(h, p);
|
|
2000
2174
|
d.transformByState({
|
|
2001
2175
|
width: m,
|
|
2002
|
-
height:
|
|
2003
|
-
}), g == null || g.resize(m,
|
|
2176
|
+
height: S
|
|
2177
|
+
}), g == null || g.resize(m, S), n.isSingle() ? _ > l ? f == null ? u && new at(u, { barSize: 8, enableVertical: !1 }) : u == null || u.resetCanvasSizeAndUpdateScroll() : (f = null, u == null || u.scrollToBarPos({ x: 0, y: 0 }), (C = u == null ? void 0 : u.getScrollBar()) == null || C.dispose()) : h > p ? f == null ? u && new at(u, { enableHorizontal: !1, barSize: 8 }) : u == null || u.resetCanvasSizeAndUpdateScroll() : (f = null, u == null || u.scrollToBarPos({ x: 0, y: 0 }), (T = u == null ? void 0 : u.getScrollBar()) == null || T.dispose());
|
|
2004
2178
|
}
|
|
2005
2179
|
_initialSetValue() {
|
|
2006
2180
|
this.disposeWithMe(
|
|
2007
2181
|
this._editorService.setValue$.subscribe((e) => {
|
|
2008
|
-
this._commandService.executeCommand(
|
|
2182
|
+
this._commandService.executeCommand(zo.id, {
|
|
2009
2183
|
unitId: e.editorUnitId,
|
|
2010
2184
|
body: e.body,
|
|
2011
2185
|
segmentId: null
|
|
@@ -2020,8 +2194,8 @@ let ye = class extends Q {
|
|
|
2020
2194
|
})
|
|
2021
2195
|
), this.disposeWithMe(
|
|
2022
2196
|
this._textSelectionRenderManager.onBlur$.subscribe(() => {
|
|
2023
|
-
var
|
|
2024
|
-
const e = (
|
|
2197
|
+
var i;
|
|
2198
|
+
const e = (i = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : i.getUnitId();
|
|
2025
2199
|
if (e == null)
|
|
2026
2200
|
return;
|
|
2027
2201
|
const n = this._editorService.getEditor(e), o = this._editorService.getFocusEditor();
|
|
@@ -2042,17 +2216,17 @@ let ye = class extends Q {
|
|
|
2042
2216
|
"univer-formula-help-param"
|
|
2043
2217
|
];
|
|
2044
2218
|
this.disposeWithMe(
|
|
2045
|
-
|
|
2046
|
-
const
|
|
2047
|
-
if (
|
|
2219
|
+
Wt(window, "mousedown").subscribe((o) => {
|
|
2220
|
+
const r = o.target.classList[0] || "";
|
|
2221
|
+
if (go(r, e)) {
|
|
2048
2222
|
this._editorService.changeSpreadsheetFocusState(!0), o.stopPropagation();
|
|
2049
2223
|
return;
|
|
2050
2224
|
}
|
|
2051
2225
|
this._editorService.changeSpreadsheetFocusState(!1);
|
|
2052
2226
|
})
|
|
2053
2227
|
), this._univerInstanceService.getAllUnitsForType(v.UNIVER_SHEET).forEach((o) => {
|
|
2054
|
-
const
|
|
2055
|
-
s != null &&
|
|
2228
|
+
const i = o.getUnitId(), r = this._renderManagerService.getRenderById(i), s = r == null ? void 0 : r.engine.getCanvas().getCanvasEle();
|
|
2229
|
+
s != null && Wt(s, "mousedown").subscribe((a) => {
|
|
2056
2230
|
this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
|
|
2057
2231
|
});
|
|
2058
2232
|
});
|
|
@@ -2080,49 +2254,49 @@ let ye = class extends Q {
|
|
|
2080
2254
|
* Listen to document edits to refresh the size of the formula editor.
|
|
2081
2255
|
*/
|
|
2082
2256
|
_commandExecutedListener() {
|
|
2083
|
-
const e = [
|
|
2257
|
+
const e = [Ge.id, Fo.id];
|
|
2084
2258
|
this.disposeWithMe(
|
|
2085
2259
|
this._commandService.onCommandExecuted((n) => {
|
|
2086
2260
|
if (e.includes(n.id)) {
|
|
2087
|
-
const o = n.params, { unitId:
|
|
2088
|
-
if (this._editorService.isSheetEditor(
|
|
2261
|
+
const o = n.params, { unitId: i } = o;
|
|
2262
|
+
if (this._editorService.isSheetEditor(i))
|
|
2089
2263
|
return;
|
|
2090
|
-
this._resize(
|
|
2264
|
+
this._resize(i), this._valueChange();
|
|
2091
2265
|
}
|
|
2092
2266
|
})
|
|
2093
2267
|
);
|
|
2094
2268
|
}
|
|
2095
2269
|
};
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
],
|
|
2104
|
-
var
|
|
2105
|
-
for (var
|
|
2106
|
-
(s = t[
|
|
2107
|
-
return o &&
|
|
2108
|
-
},
|
|
2109
|
-
let
|
|
2110
|
-
constructor(t, e, n, o,
|
|
2111
|
-
super(), this._context = t, this._commandService = e, this._docSkeletonManagerService = n, this._configService = o, this._editorService =
|
|
2270
|
+
Pe = Ss([
|
|
2271
|
+
Ve(je.Rendered, Pe),
|
|
2272
|
+
Se(0, L),
|
|
2273
|
+
Se(1, oe),
|
|
2274
|
+
Se(2, E),
|
|
2275
|
+
Se(3, ie),
|
|
2276
|
+
Se(4, X)
|
|
2277
|
+
], Pe);
|
|
2278
|
+
var vs = Object.defineProperty, Cs = Object.getOwnPropertyDescriptor, Rs = (t, e, n, o) => {
|
|
2279
|
+
for (var i = o > 1 ? void 0 : o ? Cs(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2280
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2281
|
+
return o && i && vs(e, n, i), i;
|
|
2282
|
+
}, ve = (t, e) => (n, o) => e(n, o, t);
|
|
2283
|
+
let ht = class extends Te {
|
|
2284
|
+
constructor(t, e, n, o, i, r) {
|
|
2285
|
+
super(), this._context = t, this._commandService = e, this._docSkeletonManagerService = n, this._configService = o, this._editorService = i, this._renderManagerService = r, this._addNewRender(), this._initRenderRefresh(), this._initCommandListener();
|
|
2112
2286
|
}
|
|
2113
2287
|
reRender(t) {
|
|
2114
|
-
var
|
|
2115
|
-
const e = (
|
|
2288
|
+
var i, r;
|
|
2289
|
+
const e = (i = this._renderManagerService.getRenderById(t)) == null ? void 0 : i.with($), n = e == null ? void 0 : e.getSkeleton();
|
|
2116
2290
|
if (!(!n || n.getViewModel().getDataModel().getSnapshot().disabled)) {
|
|
2117
2291
|
if (n.calculate(), this._editorService.isEditor(t)) {
|
|
2118
|
-
(
|
|
2292
|
+
(r = this._context.mainComponent) == null || r.makeDirty();
|
|
2119
2293
|
return;
|
|
2120
2294
|
}
|
|
2121
2295
|
this._recalculateSizeBySkeleton(n);
|
|
2122
2296
|
}
|
|
2123
2297
|
}
|
|
2124
2298
|
_addNewRender() {
|
|
2125
|
-
const { scene: t, engine: e, unit: n } = this._context, o = new
|
|
2299
|
+
const { scene: t, engine: e, unit: n } = this._context, o = new qo(J.VIEW_MAIN, t, {
|
|
2126
2300
|
left: 0,
|
|
2127
2301
|
top: 0,
|
|
2128
2302
|
bottom: 0,
|
|
@@ -2139,9 +2313,9 @@ let st = class extends Se {
|
|
|
2139
2313
|
g *= c.deltaY > 0 ? -1 : 1, t.scaleX < 1 && (g /= 2), t.scaleX + g > 4 ? t.scale(4, 4) : t.scaleX + g < 0.1 ? t.scale(0.1, 0.1) : c.preventDefault();
|
|
2140
2314
|
} else
|
|
2141
2315
|
o.onMouseWheel(c, a);
|
|
2142
|
-
}), this._configService.getConfig("hasScroll") !== !1 && new
|
|
2143
|
-
new
|
|
2144
|
-
new
|
|
2316
|
+
}), this._configService.getConfig("hasScroll") !== !1 && new at(o), t.addLayer(
|
|
2317
|
+
new Ht(t, [], Je),
|
|
2318
|
+
new Ht(t, [], Go)
|
|
2145
2319
|
), this._addComponent(), n.getShouldRenderLoopImmediately() && e.runRenderLoop(() => {
|
|
2146
2320
|
t.render();
|
|
2147
2321
|
});
|
|
@@ -2150,24 +2324,24 @@ let st = class extends Se {
|
|
|
2150
2324
|
const { scene: t, unit: e, components: n } = this._context, o = {
|
|
2151
2325
|
pageMarginLeft: e.documentStyle.marginLeft || 0,
|
|
2152
2326
|
pageMarginTop: e.documentStyle.marginTop || 0
|
|
2153
|
-
},
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2156
|
-
|
|
2327
|
+
}, i = new Qo(se.MAIN, void 0, o);
|
|
2328
|
+
i.zIndex = wt;
|
|
2329
|
+
const r = new ei(se.BACKGROUND, void 0, o);
|
|
2330
|
+
r.zIndex = wt, this._context.mainComponent = i, n.set(se.MAIN, i), n.set(se.BACKGROUND, r), t.addObjects([i], Je), t.addObjects([r], ko), this._editorService.getEditor(e.getUnitId()) == null && t.enableLayerCache(Je);
|
|
2157
2331
|
}
|
|
2158
2332
|
_initRenderRefresh() {
|
|
2159
|
-
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(
|
|
2333
|
+
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(de(this.dispose$)).subscribe((t) => {
|
|
2160
2334
|
this._create(t);
|
|
2161
2335
|
});
|
|
2162
2336
|
}
|
|
2163
2337
|
_create(t) {
|
|
2164
2338
|
if (!t)
|
|
2165
2339
|
return;
|
|
2166
|
-
const { mainComponent: e, components: n } = this._context, o = e,
|
|
2167
|
-
o.changeSkeleton(t),
|
|
2340
|
+
const { mainComponent: e, components: n } = this._context, o = e, i = n.get(se.BACKGROUND);
|
|
2341
|
+
o.changeSkeleton(t), i.changeSkeleton(t), this._recalculateSizeBySkeleton(t);
|
|
2168
2342
|
}
|
|
2169
2343
|
_initCommandListener() {
|
|
2170
|
-
const t = [
|
|
2344
|
+
const t = [Ge.id];
|
|
2171
2345
|
this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
2172
2346
|
if (t.includes(e.id)) {
|
|
2173
2347
|
const n = e.params, { unitId: o } = n;
|
|
@@ -2177,35 +2351,53 @@ let st = class extends Se {
|
|
|
2177
2351
|
}
|
|
2178
2352
|
_recalculateSizeBySkeleton(t) {
|
|
2179
2353
|
var g;
|
|
2180
|
-
const { mainComponent: e, scene: n, unitId: o, components:
|
|
2354
|
+
const { mainComponent: e, scene: n, unitId: o, components: i } = this._context, r = e, s = i.get(se.BACKGROUND), a = (g = t.getSkeletonData()) == null ? void 0 : g.pages;
|
|
2181
2355
|
if (a == null)
|
|
2182
2356
|
return;
|
|
2183
2357
|
let c = 0, d = 0;
|
|
2184
|
-
for (let h = 0,
|
|
2185
|
-
const l = a[h], { pageWidth:
|
|
2186
|
-
|
|
2358
|
+
for (let h = 0, _ = a.length; h < _; h++) {
|
|
2359
|
+
const l = a[h], { pageWidth: p, pageHeight: u } = l;
|
|
2360
|
+
r.pageLayoutType === Oe.VERTICAL ? (d += u, d += r.pageMarginTop, h === _ - 1 && (d += r.pageMarginTop), c = Math.max(c, p)) : r.pageLayoutType === Oe.HORIZONTAL && (c += p, h !== _ - 1 && (c += r.pageMarginLeft), d = Math.max(d, u));
|
|
2187
2361
|
}
|
|
2188
|
-
|
|
2362
|
+
r.resize(c, d), s.resize(c, d), this._editorService.isEditor(o) || n.resize(c, d);
|
|
2189
2363
|
}
|
|
2190
2364
|
};
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
],
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
(
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2365
|
+
ht = Rs([
|
|
2366
|
+
ve(1, E),
|
|
2367
|
+
ve(2, M($)),
|
|
2368
|
+
ve(3, _o),
|
|
2369
|
+
ve(4, oe),
|
|
2370
|
+
ve(5, X)
|
|
2371
|
+
], ht);
|
|
2372
|
+
class xt extends z {
|
|
2373
|
+
constructor(e) {
|
|
2374
|
+
super(), this._context = e;
|
|
2375
|
+
}
|
|
2376
|
+
calculatePagePosition() {
|
|
2377
|
+
var T, C;
|
|
2378
|
+
const e = Q(this._context), o = (C = (T = this._context.unit.getSettings()) == null ? void 0 : T.zoomRatio) != null ? C : 1, { document: i, scene: r, docBackground: s } = e, a = r == null ? void 0 : r.getParent(), { width: c, height: d, pageMarginLeft: g, pageMarginTop: h } = i;
|
|
2379
|
+
if (a == null || c === Number.POSITIVE_INFINITY || d === Number.POSITIVE_INFINITY)
|
|
2380
|
+
return;
|
|
2381
|
+
const { width: _, height: l } = a;
|
|
2382
|
+
let p = 0, u = 0, f = 0, m = 0, S = Number.POSITIVE_INFINITY;
|
|
2383
|
+
_ > (c + g * 2) * o ? (p = _ / 2 - c * o / 2, p /= o, f = (_ - g * 2) / o, S = 0) : (p = g, f = c + g * 2, S = (f - _ / o) / 2), l > d ? (u = l / 2 - d / 2, m = (l - h * 2) / o) : (u = h, m = d + h * 2), r.resize(f, m + 200), i.translate(p, u), s.translate(p, u);
|
|
2384
|
+
const O = r.getViewport(J.VIEW_MAIN);
|
|
2385
|
+
return S !== Number.POSITIVE_INFINITY && O != null && O.scrollToViewportPos({
|
|
2386
|
+
viewportScrollX: S
|
|
2387
|
+
}), this;
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
var Os = Object.defineProperty, Ts = Object.getOwnPropertyDescriptor, Es = (t, e, n, o) => {
|
|
2391
|
+
for (var i = o > 1 ? void 0 : o ? Ts(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2392
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2393
|
+
return o && i && Os(e, n, i), i;
|
|
2394
|
+
}, ce = (t, e) => (n, o) => e(n, o, t);
|
|
2395
|
+
let gt = class extends z {
|
|
2396
|
+
constructor(t, e, n, o, i, r, s) {
|
|
2397
|
+
super(), this._context = t, this._docSkeletonManagerService = e, this._univerInstanceService = n, this._commandService = o, this._textSelectionManagerService = i, this._editorService = r, this._docPageLayoutService = s, this._init();
|
|
2206
2398
|
}
|
|
2207
2399
|
_init() {
|
|
2208
|
-
this._initSkeletonListener(), this._initCommandExecutedListener(), this._initRenderRefresher(), setTimeout(() => this.
|
|
2400
|
+
this._initSkeletonListener(), this._initCommandExecutedListener(), this._initRenderRefresher(), setTimeout(() => this.updateViewZoom(1, !0), 20);
|
|
2209
2401
|
}
|
|
2210
2402
|
_initRenderRefresher() {
|
|
2211
2403
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((t) => {
|
|
@@ -2215,17 +2407,17 @@ let at = class extends Q {
|
|
|
2215
2407
|
this._editorService.isEditor(e) || this.disposeWithMe(n.onMouseWheel$.subscribeEvent((o) => {
|
|
2216
2408
|
if (!o.ctrlKey)
|
|
2217
2409
|
return;
|
|
2218
|
-
const
|
|
2219
|
-
if (!
|
|
2410
|
+
const i = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
2411
|
+
if (!i)
|
|
2220
2412
|
return;
|
|
2221
|
-
const
|
|
2222
|
-
let s =
|
|
2413
|
+
const r = Math.abs(o.deltaX);
|
|
2414
|
+
let s = r < 40 ? 0.2 : r < 80 ? 0.4 : 0.2;
|
|
2223
2415
|
s *= o.deltaY > 0 ? -1 : 1, n.scaleX < 1 && (s /= 2);
|
|
2224
|
-
const a =
|
|
2416
|
+
const a = i.zoomRatio;
|
|
2225
2417
|
let c = +Number.parseFloat(`${a + s}`).toFixed(1);
|
|
2226
|
-
c = c >= 4 ? 4 : c <= 0.1 ? 0.1 : c, this._commandService.executeCommand(
|
|
2418
|
+
c = c >= 4 ? 4 : c <= 0.1 ? 0.1 : c, this._commandService.executeCommand(Yo.id, {
|
|
2227
2419
|
zoomRatio: c,
|
|
2228
|
-
unitId:
|
|
2420
|
+
unitId: i.getUnitId()
|
|
2229
2421
|
}), o.preventDefault();
|
|
2230
2422
|
}));
|
|
2231
2423
|
});
|
|
@@ -2237,115 +2429,100 @@ let at = class extends Q {
|
|
|
2237
2429
|
const e = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
2238
2430
|
if (!e) return;
|
|
2239
2431
|
const n = e.zoomRatio || 1;
|
|
2240
|
-
this.
|
|
2432
|
+
this.updateViewZoom(n, !1);
|
|
2241
2433
|
}));
|
|
2242
2434
|
}
|
|
2243
2435
|
_initCommandExecutedListener() {
|
|
2244
|
-
const t = [
|
|
2436
|
+
const t = [he.id];
|
|
2245
2437
|
this.disposeWithMe(this._commandService.onCommandExecuted((e) => {
|
|
2246
2438
|
if (t.includes(e.id)) {
|
|
2247
2439
|
const n = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
2248
2440
|
if (!n) return;
|
|
2249
|
-
const o = e.params, { unitId:
|
|
2250
|
-
if (
|
|
2441
|
+
const o = e.params, { unitId: i } = o;
|
|
2442
|
+
if (i !== n.getUnitId())
|
|
2251
2443
|
return;
|
|
2252
|
-
const
|
|
2253
|
-
this.
|
|
2444
|
+
const r = n.zoomRatio || 1;
|
|
2445
|
+
this.updateViewZoom(r);
|
|
2254
2446
|
}
|
|
2255
2447
|
}));
|
|
2256
2448
|
}
|
|
2257
|
-
|
|
2449
|
+
updateViewZoom(t, e = !0) {
|
|
2258
2450
|
var o;
|
|
2259
|
-
const n =
|
|
2260
|
-
n.scene.scale(t, t), this.
|
|
2261
|
-
}
|
|
2262
|
-
_calculatePagePosition(t, e) {
|
|
2263
|
-
const { document: n, scene: o, docBackground: r } = t, i = o == null ? void 0 : o.getParent(), { width: s, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
|
|
2264
|
-
if (i == null || s === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
|
|
2265
|
-
return;
|
|
2266
|
-
const { width: g, height: h } = i;
|
|
2267
|
-
let p = 0, l = 0, _ = 0, u = 0, f = Number.POSITIVE_INFINITY;
|
|
2268
|
-
g > (s + c * 2) * e ? (p = g / 2 - s * e / 2, p /= e, _ = (g - c * 2) / e, f = 0) : (p = c, _ = s + c * 2, f = (_ - g / e) / 2), h > a ? (l = h / 2 - a / 2, u = (h - d * 2) / e) : (l = d, u = a + d * 2), o.resize(_, u + 200), n.translate(p, l), r.translate(p, l);
|
|
2269
|
-
const m = o.getViewport(q.VIEW_MAIN);
|
|
2270
|
-
if (f !== Number.POSITIVE_INFINITY && m != null) {
|
|
2271
|
-
const R = m.transViewportScroll2ScrollValue(f, 0).x;
|
|
2272
|
-
m.scrollTo({
|
|
2273
|
-
x: R
|
|
2274
|
-
});
|
|
2275
|
-
}
|
|
2276
|
-
return this;
|
|
2451
|
+
const n = Q(this._context);
|
|
2452
|
+
n.scene.scale(t, t), this._docPageLayoutService.calculatePagePosition(), e && !this._editorService.isEditor(this._context.unitId) && this._textSelectionManagerService.refreshSelection(), (o = n.scene.getTransformer()) == null || o.clearSelectedObjects();
|
|
2277
2453
|
}
|
|
2278
2454
|
};
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2455
|
+
gt = Es([
|
|
2456
|
+
ce(1, M($)),
|
|
2457
|
+
ce(2, L),
|
|
2458
|
+
ce(3, E),
|
|
2459
|
+
ce(4, M(Z)),
|
|
2460
|
+
ce(5, oe),
|
|
2461
|
+
ce(6, M(xt))
|
|
2462
|
+
], gt);
|
|
2463
|
+
var Is = Object.defineProperty, Ms = Object.getOwnPropertyDescriptor, bs = (t, e, n, o) => {
|
|
2464
|
+
for (var i = o > 1 ? void 0 : o ? Ms(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2465
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2466
|
+
return o && i && Is(e, n, i), i;
|
|
2467
|
+
}, le = (t, e) => (n, o) => e(n, o, t);
|
|
2468
|
+
let _t = class extends z {
|
|
2469
|
+
constructor(e, n, o, i, r, s, a) {
|
|
2293
2470
|
super();
|
|
2294
|
-
|
|
2295
|
-
this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv =
|
|
2471
|
+
I(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
2472
|
+
this._context = e, this._commandService = n, this._editorService = o, this._instanceSrv = i, this._textSelectionRenderManager = r, this._docSkeletonManagerService = s, this._textSelectionManagerService = a, this._initialize();
|
|
2296
2473
|
}
|
|
2297
2474
|
_initialize() {
|
|
2298
2475
|
this._init(), this._skeletonListener(), this._commandExecutedListener();
|
|
2299
2476
|
}
|
|
2300
2477
|
_init() {
|
|
2301
|
-
const { unitId: e } = this._context, n =
|
|
2478
|
+
const { unitId: e } = this._context, n = Q(this._context);
|
|
2302
2479
|
n == null || n.document == null || this._loadedMap.has(n.document) || (this._initialMain(e), this._loadedMap.add(n.document));
|
|
2303
2480
|
}
|
|
2304
2481
|
// eslint-disable-next-line max-lines-per-function
|
|
2305
2482
|
_initialMain(e) {
|
|
2306
|
-
const n =
|
|
2483
|
+
const n = Q(this._context), { document: o, scene: i } = n;
|
|
2307
2484
|
this.disposeWithMe(o.onPointerEnter$.subscribeEvent(() => {
|
|
2308
|
-
this._isEditorReadOnly(e) || (o.cursor =
|
|
2485
|
+
this._isEditorReadOnly(e) || (o.cursor = Vt.TEXT);
|
|
2309
2486
|
})), this.disposeWithMe(o.onPointerLeave$.subscribeEvent(() => {
|
|
2310
|
-
o.cursor =
|
|
2311
|
-
})), this.disposeWithMe(o.onPointerDown$.subscribeEvent((
|
|
2487
|
+
o.cursor = Vt.DEFAULT, i.resetCursor();
|
|
2488
|
+
})), this.disposeWithMe(o.onPointerDown$.subscribeEvent((r, s) => {
|
|
2312
2489
|
if (this._isEditorReadOnly(e))
|
|
2313
2490
|
return;
|
|
2314
2491
|
const a = this._instanceSrv.getCurrentUnitForType(v.UNIVER_DOC);
|
|
2315
2492
|
(a == null ? void 0 : a.getUnitId()) !== e && this._instanceSrv.setCurrentUnitForType(e);
|
|
2316
|
-
const c = this._docSkeletonManagerService.getSkeleton(), { offsetX: d, offsetY: g } =
|
|
2493
|
+
const c = this._docSkeletonManagerService.getSkeleton(), { offsetX: d, offsetY: g } = r, h = this._getTransformCoordForDocumentOffset(d, g);
|
|
2317
2494
|
if (h != null) {
|
|
2318
2495
|
const {
|
|
2319
|
-
pageLayoutType:
|
|
2496
|
+
pageLayoutType: _ = Oe.VERTICAL,
|
|
2320
2497
|
pageMarginLeft: l,
|
|
2321
|
-
pageMarginTop:
|
|
2498
|
+
pageMarginTop: p
|
|
2322
2499
|
} = o.getOffsetConfig(), { editArea: u } = c.findEditAreaByCoord(
|
|
2323
2500
|
h,
|
|
2324
|
-
|
|
2501
|
+
_,
|
|
2325
2502
|
l,
|
|
2326
|
-
|
|
2503
|
+
p
|
|
2327
2504
|
), f = this._docSkeletonManagerService.getViewModel(), m = f.getEditArea();
|
|
2328
|
-
m !==
|
|
2505
|
+
m !== w.BODY && u !== w.BODY && u !== m && f.setEditArea(u);
|
|
2329
2506
|
}
|
|
2330
|
-
if (this._textSelectionRenderManager.eventTrigger(
|
|
2507
|
+
if (this._textSelectionRenderManager.eventTrigger(r), this._editorService.getEditor(e)) {
|
|
2331
2508
|
this._setEditorFocus(e);
|
|
2332
|
-
const { offsetX:
|
|
2509
|
+
const { offsetX: _, offsetY: l } = r;
|
|
2333
2510
|
setTimeout(() => {
|
|
2334
|
-
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(
|
|
2511
|
+
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(_, l);
|
|
2335
2512
|
}, 0);
|
|
2336
2513
|
}
|
|
2337
|
-
|
|
2338
|
-
})), this.disposeWithMe(o.onDblclick$.subscribeEvent((
|
|
2339
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(
|
|
2340
|
-
})), this.disposeWithMe(o.onTripleClick$.subscribeEvent((
|
|
2341
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(
|
|
2514
|
+
r.button !== 2 && s.stopPropagation();
|
|
2515
|
+
})), this.disposeWithMe(o.onDblclick$.subscribeEvent((r) => {
|
|
2516
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(r);
|
|
2517
|
+
})), this.disposeWithMe(o.onTripleClick$.subscribeEvent((r) => {
|
|
2518
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(r);
|
|
2342
2519
|
}));
|
|
2343
2520
|
}
|
|
2344
2521
|
_getTransformCoordForDocumentOffset(e, n) {
|
|
2345
|
-
const o =
|
|
2522
|
+
const o = Q(this._context), { document: i, scene: r } = o, { documentTransform: s } = i.getOffsetConfig(), a = r.getViewports()[0];
|
|
2346
2523
|
if (a == null)
|
|
2347
2524
|
return;
|
|
2348
|
-
const c = a.transformVector2SceneCoord(
|
|
2525
|
+
const c = a.transformVector2SceneCoord(Rt.FromArray([e, n]));
|
|
2349
2526
|
return s.clone().invert().applyPoint(c);
|
|
2350
2527
|
}
|
|
2351
2528
|
_isEditorReadOnly(e) {
|
|
@@ -2356,13 +2533,13 @@ let ct = class extends Q {
|
|
|
2356
2533
|
this._editorService.focusStyle(e);
|
|
2357
2534
|
}
|
|
2358
2535
|
_commandExecutedListener() {
|
|
2359
|
-
const e = [
|
|
2536
|
+
const e = [he.id];
|
|
2360
2537
|
this.disposeWithMe(
|
|
2361
2538
|
this._commandService.onCommandExecuted((n) => {
|
|
2362
2539
|
var o;
|
|
2363
2540
|
if (e.includes(n.id)) {
|
|
2364
|
-
const
|
|
2365
|
-
if (
|
|
2541
|
+
const i = n.params, { unitId: r } = i, s = (o = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : o.unitId;
|
|
2542
|
+
if (r !== s)
|
|
2366
2543
|
return;
|
|
2367
2544
|
this._textSelectionManagerService.refreshSelection();
|
|
2368
2545
|
}
|
|
@@ -2374,11 +2551,11 @@ let ct = class extends Q {
|
|
|
2374
2551
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
2375
2552
|
if (e == null)
|
|
2376
2553
|
return;
|
|
2377
|
-
const { scene: n, mainComponent: o, unitId:
|
|
2554
|
+
const { scene: n, mainComponent: o, unitId: i } = this._context;
|
|
2378
2555
|
this._textSelectionRenderManager.changeRuntime(e, n, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
2379
|
-
unitId:
|
|
2556
|
+
unitId: i,
|
|
2380
2557
|
subUnitId: ""
|
|
2381
|
-
}),
|
|
2558
|
+
}), po(i) || this._textSelectionManagerService.replaceTextRanges([
|
|
2382
2559
|
{
|
|
2383
2560
|
startOffset: 0,
|
|
2384
2561
|
endOffset: 0
|
|
@@ -2388,21 +2565,21 @@ let ct = class extends Q {
|
|
|
2388
2565
|
);
|
|
2389
2566
|
}
|
|
2390
2567
|
};
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
],
|
|
2399
|
-
var
|
|
2400
|
-
for (var
|
|
2401
|
-
(s = t[
|
|
2402
|
-
return o &&
|
|
2403
|
-
},
|
|
2404
|
-
function
|
|
2405
|
-
const n =
|
|
2568
|
+
_t = bs([
|
|
2569
|
+
le(1, E),
|
|
2570
|
+
le(2, oe),
|
|
2571
|
+
le(3, L),
|
|
2572
|
+
le(4, ie),
|
|
2573
|
+
le(5, M($)),
|
|
2574
|
+
le(6, M(Z))
|
|
2575
|
+
], _t);
|
|
2576
|
+
var xs = Object.defineProperty, Ds = Object.getOwnPropertyDescriptor, ys = (t, e, n, o) => {
|
|
2577
|
+
for (var i = o > 1 ? void 0 : o ? Ds(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2578
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2579
|
+
return o && i && xs(e, n, i), i;
|
|
2580
|
+
}, be = (t, e) => (n, o) => e(n, o, t);
|
|
2581
|
+
function rn(t, e) {
|
|
2582
|
+
const n = sn(t.left, t.top, e), o = sn(t.right, t.bottom, e);
|
|
2406
2583
|
return {
|
|
2407
2584
|
left: n.x,
|
|
2408
2585
|
top: n.y,
|
|
@@ -2410,79 +2587,79 @@ function kt(t, e) {
|
|
|
2410
2587
|
bottom: o.y
|
|
2411
2588
|
};
|
|
2412
2589
|
}
|
|
2413
|
-
function
|
|
2414
|
-
const { scaleX: o, scaleY:
|
|
2415
|
-
if (!
|
|
2590
|
+
function sn(t, e, n) {
|
|
2591
|
+
const { scaleX: o, scaleY: i } = n.getAncestorScale(), r = n.getViewport(J.VIEW_MAIN);
|
|
2592
|
+
if (!r)
|
|
2416
2593
|
return {
|
|
2417
2594
|
x: t,
|
|
2418
2595
|
y: e
|
|
2419
2596
|
};
|
|
2420
|
-
const { viewportScrollX: s, viewportScrollY: a } =
|
|
2597
|
+
const { viewportScrollX: s, viewportScrollY: a } = r, c = (t - s) * o, d = (e - a) * i;
|
|
2421
2598
|
return {
|
|
2422
2599
|
x: c,
|
|
2423
2600
|
y: d
|
|
2424
2601
|
};
|
|
2425
2602
|
}
|
|
2426
|
-
let
|
|
2603
|
+
let pt = class extends z {
|
|
2427
2604
|
constructor(t, e, n, o) {
|
|
2428
2605
|
super(), this._globalPopupManagerService = t, this._renderManagerService = e, this._univerInstanceService = n, this._commandService = o;
|
|
2429
2606
|
}
|
|
2430
2607
|
// #region attach to object
|
|
2431
2608
|
_createObjectPositionObserver(t, e) {
|
|
2432
2609
|
const n = () => {
|
|
2433
|
-
const { scene: a, engine: c } = e, { left: d, top: g, width: h, height:
|
|
2610
|
+
const { scene: a, engine: c } = e, { left: d, top: g, width: h, height: _ } = t, l = {
|
|
2434
2611
|
left: d,
|
|
2435
2612
|
right: d + h,
|
|
2436
2613
|
top: g,
|
|
2437
|
-
bottom: g +
|
|
2438
|
-
},
|
|
2614
|
+
bottom: g + _
|
|
2615
|
+
}, p = c.getCanvasElement(), u = p.getBoundingClientRect(), f = jt(p.style.width), m = rn(l, a), { top: S, left: O, width: T } = u, C = T / f;
|
|
2439
2616
|
return {
|
|
2440
|
-
left:
|
|
2441
|
-
right:
|
|
2442
|
-
top:
|
|
2443
|
-
bottom:
|
|
2617
|
+
left: m.left * C + O,
|
|
2618
|
+
right: m.right * C + O,
|
|
2619
|
+
top: m.top * C + S,
|
|
2620
|
+
bottom: m.bottom * C + S
|
|
2444
2621
|
};
|
|
2445
|
-
}, o = n(),
|
|
2446
|
-
|
|
2447
|
-
a.id ===
|
|
2622
|
+
}, o = n(), i = new Fe(o), r = new At();
|
|
2623
|
+
r.add(this._commandService.onCommandExecuted((a) => {
|
|
2624
|
+
a.id === he.id && i.next(n());
|
|
2448
2625
|
}));
|
|
2449
|
-
const s = e.scene.getViewport(
|
|
2450
|
-
return s &&
|
|
2451
|
-
|
|
2626
|
+
const s = e.scene.getViewport(J.VIEW_MAIN);
|
|
2627
|
+
return s && r.add(s.onScrollAfter$.subscribeEvent(() => {
|
|
2628
|
+
i.next(n());
|
|
2452
2629
|
})), {
|
|
2453
2630
|
position: o,
|
|
2454
|
-
position$:
|
|
2455
|
-
disposable:
|
|
2631
|
+
position$: i,
|
|
2632
|
+
disposable: r
|
|
2456
2633
|
};
|
|
2457
2634
|
}
|
|
2458
2635
|
_createRangePositionObserver(t, e) {
|
|
2459
2636
|
var a;
|
|
2460
2637
|
const n = () => {
|
|
2461
|
-
const { scene: c, mainComponent: d, engine: g } = e, h = e.with(
|
|
2462
|
-
if (!l || !
|
|
2638
|
+
const { scene: c, mainComponent: d, engine: g } = e, h = e.with($).getSkeleton(), _ = h.findNodePositionByCharIndex(t.startOffset), l = h.findNodePositionByCharIndex(t.endOffset), p = d;
|
|
2639
|
+
if (!l || !_)
|
|
2463
2640
|
return;
|
|
2464
|
-
const u =
|
|
2465
|
-
return
|
|
2466
|
-
left:
|
|
2467
|
-
right:
|
|
2468
|
-
top:
|
|
2469
|
-
bottom:
|
|
2641
|
+
const u = p.getOffsetConfig(), { docsLeft: f, docsTop: m } = u, S = g.getCanvasElement(), O = S.getBoundingClientRect(), T = jt(S.style.width), { top: C, left: N, width: k } = O, V = k / T, { scaleX: W, scaleY: Dt } = c.getAncestorScale(), qn = new $n(u, h), { borderBoxPointGroup: Qn } = qn.getRangePointData(_, l);
|
|
2642
|
+
return ti(Qn).map((re) => rn(re, c)).map((re) => ({
|
|
2643
|
+
left: (re.left + f * W) * V + N,
|
|
2644
|
+
right: (re.right + f * W) * V + N,
|
|
2645
|
+
top: (re.top + m * Dt) * V + C,
|
|
2646
|
+
bottom: (re.bottom + m * Dt) * V + C
|
|
2470
2647
|
}));
|
|
2471
|
-
}, o = (a = n()) != null ? a : [],
|
|
2472
|
-
|
|
2473
|
-
if (c.id ===
|
|
2648
|
+
}, o = (a = n()) != null ? a : [], i = new Fe(o), r = new At();
|
|
2649
|
+
r.add(this._commandService.onCommandExecuted((c) => {
|
|
2650
|
+
if (c.id === he.id) {
|
|
2474
2651
|
const d = n();
|
|
2475
|
-
d &&
|
|
2652
|
+
d && i.next(d);
|
|
2476
2653
|
}
|
|
2477
2654
|
}));
|
|
2478
|
-
const s = e.scene.getViewport(
|
|
2479
|
-
return s &&
|
|
2655
|
+
const s = e.scene.getViewport(J.VIEW_MAIN);
|
|
2656
|
+
return s && r.add(s.onScrollAfter$.subscribeEvent(() => {
|
|
2480
2657
|
const c = n();
|
|
2481
|
-
c &&
|
|
2658
|
+
c && i.next(c);
|
|
2482
2659
|
})), {
|
|
2483
2660
|
positions: o,
|
|
2484
|
-
positions$:
|
|
2485
|
-
disposable:
|
|
2661
|
+
positions$: i,
|
|
2662
|
+
disposable: r
|
|
2486
2663
|
};
|
|
2487
2664
|
}
|
|
2488
2665
|
/**
|
|
@@ -2492,17 +2669,17 @@ let lt = class extends Q {
|
|
|
2492
2669
|
* @returns disposable
|
|
2493
2670
|
*/
|
|
2494
2671
|
attachPopupToObject(t, e) {
|
|
2495
|
-
const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(),
|
|
2496
|
-
if (!
|
|
2672
|
+
const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), i = this._renderManagerService.getRenderById(o);
|
|
2673
|
+
if (!i)
|
|
2497
2674
|
return {
|
|
2498
2675
|
dispose: () => {
|
|
2499
2676
|
}
|
|
2500
2677
|
};
|
|
2501
|
-
const { position:
|
|
2678
|
+
const { position: r, position$: s, disposable: a } = this._createObjectPositionObserver(t, i), c = this._globalPopupManagerService.addPopup({
|
|
2502
2679
|
...e,
|
|
2503
2680
|
unitId: o,
|
|
2504
2681
|
subUnitId: "default",
|
|
2505
|
-
anchorRect:
|
|
2682
|
+
anchorRect: r,
|
|
2506
2683
|
anchorRect$: s
|
|
2507
2684
|
});
|
|
2508
2685
|
return {
|
|
@@ -2512,21 +2689,21 @@ let lt = class extends Q {
|
|
|
2512
2689
|
};
|
|
2513
2690
|
}
|
|
2514
2691
|
attachPopupToRange(t, e) {
|
|
2515
|
-
const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), { direction:
|
|
2516
|
-
if (!
|
|
2692
|
+
const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC).getUnitId(), { direction: i = "top" } = e, r = this._renderManagerService.getRenderById(o);
|
|
2693
|
+
if (!r)
|
|
2517
2694
|
return {
|
|
2518
2695
|
dispose: () => {
|
|
2519
2696
|
}
|
|
2520
2697
|
};
|
|
2521
|
-
const { positions: s, positions$: a, disposable: c } = this._createRangePositionObserver(t,
|
|
2698
|
+
const { positions: s, positions$: a, disposable: c } = this._createRangePositionObserver(t, r), d = a.pipe(ii((h) => i === "top" ? h[0] : h[h.length - 1])), g = this._globalPopupManagerService.addPopup({
|
|
2522
2699
|
...e,
|
|
2523
2700
|
unitId: o,
|
|
2524
2701
|
subUnitId: "default",
|
|
2525
|
-
anchorRect:
|
|
2702
|
+
anchorRect: i === "top" ? s[0] : s[s.length - 1],
|
|
2526
2703
|
anchorRect$: d,
|
|
2527
2704
|
excludeRects: s,
|
|
2528
2705
|
excludeRects$: a,
|
|
2529
|
-
direction:
|
|
2706
|
+
direction: i === "top" ? "top" : "bottom"
|
|
2530
2707
|
});
|
|
2531
2708
|
return {
|
|
2532
2709
|
dispose: () => {
|
|
@@ -2535,23 +2712,23 @@ let lt = class extends Q {
|
|
|
2535
2712
|
};
|
|
2536
2713
|
}
|
|
2537
2714
|
};
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
],
|
|
2544
|
-
var
|
|
2545
|
-
for (var
|
|
2546
|
-
(s = t[
|
|
2547
|
-
return o &&
|
|
2548
|
-
},
|
|
2549
|
-
let
|
|
2715
|
+
pt = ys([
|
|
2716
|
+
be(0, M(Uo)),
|
|
2717
|
+
be(1, X),
|
|
2718
|
+
be(2, L),
|
|
2719
|
+
be(3, E)
|
|
2720
|
+
], pt);
|
|
2721
|
+
var Ps = Object.defineProperty, As = Object.getOwnPropertyDescriptor, Ns = (t, e, n, o) => {
|
|
2722
|
+
for (var i = o > 1 ? void 0 : o ? As(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2723
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2724
|
+
return o && i && Ps(e, n, i), i;
|
|
2725
|
+
}, an = (t, e) => (n, o) => e(n, o, t);
|
|
2726
|
+
let Ae = class extends Te {
|
|
2550
2727
|
constructor(t, e) {
|
|
2551
2728
|
super(), this._instanceSrv = t, this._renderManagerService = e, this._init();
|
|
2552
2729
|
}
|
|
2553
2730
|
_init() {
|
|
2554
|
-
this._renderManagerService.createRender$.pipe(
|
|
2731
|
+
this._renderManagerService.createRender$.pipe(de(this.dispose$)).subscribe((t) => this._createRenderWithId(t)), this._instanceSrv.getTypeOfUnitAdded$(v.UNIVER_DOC).pipe(de(this.dispose$)).subscribe((t) => this._createRenderer(t)), this._instanceSrv.getAllUnitsForType(v.UNIVER_DOC).forEach((t) => this._createRenderer(t)), this._instanceSrv.getTypeOfUnitDisposed$(v.UNIVER_DOC).pipe(de(this.dispose$)).subscribe((t) => this._disposeRenderer(t));
|
|
2555
2732
|
}
|
|
2556
2733
|
_createRenderer(t) {
|
|
2557
2734
|
const e = t.getUnitId();
|
|
@@ -2565,19 +2742,188 @@ let xe = class extends Se {
|
|
|
2565
2742
|
this._renderManagerService.removeRender(e);
|
|
2566
2743
|
}
|
|
2567
2744
|
};
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
],
|
|
2573
|
-
var
|
|
2574
|
-
for (var
|
|
2575
|
-
(s = t[
|
|
2576
|
-
return o &&
|
|
2577
|
-
},
|
|
2578
|
-
|
|
2745
|
+
Ae = Ns([
|
|
2746
|
+
Ve(je.Ready, Ae),
|
|
2747
|
+
an(0, L),
|
|
2748
|
+
an(1, X)
|
|
2749
|
+
], Ae);
|
|
2750
|
+
var Fs = Object.defineProperty, Us = Object.getOwnPropertyDescriptor, Ls = (t, e, n, o) => {
|
|
2751
|
+
for (var i = o > 1 ? void 0 : o ? Us(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2752
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2753
|
+
return o && i && Fs(e, n, i), i;
|
|
2754
|
+
}, nt = (t, e) => (n, o) => e(n, o, t);
|
|
2755
|
+
const ws = [
|
|
2756
|
+
mn,
|
|
2757
|
+
Sn,
|
|
2758
|
+
vn,
|
|
2759
|
+
fo
|
|
2760
|
+
];
|
|
2761
|
+
let ft = class extends z {
|
|
2762
|
+
constructor(t, e, n, o) {
|
|
2763
|
+
super(), this._context = t, this._contextMenuService = e, this._textSelectionManagerService = n, this._commandService = o, ws.includes(this._context.unitId) || (this._initPointerDown(), this._initEditChange());
|
|
2764
|
+
}
|
|
2765
|
+
_initPointerDown() {
|
|
2766
|
+
var n, o;
|
|
2767
|
+
const e = ((o = (n = this._context) == null ? void 0 : n.mainComponent) == null ? void 0 : o.onPointerDown$).subscribeEvent((i) => {
|
|
2768
|
+
i.button === 2 && this._contextMenuService.triggerContextMenu(i, P.CONTEXT_MENU);
|
|
2769
|
+
});
|
|
2770
|
+
this.disposeWithMe(e);
|
|
2771
|
+
}
|
|
2772
|
+
_initEditChange() {
|
|
2773
|
+
this.disposeWithMe(
|
|
2774
|
+
this._commandService.onCommandExecuted((t) => {
|
|
2775
|
+
t.id === Ge.id && this._contextMenuService.visible && this._contextMenuService.hideContextMenu();
|
|
2776
|
+
})
|
|
2777
|
+
);
|
|
2778
|
+
}
|
|
2779
|
+
};
|
|
2780
|
+
ft = Ls([
|
|
2781
|
+
nt(1, Lo),
|
|
2782
|
+
nt(2, M(Z)),
|
|
2783
|
+
nt(3, E)
|
|
2784
|
+
], ft);
|
|
2785
|
+
var $s = Object.defineProperty, Bs = Object.getOwnPropertyDescriptor, Hs = (t, e, n, o) => {
|
|
2786
|
+
for (var i = o > 1 ? void 0 : o ? Bs(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2787
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2788
|
+
return o && i && $s(e, n, i), i;
|
|
2789
|
+
}, cn = (t, e) => (n, o) => e(n, o, t);
|
|
2790
|
+
const Vs = [
|
|
2791
|
+
mn,
|
|
2792
|
+
Sn,
|
|
2793
|
+
vn
|
|
2794
|
+
];
|
|
2795
|
+
let mt = class extends z {
|
|
2796
|
+
constructor(t, e, n) {
|
|
2797
|
+
super(), this._context = t, this._docPageLayoutService = e, this._textSelectionManagerService = n, Vs.includes(this._context.unitId) || this._initResize();
|
|
2798
|
+
}
|
|
2799
|
+
_initResize() {
|
|
2800
|
+
this.disposeWithMe(
|
|
2801
|
+
rt(this._context.engine.onTransformChange$).pipe(
|
|
2802
|
+
ri((t) => t.type === ni.resize),
|
|
2803
|
+
Bn(16)
|
|
2804
|
+
).subscribe(() => {
|
|
2805
|
+
this._docPageLayoutService.calculatePagePosition(), this._textSelectionManagerService.refreshSelection();
|
|
2806
|
+
})
|
|
2807
|
+
);
|
|
2808
|
+
}
|
|
2809
|
+
};
|
|
2810
|
+
mt = Hs([
|
|
2811
|
+
cn(1, M(xt)),
|
|
2812
|
+
cn(2, M(Z))
|
|
2813
|
+
], mt);
|
|
2814
|
+
var js = Object.defineProperty, Ws = Object.getOwnPropertyDescriptor, zs = (t, e, n, o) => {
|
|
2815
|
+
for (var i = o > 1 ? void 0 : o ? Ws(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2816
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2817
|
+
return o && i && js(e, n, i), i;
|
|
2818
|
+
}, ln = (t, e) => (n, o) => e(n, o, t);
|
|
2819
|
+
let Le = class extends z {
|
|
2820
|
+
constructor(e, n) {
|
|
2821
|
+
super();
|
|
2822
|
+
I(this, "_activeCustomRanges$", new Fe([]));
|
|
2823
|
+
I(this, "activeCustomRanges$", this._activeCustomRanges$.asObservable());
|
|
2824
|
+
I(this, "_activeIndex$", new Fe(null));
|
|
2825
|
+
I(this, "activeIndex$", this._activeIndex$.asObservable());
|
|
2826
|
+
I(this, "_scrolling", !1);
|
|
2827
|
+
this._univerInstanceService = e, this._renderManagerService = n, this.disposeWithMe(() => {
|
|
2828
|
+
this._activeCustomRanges$.complete(), this._activeIndex$.complete();
|
|
2829
|
+
});
|
|
2830
|
+
}
|
|
2831
|
+
_getTransformCoordForDocumentOffset(e, n, o, i) {
|
|
2832
|
+
const { documentTransform: r } = e.getOffsetConfig(), s = n.transformVector2SceneCoord(Rt.FromArray([o, i]));
|
|
2833
|
+
if (s)
|
|
2834
|
+
return r.clone().invert().applyPoint(s);
|
|
2835
|
+
}
|
|
2836
|
+
_calcActiveCustomRanges(e, n) {
|
|
2837
|
+
var p, u;
|
|
2838
|
+
const o = this._univerInstanceService.getCurrentUnitForType(v.UNIVER_DOC);
|
|
2839
|
+
if (!o) {
|
|
2840
|
+
this._activeCustomRanges$.next([]);
|
|
2841
|
+
return;
|
|
2842
|
+
}
|
|
2843
|
+
const i = this._renderManagerService.getRenderById(o.getUnitId());
|
|
2844
|
+
if (!i)
|
|
2845
|
+
return null;
|
|
2846
|
+
const r = i.mainComponent, s = i.with($).getSkeleton(), { pageLayoutType: a = Oe.VERTICAL, pageMarginLeft: c, pageMarginTop: d, docsLeft: g, docsTop: h } = r.getOffsetConfig(), _ = this._getTransformCoordForDocumentOffset(
|
|
2847
|
+
r,
|
|
2848
|
+
i.scene.getViewport(J.VIEW_MAIN),
|
|
2849
|
+
e,
|
|
2850
|
+
n
|
|
2851
|
+
);
|
|
2852
|
+
if (!_)
|
|
2853
|
+
return;
|
|
2854
|
+
const l = s.findNodeByCoord(
|
|
2855
|
+
_,
|
|
2856
|
+
a,
|
|
2857
|
+
c,
|
|
2858
|
+
d
|
|
2859
|
+
);
|
|
2860
|
+
if (l && l.node) {
|
|
2861
|
+
const f = l.node.left + c, m = l.node.left + l.node.width + c;
|
|
2862
|
+
if (_.x < f || _.x > m) {
|
|
2863
|
+
this._activeIndex$.next(null), this._activeCustomRanges$.next([]);
|
|
2864
|
+
return;
|
|
2865
|
+
}
|
|
2866
|
+
const S = l.node.parent.st + l.node.parent.glyphGroup.indexOf(l.node);
|
|
2867
|
+
S !== this._activeIndex$.value && this._activeIndex$.next(S);
|
|
2868
|
+
const O = (u = (p = o.getCustomRanges()) == null ? void 0 : p.filter((C) => C.startIndex <= S && C.endIndex >= S)) != null ? u : [], T = this._activeCustomRanges$.value;
|
|
2869
|
+
if (T.length === O.length && T.every((C, N) => C.rangeId === O[N].rangeId))
|
|
2870
|
+
return;
|
|
2871
|
+
this._activeCustomRanges$.next(O);
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
onMouseMove(e) {
|
|
2875
|
+
if (this._scrolling)
|
|
2876
|
+
return;
|
|
2877
|
+
const { offsetX: n, offsetY: o } = e;
|
|
2878
|
+
this._calcActiveCustomRanges(n, o);
|
|
2879
|
+
}
|
|
2880
|
+
startScroll() {
|
|
2881
|
+
this._scrolling || (this._scrolling = !0);
|
|
2882
|
+
}
|
|
2883
|
+
endScroll() {
|
|
2884
|
+
this._scrolling = !1;
|
|
2885
|
+
}
|
|
2886
|
+
};
|
|
2887
|
+
Le = zs([
|
|
2888
|
+
ln(0, L),
|
|
2889
|
+
ln(1, X)
|
|
2890
|
+
], Le);
|
|
2891
|
+
var Gs = Object.defineProperty, ks = Object.getOwnPropertyDescriptor, Ys = (t, e, n, o) => {
|
|
2892
|
+
for (var i = o > 1 ? void 0 : o ? ks(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2893
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2894
|
+
return o && i && Gs(e, n, i), i;
|
|
2895
|
+
}, Xs = (t, e) => (n, o) => e(n, o, t);
|
|
2896
|
+
let St = class extends z {
|
|
2897
|
+
constructor(t, e) {
|
|
2898
|
+
super(), this._context = t, this._docHoverManagerService = e, this._initPointerDown(), this._initScroll();
|
|
2899
|
+
}
|
|
2900
|
+
_initPointerDown() {
|
|
2901
|
+
this.disposeWithMe(
|
|
2902
|
+
rt(this._context.scene.onPointerMove$).pipe(Bn(16)).subscribe((t) => {
|
|
2903
|
+
this._docHoverManagerService.onMouseMove(t);
|
|
2904
|
+
})
|
|
2905
|
+
);
|
|
2906
|
+
}
|
|
2907
|
+
_initScroll() {
|
|
2908
|
+
const t = this._context.scene.getViewport(J.VIEW_MAIN);
|
|
2909
|
+
t && (this.disposeWithMe(rt(t.onScrollAfter$).pipe(si(60)).subscribe(() => {
|
|
2910
|
+
this._docHoverManagerService.endScroll();
|
|
2911
|
+
})), this.disposeWithMe(t.onScrollBefore$.subscribeEvent(() => {
|
|
2912
|
+
this._docHoverManagerService.startScroll();
|
|
2913
|
+
})));
|
|
2914
|
+
}
|
|
2915
|
+
};
|
|
2916
|
+
St = Ys([
|
|
2917
|
+
Xs(1, M(Le))
|
|
2918
|
+
], St);
|
|
2919
|
+
var Ks = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, Js = (t, e, n, o) => {
|
|
2920
|
+
for (var i = o > 1 ? void 0 : o ? Zs(e, n) : e, r = t.length - 1, s; r >= 0; r--)
|
|
2921
|
+
(s = t[r]) && (i = (o ? s(e, n, i) : s(i)) || i);
|
|
2922
|
+
return o && i && Ks(e, n, i), i;
|
|
2923
|
+
}, ot = (t, e) => (n, o) => e(n, o, t), xe;
|
|
2924
|
+
let dn = (xe = class extends mo {
|
|
2579
2925
|
constructor(t, e, n, o) {
|
|
2580
|
-
super(), this._config = t, this._injector = e, this._renderManagerSrv = n, this._logService = o, this._config =
|
|
2926
|
+
super(), this._config = t, this._injector = e, this._renderManagerSrv = n, this._logService = o, this._config = K.deepMerge({}, Li, this._config), this._initDependencies(e), this._initializeCommands();
|
|
2581
2927
|
}
|
|
2582
2928
|
onReady() {
|
|
2583
2929
|
this._initRenderBasics();
|
|
@@ -2587,35 +2933,36 @@ let Yt = (Ie = class extends Dn {
|
|
|
2587
2933
|
}
|
|
2588
2934
|
_initializeCommands() {
|
|
2589
2935
|
[
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2936
|
+
$i,
|
|
2937
|
+
Bi,
|
|
2938
|
+
Vi,
|
|
2939
|
+
Hi,
|
|
2940
|
+
ji,
|
|
2941
|
+
Wi,
|
|
2942
|
+
zi,
|
|
2943
|
+
Gi,
|
|
2944
|
+
ki,
|
|
2945
|
+
us,
|
|
2946
|
+
hs,
|
|
2947
|
+
ds
|
|
2602
2948
|
].forEach((t) => {
|
|
2603
|
-
this._injector.get(
|
|
2949
|
+
this._injector.get(On).registerShortcut(t);
|
|
2604
2950
|
});
|
|
2605
2951
|
}
|
|
2606
2952
|
_initDependencies(t) {
|
|
2607
2953
|
[
|
|
2608
|
-
[
|
|
2609
|
-
[Me],
|
|
2954
|
+
[Re, { useFactory: () => this._injector.createInstance(Re, this._config) }],
|
|
2610
2955
|
[ye],
|
|
2611
|
-
[
|
|
2612
|
-
[
|
|
2613
|
-
[
|
|
2614
|
-
[
|
|
2956
|
+
[Pe],
|
|
2957
|
+
[Ae],
|
|
2958
|
+
[Ce, { useFactory: () => this._injector.createInstance(Ce, this._config) }],
|
|
2959
|
+
[Ee, { useClass: ct }],
|
|
2960
|
+
[pt],
|
|
2961
|
+
[Le]
|
|
2615
2962
|
].forEach((n) => t.add(n));
|
|
2616
2963
|
}
|
|
2617
2964
|
_markDocAsFocused() {
|
|
2618
|
-
const t = this._injector.get(
|
|
2965
|
+
const t = this._injector.get(L), e = this._injector.get(oe);
|
|
2619
2966
|
try {
|
|
2620
2967
|
const n = t.getCurrentUnitForType(v.UNIVER_DOC);
|
|
2621
2968
|
if (!n) return;
|
|
@@ -2626,34 +2973,38 @@ let Yt = (Ie = class extends Dn {
|
|
|
2626
2973
|
}
|
|
2627
2974
|
}
|
|
2628
2975
|
_initUI() {
|
|
2629
|
-
this._injector.get(
|
|
2976
|
+
this._injector.get(Ce);
|
|
2630
2977
|
}
|
|
2631
2978
|
_initRenderBasics() {
|
|
2632
2979
|
[
|
|
2633
|
-
[
|
|
2634
|
-
[
|
|
2635
|
-
[
|
|
2636
|
-
[
|
|
2980
|
+
[$],
|
|
2981
|
+
[Xo],
|
|
2982
|
+
[xt],
|
|
2983
|
+
[ht],
|
|
2984
|
+
[gt]
|
|
2637
2985
|
].forEach((t) => {
|
|
2638
2986
|
this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, t);
|
|
2639
2987
|
});
|
|
2640
2988
|
}
|
|
2641
2989
|
_initRenderModules() {
|
|
2642
2990
|
[
|
|
2643
|
-
[
|
|
2644
|
-
[
|
|
2645
|
-
[
|
|
2991
|
+
[lt],
|
|
2992
|
+
[_t],
|
|
2993
|
+
[ut],
|
|
2994
|
+
[mt],
|
|
2995
|
+
[St],
|
|
2996
|
+
[ft]
|
|
2646
2997
|
].forEach((t) => {
|
|
2647
2998
|
this._renderManagerSrv.registerRenderModule(v.UNIVER_DOC, t);
|
|
2648
2999
|
});
|
|
2649
3000
|
}
|
|
2650
|
-
},
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
],
|
|
2656
|
-
function
|
|
3001
|
+
}, I(xe, "pluginName", wi), I(xe, "type", v.UNIVER_DOC), xe);
|
|
3002
|
+
dn = Js([
|
|
3003
|
+
ot(1, M(Be)),
|
|
3004
|
+
ot(2, X),
|
|
3005
|
+
ot(3, gn)
|
|
3006
|
+
], dn);
|
|
3007
|
+
function la(t) {
|
|
2657
3008
|
return {
|
|
2658
3009
|
left: t.positionH.posOffset,
|
|
2659
3010
|
top: t.positionV.posOffset,
|
|
@@ -2661,41 +3012,42 @@ function ki(t) {
|
|
|
2661
3012
|
height: t.size.height
|
|
2662
3013
|
};
|
|
2663
3014
|
}
|
|
2664
|
-
function
|
|
3015
|
+
function da(t, e = 0, n = 0) {
|
|
2665
3016
|
return {
|
|
2666
3017
|
size: {
|
|
2667
3018
|
width: t.width,
|
|
2668
3019
|
height: t.height
|
|
2669
3020
|
},
|
|
2670
3021
|
positionH: {
|
|
2671
|
-
relativeFrom:
|
|
3022
|
+
relativeFrom: So.MARGIN,
|
|
2672
3023
|
posOffset: (t.left || 0) - e
|
|
2673
3024
|
},
|
|
2674
3025
|
positionV: {
|
|
2675
|
-
relativeFrom:
|
|
3026
|
+
relativeFrom: vo.PAGE,
|
|
2676
3027
|
posOffset: (t.top || 0) - n
|
|
2677
3028
|
},
|
|
2678
3029
|
angle: t.angle || 0
|
|
2679
3030
|
};
|
|
2680
3031
|
}
|
|
2681
3032
|
export {
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
3033
|
+
wi as DOC_UI_PLUGIN_NAME,
|
|
3034
|
+
Ui as DefaultDocContainerConfig,
|
|
3035
|
+
Li as DefaultDocUiConfig,
|
|
3036
|
+
Fi as DefaultToolbarConfig,
|
|
3037
|
+
lt as DocBackScrollRenderController,
|
|
3038
|
+
pt as DocCanvasPopManagerService,
|
|
3039
|
+
Kn as DocCopyCommand,
|
|
3040
|
+
Zn as DocCutCommand,
|
|
3041
|
+
Le as DocHoverManagerService,
|
|
3042
|
+
Jn as DocPasteCommand,
|
|
3043
|
+
ht as DocRenderController,
|
|
3044
|
+
Ae as DocsRenderService,
|
|
3045
|
+
Ee as IDocClipboardService,
|
|
3046
|
+
Oi as PastePluginLark,
|
|
3047
|
+
Mi as PastePluginUniver,
|
|
3048
|
+
Ei as PastePluginWord,
|
|
3049
|
+
dn as UniverDocsUIPlugin,
|
|
3050
|
+
la as docDrawingPositionToTransform,
|
|
3051
|
+
da as transformToDocDrawingPosition,
|
|
3052
|
+
A as whenDocAndEditorFocused
|
|
2701
3053
|
};
|