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