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