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