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