@univerjs/docs-ui 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/lib/cjs/index.js +3 -3
- package/lib/es/index.js +1092 -885
- package/lib/types/controllers/doc-editor-bridge.controller.d.ts +3 -2
- package/lib/types/controllers/menu/menu.d.ts +4 -0
- package/lib/types/locale/zh-CN.d.ts +4 -0
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-univer.d.ts +18 -0
- package/lib/types/services/clipboard/udm-to-html/convertor.d.ts +4 -1
- package/lib/types/views/doc-canvas-view.d.ts +3 -1
- package/lib/umd/index.js +3 -3
- package/package.json +25 -18
package/lib/es/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var S = (
|
|
4
|
-
import { FOCUSING_DOC as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { KeyCode as
|
|
7
|
-
import { MoveCursorOperation as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
const
|
|
1
|
+
var Nt = Object.defineProperty;
|
|
2
|
+
var $t = (r, e, t) => e in r ? Nt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var S = (r, e, t) => ($t(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { FOCUSING_DOC as Ee, FOCUSING_UNIVER_EDITOR as Xe, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as wt, Direction as W, EDITOR_ACTIVATED as Ct, LocaleService as Ge, RxDisposable as ce, ICommandService as m, BooleanNumber as v, UniverInstanceType as R, BaselineOffset as J, ThemeService as Bt, HorizontalAlign as xe, IUniverInstanceService as D, Disposable as Y, OnLifecycle as L, LifecycleStages as A, Tools as Ze, LRUMap as Ft, ColorKit as nt, toDisposable as w, ILogService as Ot, CommandType as qe, IContextService as jt, checkForSubstrings as Wt, IConfigService as zt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as Vt, IFloatingObjectManagerService as kt, Plugin as Ht, PluginType as Yt } from "@univerjs/core";
|
|
5
|
+
import { Inject as C, Injector as De, Optional as Xt, createIdentifier as Gt } from "@wendellhu/redi";
|
|
6
|
+
import { KeyCode as P, MetaKeys as le, ILayoutService as Rt, MenuGroup as T, MenuItemType as b, MenuPosition as I, getMenuHiddenObservable as M, FONT_FAMILY_LIST as rt, FONT_SIZE_LIST as Zt, FontFamily as qt, FontFamilyItem as Kt, FontSize as Jt, DesktopUIPart as Qt, ComponentManager as en, IEditorService as N, IMenuService as tn, IUIController as nn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as rn, HTML_CLIPBOARD_MIME_TYPE as on, IClipboardInterfaceService as Ke, CopyCommand as sn, CutCommand as an, PasteCommand as cn, SetEditorResizeOperation as ln, IShortcutService as dn } from "@univerjs/ui";
|
|
7
|
+
import { MoveCursorOperation as Pe, MoveSelectionOperation as Ue, SelectAllOperation as un, SetInlineFormatBoldCommand as hn, SetTextSelectionsOperation as U, SetInlineFormatCommand as ee, SetInlineFormatItalicCommand as gn, SetInlineFormatUnderlineCommand as _n, SetInlineFormatStrikethroughCommand as pn, SetInlineFormatSubscriptCommand as fn, SetInlineFormatSuperscriptCommand as Sn, SetInlineFormatFontFamilyCommand as it, SetInlineFormatFontSizeCommand as ot, SetInlineFormatTextColorCommand as st, AlignLeftCommand as mn, AlignOperationCommand as Le, AlignCenterCommand as vn, AlignRightCommand as Cn, AlignJustifyCommand as On, OrderListCommand as Rn, BulletListCommand as Tn, TextSelectionManagerService as te, BreakLineCommand as bn, DeleteLeftCommand as In, DeleteRightCommand as Mn, CutContentCommand as Tt, InnerPasteCommand as bt, VIEWPORT_KEY as Ae, CoverContentCommand as yn, RichTextEditingMutation as Je, DocSkeletonManagerService as ne, DOCS_COMPONENT_MAIN_LAYER_INDEX as Fe, DOCS_COMPONENT_HEADER_LAYER_INDEX as En, DOCS_VIEW_KEY as at, DOCS_COMPONENT_DEFAULT_Z_INDEX as xn, SetDocZoomRatioOperation as Qe, SetDocZoomRatioCommand as Dn, getDocObject as It, getDocObjectById as Pn } from "@univerjs/docs";
|
|
8
|
+
import { connectInjector as Un } from "@wendellhu/redi/react-bindings";
|
|
9
|
+
import { ITextSelectionRenderManager as de, pixelToPt as Ln, ptToPixel as ct, ScrollBar as ke, IRenderManagerService as z, PageLayoutType as lt, Viewport as An, EVENT_TYPE as Nn, Layer as dt, Documents as $n, Liquid as wn, Rect as Bn, CURSOR_TYPE as ut, NodePositionConvertToCursor as Fn, getAnchorBounding as jn } from "@univerjs/engine-render";
|
|
10
|
+
import Wn from "react";
|
|
11
|
+
import { Observable as E, takeUntil as ae, fromEvent as ht, BehaviorSubject as zn } from "rxjs";
|
|
12
|
+
import { ColorPicker as Vn } from "@univerjs/design";
|
|
13
|
+
const kn = {
|
|
14
14
|
undo: !0,
|
|
15
15
|
redo: !0,
|
|
16
16
|
// Undo redo
|
|
@@ -38,7 +38,7 @@ const xn = {
|
|
|
38
38
|
// 'Wrap mode'
|
|
39
39
|
textRotateMode: !0
|
|
40
40
|
// 'Text Rotation Mode'
|
|
41
|
-
},
|
|
41
|
+
}, Hn = {
|
|
42
42
|
outerLeft: !1,
|
|
43
43
|
outerRight: !1,
|
|
44
44
|
header: !0,
|
|
@@ -51,90 +51,90 @@ const xn = {
|
|
|
51
51
|
frozenContent: !1,
|
|
52
52
|
infoBar: !0,
|
|
53
53
|
toolbar: !0
|
|
54
|
-
},
|
|
54
|
+
}, Yn = {
|
|
55
55
|
layout: {
|
|
56
|
-
docContainerConfig:
|
|
57
|
-
toolbarConfig:
|
|
56
|
+
docContainerConfig: Hn,
|
|
57
|
+
toolbarConfig: kn
|
|
58
58
|
}
|
|
59
|
-
},
|
|
60
|
-
function
|
|
61
|
-
return
|
|
59
|
+
}, Xn = "DocUI";
|
|
60
|
+
function $(r) {
|
|
61
|
+
return r.getContextValue(Ee) && r.getContextValue(Xe);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
63
|
+
function Gn(r) {
|
|
64
|
+
return r.getContextValue(Ee) && r.getContextValue(Xe) && !r.getContextValue(wt);
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
id:
|
|
68
|
-
binding:
|
|
69
|
-
preconditions:
|
|
66
|
+
const Zn = {
|
|
67
|
+
id: Pe.id,
|
|
68
|
+
binding: P.ARROW_UP,
|
|
69
|
+
preconditions: $,
|
|
70
70
|
staticParameters: {
|
|
71
|
-
direction:
|
|
71
|
+
direction: W.UP
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
id:
|
|
75
|
-
binding:
|
|
76
|
-
preconditions:
|
|
73
|
+
}, qn = {
|
|
74
|
+
id: Pe.id,
|
|
75
|
+
binding: P.ARROW_DOWN,
|
|
76
|
+
preconditions: $,
|
|
77
77
|
staticParameters: {
|
|
78
|
-
direction:
|
|
78
|
+
direction: W.DOWN
|
|
79
79
|
}
|
|
80
|
-
},
|
|
81
|
-
id:
|
|
82
|
-
binding:
|
|
83
|
-
preconditions:
|
|
80
|
+
}, Kn = {
|
|
81
|
+
id: Pe.id,
|
|
82
|
+
binding: P.ARROW_LEFT,
|
|
83
|
+
preconditions: $,
|
|
84
84
|
staticParameters: {
|
|
85
|
-
direction:
|
|
85
|
+
direction: W.LEFT
|
|
86
86
|
}
|
|
87
|
-
},
|
|
88
|
-
id:
|
|
89
|
-
binding:
|
|
90
|
-
preconditions:
|
|
87
|
+
}, Jn = {
|
|
88
|
+
id: Pe.id,
|
|
89
|
+
binding: P.ARROW_RIGHT,
|
|
90
|
+
preconditions: $,
|
|
91
91
|
staticParameters: {
|
|
92
|
-
direction:
|
|
92
|
+
direction: W.RIGHT
|
|
93
93
|
}
|
|
94
|
-
},
|
|
95
|
-
id:
|
|
96
|
-
binding:
|
|
97
|
-
preconditions:
|
|
94
|
+
}, Qn = {
|
|
95
|
+
id: Ue.id,
|
|
96
|
+
binding: P.ARROW_UP | le.SHIFT,
|
|
97
|
+
preconditions: $,
|
|
98
98
|
staticParameters: {
|
|
99
|
-
direction:
|
|
99
|
+
direction: W.UP
|
|
100
100
|
}
|
|
101
|
-
},
|
|
102
|
-
id:
|
|
103
|
-
binding:
|
|
104
|
-
preconditions:
|
|
101
|
+
}, er = {
|
|
102
|
+
id: Ue.id,
|
|
103
|
+
binding: P.ARROW_DOWN | le.SHIFT,
|
|
104
|
+
preconditions: $,
|
|
105
105
|
staticParameters: {
|
|
106
|
-
direction:
|
|
106
|
+
direction: W.DOWN
|
|
107
107
|
}
|
|
108
|
-
},
|
|
109
|
-
id:
|
|
110
|
-
binding:
|
|
111
|
-
preconditions:
|
|
108
|
+
}, tr = {
|
|
109
|
+
id: Ue.id,
|
|
110
|
+
binding: P.ARROW_LEFT | le.SHIFT,
|
|
111
|
+
preconditions: $,
|
|
112
112
|
staticParameters: {
|
|
113
|
-
direction:
|
|
113
|
+
direction: W.LEFT
|
|
114
114
|
}
|
|
115
|
-
},
|
|
116
|
-
id:
|
|
117
|
-
binding:
|
|
118
|
-
preconditions:
|
|
115
|
+
}, nr = {
|
|
116
|
+
id: Ue.id,
|
|
117
|
+
binding: P.ARROW_RIGHT | le.SHIFT,
|
|
118
|
+
preconditions: $,
|
|
119
119
|
staticParameters: {
|
|
120
|
-
direction:
|
|
120
|
+
direction: W.RIGHT
|
|
121
121
|
}
|
|
122
|
-
},
|
|
123
|
-
id:
|
|
124
|
-
binding:
|
|
125
|
-
preconditions: (
|
|
122
|
+
}, rr = {
|
|
123
|
+
id: un.id,
|
|
124
|
+
binding: P.A | le.CTRL_COMMAND,
|
|
125
|
+
preconditions: (r) => r.getContextValue(Xe) && (r.getContextValue(Ee) || r.getContextValue(Ct))
|
|
126
126
|
};
|
|
127
|
-
var
|
|
128
|
-
for (var
|
|
129
|
-
(o =
|
|
130
|
-
return n &&
|
|
131
|
-
},
|
|
132
|
-
let
|
|
133
|
-
constructor(
|
|
127
|
+
var ir = Object.defineProperty, or = Object.getOwnPropertyDescriptor, sr = (r, e, t, n) => {
|
|
128
|
+
for (var i = n > 1 ? void 0 : n ? or(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
129
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
130
|
+
return n && i && ir(e, t, i), i;
|
|
131
|
+
}, gt = (r, e) => (t, n) => e(t, n, r);
|
|
132
|
+
let He = class {
|
|
133
|
+
constructor(r, e, t) {
|
|
134
134
|
S(this, "_docContainer");
|
|
135
135
|
// 获取SheetContainer组件
|
|
136
|
-
S(this, "getComponent", (
|
|
137
|
-
if (this._docContainer =
|
|
136
|
+
S(this, "getComponent", (r) => {
|
|
137
|
+
if (this._docContainer = r, !r.getContentRef().current)
|
|
138
138
|
throw new Error("container is not ready");
|
|
139
139
|
});
|
|
140
140
|
/**
|
|
@@ -144,10 +144,10 @@ let je = class {
|
|
|
144
144
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
145
145
|
*
|
|
146
146
|
*/
|
|
147
|
-
S(this, "changeLocale", (
|
|
148
|
-
this._localeService.setLocale(
|
|
147
|
+
S(this, "changeLocale", (r) => {
|
|
148
|
+
this._localeService.setLocale(r);
|
|
149
149
|
});
|
|
150
|
-
this._config =
|
|
150
|
+
this._config = r, this._localeService = e, this._injector = t;
|
|
151
151
|
}
|
|
152
152
|
getUIConfig() {
|
|
153
153
|
return {
|
|
@@ -160,25 +160,25 @@ let je = class {
|
|
|
160
160
|
getContentRef() {
|
|
161
161
|
return this._docContainer.getContentRef();
|
|
162
162
|
}
|
|
163
|
-
UIDidMount(
|
|
163
|
+
UIDidMount(r) {
|
|
164
164
|
if (this._docContainer)
|
|
165
|
-
return
|
|
165
|
+
return r(this._docContainer);
|
|
166
166
|
}
|
|
167
167
|
getDocContainer() {
|
|
168
168
|
return this._docContainer;
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
],
|
|
175
|
-
var
|
|
176
|
-
for (var
|
|
177
|
-
(o =
|
|
178
|
-
return n &&
|
|
179
|
-
},
|
|
180
|
-
let
|
|
181
|
-
constructor(e, t, n,
|
|
171
|
+
He = sr([
|
|
172
|
+
gt(1, C(Ge)),
|
|
173
|
+
gt(2, C(De))
|
|
174
|
+
], He);
|
|
175
|
+
var ar = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, lr = (r, e, t, n) => {
|
|
176
|
+
for (var i = n > 1 ? void 0 : n ? cr(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
177
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
178
|
+
return n && i && ar(e, t, i), i;
|
|
179
|
+
}, _e = (r, e) => (t, n) => e(t, n, r);
|
|
180
|
+
let se = class extends ce {
|
|
181
|
+
constructor(e, t, n, i, s) {
|
|
182
182
|
super();
|
|
183
183
|
S(this, "_docContainerController");
|
|
184
184
|
/**
|
|
@@ -191,7 +191,7 @@ let ie = class extends ce {
|
|
|
191
191
|
S(this, "changeLocale", (e) => {
|
|
192
192
|
this._localeService.setLocale(e);
|
|
193
193
|
});
|
|
194
|
-
this._localeService = t, this._injector = n, this._textSelectionRenderManager =
|
|
194
|
+
this._localeService = t, this._injector = n, this._textSelectionRenderManager = i, this._layoutService = s, this._docContainerController = this._injector.createInstance(He, e), this._registerContainer();
|
|
195
195
|
}
|
|
196
196
|
_registerContainer() {
|
|
197
197
|
this._layoutService && this.disposeWithMe(
|
|
@@ -203,14 +203,14 @@ let ie = class extends ce {
|
|
|
203
203
|
return this._docContainerController;
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
],
|
|
212
|
-
const
|
|
213
|
-
var
|
|
206
|
+
se = lr([
|
|
207
|
+
_e(1, C(Ge)),
|
|
208
|
+
_e(2, C(De)),
|
|
209
|
+
_e(3, de),
|
|
210
|
+
_e(4, Xt(Rt))
|
|
211
|
+
], se);
|
|
212
|
+
const Ne = "UI_PLUGIN_DOCS", Mt = `${Ne}_COLOR_PICKER_COMPONENT`, yt = `${Ne}_FONT_FAMILY_COMPONENT`, Et = `${Ne}_FONT_FAMILY_ITEM_COMPONENT`, xt = `${Ne}_FONT_SIZE_COMPONENT`;
|
|
213
|
+
var Dt = { exports: {} }, $e = {};
|
|
214
214
|
/**
|
|
215
215
|
* @license React
|
|
216
216
|
* react-jsx-runtime.production.min.js
|
|
@@ -220,377 +220,503 @@ var It = { exports: {} }, Le = {};
|
|
|
220
220
|
* This source code is licensed under the MIT license found in the
|
|
221
221
|
* LICENSE file in the root directory of this source tree.
|
|
222
222
|
*/
|
|
223
|
-
var
|
|
224
|
-
function
|
|
225
|
-
var n,
|
|
223
|
+
var dr = Wn, ur = Symbol.for("react.element"), hr = Symbol.for("react.fragment"), gr = Object.prototype.hasOwnProperty, _r = dr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, pr = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
224
|
+
function Pt(r, e, t) {
|
|
225
|
+
var n, i = {}, s = null, o = null;
|
|
226
226
|
t !== void 0 && (s = "" + t), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
|
|
227
227
|
for (n in e)
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
for (n in e =
|
|
231
|
-
|
|
232
|
-
return { $$typeof:
|
|
228
|
+
gr.call(e, n) && !pr.hasOwnProperty(n) && (i[n] = e[n]);
|
|
229
|
+
if (r && r.defaultProps)
|
|
230
|
+
for (n in e = r.defaultProps, e)
|
|
231
|
+
i[n] === void 0 && (i[n] = e[n]);
|
|
232
|
+
return { $$typeof: ur, type: r, key: s, ref: o, props: i, _owner: _r.current };
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
const
|
|
240
|
-
docsUiCanvasBackground:
|
|
241
|
-
},
|
|
242
|
-
function
|
|
243
|
-
const e =
|
|
234
|
+
$e.Fragment = hr;
|
|
235
|
+
$e.jsx = Pt;
|
|
236
|
+
$e.jsxs = Pt;
|
|
237
|
+
Dt.exports = $e;
|
|
238
|
+
var fr = Dt.exports;
|
|
239
|
+
const Sr = "univer-docs-ui-canvas-background", mr = {
|
|
240
|
+
docsUiCanvasBackground: Sr
|
|
241
|
+
}, vr = () => /* @__PURE__ */ fr.jsx("div", { className: mr.docsUiCanvasBackground });
|
|
242
|
+
function Cr(r) {
|
|
243
|
+
const e = r.get(m);
|
|
244
244
|
return {
|
|
245
|
-
id:
|
|
246
|
-
group:
|
|
247
|
-
type:
|
|
245
|
+
id: hn.id,
|
|
246
|
+
group: T.TOOLBAR_FORMAT,
|
|
247
|
+
type: b.BUTTON,
|
|
248
248
|
icon: "BoldSingle",
|
|
249
249
|
title: "Set bold",
|
|
250
250
|
tooltip: "toolbar.bold",
|
|
251
|
-
positions: [
|
|
252
|
-
activated$: new
|
|
253
|
-
const n = e.onCommandExecuted((
|
|
251
|
+
positions: [I.TOOLBAR_START],
|
|
252
|
+
activated$: new E((t) => {
|
|
253
|
+
const n = e.onCommandExecuted((i) => {
|
|
254
254
|
var o;
|
|
255
|
-
const s =
|
|
256
|
-
if (s ===
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
255
|
+
const s = i.id;
|
|
256
|
+
if (s === U.id || s === ee.id) {
|
|
257
|
+
const a = V(r);
|
|
258
|
+
if (a == null)
|
|
259
259
|
return;
|
|
260
|
-
const
|
|
261
|
-
t.next(
|
|
260
|
+
const c = (o = a.ts) == null ? void 0 : o.bl;
|
|
261
|
+
t.next(c === v.TRUE);
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
264
|
return t.next(!1), n.dispose;
|
|
265
265
|
}),
|
|
266
|
-
hidden$:
|
|
266
|
+
hidden$: M(r, R.DOC)
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const e =
|
|
269
|
+
function Or(r) {
|
|
270
|
+
const e = r.get(m);
|
|
271
271
|
return {
|
|
272
|
-
id:
|
|
273
|
-
group:
|
|
274
|
-
type:
|
|
272
|
+
id: gn.id,
|
|
273
|
+
group: T.TOOLBAR_FORMAT,
|
|
274
|
+
type: b.BUTTON,
|
|
275
275
|
icon: "ItalicSingle",
|
|
276
276
|
title: "Set italic",
|
|
277
277
|
tooltip: "toolbar.italic",
|
|
278
|
-
positions: [
|
|
279
|
-
activated$: new
|
|
280
|
-
const n = e.onCommandExecuted((
|
|
278
|
+
positions: [I.TOOLBAR_START],
|
|
279
|
+
activated$: new E((t) => {
|
|
280
|
+
const n = e.onCommandExecuted((i) => {
|
|
281
281
|
var o;
|
|
282
|
-
const s =
|
|
283
|
-
if (s ===
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
282
|
+
const s = i.id;
|
|
283
|
+
if (s === U.id || s === ee.id) {
|
|
284
|
+
const a = V(r);
|
|
285
|
+
if (a == null)
|
|
286
286
|
return;
|
|
287
|
-
const
|
|
288
|
-
t.next(
|
|
287
|
+
const c = (o = a.ts) == null ? void 0 : o.it;
|
|
288
|
+
t.next(c === v.TRUE);
|
|
289
289
|
}
|
|
290
290
|
});
|
|
291
291
|
return t.next(!1), n.dispose;
|
|
292
292
|
}),
|
|
293
|
-
hidden$:
|
|
293
|
+
hidden$: M(r, R.DOC)
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const e =
|
|
296
|
+
function Rr(r) {
|
|
297
|
+
const e = r.get(m);
|
|
298
298
|
return {
|
|
299
|
-
id:
|
|
300
|
-
group:
|
|
301
|
-
type:
|
|
299
|
+
id: _n.id,
|
|
300
|
+
group: T.TOOLBAR_FORMAT,
|
|
301
|
+
type: b.BUTTON,
|
|
302
302
|
icon: "UnderlineSingle",
|
|
303
303
|
title: "Set underline",
|
|
304
304
|
tooltip: "toolbar.underline",
|
|
305
|
-
positions: [
|
|
306
|
-
activated$: new
|
|
307
|
-
const n = e.onCommandExecuted((
|
|
305
|
+
positions: [I.TOOLBAR_START],
|
|
306
|
+
activated$: new E((t) => {
|
|
307
|
+
const n = e.onCommandExecuted((i) => {
|
|
308
308
|
var o;
|
|
309
|
-
const s =
|
|
310
|
-
if (s ===
|
|
311
|
-
const
|
|
312
|
-
if (
|
|
309
|
+
const s = i.id;
|
|
310
|
+
if (s === U.id || s === ee.id) {
|
|
311
|
+
const a = V(r);
|
|
312
|
+
if (a == null)
|
|
313
313
|
return;
|
|
314
|
-
const
|
|
315
|
-
t.next((
|
|
314
|
+
const c = (o = a.ts) == null ? void 0 : o.ul;
|
|
315
|
+
t.next((c == null ? void 0 : c.s) === v.TRUE);
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
318
|
return t.next(!1), n.dispose;
|
|
319
319
|
}),
|
|
320
|
-
hidden$:
|
|
320
|
+
hidden$: M(r, R.DOC)
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
const e =
|
|
323
|
+
function Tr(r) {
|
|
324
|
+
const e = r.get(m);
|
|
325
325
|
return {
|
|
326
|
-
id:
|
|
327
|
-
group:
|
|
328
|
-
type:
|
|
326
|
+
id: pn.id,
|
|
327
|
+
group: T.TOOLBAR_FORMAT,
|
|
328
|
+
type: b.BUTTON,
|
|
329
329
|
icon: "StrikethroughSingle",
|
|
330
330
|
title: "Set strike through",
|
|
331
331
|
tooltip: "toolbar.strikethrough",
|
|
332
|
-
positions: [
|
|
333
|
-
activated$: new
|
|
334
|
-
const n = e.onCommandExecuted((
|
|
332
|
+
positions: [I.TOOLBAR_START],
|
|
333
|
+
activated$: new E((t) => {
|
|
334
|
+
const n = e.onCommandExecuted((i) => {
|
|
335
335
|
var o;
|
|
336
|
-
const s =
|
|
337
|
-
if (s ===
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
336
|
+
const s = i.id;
|
|
337
|
+
if (s === U.id || s === ee.id) {
|
|
338
|
+
const a = V(r);
|
|
339
|
+
if (a == null)
|
|
340
340
|
return;
|
|
341
|
-
const
|
|
342
|
-
t.next((
|
|
341
|
+
const c = (o = a.ts) == null ? void 0 : o.st;
|
|
342
|
+
t.next((c == null ? void 0 : c.s) === v.TRUE);
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
return t.next(!1), n.dispose;
|
|
346
346
|
}),
|
|
347
|
-
hidden$:
|
|
347
|
+
hidden$: M(r, R.DOC)
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
const e =
|
|
350
|
+
function br(r) {
|
|
351
|
+
const e = r.get(m);
|
|
352
352
|
return {
|
|
353
|
-
id:
|
|
354
|
-
group:
|
|
355
|
-
type:
|
|
353
|
+
id: fn.id,
|
|
354
|
+
group: T.TOOLBAR_FORMAT,
|
|
355
|
+
type: b.BUTTON,
|
|
356
356
|
icon: "SubscriptSingle",
|
|
357
357
|
tooltip: "toolbar.subscript",
|
|
358
|
-
positions: [
|
|
359
|
-
activated$: new
|
|
360
|
-
const n = e.onCommandExecuted((
|
|
358
|
+
positions: [I.TOOLBAR_START],
|
|
359
|
+
activated$: new E((t) => {
|
|
360
|
+
const n = e.onCommandExecuted((i) => {
|
|
361
361
|
var o;
|
|
362
|
-
const s =
|
|
363
|
-
if (s ===
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
362
|
+
const s = i.id;
|
|
363
|
+
if (s === U.id || s === ee.id) {
|
|
364
|
+
const a = V(r);
|
|
365
|
+
if (a == null)
|
|
366
366
|
return;
|
|
367
|
-
const
|
|
368
|
-
t.next(
|
|
367
|
+
const c = (o = a.ts) == null ? void 0 : o.va;
|
|
368
|
+
t.next(c === J.SUBSCRIPT);
|
|
369
369
|
}
|
|
370
370
|
});
|
|
371
371
|
return t.next(!1), n.dispose;
|
|
372
372
|
}),
|
|
373
|
-
hidden$:
|
|
373
|
+
hidden$: M(r, R.DOC)
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
const e =
|
|
376
|
+
function Ir(r) {
|
|
377
|
+
const e = r.get(m);
|
|
378
378
|
return {
|
|
379
|
-
id:
|
|
380
|
-
group:
|
|
381
|
-
type:
|
|
379
|
+
id: Sn.id,
|
|
380
|
+
group: T.TOOLBAR_FORMAT,
|
|
381
|
+
type: b.BUTTON,
|
|
382
382
|
icon: "SuperscriptSingle",
|
|
383
383
|
tooltip: "toolbar.superscript",
|
|
384
|
-
positions: [
|
|
385
|
-
activated$: new
|
|
386
|
-
const n = e.onCommandExecuted((
|
|
384
|
+
positions: [I.TOOLBAR_START],
|
|
385
|
+
activated$: new E((t) => {
|
|
386
|
+
const n = e.onCommandExecuted((i) => {
|
|
387
387
|
var o;
|
|
388
|
-
const s =
|
|
389
|
-
if (s ===
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
388
|
+
const s = i.id;
|
|
389
|
+
if (s === U.id || s === ee.id) {
|
|
390
|
+
const a = V(r);
|
|
391
|
+
if (a == null)
|
|
392
392
|
return;
|
|
393
|
-
const
|
|
394
|
-
t.next(
|
|
393
|
+
const c = (o = a.ts) == null ? void 0 : o.va;
|
|
394
|
+
t.next(c === J.SUPERSCRIPT);
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
return t.next(!1), n.dispose;
|
|
398
398
|
}),
|
|
399
|
-
hidden$:
|
|
399
|
+
hidden$: M(r, R.DOC)
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
const e =
|
|
402
|
+
function Mr(r) {
|
|
403
|
+
const e = r.get(m);
|
|
404
404
|
return {
|
|
405
|
-
id:
|
|
405
|
+
id: it.id,
|
|
406
406
|
tooltip: "toolbar.font",
|
|
407
|
-
group:
|
|
408
|
-
type:
|
|
409
|
-
label:
|
|
410
|
-
positions: [
|
|
411
|
-
selections:
|
|
407
|
+
group: T.TOOLBAR_FORMAT,
|
|
408
|
+
type: b.SELECTOR,
|
|
409
|
+
label: yt,
|
|
410
|
+
positions: [I.TOOLBAR_START],
|
|
411
|
+
selections: rt.map((t) => ({
|
|
412
412
|
label: {
|
|
413
|
-
name:
|
|
413
|
+
name: Et,
|
|
414
414
|
hoverable: !0
|
|
415
415
|
},
|
|
416
416
|
value: t.value
|
|
417
417
|
})),
|
|
418
418
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
419
|
-
value$: new
|
|
420
|
-
const n =
|
|
421
|
-
var
|
|
419
|
+
value$: new E((t) => {
|
|
420
|
+
const n = rt[0].value, i = e.onCommandExecuted((s) => {
|
|
421
|
+
var a;
|
|
422
422
|
const o = s.id;
|
|
423
|
-
if (o ===
|
|
424
|
-
const
|
|
425
|
-
if (
|
|
423
|
+
if (o === U.id || o === it.id) {
|
|
424
|
+
const c = V(r);
|
|
425
|
+
if (c == null)
|
|
426
426
|
return;
|
|
427
|
-
const d = (
|
|
427
|
+
const d = (a = c.ts) == null ? void 0 : a.ff;
|
|
428
428
|
t.next(d != null ? d : n);
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
|
-
return t.next(n),
|
|
431
|
+
return t.next(n), i.dispose;
|
|
432
432
|
}),
|
|
433
|
-
hidden$:
|
|
433
|
+
hidden$: M(r, R.DOC)
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
|
-
function
|
|
437
|
-
const e =
|
|
436
|
+
function yr(r) {
|
|
437
|
+
const e = r.get(m);
|
|
438
438
|
return {
|
|
439
|
-
id:
|
|
440
|
-
group:
|
|
441
|
-
type:
|
|
439
|
+
id: ot.id,
|
|
440
|
+
group: T.TOOLBAR_FORMAT,
|
|
441
|
+
type: b.SELECTOR,
|
|
442
442
|
tooltip: "toolbar.fontSize",
|
|
443
443
|
label: {
|
|
444
|
-
name:
|
|
444
|
+
name: xt,
|
|
445
445
|
props: {
|
|
446
446
|
min: 1,
|
|
447
447
|
max: 400
|
|
448
448
|
// disabled$,
|
|
449
449
|
}
|
|
450
450
|
},
|
|
451
|
-
positions: [
|
|
452
|
-
selections:
|
|
451
|
+
positions: [I.TOOLBAR_START],
|
|
452
|
+
selections: Zt,
|
|
453
453
|
// disabled$,
|
|
454
|
-
value$: new
|
|
455
|
-
const
|
|
456
|
-
var
|
|
454
|
+
value$: new E((t) => {
|
|
455
|
+
const i = e.onCommandExecuted((s) => {
|
|
456
|
+
var a;
|
|
457
457
|
const o = s.id;
|
|
458
|
-
if (o ===
|
|
459
|
-
const
|
|
460
|
-
if (
|
|
458
|
+
if (o === U.id || o === ot.id) {
|
|
459
|
+
const c = V(r);
|
|
460
|
+
if (c == null)
|
|
461
461
|
return;
|
|
462
|
-
const d = (
|
|
462
|
+
const d = (a = c.ts) == null ? void 0 : a.fs;
|
|
463
463
|
t.next(d != null ? d : 14);
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
|
-
return t.next(14),
|
|
466
|
+
return t.next(14), i.dispose;
|
|
467
467
|
}),
|
|
468
|
-
hidden$:
|
|
468
|
+
hidden$: M(r, R.DOC)
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
const e =
|
|
471
|
+
function Er(r) {
|
|
472
|
+
const e = r.get(m), t = r.get(Bt);
|
|
473
473
|
return {
|
|
474
|
-
id:
|
|
474
|
+
id: st.id,
|
|
475
475
|
icon: "FontColor",
|
|
476
476
|
tooltip: "toolbar.textColor.main",
|
|
477
|
-
group:
|
|
478
|
-
type:
|
|
479
|
-
positions: [
|
|
477
|
+
group: T.TOOLBAR_FORMAT,
|
|
478
|
+
type: b.BUTTON_SELECTOR,
|
|
479
|
+
positions: [I.TOOLBAR_START],
|
|
480
480
|
selections: [
|
|
481
481
|
{
|
|
482
482
|
label: {
|
|
483
|
-
name:
|
|
483
|
+
name: Mt,
|
|
484
484
|
hoverable: !1
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
],
|
|
488
|
-
value$: new
|
|
489
|
-
const
|
|
490
|
-
if (o.id ===
|
|
491
|
-
const
|
|
492
|
-
n.next(
|
|
488
|
+
value$: new E((n) => {
|
|
489
|
+
const i = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
|
|
490
|
+
if (o.id === st.id) {
|
|
491
|
+
const a = o.params.value;
|
|
492
|
+
n.next(a != null ? a : i);
|
|
493
493
|
}
|
|
494
494
|
});
|
|
495
|
-
return n.next(
|
|
495
|
+
return n.next(i), s.dispose;
|
|
496
496
|
}),
|
|
497
|
-
hidden$:
|
|
497
|
+
hidden$: M(r, R.DOC)
|
|
498
498
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function xr(r) {
|
|
502
|
+
const e = r.get(m);
|
|
502
503
|
return {
|
|
503
|
-
id:
|
|
504
|
-
group:
|
|
505
|
-
type:
|
|
504
|
+
id: mn.id,
|
|
505
|
+
group: T.TOOLBAR_LAYOUT,
|
|
506
|
+
type: b.BUTTON,
|
|
507
|
+
icon: "LeftJustifyingSingle",
|
|
508
|
+
tooltip: "toolbar.alignLeft",
|
|
509
|
+
positions: [I.TOOLBAR_START],
|
|
510
|
+
activated$: new E((t) => {
|
|
511
|
+
const n = e.onCommandExecuted((i) => {
|
|
512
|
+
var o;
|
|
513
|
+
const s = i.id;
|
|
514
|
+
if (s === U.id || s === Le.id) {
|
|
515
|
+
const a = we(r);
|
|
516
|
+
if (a == null)
|
|
517
|
+
return;
|
|
518
|
+
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
519
|
+
t.next(c === xe.LEFT);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
return t.next(!1), n.dispose;
|
|
523
|
+
}),
|
|
524
|
+
hidden$: M(r, R.DOC)
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function Dr(r) {
|
|
528
|
+
const e = r.get(m);
|
|
529
|
+
return {
|
|
530
|
+
id: vn.id,
|
|
531
|
+
group: T.TOOLBAR_LAYOUT,
|
|
532
|
+
type: b.BUTTON,
|
|
533
|
+
icon: "HorizontallySingle",
|
|
534
|
+
tooltip: "toolbar.alignCenter",
|
|
535
|
+
positions: [I.TOOLBAR_START],
|
|
536
|
+
activated$: new E((t) => {
|
|
537
|
+
const n = e.onCommandExecuted((i) => {
|
|
538
|
+
var o;
|
|
539
|
+
const s = i.id;
|
|
540
|
+
if (s === U.id || s === Le.id) {
|
|
541
|
+
const a = we(r);
|
|
542
|
+
if (a == null)
|
|
543
|
+
return;
|
|
544
|
+
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
545
|
+
t.next(c === xe.CENTER);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
return t.next(!1), n.dispose;
|
|
549
|
+
}),
|
|
550
|
+
hidden$: M(r, R.DOC)
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function Pr(r) {
|
|
554
|
+
const e = r.get(m);
|
|
555
|
+
return {
|
|
556
|
+
id: Cn.id,
|
|
557
|
+
group: T.TOOLBAR_LAYOUT,
|
|
558
|
+
type: b.BUTTON,
|
|
559
|
+
icon: "RightJustifyingSingle",
|
|
560
|
+
tooltip: "toolbar.alignRight",
|
|
561
|
+
positions: [I.TOOLBAR_START],
|
|
562
|
+
activated$: new E((t) => {
|
|
563
|
+
const n = e.onCommandExecuted((i) => {
|
|
564
|
+
var o;
|
|
565
|
+
const s = i.id;
|
|
566
|
+
if (s === U.id || s === Le.id) {
|
|
567
|
+
const a = we(r);
|
|
568
|
+
if (a == null)
|
|
569
|
+
return;
|
|
570
|
+
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
571
|
+
t.next(c === xe.RIGHT);
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
return t.next(!1), n.dispose;
|
|
575
|
+
}),
|
|
576
|
+
hidden$: M(r, R.DOC)
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
function Ur(r) {
|
|
580
|
+
const e = r.get(m);
|
|
581
|
+
return {
|
|
582
|
+
id: On.id,
|
|
583
|
+
group: T.TOOLBAR_LAYOUT,
|
|
584
|
+
type: b.BUTTON,
|
|
585
|
+
icon: "AlignTextBothSingle",
|
|
586
|
+
tooltip: "toolbar.alignJustify",
|
|
587
|
+
positions: [I.TOOLBAR_START],
|
|
588
|
+
activated$: new E((t) => {
|
|
589
|
+
const n = e.onCommandExecuted((i) => {
|
|
590
|
+
var o;
|
|
591
|
+
const s = i.id;
|
|
592
|
+
if (s === U.id || s === Le.id) {
|
|
593
|
+
const a = we(r);
|
|
594
|
+
if (a == null)
|
|
595
|
+
return;
|
|
596
|
+
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
597
|
+
t.next(c === xe.JUSTIFIED);
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
return t.next(!1), n.dispose;
|
|
601
|
+
}),
|
|
602
|
+
hidden$: M(r, R.DOC)
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
function Lr(r) {
|
|
606
|
+
return {
|
|
607
|
+
id: Rn.id,
|
|
608
|
+
group: T.TOOLBAR_LAYOUT,
|
|
609
|
+
type: b.BUTTON,
|
|
506
610
|
icon: "OrderSingle",
|
|
507
611
|
tooltip: "toolbar.order",
|
|
508
|
-
positions: [
|
|
509
|
-
hidden$:
|
|
612
|
+
positions: [I.TOOLBAR_START],
|
|
613
|
+
hidden$: M(r, R.DOC)
|
|
510
614
|
};
|
|
511
615
|
}
|
|
512
|
-
function
|
|
616
|
+
function Ar(r) {
|
|
513
617
|
return {
|
|
514
|
-
id:
|
|
515
|
-
group:
|
|
516
|
-
type:
|
|
618
|
+
id: Tn.id,
|
|
619
|
+
group: T.TOOLBAR_LAYOUT,
|
|
620
|
+
type: b.BUTTON,
|
|
517
621
|
icon: "UnorderSingle",
|
|
518
622
|
tooltip: "toolbar.unorder",
|
|
519
|
-
positions: [
|
|
520
|
-
hidden$:
|
|
623
|
+
positions: [I.TOOLBAR_START],
|
|
624
|
+
hidden$: M(r, R.DOC)
|
|
521
625
|
};
|
|
522
626
|
}
|
|
523
|
-
function
|
|
524
|
-
var
|
|
525
|
-
const e =
|
|
526
|
-
if (n == null ||
|
|
627
|
+
function V(r) {
|
|
628
|
+
var c;
|
|
629
|
+
const e = r.get(D), t = r.get(te), n = e.getCurrentUniverDocInstance(), i = t.getActiveRange();
|
|
630
|
+
if (n == null || i == null)
|
|
527
631
|
return;
|
|
528
|
-
const s = (
|
|
632
|
+
const s = (c = n.getBody()) == null ? void 0 : c.textRuns;
|
|
529
633
|
if (s == null)
|
|
530
634
|
return;
|
|
531
|
-
const { startOffset: o } =
|
|
635
|
+
const { startOffset: o } = i;
|
|
532
636
|
return s.find(({ st: d, ed: u }) => o >= d && o < u);
|
|
533
637
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
638
|
+
function we(r) {
|
|
639
|
+
var c;
|
|
640
|
+
const e = r.get(D), t = r.get(te), n = e.getCurrentUniverDocInstance(), i = t.getActiveRange();
|
|
641
|
+
if (n == null || i == null)
|
|
642
|
+
return;
|
|
643
|
+
const s = (c = n.getBody()) == null ? void 0 : c.paragraphs;
|
|
644
|
+
if (s == null)
|
|
645
|
+
return;
|
|
646
|
+
const { startOffset: o } = i;
|
|
647
|
+
let a = -1;
|
|
648
|
+
for (const d of s) {
|
|
649
|
+
const { startIndex: u } = d;
|
|
650
|
+
if (o > a && o <= u)
|
|
651
|
+
return d;
|
|
652
|
+
a = u;
|
|
653
|
+
}
|
|
654
|
+
return null;
|
|
655
|
+
}
|
|
656
|
+
var Nr = Object.defineProperty, $r = Object.getOwnPropertyDescriptor, wr = (r, e, t, n) => {
|
|
657
|
+
for (var i = n > 1 ? void 0 : n ? $r(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
658
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
659
|
+
return n && i && Nr(e, t, i), i;
|
|
660
|
+
}, k = (r, e) => (t, n) => e(t, n, r);
|
|
661
|
+
let Se = class extends Y {
|
|
662
|
+
constructor(r, e, t, n, i, s, o) {
|
|
663
|
+
super(), this._injector = r, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = i, this._uiController = s, this._currentUniverService = o, this._init();
|
|
542
664
|
}
|
|
543
665
|
_initCustomComponents() {
|
|
544
|
-
const
|
|
545
|
-
this.disposeWithMe(
|
|
666
|
+
const r = this._componentManager;
|
|
667
|
+
this.disposeWithMe(r.register(Mt, Vn)), this.disposeWithMe(r.register(yt, qt)), this.disposeWithMe(r.register(Et, Kt)), this.disposeWithMe(r.register(xt, Jt));
|
|
546
668
|
}
|
|
547
669
|
_initMenus() {
|
|
548
670
|
[
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
671
|
+
Cr,
|
|
672
|
+
Or,
|
|
673
|
+
Rr,
|
|
674
|
+
Tr,
|
|
675
|
+
br,
|
|
676
|
+
Ir,
|
|
677
|
+
yr,
|
|
678
|
+
Mr,
|
|
679
|
+
Er,
|
|
680
|
+
xr,
|
|
681
|
+
Dr,
|
|
682
|
+
Pr,
|
|
683
|
+
Ur,
|
|
684
|
+
Lr,
|
|
685
|
+
Ar
|
|
686
|
+
].forEach((r) => {
|
|
687
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(r)));
|
|
562
688
|
});
|
|
563
689
|
}
|
|
564
690
|
_init() {
|
|
565
|
-
this._initCustomComponents(), this._initMenus(), this._initDocBackground();
|
|
691
|
+
this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
|
|
566
692
|
}
|
|
567
693
|
_initDocBackground() {
|
|
568
|
-
const
|
|
569
|
-
if (
|
|
694
|
+
const r = this._currentUniverService.getAllUniverDocsInstance()[0].getUnitId();
|
|
695
|
+
if (r == null)
|
|
570
696
|
return;
|
|
571
|
-
this._editorService.isEditor(
|
|
572
|
-
this._uiController.
|
|
697
|
+
this._editorService.isEditor(r) || this.disposeWithMe(
|
|
698
|
+
this._uiController.registerComponent(Qt.CONTENT, () => Un(vr, this._injector))
|
|
573
699
|
);
|
|
574
700
|
}
|
|
575
701
|
_initFocusHandler() {
|
|
576
702
|
this.disposeWithMe(
|
|
577
|
-
this._layoutService.registerFocusHandler(
|
|
703
|
+
this._layoutService.registerFocusHandler(R.DOC, () => {
|
|
578
704
|
this._injector.get(de).focus();
|
|
579
705
|
})
|
|
580
706
|
);
|
|
581
707
|
}
|
|
582
708
|
};
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
],
|
|
593
|
-
const
|
|
709
|
+
Se = wr([
|
|
710
|
+
L(A.Rendered, Se),
|
|
711
|
+
k(0, C(De)),
|
|
712
|
+
k(1, C(en)),
|
|
713
|
+
k(2, Rt),
|
|
714
|
+
k(3, N),
|
|
715
|
+
k(4, tn),
|
|
716
|
+
k(5, nn),
|
|
717
|
+
k(6, D)
|
|
718
|
+
], Se);
|
|
719
|
+
const Br = {
|
|
594
720
|
toolbar: {
|
|
595
721
|
undo: "Undo",
|
|
596
722
|
redo: "Redo",
|
|
@@ -608,9 +734,13 @@ const xi = {
|
|
|
608
734
|
},
|
|
609
735
|
resetColor: "Reset",
|
|
610
736
|
order: "Ordered list",
|
|
611
|
-
unorder: "Unordered list"
|
|
737
|
+
unorder: "Unordered list",
|
|
738
|
+
alignLeft: "Align Left",
|
|
739
|
+
alignCenter: "Align Center",
|
|
740
|
+
alignRight: "Align Right",
|
|
741
|
+
alignJustify: "Justify"
|
|
612
742
|
}
|
|
613
|
-
},
|
|
743
|
+
}, Ji = Br, Fr = {
|
|
614
744
|
toolbar: {
|
|
615
745
|
undo: "撤销",
|
|
616
746
|
redo: "重做",
|
|
@@ -628,31 +758,35 @@ const xi = {
|
|
|
628
758
|
},
|
|
629
759
|
resetColor: "重置颜色",
|
|
630
760
|
order: "有序列表",
|
|
631
|
-
unorder: "无序列表"
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
},
|
|
638
|
-
id:
|
|
639
|
-
preconditions:
|
|
640
|
-
binding:
|
|
641
|
-
},
|
|
642
|
-
id:
|
|
643
|
-
preconditions:
|
|
644
|
-
binding:
|
|
645
|
-
},
|
|
646
|
-
|
|
647
|
-
|
|
761
|
+
unorder: "无序列表",
|
|
762
|
+
alignLeft: "左对齐",
|
|
763
|
+
alignCenter: "居中对齐",
|
|
764
|
+
alignRight: "右对齐",
|
|
765
|
+
alignJustify: "两端对齐"
|
|
766
|
+
}
|
|
767
|
+
}, jr = Fr, Wr = {
|
|
768
|
+
id: bn.id,
|
|
769
|
+
preconditions: Gn,
|
|
770
|
+
binding: P.ENTER
|
|
771
|
+
}, zr = {
|
|
772
|
+
id: In.id,
|
|
773
|
+
preconditions: $,
|
|
774
|
+
binding: P.BACKSPACE
|
|
775
|
+
}, Vr = {
|
|
776
|
+
id: Mn.id,
|
|
777
|
+
preconditions: $,
|
|
778
|
+
binding: P.DELETE
|
|
779
|
+
}, kr = 10, Hr = 6;
|
|
780
|
+
function Yr() {
|
|
781
|
+
return Ze.generateRandomId(Hr);
|
|
648
782
|
}
|
|
649
|
-
function
|
|
650
|
-
const e =
|
|
783
|
+
function Xr(r) {
|
|
784
|
+
const e = r.match(/data-copy-id="([^\s]+)"/);
|
|
651
785
|
return e && e[1] ? e[1] : null;
|
|
652
786
|
}
|
|
653
|
-
class
|
|
787
|
+
class Gr {
|
|
654
788
|
constructor() {
|
|
655
|
-
S(this, "_cache", new
|
|
789
|
+
S(this, "_cache", new Ft(kr));
|
|
656
790
|
}
|
|
657
791
|
set(e, t) {
|
|
658
792
|
this._cache.set(e, t);
|
|
@@ -664,79 +798,79 @@ class Er {
|
|
|
664
798
|
this._cache.clear();
|
|
665
799
|
}
|
|
666
800
|
}
|
|
667
|
-
const
|
|
668
|
-
function
|
|
669
|
-
const e =
|
|
801
|
+
const _t = new Gr();
|
|
802
|
+
function et(r) {
|
|
803
|
+
const e = r.style, t = {}, n = r.tagName.toLowerCase();
|
|
670
804
|
switch (n) {
|
|
671
805
|
case "b":
|
|
672
806
|
case "em":
|
|
673
807
|
case "strong": {
|
|
674
|
-
t.bl =
|
|
808
|
+
t.bl = v.TRUE;
|
|
675
809
|
break;
|
|
676
810
|
}
|
|
677
811
|
case "s": {
|
|
678
812
|
t.st = {
|
|
679
|
-
s:
|
|
813
|
+
s: v.TRUE
|
|
680
814
|
};
|
|
681
815
|
break;
|
|
682
816
|
}
|
|
683
817
|
case "u": {
|
|
684
818
|
t.ul = {
|
|
685
|
-
s:
|
|
819
|
+
s: v.TRUE
|
|
686
820
|
};
|
|
687
821
|
break;
|
|
688
822
|
}
|
|
689
823
|
case "i": {
|
|
690
|
-
t.it =
|
|
824
|
+
t.it = v.TRUE;
|
|
691
825
|
break;
|
|
692
826
|
}
|
|
693
827
|
case "sub":
|
|
694
828
|
case "sup": {
|
|
695
|
-
t.va = n === "sup" ?
|
|
829
|
+
t.va = n === "sup" ? J.SUPERSCRIPT : J.SUBSCRIPT;
|
|
696
830
|
break;
|
|
697
831
|
}
|
|
698
832
|
}
|
|
699
|
-
for (let
|
|
700
|
-
const s = e[
|
|
833
|
+
for (let i = 0; i < e.length; i++) {
|
|
834
|
+
const s = e[i], o = e.getPropertyValue(s);
|
|
701
835
|
switch (s) {
|
|
702
836
|
case "font-family": {
|
|
703
837
|
t.ff = o;
|
|
704
838
|
break;
|
|
705
839
|
}
|
|
706
840
|
case "font-size": {
|
|
707
|
-
const
|
|
708
|
-
Number.isNaN(
|
|
841
|
+
const a = Number.parseInt(o);
|
|
842
|
+
Number.isNaN(a) || (o.endsWith("pt") ? t.fs = a : o.endsWith("px") && (t.fs = Ln(a)));
|
|
709
843
|
break;
|
|
710
844
|
}
|
|
711
845
|
case "font-style": {
|
|
712
|
-
o === "italic" && (t.it =
|
|
846
|
+
o === "italic" && (t.it = v.TRUE);
|
|
713
847
|
break;
|
|
714
848
|
}
|
|
715
849
|
case "font-weight": {
|
|
716
|
-
Number(o) > 400 && (t.bl =
|
|
850
|
+
Number(o) > 400 && (t.bl = v.TRUE);
|
|
717
851
|
break;
|
|
718
852
|
}
|
|
719
853
|
case "text-decoration": {
|
|
720
854
|
/underline/.test(o) ? t.ul = {
|
|
721
|
-
s:
|
|
855
|
+
s: v.TRUE
|
|
722
856
|
} : /overline/.test(o) ? t.ol = {
|
|
723
|
-
s:
|
|
857
|
+
s: v.TRUE
|
|
724
858
|
} : /line-through/.test(o) && (t.st = {
|
|
725
|
-
s:
|
|
859
|
+
s: v.TRUE
|
|
726
860
|
});
|
|
727
861
|
break;
|
|
728
862
|
}
|
|
729
863
|
case "color": {
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
rgb:
|
|
864
|
+
const a = new nt(o);
|
|
865
|
+
a.isValid && (t.cl = {
|
|
866
|
+
rgb: a.toRgbString()
|
|
733
867
|
});
|
|
734
868
|
break;
|
|
735
869
|
}
|
|
736
870
|
case "background-color": {
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
rgb:
|
|
871
|
+
const a = new nt(o);
|
|
872
|
+
a.isValid && (t.bg = {
|
|
873
|
+
rgb: a.toRgbString()
|
|
740
874
|
});
|
|
741
875
|
break;
|
|
742
876
|
}
|
|
@@ -744,15 +878,15 @@ function Ge(i) {
|
|
|
744
878
|
}
|
|
745
879
|
return t;
|
|
746
880
|
}
|
|
747
|
-
function
|
|
748
|
-
const e = new DOMParser(), t = `<x-univer id="univer-root">${
|
|
881
|
+
function Zr(r) {
|
|
882
|
+
const e = new DOMParser(), t = `<x-univer id="univer-root">${r}</x-univer>`;
|
|
749
883
|
return e.parseFromString(t, "text/html").querySelector("#univer-root");
|
|
750
884
|
}
|
|
751
|
-
function
|
|
752
|
-
const t =
|
|
753
|
-
return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(
|
|
885
|
+
function pt(r, e) {
|
|
886
|
+
const t = r.tagName.toLowerCase();
|
|
887
|
+
return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(r);
|
|
754
888
|
}
|
|
755
|
-
const
|
|
889
|
+
const ye = class ye {
|
|
756
890
|
constructor() {
|
|
757
891
|
S(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
758
892
|
S(this, "_styleRules", []);
|
|
@@ -764,51 +898,51 @@ const Me = class Me {
|
|
|
764
898
|
this._pluginList.push(e);
|
|
765
899
|
}
|
|
766
900
|
convert(e) {
|
|
767
|
-
const t =
|
|
901
|
+
const t = ye._pluginList.find((s) => s.checkPasteType(e)), n = Zr(e), i = {
|
|
768
902
|
dataStream: "",
|
|
769
903
|
textRuns: []
|
|
770
904
|
};
|
|
771
|
-
return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, n == null ? void 0 : n.childNodes,
|
|
905
|
+
return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, n == null ? void 0 : n.childNodes, i), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], i;
|
|
772
906
|
}
|
|
773
907
|
_process(e, t, n) {
|
|
774
|
-
var
|
|
908
|
+
var i;
|
|
775
909
|
for (const s of t)
|
|
776
910
|
if (s.nodeType === Node.TEXT_NODE) {
|
|
777
|
-
const o = (
|
|
778
|
-
let
|
|
779
|
-
e && this._styleCache.has(e) && (
|
|
911
|
+
const o = (i = s.nodeValue) == null ? void 0 : i.replace(/[\r\n]/g, "");
|
|
912
|
+
let a;
|
|
913
|
+
e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += o, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
|
|
780
914
|
st: n.dataStream.length - o.length,
|
|
781
915
|
ed: n.dataStream.length,
|
|
782
|
-
ts:
|
|
916
|
+
ts: a
|
|
783
917
|
});
|
|
784
918
|
} else if (s.nodeType === Node.ELEMENT_NODE) {
|
|
785
|
-
const o = e ? this._styleCache.get(e) : {},
|
|
786
|
-
this._styleCache.set(s, { ...o, ...
|
|
919
|
+
const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => pt(s, h)), c = a ? a.getStyle(s) : et(s);
|
|
920
|
+
this._styleCache.set(s, { ...o, ...c });
|
|
787
921
|
const { childNodes: d } = s;
|
|
788
922
|
this._process(s, d, n);
|
|
789
923
|
const u = this._afterProcessRules.find(
|
|
790
|
-
({ filter:
|
|
924
|
+
({ filter: h }) => pt(s, h)
|
|
791
925
|
);
|
|
792
926
|
u && u.handler(n, s);
|
|
793
927
|
}
|
|
794
928
|
}
|
|
795
929
|
};
|
|
796
|
-
S(
|
|
797
|
-
let
|
|
798
|
-
const
|
|
930
|
+
S(ye, "_pluginList", []);
|
|
931
|
+
let Q = ye;
|
|
932
|
+
const qr = {
|
|
799
933
|
name: "univer-doc-paste-plugin-lark",
|
|
800
|
-
checkPasteType(
|
|
801
|
-
return /lark-record-clipboard/i.test(
|
|
934
|
+
checkPasteType(r) {
|
|
935
|
+
return /lark-record-clipboard/i.test(r);
|
|
802
936
|
},
|
|
803
937
|
// TODO: @JOCS, support inline code copy from lark.
|
|
804
938
|
stylesRules: [
|
|
805
939
|
{
|
|
806
940
|
filter: ["s"],
|
|
807
|
-
getStyle(
|
|
808
|
-
const e =
|
|
941
|
+
getStyle(r) {
|
|
942
|
+
const e = et(r);
|
|
809
943
|
return {
|
|
810
944
|
st: {
|
|
811
|
-
s:
|
|
945
|
+
s: v.TRUE
|
|
812
946
|
},
|
|
813
947
|
...e
|
|
814
948
|
};
|
|
@@ -817,111 +951,148 @@ const xr = {
|
|
|
817
951
|
],
|
|
818
952
|
afterProcessRules: [
|
|
819
953
|
{
|
|
820
|
-
filter(
|
|
821
|
-
return
|
|
954
|
+
filter(r) {
|
|
955
|
+
return r.tagName === "DIV" && /ace-line/i.test(r.className);
|
|
822
956
|
},
|
|
823
|
-
handler(
|
|
824
|
-
|
|
825
|
-
startIndex:
|
|
826
|
-
}),
|
|
957
|
+
handler(r) {
|
|
958
|
+
r.paragraphs == null && (r.paragraphs = []), r.paragraphs.push({
|
|
959
|
+
startIndex: r.dataStream.length
|
|
960
|
+
}), r.dataStream += "\r";
|
|
827
961
|
}
|
|
828
962
|
}
|
|
829
963
|
]
|
|
830
|
-
};
|
|
831
|
-
function
|
|
832
|
-
const e =
|
|
964
|
+
}, Kr = qr;
|
|
965
|
+
function Ut(r) {
|
|
966
|
+
const e = r.style, t = {};
|
|
833
967
|
for (let n = 0; n < e.length; n++) {
|
|
834
|
-
const
|
|
835
|
-
switch (
|
|
968
|
+
const i = e[n], s = e.getPropertyValue(i);
|
|
969
|
+
switch (i) {
|
|
836
970
|
case "margin-top": {
|
|
837
971
|
const o = Number.parseInt(s);
|
|
838
|
-
t.spaceAbove = /pt/.test(s) ?
|
|
972
|
+
t.spaceAbove = /pt/.test(s) ? ct(o) : o;
|
|
839
973
|
break;
|
|
840
974
|
}
|
|
841
975
|
case "margin-bottom": {
|
|
842
976
|
const o = Number.parseInt(s);
|
|
843
|
-
t.spaceBelow = /pt/.test(s) ?
|
|
977
|
+
t.spaceBelow = /pt/.test(s) ? ct(o) : o;
|
|
978
|
+
break;
|
|
979
|
+
}
|
|
980
|
+
case "line-height": {
|
|
981
|
+
const o = Number.parseFloat(s);
|
|
982
|
+
t.lineSpacing = o;
|
|
844
983
|
break;
|
|
845
984
|
}
|
|
846
985
|
}
|
|
847
986
|
}
|
|
848
987
|
return Object.getOwnPropertyNames(t).length ? t : null;
|
|
849
988
|
}
|
|
850
|
-
const
|
|
989
|
+
const Jr = {
|
|
851
990
|
name: "univer-doc-paste-plugin-word",
|
|
852
|
-
checkPasteType(
|
|
853
|
-
return /word|mso/i.test(
|
|
991
|
+
checkPasteType(r) {
|
|
992
|
+
return /word|mso/i.test(r);
|
|
854
993
|
},
|
|
855
994
|
stylesRules: [
|
|
856
995
|
{
|
|
857
996
|
filter: ["b"],
|
|
858
|
-
getStyle(
|
|
859
|
-
const e =
|
|
860
|
-
return { bl:
|
|
997
|
+
getStyle(r) {
|
|
998
|
+
const e = et(r);
|
|
999
|
+
return { bl: v.TRUE, ...e };
|
|
861
1000
|
}
|
|
862
1001
|
}
|
|
863
1002
|
],
|
|
864
1003
|
afterProcessRules: [
|
|
865
1004
|
{
|
|
866
|
-
filter(
|
|
867
|
-
return
|
|
1005
|
+
filter(r) {
|
|
1006
|
+
return r.tagName === "P" && /mso/i.test(r.className);
|
|
868
1007
|
},
|
|
869
|
-
handler(
|
|
870
|
-
|
|
1008
|
+
handler(r, e) {
|
|
1009
|
+
r.paragraphs == null && (r.paragraphs = []);
|
|
871
1010
|
const t = {
|
|
872
|
-
startIndex:
|
|
873
|
-
}, n =
|
|
874
|
-
n && (t.paragraphStyle = n),
|
|
1011
|
+
startIndex: r.dataStream.length
|
|
1012
|
+
}, n = Ut(e);
|
|
1013
|
+
n && (t.paragraphStyle = n), r.paragraphs.push(t), r.dataStream += "\r";
|
|
875
1014
|
}
|
|
876
1015
|
}
|
|
877
1016
|
]
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const { spaceAbove: p, spaceBelow: a } = f, h = [];
|
|
896
|
-
p != null && (typeof p == "number" ? h.push(`margin-top: ${p}px`) : h.push(`margin-top: ${p.v}px`)), a != null && (typeof a == "number" ? h.push(`margin-bottom: ${a}px`) : h.push(`margin-bottom: ${a.v}px`)), c.push(
|
|
897
|
-
`<p className="UniverNormal" ${h.length ? `style="${h.join(";")}"` : ""}>${o.join("")}</p>`
|
|
898
|
-
), o.length = 0;
|
|
899
|
-
}
|
|
1017
|
+
}, Qr = Jr, ei = {
|
|
1018
|
+
name: "univer-doc-paste-plugin-univer",
|
|
1019
|
+
checkPasteType(r) {
|
|
1020
|
+
return /UniverNormal/i.test(r);
|
|
1021
|
+
},
|
|
1022
|
+
stylesRules: [],
|
|
1023
|
+
afterProcessRules: [
|
|
1024
|
+
{
|
|
1025
|
+
filter(r) {
|
|
1026
|
+
return r.tagName === "P" && /UniverNormal/i.test(r.className);
|
|
1027
|
+
},
|
|
1028
|
+
handler(r, e) {
|
|
1029
|
+
r.paragraphs == null && (r.paragraphs = []);
|
|
1030
|
+
const t = {
|
|
1031
|
+
startIndex: r.dataStream.length
|
|
1032
|
+
}, n = Ut(e);
|
|
1033
|
+
n && (t.paragraphStyle = n), r.paragraphs.push(t), r.dataStream += "\r";
|
|
900
1034
|
}
|
|
901
|
-
|
|
902
|
-
|
|
1035
|
+
}
|
|
1036
|
+
]
|
|
1037
|
+
}, ti = ei;
|
|
1038
|
+
function ft(r, e) {
|
|
1039
|
+
const { st: t, ed: n, ts: i = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: u, ol: h, bg: p, cl: g, va: f } = i;
|
|
1040
|
+
let l = r.slice(t, n);
|
|
1041
|
+
const _ = [];
|
|
1042
|
+
return a === v.TRUE && (l = `<i>${l}</i>`), f === J.SUPERSCRIPT ? l = `<sup>${l}</sup>` : f === J.SUBSCRIPT && (l = `<sub>${l}</sub>`), (d == null ? void 0 : d.s) === v.TRUE && (l = `<u>${l}</u>`), (u == null ? void 0 : u.s) === v.TRUE && (l = `<s>${l}</s>`), c === v.TRUE && (l = `<strong>${l}</strong>`), s && _.push(`font-family: ${s}`), g && _.push(`color: ${g.rgb}`), o && _.push(`font-size: ${o}pt`), h && _.push("text-decoration: overline"), p && _.push(`background: ${p.rgb}`), _.length ? `<span style="${_.join("; ")};">${l}</span>` : l;
|
|
1043
|
+
}
|
|
1044
|
+
function je(r, e, t) {
|
|
1045
|
+
const { dataStream: n, textRuns: i = [] } = r;
|
|
1046
|
+
let s = e;
|
|
1047
|
+
const o = [];
|
|
1048
|
+
for (const a of i) {
|
|
1049
|
+
const { st: c, ed: d } = a;
|
|
1050
|
+
Ze.hasIntersectionBetweenTwoRanges(e, t, c, d) && (c > s ? (o.push(n.slice(s, c)), o.push(ft(n, {
|
|
1051
|
+
...a,
|
|
1052
|
+
ed: Math.min(d, t)
|
|
1053
|
+
}))) : o.push(ft(n, {
|
|
1054
|
+
...a,
|
|
1055
|
+
st: s,
|
|
1056
|
+
ed: Math.min(d, t)
|
|
1057
|
+
}))), s = Math.max(e, Math.min(d, t));
|
|
1058
|
+
}
|
|
1059
|
+
return s !== t && o.push(n.slice(s, t)), o.join("");
|
|
903
1060
|
}
|
|
904
|
-
|
|
1061
|
+
function St(r, e = !0) {
|
|
1062
|
+
var t;
|
|
1063
|
+
if (e && ((t = r.paragraphs) != null && t.length)) {
|
|
1064
|
+
const { dataStream: n, paragraphs: i = [] } = r;
|
|
1065
|
+
let s = "", o = -1;
|
|
1066
|
+
for (const a of i) {
|
|
1067
|
+
const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: p } = d, g = [];
|
|
1068
|
+
u != null && (typeof u == "number" ? g.push(`margin-top: ${u}px`) : g.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? g.push(`margin-bottom: ${h}px`) : g.push(`margin-bottom: ${h.v}px`)), p != null && g.push(`line-height: ${p}`), c > o + 1 ? s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}>${je(r, o + 1, c)}</p>` : s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}></p>`, o = c;
|
|
1069
|
+
}
|
|
1070
|
+
return o !== n.length && (s += je(r, o, n.length)), s;
|
|
1071
|
+
} else
|
|
1072
|
+
return je(r, 0, r.dataStream.length);
|
|
1073
|
+
}
|
|
1074
|
+
class ni {
|
|
905
1075
|
convert(e) {
|
|
906
1076
|
if (e.length === 0)
|
|
907
1077
|
throw new Error("The bodyList length at least to be 1");
|
|
908
1078
|
if (e.length === 1)
|
|
909
|
-
return
|
|
1079
|
+
return St(e[0]);
|
|
910
1080
|
let t = "";
|
|
911
1081
|
for (const n of e)
|
|
912
|
-
t += '<p className="UniverNormal">', t +=
|
|
1082
|
+
t += '<p className="UniverNormal">', t += St(n, !1), t += "</p>";
|
|
913
1083
|
return t;
|
|
914
1084
|
}
|
|
915
1085
|
}
|
|
916
|
-
var
|
|
917
|
-
for (var
|
|
918
|
-
(o =
|
|
919
|
-
return n &&
|
|
920
|
-
},
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1086
|
+
var ri = Object.defineProperty, ii = Object.getOwnPropertyDescriptor, oi = (r, e, t, n) => {
|
|
1087
|
+
for (var i = n > 1 ? void 0 : n ? ii(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1088
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1089
|
+
return n && i && ri(e, t, i), i;
|
|
1090
|
+
}, re = (r, e) => (t, n) => e(t, n, r);
|
|
1091
|
+
Q.use(Qr);
|
|
1092
|
+
Q.use(Kr);
|
|
1093
|
+
Q.use(ti);
|
|
1094
|
+
function si(r) {
|
|
1095
|
+
const e = r.replace(/\n/g, "\r"), t = [];
|
|
925
1096
|
for (let n = 0; n < e.length; n++)
|
|
926
1097
|
e[n] === "\r" && t.push({ startIndex: n });
|
|
927
1098
|
return {
|
|
@@ -929,14 +1100,14 @@ function Br(i) {
|
|
|
929
1100
|
paragraphs: t
|
|
930
1101
|
};
|
|
931
1102
|
}
|
|
932
|
-
const ue =
|
|
933
|
-
let
|
|
934
|
-
constructor(e, t, n,
|
|
1103
|
+
const ue = Gt("doc.clipboard-service");
|
|
1104
|
+
let Ye = class extends Y {
|
|
1105
|
+
constructor(e, t, n, i, s) {
|
|
935
1106
|
super();
|
|
936
1107
|
S(this, "_clipboardHooks", []);
|
|
937
|
-
S(this, "_htmlToUDM", new
|
|
938
|
-
S(this, "_umdToHtml", new
|
|
939
|
-
this._currentUniverService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService =
|
|
1108
|
+
S(this, "_htmlToUDM", new Q());
|
|
1109
|
+
S(this, "_umdToHtml", new ni());
|
|
1110
|
+
this._currentUniverService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = i, this._textSelectionManagerService = s;
|
|
940
1111
|
}
|
|
941
1112
|
async copy() {
|
|
942
1113
|
const e = this._getDocumentBodyInRanges();
|
|
@@ -966,59 +1137,59 @@ let We = class extends H {
|
|
|
966
1137
|
segmentId: e,
|
|
967
1138
|
endOffset: t,
|
|
968
1139
|
style: n
|
|
969
|
-
} = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {},
|
|
970
|
-
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null ||
|
|
1140
|
+
} = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, i = this._textSelectionManagerService.getSelections();
|
|
1141
|
+
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || i == null)
|
|
971
1142
|
return !1;
|
|
972
1143
|
this.copy();
|
|
973
1144
|
try {
|
|
974
1145
|
let o = t;
|
|
975
|
-
for (const
|
|
976
|
-
const { startOffset: d, endOffset: u } =
|
|
1146
|
+
for (const c of i) {
|
|
1147
|
+
const { startOffset: d, endOffset: u } = c;
|
|
977
1148
|
d == null || u == null || u <= t && (o -= u - d);
|
|
978
1149
|
}
|
|
979
|
-
const
|
|
1150
|
+
const a = [
|
|
980
1151
|
{
|
|
981
1152
|
startOffset: o,
|
|
982
1153
|
endOffset: o,
|
|
983
1154
|
style: n
|
|
984
1155
|
}
|
|
985
1156
|
];
|
|
986
|
-
return this._commandService.executeCommand(
|
|
1157
|
+
return this._commandService.executeCommand(Tt.id, { segmentId: e, textRanges: a });
|
|
987
1158
|
} catch {
|
|
988
1159
|
return this._logService.error("[DocClipboardController] cut content failed"), !1;
|
|
989
1160
|
}
|
|
990
1161
|
}
|
|
991
1162
|
async _paste(e) {
|
|
992
1163
|
var o;
|
|
993
|
-
const { segmentId: t, endOffset: n, style:
|
|
1164
|
+
const { segmentId: t, endOffset: n, style: i } = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, s = this._textSelectionManagerService.getSelections();
|
|
994
1165
|
if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || s == null)
|
|
995
1166
|
return !1;
|
|
996
1167
|
try {
|
|
997
|
-
let
|
|
1168
|
+
let a = n;
|
|
998
1169
|
for (const d of s) {
|
|
999
|
-
const { startOffset: u, endOffset:
|
|
1000
|
-
u == null ||
|
|
1170
|
+
const { startOffset: u, endOffset: h } = d;
|
|
1171
|
+
u == null || h == null || h <= n && (a += e.dataStream.length - (h - u));
|
|
1001
1172
|
}
|
|
1002
|
-
const
|
|
1173
|
+
const c = [
|
|
1003
1174
|
{
|
|
1004
|
-
startOffset:
|
|
1005
|
-
endOffset:
|
|
1006
|
-
style:
|
|
1175
|
+
startOffset: a,
|
|
1176
|
+
endOffset: a,
|
|
1177
|
+
style: i
|
|
1007
1178
|
}
|
|
1008
1179
|
];
|
|
1009
|
-
return this._commandService.executeCommand(
|
|
1180
|
+
return this._commandService.executeCommand(bt.id, { body: e, segmentId: t, textRanges: c });
|
|
1010
1181
|
} catch {
|
|
1011
1182
|
return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
|
|
1012
1183
|
}
|
|
1013
1184
|
}
|
|
1014
1185
|
async _setClipboardData(e) {
|
|
1015
|
-
const t =
|
|
1186
|
+
const t = Yr(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
|
|
1016
1187
|
`) : e[0].dataStream;
|
|
1017
|
-
let
|
|
1018
|
-
return e.length === 1 && (
|
|
1188
|
+
let i = this._umdToHtml.convert(e);
|
|
1189
|
+
return e.length === 1 && (i = i.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), _t.set(t, e[0])), this._clipboardInterfaceService.write(n, i);
|
|
1019
1190
|
}
|
|
1020
1191
|
addClipboardHook(e) {
|
|
1021
|
-
return this._clipboardHooks.push(e),
|
|
1192
|
+
return this._clipboardHooks.push(e), w(() => {
|
|
1022
1193
|
const t = this._clipboardHooks.indexOf(e);
|
|
1023
1194
|
t > -1 && this._clipboardHooks.splice(t, 1);
|
|
1024
1195
|
});
|
|
@@ -1027,21 +1198,21 @@ let We = class extends H {
|
|
|
1027
1198
|
const e = this._textSelectionManagerService.getSelections(), t = this._currentUniverService.getCurrentUniverDocInstance(), n = [];
|
|
1028
1199
|
if (e == null)
|
|
1029
1200
|
return n;
|
|
1030
|
-
for (const
|
|
1031
|
-
const { startOffset: s, endOffset: o, collapsed:
|
|
1032
|
-
if (
|
|
1201
|
+
for (const i of e) {
|
|
1202
|
+
const { startOffset: s, endOffset: o, collapsed: a } = i;
|
|
1203
|
+
if (a || s == null || o == null)
|
|
1033
1204
|
continue;
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1205
|
+
const c = t.sliceBody(s, o);
|
|
1206
|
+
c != null && n.push(c);
|
|
1036
1207
|
}
|
|
1037
1208
|
return n;
|
|
1038
1209
|
}
|
|
1039
1210
|
async _generateBodyFromClipboardItems(e) {
|
|
1040
1211
|
try {
|
|
1041
1212
|
let t = "", n = "";
|
|
1042
|
-
for (const
|
|
1043
|
-
for (const s of
|
|
1044
|
-
s ===
|
|
1213
|
+
for (const i of e)
|
|
1214
|
+
for (const s of i.types)
|
|
1215
|
+
s === rn ? n = await i.getType(s).then((o) => o && o.text()) : s === on && (t = await i.getType(s).then((o) => o && o.text()));
|
|
1045
1216
|
return this._generateBodyFromHtmlAndText(t, n);
|
|
1046
1217
|
} catch (t) {
|
|
1047
1218
|
return Promise.reject(t);
|
|
@@ -1050,98 +1221,98 @@ let We = class extends H {
|
|
|
1050
1221
|
_generateBodyFromHtmlAndText(e, t) {
|
|
1051
1222
|
if (!e) {
|
|
1052
1223
|
if (t)
|
|
1053
|
-
return
|
|
1224
|
+
return si(t);
|
|
1054
1225
|
throw new Error("[DocClipboardService] html and text cannot be both empty!");
|
|
1055
1226
|
}
|
|
1056
|
-
const n =
|
|
1227
|
+
const n = Xr(e);
|
|
1057
1228
|
if (n) {
|
|
1058
|
-
const
|
|
1059
|
-
if (
|
|
1060
|
-
return
|
|
1229
|
+
const i = _t.get(n);
|
|
1230
|
+
if (i)
|
|
1231
|
+
return i;
|
|
1061
1232
|
}
|
|
1062
1233
|
return this._htmlToUDM.convert(e);
|
|
1063
1234
|
}
|
|
1064
1235
|
};
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
],
|
|
1072
|
-
function
|
|
1073
|
-
return
|
|
1236
|
+
Ye = oi([
|
|
1237
|
+
re(0, D),
|
|
1238
|
+
re(1, Ot),
|
|
1239
|
+
re(2, m),
|
|
1240
|
+
re(3, Ke),
|
|
1241
|
+
re(4, C(te))
|
|
1242
|
+
], Ye);
|
|
1243
|
+
function Be(r) {
|
|
1244
|
+
return r.getContextValue(Ee) || r.getContextValue(Ct);
|
|
1074
1245
|
}
|
|
1075
|
-
const
|
|
1076
|
-
id:
|
|
1246
|
+
const tt = 999, ai = {
|
|
1247
|
+
id: sn.id,
|
|
1077
1248
|
name: "doc.command.copy",
|
|
1078
|
-
type:
|
|
1249
|
+
type: qe.COMMAND,
|
|
1079
1250
|
multi: !0,
|
|
1080
|
-
priority:
|
|
1081
|
-
preconditions:
|
|
1082
|
-
handler: async (
|
|
1083
|
-
},
|
|
1084
|
-
id:
|
|
1251
|
+
priority: tt,
|
|
1252
|
+
preconditions: Be,
|
|
1253
|
+
handler: async (r) => r.get(ue).copy()
|
|
1254
|
+
}, ci = {
|
|
1255
|
+
id: an.id,
|
|
1085
1256
|
name: "doc.command.cut",
|
|
1086
|
-
type:
|
|
1257
|
+
type: qe.COMMAND,
|
|
1087
1258
|
multi: !0,
|
|
1088
|
-
priority:
|
|
1089
|
-
preconditions:
|
|
1090
|
-
handler: async (
|
|
1091
|
-
},
|
|
1092
|
-
id:
|
|
1259
|
+
priority: tt,
|
|
1260
|
+
preconditions: Be,
|
|
1261
|
+
handler: async (r) => r.get(ue).cut()
|
|
1262
|
+
}, li = {
|
|
1263
|
+
id: cn.id,
|
|
1093
1264
|
name: "doc.command.paste",
|
|
1094
|
-
type:
|
|
1265
|
+
type: qe.COMMAND,
|
|
1095
1266
|
multi: !0,
|
|
1096
|
-
priority:
|
|
1097
|
-
preconditions:
|
|
1098
|
-
handler: async (
|
|
1099
|
-
const e =
|
|
1267
|
+
priority: tt,
|
|
1268
|
+
preconditions: Be,
|
|
1269
|
+
handler: async (r) => {
|
|
1270
|
+
const e = r.get(ue), n = await r.get(Ke).read();
|
|
1100
1271
|
return n.length === 0 ? !1 : e.paste(n);
|
|
1101
1272
|
}
|
|
1102
1273
|
};
|
|
1103
|
-
var
|
|
1104
|
-
for (var
|
|
1105
|
-
(o =
|
|
1106
|
-
return n &&
|
|
1107
|
-
},
|
|
1108
|
-
let
|
|
1109
|
-
constructor(
|
|
1110
|
-
super(), this._commandService =
|
|
1274
|
+
var di = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, hi = (r, e, t, n) => {
|
|
1275
|
+
for (var i = n > 1 ? void 0 : n ? ui(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1276
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1277
|
+
return n && i && di(e, t, i), i;
|
|
1278
|
+
}, ie = (r, e) => (t, n) => e(t, n, r);
|
|
1279
|
+
let me = class extends ce {
|
|
1280
|
+
constructor(r, e, t, n, i) {
|
|
1281
|
+
super(), this._commandService = r, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = i, this._init();
|
|
1111
1282
|
}
|
|
1112
1283
|
_init() {
|
|
1113
|
-
[
|
|
1284
|
+
[ai, ci, li].forEach((r) => this.disposeWithMe(this._commandService.registerMultipleCommand(r))), [bt, Tt].forEach((r) => this.disposeWithMe(this._commandService.registerCommand(r))), this._initLegacyPasteCommand();
|
|
1114
1285
|
}
|
|
1115
1286
|
_initLegacyPasteCommand() {
|
|
1116
|
-
var
|
|
1117
|
-
|
|
1287
|
+
var r;
|
|
1288
|
+
(r = this._textSelectionRenderManager) == null || r.onPaste$.pipe(ae(this.dispose$)).subscribe((e) => {
|
|
1118
1289
|
var s, o;
|
|
1119
|
-
if (!
|
|
1290
|
+
if (!Be(this._contextService))
|
|
1120
1291
|
return;
|
|
1121
1292
|
e.event.preventDefault();
|
|
1122
|
-
const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"),
|
|
1123
|
-
this._docClipboardService.legacyPaste(n,
|
|
1293
|
+
const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"), i = (o = t.clipboardData) == null ? void 0 : o.getData("text/plain");
|
|
1294
|
+
this._docClipboardService.legacyPaste(n, i);
|
|
1124
1295
|
});
|
|
1125
1296
|
}
|
|
1126
1297
|
};
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
],
|
|
1135
|
-
var
|
|
1136
|
-
for (var
|
|
1137
|
-
(o =
|
|
1138
|
-
return n &&
|
|
1139
|
-
},
|
|
1140
|
-
let
|
|
1141
|
-
constructor(e, t, n,
|
|
1298
|
+
me = hi([
|
|
1299
|
+
L(A.Steady, me),
|
|
1300
|
+
ie(0, m),
|
|
1301
|
+
ie(1, Ke),
|
|
1302
|
+
ie(2, ue),
|
|
1303
|
+
ie(3, de),
|
|
1304
|
+
ie(4, jt)
|
|
1305
|
+
], me);
|
|
1306
|
+
var gi = Object.defineProperty, _i = Object.getOwnPropertyDescriptor, pi = (r, e, t, n) => {
|
|
1307
|
+
for (var i = n > 1 ? void 0 : n ? _i(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1308
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1309
|
+
return n && i && gi(e, t, i), i;
|
|
1310
|
+
}, Z = (r, e) => (t, n) => e(t, n, r);
|
|
1311
|
+
let ve = class extends Y {
|
|
1312
|
+
constructor(e, t, n, i, s, o) {
|
|
1142
1313
|
super();
|
|
1143
1314
|
S(this, "_initialEditors", /* @__PURE__ */ new Set());
|
|
1144
|
-
this._currentUniverService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService =
|
|
1315
|
+
this._currentUniverService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = i, this._textSelectionRenderManager = s, this._renderManagerService = o, this._initialize();
|
|
1145
1316
|
}
|
|
1146
1317
|
_initialize() {
|
|
1147
1318
|
this.disposeWithMe(
|
|
@@ -1154,30 +1325,31 @@ let me = class extends H {
|
|
|
1154
1325
|
}), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
|
|
1155
1326
|
}
|
|
1156
1327
|
_resize(e) {
|
|
1157
|
-
var
|
|
1328
|
+
var B, F, j;
|
|
1158
1329
|
if (e == null)
|
|
1159
1330
|
return;
|
|
1160
1331
|
const t = this._editorService.getEditor(e);
|
|
1161
1332
|
if ((t == null ? void 0 : t.cancelDefaultResizeListener) === !0)
|
|
1162
1333
|
return;
|
|
1163
|
-
const n = (
|
|
1164
|
-
if (t == null || t.render == null || n == null ||
|
|
1334
|
+
const n = (B = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : B.skeleton, i = this._currentUniverService.getUniverDocInstance(e);
|
|
1335
|
+
if (t == null || t.render == null || n == null || i == null)
|
|
1165
1336
|
return;
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1337
|
+
n.calculate();
|
|
1338
|
+
const { marginTop: s = 0, marginBottom: o = 0, marginLeft: a = 0, marginRight: c = 0 } = i.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
|
|
1339
|
+
let { actualHeight: h, actualWidth: p } = n.getActualSize();
|
|
1340
|
+
h += s + o, p += a + c;
|
|
1341
|
+
const { width: g, height: f } = t.getBoundingClientRect(), l = d.getViewport(Ae.VIEW_MAIN);
|
|
1342
|
+
let _ = l == null ? void 0 : l.getScrollBar();
|
|
1343
|
+
const O = Math.max(p, g), y = Math.max(h, f);
|
|
1172
1344
|
d.transformByState({
|
|
1173
|
-
width:
|
|
1174
|
-
height:
|
|
1175
|
-
}), u == null || u.resize(
|
|
1345
|
+
width: O,
|
|
1346
|
+
height: y
|
|
1347
|
+
}), u == null || u.resize(O, y), t.isSingle() ? p > g ? _ == null ? l && new ke(l, { barSize: 8, enableVertical: !1 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (j = l == null ? void 0 : l.getScrollBar()) == null || j.dispose()) : h > f ? _ == null ? l && new ke(l, { enableHorizontal: !1, barSize: 8 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (F = l == null ? void 0 : l.getScrollBar()) == null || F.dispose());
|
|
1176
1348
|
}
|
|
1177
1349
|
_initialSetValue() {
|
|
1178
1350
|
this.disposeWithMe(
|
|
1179
1351
|
this._editorService.setValue$.subscribe((e) => {
|
|
1180
|
-
this._commandService.executeCommand(
|
|
1352
|
+
this._commandService.executeCommand(yn.id, {
|
|
1181
1353
|
unitId: e.editorUnitId,
|
|
1182
1354
|
body: e.body,
|
|
1183
1355
|
segmentId: null
|
|
@@ -1190,14 +1362,43 @@ let me = class extends H {
|
|
|
1190
1362
|
this._editorService.blur$.subscribe(() => {
|
|
1191
1363
|
this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.blur();
|
|
1192
1364
|
})
|
|
1365
|
+
), this.disposeWithMe(
|
|
1366
|
+
this._textSelectionRenderManager.onBlur$.subscribe(() => {
|
|
1367
|
+
const e = this._currentUniverService.getCurrentUniverDocInstance().getUnitId();
|
|
1368
|
+
if (e == null)
|
|
1369
|
+
return;
|
|
1370
|
+
const t = this._editorService.getEditor(e);
|
|
1371
|
+
t == null || t.isSheetEditor() || this._editorService.blur();
|
|
1372
|
+
})
|
|
1193
1373
|
);
|
|
1194
1374
|
}
|
|
1195
1375
|
_initialFocus() {
|
|
1196
1376
|
this.disposeWithMe(
|
|
1197
|
-
this._editorService.focus$.subscribe((
|
|
1198
|
-
this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.addTextRanges([
|
|
1377
|
+
this._editorService.focus$.subscribe((n) => {
|
|
1378
|
+
this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.addTextRanges([n]);
|
|
1199
1379
|
})
|
|
1200
1380
|
);
|
|
1381
|
+
const e = [
|
|
1382
|
+
"univer-formula-search",
|
|
1383
|
+
"univer-formula-help",
|
|
1384
|
+
"formula-help-decorator",
|
|
1385
|
+
"univer-formula-help-param"
|
|
1386
|
+
];
|
|
1387
|
+
this.disposeWithMe(
|
|
1388
|
+
ht(window, "mousedown").subscribe((n) => {
|
|
1389
|
+
const s = n.target.classList[0] || "";
|
|
1390
|
+
if (Wt(s, e)) {
|
|
1391
|
+
this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
|
|
1392
|
+
return;
|
|
1393
|
+
}
|
|
1394
|
+
this._editorService.changeSpreadsheetFocusState(!1);
|
|
1395
|
+
})
|
|
1396
|
+
), this._currentUniverService.getAllUniverSheetsInstance().forEach((n) => {
|
|
1397
|
+
const i = n.getUnitId(), s = this._renderManagerService.getRenderById(i), o = s == null ? void 0 : s.engine.getCanvas().getCanvasEle();
|
|
1398
|
+
o != null && ht(o, "mousedown").subscribe((a) => {
|
|
1399
|
+
this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
|
|
1400
|
+
});
|
|
1401
|
+
});
|
|
1201
1402
|
}
|
|
1202
1403
|
_initialValueChange() {
|
|
1203
1404
|
this.disposeWithMe(
|
|
@@ -1221,40 +1422,41 @@ let me = class extends H {
|
|
|
1221
1422
|
* Listen to document edits to refresh the size of the normula editor.
|
|
1222
1423
|
*/
|
|
1223
1424
|
_commandExecutedListener() {
|
|
1224
|
-
const e = [
|
|
1425
|
+
const e = [Je.id, ln.id];
|
|
1225
1426
|
this.disposeWithMe(
|
|
1226
1427
|
this._commandService.onCommandExecuted((t) => {
|
|
1227
1428
|
if (e.includes(t.id)) {
|
|
1228
|
-
const n = t.params, { unitId:
|
|
1229
|
-
if (this._editorService.isSheetEditor(
|
|
1429
|
+
const n = t.params, { unitId: i } = n;
|
|
1430
|
+
if (this._editorService.isSheetEditor(i))
|
|
1230
1431
|
return;
|
|
1231
|
-
this._resize(
|
|
1432
|
+
this._resize(i), this._valueChange();
|
|
1232
1433
|
}
|
|
1233
1434
|
})
|
|
1234
1435
|
);
|
|
1235
1436
|
}
|
|
1236
1437
|
};
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1438
|
+
ve = pi([
|
|
1439
|
+
L(A.Rendered, ve),
|
|
1440
|
+
Z(0, D),
|
|
1441
|
+
Z(1, C(ne)),
|
|
1442
|
+
Z(2, N),
|
|
1443
|
+
Z(3, m),
|
|
1444
|
+
Z(4, de),
|
|
1445
|
+
Z(5, z)
|
|
1446
|
+
], ve);
|
|
1447
|
+
var fi = Object.defineProperty, Si = Object.getOwnPropertyDescriptor, mi = (r, e, t, n) => {
|
|
1448
|
+
for (var i = n > 1 ? void 0 : n ? Si(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1449
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1450
|
+
return n && i && fi(e, t, i), i;
|
|
1451
|
+
}, pe = (r, e) => (t, n) => e(t, n, r);
|
|
1452
|
+
let Ce = class extends ce {
|
|
1453
|
+
constructor(e, t, n, i) {
|
|
1252
1454
|
super();
|
|
1253
1455
|
S(this, "_docRenderMap", /* @__PURE__ */ new Set());
|
|
1254
|
-
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService =
|
|
1456
|
+
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = i, this._initialRenderRefresh(), this._commandExecutedListener();
|
|
1255
1457
|
}
|
|
1256
1458
|
_initialRenderRefresh() {
|
|
1257
|
-
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(
|
|
1459
|
+
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ae(this.dispose$)).subscribe((e) => {
|
|
1258
1460
|
this._create(e);
|
|
1259
1461
|
});
|
|
1260
1462
|
}
|
|
@@ -1262,70 +1464,70 @@ let ve = class extends ce {
|
|
|
1262
1464
|
if (e == null)
|
|
1263
1465
|
return;
|
|
1264
1466
|
const { skeleton: t, unitId: n } = e;
|
|
1265
|
-
let
|
|
1266
|
-
|
|
1267
|
-
const { mainComponent: s } =
|
|
1268
|
-
s.changeSkeleton(t), this._recalculateSizeBySkeleton(
|
|
1467
|
+
let i = this._renderManagerService.getRenderById(n);
|
|
1468
|
+
i == null && (this._renderManagerService.create(n), i = this._renderManagerService.getRenderById(n));
|
|
1469
|
+
const { mainComponent: s } = i;
|
|
1470
|
+
s.changeSkeleton(t), this._recalculateSizeBySkeleton(i, t);
|
|
1269
1471
|
}
|
|
1270
1472
|
_recalculateSizeBySkeleton(e, t) {
|
|
1271
1473
|
var u;
|
|
1272
|
-
const { mainComponent: n, scene:
|
|
1273
|
-
if (
|
|
1474
|
+
const { mainComponent: n, scene: i, unitId: s } = e, o = n, a = (u = t.getSkeletonData()) == null ? void 0 : u.pages;
|
|
1475
|
+
if (a == null)
|
|
1274
1476
|
return;
|
|
1275
|
-
let
|
|
1276
|
-
for (let
|
|
1277
|
-
const
|
|
1278
|
-
o.pageLayoutType ===
|
|
1477
|
+
let c = 0, d = 0;
|
|
1478
|
+
for (let h = 0, p = a.length; h < p; h++) {
|
|
1479
|
+
const g = a[h], { pageWidth: f, pageHeight: l } = g;
|
|
1480
|
+
o.pageLayoutType === lt.VERTICAL ? (d += l, d += o.pageMarginTop, h === p - 1 && (d += o.pageMarginTop), c = Math.max(c, f)) : o.pageLayoutType === lt.HORIZONTAL && (c += f, h !== p - 1 && (c += o.pageMarginLeft), d = Math.max(d, l));
|
|
1279
1481
|
}
|
|
1280
|
-
o.resize(
|
|
1482
|
+
o.resize(c, d), this._editorService.isEditor(s) || i.resize(c, d);
|
|
1281
1483
|
}
|
|
1282
1484
|
_commandExecutedListener() {
|
|
1283
|
-
const e = [
|
|
1485
|
+
const e = [Je.id];
|
|
1284
1486
|
this.disposeWithMe(
|
|
1285
1487
|
this._commandService.onCommandExecuted((t) => {
|
|
1286
1488
|
var n;
|
|
1287
1489
|
if (e.includes(t.id)) {
|
|
1288
|
-
const
|
|
1490
|
+
const i = t.params, { unitId: s } = i, o = this._docSkeletonManagerService.getSkeletonByUnitId(s);
|
|
1289
1491
|
if (o == null)
|
|
1290
1492
|
return;
|
|
1291
|
-
const { skeleton:
|
|
1292
|
-
if (
|
|
1493
|
+
const { skeleton: a } = o, c = this._renderManagerService.getRenderById(s);
|
|
1494
|
+
if (c == null || !!a.getViewModel().getDataModel().getSnapshot().disabled)
|
|
1293
1495
|
return;
|
|
1294
|
-
if (
|
|
1295
|
-
(n =
|
|
1496
|
+
if (a.calculate(), this._editorService.isEditor(s)) {
|
|
1497
|
+
(n = c.mainComponent) == null || n.makeDirty();
|
|
1296
1498
|
return;
|
|
1297
1499
|
}
|
|
1298
|
-
this._recalculateSizeBySkeleton(
|
|
1500
|
+
this._recalculateSizeBySkeleton(c, a);
|
|
1299
1501
|
}
|
|
1300
1502
|
})
|
|
1301
1503
|
);
|
|
1302
1504
|
}
|
|
1303
1505
|
};
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
],
|
|
1311
|
-
var
|
|
1312
|
-
for (var
|
|
1313
|
-
(o =
|
|
1314
|
-
return n &&
|
|
1315
|
-
},
|
|
1316
|
-
let
|
|
1317
|
-
constructor(e, t, n) {
|
|
1506
|
+
Ce = mi([
|
|
1507
|
+
L(A.Rendered, Ce),
|
|
1508
|
+
pe(0, C(ne)),
|
|
1509
|
+
pe(1, z),
|
|
1510
|
+
pe(2, m),
|
|
1511
|
+
pe(3, N)
|
|
1512
|
+
], Ce);
|
|
1513
|
+
var vi = Object.defineProperty, Ci = Object.getOwnPropertyDescriptor, Oi = (r, e, t, n) => {
|
|
1514
|
+
for (var i = n > 1 ? void 0 : n ? Ci(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1515
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1516
|
+
return n && i && vi(e, t, i), i;
|
|
1517
|
+
}, fe = (r, e) => (t, n) => e(t, n, r);
|
|
1518
|
+
let Oe = class extends ce {
|
|
1519
|
+
constructor(e, t, n, i) {
|
|
1318
1520
|
super();
|
|
1319
1521
|
S(this, "_scene");
|
|
1320
1522
|
S(this, "_currentDocumentModel");
|
|
1321
|
-
S(this, "_fps$", new
|
|
1523
|
+
S(this, "_fps$", new zn(""));
|
|
1322
1524
|
S(this, "fps$", this._fps$.asObservable());
|
|
1323
|
-
this._renderManagerService = e, this._configService = t, this._currentUniverService = n, this._initialize();
|
|
1525
|
+
this._renderManagerService = e, this._configService = t, this._currentUniverService = n, this._editorService = i, this._initialize();
|
|
1324
1526
|
}
|
|
1325
1527
|
_initialize() {
|
|
1326
|
-
this._renderManagerService.createRender$.pipe(
|
|
1528
|
+
this._renderManagerService.createRender$.pipe(ae(this.dispose$)).subscribe((e) => {
|
|
1327
1529
|
this._create(e);
|
|
1328
|
-
}), this._currentUniverService.currentDoc$.pipe(
|
|
1530
|
+
}), this._currentUniverService.currentDoc$.pipe(ae(this.dispose$)).subscribe((e) => {
|
|
1329
1531
|
this._create(e == null ? void 0 : e.getUnitId());
|
|
1330
1532
|
}), this._currentUniverService.getAllUniverDocsInstance().forEach((e) => {
|
|
1331
1533
|
this._create(e.getUnitId());
|
|
@@ -1341,62 +1543,63 @@ let Ce = class extends ce {
|
|
|
1341
1543
|
t != null && (this._currentDocumentModel = t, this._renderManagerService.has(e) || this._addNewRender());
|
|
1342
1544
|
}
|
|
1343
1545
|
_addNewRender() {
|
|
1344
|
-
const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(),
|
|
1345
|
-
if (n != null &&
|
|
1546
|
+
const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(), i = e.getParentRenderUnitId();
|
|
1547
|
+
if (n != null && i != null)
|
|
1346
1548
|
throw new Error("container or parentRenderUnitId can only exist one");
|
|
1347
|
-
n == null &&
|
|
1549
|
+
n == null && i != null ? this._renderManagerService.createRenderWithParent(t, i) : this._renderManagerService.createRender(t);
|
|
1348
1550
|
const s = this._renderManagerService.getRenderById(t);
|
|
1349
1551
|
if (s == null)
|
|
1350
1552
|
return;
|
|
1351
|
-
const { scene: o, engine:
|
|
1553
|
+
const { scene: o, engine: a } = s;
|
|
1352
1554
|
o.openTransformer(), this._scene = o;
|
|
1353
|
-
const
|
|
1555
|
+
const c = new An(Ae.VIEW_MAIN, o, {
|
|
1354
1556
|
left: 0,
|
|
1355
1557
|
top: 0,
|
|
1356
1558
|
bottom: 0,
|
|
1357
1559
|
right: 0,
|
|
1358
1560
|
isWheelPreventDefaultX: !0
|
|
1359
1561
|
});
|
|
1360
|
-
o.attachControl(), o.on(
|
|
1361
|
-
const
|
|
1362
|
-
if (
|
|
1363
|
-
const
|
|
1364
|
-
let
|
|
1365
|
-
|
|
1562
|
+
o.attachControl(), o.on(Nn.wheel, (h, p) => {
|
|
1563
|
+
const g = h;
|
|
1564
|
+
if (g.ctrlKey) {
|
|
1565
|
+
const f = Math.abs(g.deltaX);
|
|
1566
|
+
let l = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
|
|
1567
|
+
l *= g.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (l /= 2), o.scaleX + l > 4 ? o.scale(4, 4) : o.scaleX + l < 0.1 ? o.scale(0.1, 0.1) : g.preventDefault();
|
|
1366
1568
|
} else
|
|
1367
|
-
|
|
1368
|
-
}), this._configService.getConfig("hasScroll") !== !1 && new
|
|
1369
|
-
new
|
|
1370
|
-
new
|
|
1371
|
-
), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() &&
|
|
1372
|
-
o.render(), this._fps$.next(Math.round(
|
|
1569
|
+
c.onMouseWheel(g, p);
|
|
1570
|
+
}), this._configService.getConfig("hasScroll") !== !1 && new ke(c), o.addLayer(
|
|
1571
|
+
new dt(o, [], Fe),
|
|
1572
|
+
new dt(o, [], En)
|
|
1573
|
+
), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
|
|
1574
|
+
o.render(), this._fps$.next(Math.round(a.getFps()).toString());
|
|
1373
1575
|
}), this._renderManagerService.setCurrent(t);
|
|
1374
1576
|
}
|
|
1375
1577
|
_addComponent(e) {
|
|
1376
|
-
const t = this._scene, n = this._currentDocumentModel,
|
|
1578
|
+
const t = this._scene, n = this._currentDocumentModel, i = new $n(at.MAIN, void 0, {
|
|
1377
1579
|
pageMarginLeft: n.documentStyle.marginLeft || 0,
|
|
1378
1580
|
pageMarginTop: n.documentStyle.marginTop || 0
|
|
1379
1581
|
});
|
|
1380
|
-
|
|
1582
|
+
i.zIndex = xn, e.mainComponent = i, e.components.set(at.MAIN, i), t.addObjects([i], Fe), this._editorService.getEditor(n.getUnitId()) == null && t.enableLayerCache(Fe);
|
|
1381
1583
|
}
|
|
1382
1584
|
};
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1585
|
+
Oe = Oi([
|
|
1586
|
+
L(A.Starting, Oe),
|
|
1587
|
+
fe(0, z),
|
|
1588
|
+
fe(1, zt),
|
|
1589
|
+
fe(2, D),
|
|
1590
|
+
fe(3, N)
|
|
1591
|
+
], Oe);
|
|
1592
|
+
var Ri = Object.defineProperty, Ti = Object.getOwnPropertyDescriptor, bi = (r, e, t, n) => {
|
|
1593
|
+
for (var i = n > 1 ? void 0 : n ? Ti(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1594
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1595
|
+
return n && i && Ri(e, t, i), i;
|
|
1596
|
+
}, q = (r, e) => (t, n) => e(t, n, r);
|
|
1597
|
+
let Re = class extends Y {
|
|
1598
|
+
constructor(e, t, n, i, s, o) {
|
|
1396
1599
|
super();
|
|
1397
|
-
S(this, "_liquid", new
|
|
1600
|
+
S(this, "_liquid", new wn());
|
|
1398
1601
|
S(this, "_pageMarginCache", /* @__PURE__ */ new Map());
|
|
1399
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService =
|
|
1602
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = i, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
|
|
1400
1603
|
}
|
|
1401
1604
|
_initialize() {
|
|
1402
1605
|
this._initialRenderRefresh(), this._updateOnPluginChange();
|
|
@@ -1406,129 +1609,129 @@ let Oe = class extends H {
|
|
|
1406
1609
|
const t = this._docSkeletonManagerService.getCurrent();
|
|
1407
1610
|
if (t == null)
|
|
1408
1611
|
return;
|
|
1409
|
-
const { unitId: n, skeleton:
|
|
1612
|
+
const { unitId: n, skeleton: i } = t, s = this._renderManagerService.getRenderById(n);
|
|
1410
1613
|
if (s == null)
|
|
1411
1614
|
return;
|
|
1412
|
-
const { mainComponent: o, components:
|
|
1413
|
-
e.forEach((
|
|
1414
|
-
const { unitId:
|
|
1415
|
-
|
|
1416
|
-
left:
|
|
1417
|
-
top:
|
|
1418
|
-
height:
|
|
1419
|
-
width:
|
|
1615
|
+
const { mainComponent: o, components: a, scene: c } = s, d = o, { left: u, top: h } = d;
|
|
1616
|
+
e.forEach((p) => {
|
|
1617
|
+
const { unitId: g, subUnitId: f, floatingObjectId: l, floatingObject: _ } = p, { left: O = 0, top: y = 0, width: B = 0, height: F = 0, angle: j, flipX: X, flipY: G, skewX: he, skewY: ge } = _, x = this._pageMarginCache.get(l), Lt = (x == null ? void 0 : x.marginLeft) || 0, At = (x == null ? void 0 : x.marginTop) || 0;
|
|
1618
|
+
i == null || i.getViewModel().getDataModel().updateDrawing(l, {
|
|
1619
|
+
left: O - u - Lt,
|
|
1620
|
+
top: y - h - At,
|
|
1621
|
+
height: F,
|
|
1622
|
+
width: B
|
|
1420
1623
|
});
|
|
1421
|
-
}),
|
|
1624
|
+
}), i == null || i.calculate(), o == null || o.makeDirty();
|
|
1422
1625
|
});
|
|
1423
1626
|
}
|
|
1424
1627
|
_initialRenderRefresh() {
|
|
1425
1628
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1426
1629
|
if (e == null)
|
|
1427
1630
|
return;
|
|
1428
|
-
const { skeleton: t, unitId: n } = e,
|
|
1429
|
-
if (
|
|
1631
|
+
const { skeleton: t, unitId: n } = e, i = this._renderManagerService.getRenderById(n);
|
|
1632
|
+
if (i == null)
|
|
1430
1633
|
return;
|
|
1431
|
-
const { mainComponent: s } =
|
|
1432
|
-
s.changeSkeleton(t), this._refreshFloatingObject(n, t,
|
|
1634
|
+
const { mainComponent: s } = i;
|
|
1635
|
+
s.changeSkeleton(t), this._refreshFloatingObject(n, t, i);
|
|
1433
1636
|
});
|
|
1434
1637
|
}
|
|
1435
1638
|
_commandExecutedListener() {
|
|
1436
|
-
const e = [
|
|
1639
|
+
const e = [Je.id, Qe.id];
|
|
1437
1640
|
this.disposeWithMe(
|
|
1438
1641
|
this._commandService.onCommandExecuted((t) => {
|
|
1439
1642
|
var n;
|
|
1440
1643
|
if (e.includes(t.id)) {
|
|
1441
|
-
const
|
|
1644
|
+
const i = t.params, { unitId: s } = i, o = this._docSkeletonManagerService.getCurrent();
|
|
1442
1645
|
if (o == null)
|
|
1443
1646
|
return;
|
|
1444
|
-
const { unitId:
|
|
1445
|
-
if (s !==
|
|
1647
|
+
const { unitId: a, skeleton: c } = o;
|
|
1648
|
+
if (s !== a)
|
|
1446
1649
|
return;
|
|
1447
|
-
const d = this._renderManagerService.getRenderById(
|
|
1650
|
+
const d = this._renderManagerService.getRenderById(a);
|
|
1448
1651
|
if (d == null)
|
|
1449
1652
|
return;
|
|
1450
|
-
if (this._editorService.isEditor(
|
|
1653
|
+
if (this._editorService.isEditor(a)) {
|
|
1451
1654
|
(n = d.mainComponent) == null || n.makeDirty();
|
|
1452
1655
|
return;
|
|
1453
1656
|
}
|
|
1454
|
-
this._refreshFloatingObject(
|
|
1657
|
+
this._refreshFloatingObject(a, c, d);
|
|
1455
1658
|
}
|
|
1456
1659
|
})
|
|
1457
1660
|
);
|
|
1458
1661
|
}
|
|
1459
1662
|
_refreshFloatingObject(e, t, n) {
|
|
1460
|
-
const
|
|
1461
|
-
if (!
|
|
1663
|
+
const i = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
|
|
1664
|
+
if (!i)
|
|
1462
1665
|
return;
|
|
1463
|
-
const { left:
|
|
1666
|
+
const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: p } = a, { pages: g } = i, f = [];
|
|
1464
1667
|
o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
|
|
1465
|
-
for (let
|
|
1466
|
-
const
|
|
1467
|
-
this._liquid.translatePagePadding(
|
|
1468
|
-
const { aLeft: X, aTop: G, height: he, width:
|
|
1469
|
-
|
|
1668
|
+
for (let l = 0, _ = g.length; l < _; l++) {
|
|
1669
|
+
const O = g[l], { skeDrawings: y, marginLeft: B, marginTop: F } = O;
|
|
1670
|
+
this._liquid.translatePagePadding(O), y.forEach((j) => {
|
|
1671
|
+
const { aLeft: X, aTop: G, height: he, width: ge, objectId: x } = j;
|
|
1672
|
+
f.push({
|
|
1470
1673
|
unitId: e,
|
|
1471
|
-
subUnitId:
|
|
1472
|
-
floatingObjectId:
|
|
1674
|
+
subUnitId: Vt,
|
|
1675
|
+
floatingObjectId: x,
|
|
1473
1676
|
floatingObject: {
|
|
1474
|
-
left: X +
|
|
1677
|
+
left: X + c + this._liquid.x,
|
|
1475
1678
|
top: G + d + this._liquid.y,
|
|
1476
|
-
width:
|
|
1679
|
+
width: ge,
|
|
1477
1680
|
height: he
|
|
1478
1681
|
}
|
|
1479
|
-
}), this._pageMarginCache.set(
|
|
1682
|
+
}), this._pageMarginCache.set(x, {
|
|
1480
1683
|
marginLeft: this._liquid.x,
|
|
1481
1684
|
marginTop: this._liquid.y
|
|
1482
1685
|
});
|
|
1483
|
-
}), this._liquid.translatePage(
|
|
1686
|
+
}), this._liquid.translatePage(O, u, h, p);
|
|
1484
1687
|
}
|
|
1485
|
-
this._floatingObjectManagerService.BatchAddOrUpdate(
|
|
1688
|
+
this._floatingObjectManagerService.BatchAddOrUpdate(f);
|
|
1486
1689
|
}
|
|
1487
1690
|
};
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
],
|
|
1497
|
-
var
|
|
1498
|
-
for (var
|
|
1499
|
-
(o =
|
|
1500
|
-
return n &&
|
|
1501
|
-
},
|
|
1502
|
-
const
|
|
1503
|
-
let
|
|
1504
|
-
constructor(
|
|
1505
|
-
super(), this._renderManagerService =
|
|
1691
|
+
Re = bi([
|
|
1692
|
+
L(A.Steady, Re),
|
|
1693
|
+
q(0, C(ne)),
|
|
1694
|
+
q(1, D),
|
|
1695
|
+
q(2, z),
|
|
1696
|
+
q(3, m),
|
|
1697
|
+
q(4, kt),
|
|
1698
|
+
q(5, N)
|
|
1699
|
+
], Re);
|
|
1700
|
+
var Ii = Object.defineProperty, Mi = Object.getOwnPropertyDescriptor, yi = (r, e, t, n) => {
|
|
1701
|
+
for (var i = n > 1 ? void 0 : n ? Mi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1702
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1703
|
+
return n && i && Ii(e, t, i), i;
|
|
1704
|
+
}, We = (r, e) => (t, n) => e(t, n, r);
|
|
1705
|
+
const Ei = "rgba(198, 198, 198, 1)", xi = "rgba(255, 255, 255, 1)";
|
|
1706
|
+
let Te = class extends Y {
|
|
1707
|
+
constructor(r, e, t) {
|
|
1708
|
+
super(), this._renderManagerService = r, this._editorService = e, this._currentUniverService = t, this._initialize(), this._commandExecutedListener();
|
|
1506
1709
|
}
|
|
1507
1710
|
_initialize() {
|
|
1508
1711
|
this._initialRenderRefresh();
|
|
1509
1712
|
}
|
|
1510
1713
|
_initialRenderRefresh() {
|
|
1511
|
-
this._renderManagerService.currentRender$.subscribe((
|
|
1714
|
+
this._renderManagerService.currentRender$.subscribe((r) => {
|
|
1512
1715
|
var s;
|
|
1513
|
-
if (
|
|
1716
|
+
if (r == null)
|
|
1514
1717
|
return;
|
|
1515
|
-
const e = this._renderManagerService.getRenderById(
|
|
1516
|
-
if (this._editorService.isEditor(
|
|
1718
|
+
const e = this._renderManagerService.getRenderById(r);
|
|
1719
|
+
if (this._editorService.isEditor(r) || this._currentUniverService.getUniverDocInstance(r) == null || e == null)
|
|
1517
1720
|
return;
|
|
1518
|
-
const { mainComponent: t } = e, n = t,
|
|
1721
|
+
const { mainComponent: t } = e, n = t, i = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
|
|
1519
1722
|
this.disposeWithMe(
|
|
1520
|
-
|
|
1723
|
+
w(
|
|
1521
1724
|
n.onPageRenderObservable.add((o) => {
|
|
1522
|
-
var
|
|
1523
|
-
if (this._editorService.isEditor(
|
|
1725
|
+
var l, _, O, y;
|
|
1726
|
+
if (this._editorService.isEditor(r))
|
|
1524
1727
|
return;
|
|
1525
|
-
const { page:
|
|
1526
|
-
u.save(), u.translate(
|
|
1527
|
-
width: (
|
|
1528
|
-
height: (
|
|
1728
|
+
const { page: a, pageLeft: c, pageTop: d, ctx: u } = o, { width: h, pageWidth: p, height: g, pageHeight: f } = a;
|
|
1729
|
+
u.save(), u.translate(c - 0.5, d - 0.5), Bn.drawWith(u, {
|
|
1730
|
+
width: (_ = (l = i == null ? void 0 : i.width) != null ? l : p) != null ? _ : h,
|
|
1731
|
+
height: (y = (O = i == null ? void 0 : i.height) != null ? O : f) != null ? y : g,
|
|
1529
1732
|
strokeWidth: 1,
|
|
1530
|
-
stroke:
|
|
1531
|
-
fill:
|
|
1733
|
+
stroke: Ei,
|
|
1734
|
+
fill: xi,
|
|
1532
1735
|
zIndex: 3
|
|
1533
1736
|
}), u.restore();
|
|
1534
1737
|
})
|
|
@@ -1539,22 +1742,22 @@ let Re = class extends H {
|
|
|
1539
1742
|
_commandExecutedListener() {
|
|
1540
1743
|
}
|
|
1541
1744
|
};
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
],
|
|
1548
|
-
var
|
|
1549
|
-
for (var
|
|
1550
|
-
(o =
|
|
1551
|
-
return n &&
|
|
1552
|
-
},
|
|
1553
|
-
let be = class extends
|
|
1554
|
-
constructor(e, t, n,
|
|
1745
|
+
Te = yi([
|
|
1746
|
+
L(A.Rendered, Te),
|
|
1747
|
+
We(0, z),
|
|
1748
|
+
We(1, N),
|
|
1749
|
+
We(2, D)
|
|
1750
|
+
], Te);
|
|
1751
|
+
var Di = Object.defineProperty, Pi = Object.getOwnPropertyDescriptor, Ui = (r, e, t, n) => {
|
|
1752
|
+
for (var i = n > 1 ? void 0 : n ? Pi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1753
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1754
|
+
return n && i && Di(e, t, i), i;
|
|
1755
|
+
}, K = (r, e) => (t, n) => e(t, n, r);
|
|
1756
|
+
let be = class extends Y {
|
|
1757
|
+
constructor(e, t, n, i, s, o) {
|
|
1555
1758
|
super();
|
|
1556
1759
|
S(this, "_initializedRender", /* @__PURE__ */ new Set());
|
|
1557
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService =
|
|
1760
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = i, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
|
|
1558
1761
|
}
|
|
1559
1762
|
dispose() {
|
|
1560
1763
|
super.dispose();
|
|
@@ -1570,20 +1773,20 @@ let be = class extends H {
|
|
|
1570
1773
|
if (n == null || this._initializedRender.has(t) || this._editorService.isEditor(t))
|
|
1571
1774
|
return;
|
|
1572
1775
|
this._initializedRender.add(t);
|
|
1573
|
-
const { scene:
|
|
1776
|
+
const { scene: i } = n;
|
|
1574
1777
|
this.disposeWithMe(
|
|
1575
|
-
|
|
1576
|
-
|
|
1778
|
+
w(
|
|
1779
|
+
i.onMouseWheelObserver.add((s) => {
|
|
1577
1780
|
if (!s.ctrlKey)
|
|
1578
1781
|
return;
|
|
1579
1782
|
const o = Math.abs(s.deltaX);
|
|
1580
|
-
let
|
|
1581
|
-
|
|
1582
|
-
const
|
|
1583
|
-
let u = +Number.parseFloat(`${d +
|
|
1584
|
-
u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(
|
|
1783
|
+
let a = o < 40 ? 0.2 : o < 80 ? 0.4 : 0.2;
|
|
1784
|
+
a *= s.deltaY > 0 ? -1 : 1, i.scaleX < 1 && (a /= 2);
|
|
1785
|
+
const c = this._currentUniverService.getCurrentUniverDocInstance(), d = c.zoomRatio;
|
|
1786
|
+
let u = +Number.parseFloat(`${d + a}`).toFixed(1);
|
|
1787
|
+
u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Dn.id, {
|
|
1585
1788
|
zoomRatio: u,
|
|
1586
|
-
unitId:
|
|
1789
|
+
unitId: c.getUnitId()
|
|
1587
1790
|
}), s.preventDefault();
|
|
1588
1791
|
})
|
|
1589
1792
|
)
|
|
@@ -1599,7 +1802,7 @@ let be = class extends H {
|
|
|
1599
1802
|
// }
|
|
1600
1803
|
_skeletonListener() {
|
|
1601
1804
|
this.disposeWithMe(
|
|
1602
|
-
|
|
1805
|
+
w(
|
|
1603
1806
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1604
1807
|
if (e == null)
|
|
1605
1808
|
return;
|
|
@@ -1610,11 +1813,11 @@ let be = class extends H {
|
|
|
1610
1813
|
);
|
|
1611
1814
|
}
|
|
1612
1815
|
_commandExecutedListener() {
|
|
1613
|
-
const e = [
|
|
1816
|
+
const e = [Qe.id];
|
|
1614
1817
|
this.disposeWithMe(
|
|
1615
1818
|
this._commandService.onCommandExecuted((t) => {
|
|
1616
1819
|
if (e.includes(t.id)) {
|
|
1617
|
-
const n = this._currentUniverService.getCurrentUniverDocInstance(),
|
|
1820
|
+
const n = this._currentUniverService.getCurrentUniverDocInstance(), i = t.params, { unitId: s } = i;
|
|
1618
1821
|
if (s !== n.getUnitId())
|
|
1619
1822
|
return;
|
|
1620
1823
|
const o = n.zoomRatio || 1;
|
|
@@ -1624,49 +1827,49 @@ let be = class extends H {
|
|
|
1624
1827
|
);
|
|
1625
1828
|
}
|
|
1626
1829
|
_updateViewZoom(e, t = !0) {
|
|
1627
|
-
var
|
|
1830
|
+
var i;
|
|
1628
1831
|
const n = this._getDocObject();
|
|
1629
|
-
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (
|
|
1832
|
+
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (i = n.scene.getTransformer()) == null || i.hideControl());
|
|
1630
1833
|
}
|
|
1631
1834
|
_calculatePagePosition(e, t) {
|
|
1632
|
-
const { document: n, scene:
|
|
1633
|
-
if (s == null || o === Number.POSITIVE_INFINITY ||
|
|
1835
|
+
const { document: n, scene: i } = e, s = i == null ? void 0 : i.getParent(), { width: o, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
|
|
1836
|
+
if (s == null || o === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
|
|
1634
1837
|
return;
|
|
1635
|
-
const { width: u, height:
|
|
1636
|
-
let
|
|
1637
|
-
u > (o +
|
|
1638
|
-
const
|
|
1639
|
-
if (
|
|
1640
|
-
const
|
|
1641
|
-
|
|
1642
|
-
x:
|
|
1838
|
+
const { width: u, height: h } = s;
|
|
1839
|
+
let p = 0, g = 0, f = 0, l = 0, _ = Number.POSITIVE_INFINITY;
|
|
1840
|
+
u > (o + c * 2) * t ? (p = u / 2 - o * t / 2, p /= t, f = (u - c * 2) / t, _ = 0) : (p = c, f = o + c * 2, _ = (f - u / t) / 2), h > a ? (g = h / 2 - a / 2, l = (h - d * 2) / t) : (g = d, l = a + d * 2), i.resize(f, l + 200), n.translate(p, g);
|
|
1841
|
+
const O = i.getViewport(Ae.VIEW_MAIN);
|
|
1842
|
+
if (_ !== Number.POSITIVE_INFINITY && O != null) {
|
|
1843
|
+
const y = O.getBarScroll(_, 0).x;
|
|
1844
|
+
O.scrollTo({
|
|
1845
|
+
x: y
|
|
1643
1846
|
});
|
|
1644
1847
|
}
|
|
1645
1848
|
return this;
|
|
1646
1849
|
}
|
|
1647
1850
|
_getDocObject() {
|
|
1648
|
-
return
|
|
1851
|
+
return It(this._currentUniverService, this._renderManagerService);
|
|
1649
1852
|
}
|
|
1650
1853
|
};
|
|
1651
|
-
be =
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1854
|
+
be = Ui([
|
|
1855
|
+
L(A.Rendered, be),
|
|
1856
|
+
K(0, C(ne)),
|
|
1857
|
+
K(1, D),
|
|
1858
|
+
K(2, m),
|
|
1859
|
+
K(3, z),
|
|
1860
|
+
K(4, C(te)),
|
|
1861
|
+
K(5, N)
|
|
1659
1862
|
], be);
|
|
1660
|
-
var
|
|
1661
|
-
for (var
|
|
1662
|
-
(o =
|
|
1663
|
-
return n &&
|
|
1664
|
-
},
|
|
1665
|
-
let Ie = class extends
|
|
1666
|
-
constructor(e, t, n,
|
|
1863
|
+
var Li = Object.defineProperty, Ai = Object.getOwnPropertyDescriptor, Ni = (r, e, t, n) => {
|
|
1864
|
+
for (var i = n > 1 ? void 0 : n ? Ai(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1865
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1866
|
+
return n && i && Li(e, t, i), i;
|
|
1867
|
+
}, H = (r, e) => (t, n) => e(t, n, r);
|
|
1868
|
+
let Ie = class extends Y {
|
|
1869
|
+
constructor(e, t, n, i, s, o, a) {
|
|
1667
1870
|
super();
|
|
1668
1871
|
S(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
1669
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService =
|
|
1872
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = i, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = a, this._initialize();
|
|
1670
1873
|
}
|
|
1671
1874
|
_initialize() {
|
|
1672
1875
|
this._init(), this._skeletonListener(), this._commandExecutedListener();
|
|
@@ -1690,37 +1893,41 @@ let Ie = class extends H {
|
|
|
1690
1893
|
const t = this._getDocObjectById(e);
|
|
1691
1894
|
if (t == null)
|
|
1692
1895
|
return;
|
|
1693
|
-
const { document: n, scene:
|
|
1896
|
+
const { document: n, scene: i } = t;
|
|
1694
1897
|
this.disposeWithMe(
|
|
1695
|
-
|
|
1898
|
+
w(
|
|
1696
1899
|
n.onPointerEnterObserver.add(() => {
|
|
1697
|
-
this._isEditorReadOnly(e) || (n.cursor =
|
|
1900
|
+
this._isEditorReadOnly(e) || (n.cursor = ut.TEXT);
|
|
1698
1901
|
})
|
|
1699
1902
|
)
|
|
1700
1903
|
), this.disposeWithMe(
|
|
1701
|
-
|
|
1904
|
+
w(
|
|
1702
1905
|
n.onPointerLeaveObserver.add(() => {
|
|
1703
|
-
n.cursor =
|
|
1906
|
+
n.cursor = ut.DEFAULT, i.resetCursor();
|
|
1704
1907
|
})
|
|
1705
1908
|
)
|
|
1706
1909
|
), this.disposeWithMe(
|
|
1707
|
-
|
|
1910
|
+
w(
|
|
1708
1911
|
n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
|
|
1709
1912
|
if (this._isEditorReadOnly(e))
|
|
1710
1913
|
return;
|
|
1711
|
-
this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(s)
|
|
1914
|
+
this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(s);
|
|
1915
|
+
const { offsetX: c, offsetY: d } = s;
|
|
1916
|
+
this._editorService.getEditor(e) && setTimeout(() => {
|
|
1917
|
+
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, d);
|
|
1918
|
+
}, 0), s.button !== 2 && o.stopPropagation();
|
|
1712
1919
|
})
|
|
1713
1920
|
)
|
|
1714
1921
|
), this.disposeWithMe(
|
|
1715
|
-
|
|
1922
|
+
w(
|
|
1716
1923
|
n == null ? void 0 : n.onDblclickObserver.add((s) => {
|
|
1717
|
-
this._textSelectionRenderManager.handleDblClick(s);
|
|
1924
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(s);
|
|
1718
1925
|
})
|
|
1719
1926
|
)
|
|
1720
1927
|
), this.disposeWithMe(
|
|
1721
|
-
|
|
1928
|
+
w(
|
|
1722
1929
|
n == null ? void 0 : n.onTripleClickObserver.add((s) => {
|
|
1723
|
-
this._textSelectionRenderManager.handleTripleClick(s);
|
|
1930
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(s);
|
|
1724
1931
|
})
|
|
1725
1932
|
)
|
|
1726
1933
|
);
|
|
@@ -1737,12 +1944,12 @@ let Ie = class extends H {
|
|
|
1737
1944
|
this._editorService.focusStyle(e);
|
|
1738
1945
|
}
|
|
1739
1946
|
_commandExecutedListener() {
|
|
1740
|
-
const e = [
|
|
1947
|
+
const e = [Qe.id];
|
|
1741
1948
|
this.disposeWithMe(
|
|
1742
1949
|
this._commandService.onCommandExecuted((t) => {
|
|
1743
1950
|
var n;
|
|
1744
1951
|
if (e.includes(t.id)) {
|
|
1745
|
-
const
|
|
1952
|
+
const i = t.params, { unitId: s } = i, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
|
|
1746
1953
|
if (s !== o)
|
|
1747
1954
|
return;
|
|
1748
1955
|
this._textSelectionManagerService.refreshSelection();
|
|
@@ -1755,10 +1962,10 @@ let Ie = class extends H {
|
|
|
1755
1962
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1756
1963
|
if (e == null)
|
|
1757
1964
|
return;
|
|
1758
|
-
const { unitId: t, skeleton: n } = e,
|
|
1759
|
-
if (
|
|
1965
|
+
const { unitId: t, skeleton: n } = e, i = this._renderManagerService.getRenderById(t);
|
|
1966
|
+
if (i == null)
|
|
1760
1967
|
return;
|
|
1761
|
-
const { scene: s, mainComponent: o } =
|
|
1968
|
+
const { scene: s, mainComponent: o } = i;
|
|
1762
1969
|
this._textSelectionRenderManager.changeRuntime(n, s, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
1763
1970
|
unitId: t,
|
|
1764
1971
|
subUnitId: ""
|
|
@@ -1767,83 +1974,83 @@ let Ie = class extends H {
|
|
|
1767
1974
|
);
|
|
1768
1975
|
}
|
|
1769
1976
|
_getDocObjectById(e) {
|
|
1770
|
-
return
|
|
1977
|
+
return Pn(e, this._renderManagerService);
|
|
1771
1978
|
}
|
|
1772
1979
|
};
|
|
1773
|
-
Ie =
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1980
|
+
Ie = Ni([
|
|
1981
|
+
L(A.Rendered, Ie),
|
|
1982
|
+
H(0, C(ne)),
|
|
1983
|
+
H(1, D),
|
|
1984
|
+
H(2, m),
|
|
1985
|
+
H(3, z),
|
|
1986
|
+
H(4, de),
|
|
1987
|
+
H(5, C(te)),
|
|
1988
|
+
H(6, N)
|
|
1782
1989
|
], Ie);
|
|
1783
|
-
var
|
|
1784
|
-
for (var
|
|
1785
|
-
(o =
|
|
1786
|
-
return n &&
|
|
1787
|
-
},
|
|
1788
|
-
const
|
|
1789
|
-
let
|
|
1790
|
-
constructor(
|
|
1791
|
-
super(), this._docSkeletonManagerService =
|
|
1990
|
+
var $i = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, Bi = (r, e, t, n) => {
|
|
1991
|
+
for (var i = n > 1 ? void 0 : n ? wi(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
1992
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
1993
|
+
return n && i && $i(e, t, i), i;
|
|
1994
|
+
}, oe = (r, e) => (t, n) => e(t, n, r);
|
|
1995
|
+
const mt = 1.5;
|
|
1996
|
+
let Me = class extends ce {
|
|
1997
|
+
constructor(r, e, t, n, i) {
|
|
1998
|
+
super(), this._docSkeletonManagerService = r, this._textSelectionManagerService = e, this._editorService = t, this._currentUniverService = n, this._renderManagerService = i, this._init();
|
|
1792
1999
|
}
|
|
1793
2000
|
_init() {
|
|
1794
|
-
this._textSelectionManagerService.textSelection$.pipe(
|
|
1795
|
-
if (
|
|
2001
|
+
this._textSelectionManagerService.textSelection$.pipe(ae(this.dispose$)).subscribe((r) => {
|
|
2002
|
+
if (r == null)
|
|
1796
2003
|
return;
|
|
1797
|
-
const { isEditing: e, unitId: t } =
|
|
2004
|
+
const { isEditing: e, unitId: t } = r;
|
|
1798
2005
|
e && this._scrollToSelection(t);
|
|
1799
2006
|
});
|
|
1800
2007
|
}
|
|
1801
2008
|
// Let the selection show on the current screen.
|
|
1802
|
-
_scrollToSelection(
|
|
1803
|
-
var
|
|
1804
|
-
const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (
|
|
2009
|
+
_scrollToSelection(r) {
|
|
2010
|
+
var x;
|
|
2011
|
+
const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (x = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : x.skeleton;
|
|
1805
2012
|
if (e == null || t == null || n == null)
|
|
1806
2013
|
return;
|
|
1807
|
-
const { collapsed:
|
|
1808
|
-
if (!
|
|
2014
|
+
const { collapsed: i, startNodePosition: s } = e;
|
|
2015
|
+
if (!i)
|
|
1809
2016
|
return;
|
|
1810
|
-
const o = t.document.getOffsetConfig(), { docsLeft:
|
|
1811
|
-
if (
|
|
2017
|
+
const o = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = o, d = new Fn(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: h, top: p, height: g } = jn(u), f = h + a, l = p + c, _ = t.scene.getViewport(Ae.VIEW_MAIN), O = !!this._editorService.getEditor(r);
|
|
2018
|
+
if (_ == null)
|
|
1812
2019
|
return;
|
|
1813
2020
|
const {
|
|
1814
|
-
left:
|
|
1815
|
-
top:
|
|
1816
|
-
right:
|
|
1817
|
-
bottom:
|
|
1818
|
-
} =
|
|
2021
|
+
left: y,
|
|
2022
|
+
top: B,
|
|
2023
|
+
right: F,
|
|
2024
|
+
bottom: j
|
|
2025
|
+
} = _.getBounding().viewBound;
|
|
1819
2026
|
let X = 0, G = 0;
|
|
1820
|
-
const he =
|
|
1821
|
-
|
|
1822
|
-
const
|
|
1823
|
-
|
|
2027
|
+
const he = O ? 0 : 100;
|
|
2028
|
+
l < B ? X = l - B : l > j - g && (X = l - j + g + he), f < y ? G = f - y : f > F - mt && (G = f - F + mt);
|
|
2029
|
+
const ge = _.getBarScroll(G, X);
|
|
2030
|
+
_.scrollBy(ge);
|
|
1824
2031
|
}
|
|
1825
2032
|
_getDocObject() {
|
|
1826
|
-
return
|
|
2033
|
+
return It(this._currentUniverService, this._renderManagerService);
|
|
1827
2034
|
}
|
|
1828
2035
|
};
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
],
|
|
1837
|
-
var
|
|
1838
|
-
for (var
|
|
1839
|
-
(o =
|
|
1840
|
-
return n &&
|
|
1841
|
-
},
|
|
1842
|
-
let
|
|
1843
|
-
constructor(
|
|
1844
|
-
super(
|
|
1845
|
-
zhCN:
|
|
1846
|
-
}), this._config =
|
|
2036
|
+
Me = Bi([
|
|
2037
|
+
L(A.Rendered, Me),
|
|
2038
|
+
oe(0, C(ne)),
|
|
2039
|
+
oe(1, C(te)),
|
|
2040
|
+
oe(2, N),
|
|
2041
|
+
oe(3, D),
|
|
2042
|
+
oe(4, z)
|
|
2043
|
+
], Me);
|
|
2044
|
+
var Fi = Object.defineProperty, ji = Object.getOwnPropertyDescriptor, Wi = (r, e, t, n) => {
|
|
2045
|
+
for (var i = n > 1 ? void 0 : n ? ji(e, t) : e, s = r.length - 1, o; s >= 0; s--)
|
|
2046
|
+
(o = r[s]) && (i = (n ? o(e, t, i) : o(i)) || i);
|
|
2047
|
+
return n && i && Fi(e, t, i), i;
|
|
2048
|
+
}, ze = (r, e) => (t, n) => e(t, n, r), Ve;
|
|
2049
|
+
let vt = (Ve = class extends Ht {
|
|
2050
|
+
constructor(r, e, t, n) {
|
|
2051
|
+
super(Xn), this._config = r, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
|
|
2052
|
+
zhCN: jr
|
|
2053
|
+
}), this._config = Ze.deepMerge({}, Yn, this._config), this._initDependencies(e), this._initializeCommands();
|
|
1847
2054
|
}
|
|
1848
2055
|
onRendered() {
|
|
1849
2056
|
this._initModules(), this._markDocAsFocused();
|
|
@@ -1852,78 +2059,78 @@ let ht = (Be = class extends wt {
|
|
|
1852
2059
|
}
|
|
1853
2060
|
_initializeCommands() {
|
|
1854
2061
|
[
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
].forEach((
|
|
1868
|
-
this._injector.get(
|
|
2062
|
+
Zn,
|
|
2063
|
+
qn,
|
|
2064
|
+
Jn,
|
|
2065
|
+
Kn,
|
|
2066
|
+
Qn,
|
|
2067
|
+
er,
|
|
2068
|
+
tr,
|
|
2069
|
+
nr,
|
|
2070
|
+
rr,
|
|
2071
|
+
zr,
|
|
2072
|
+
Vr,
|
|
2073
|
+
Wr
|
|
2074
|
+
].forEach((r) => {
|
|
2075
|
+
this._injector.get(dn).registerShortcut(r);
|
|
1869
2076
|
});
|
|
1870
2077
|
}
|
|
1871
|
-
_initDependencies(
|
|
2078
|
+
_initDependencies(r) {
|
|
1872
2079
|
[
|
|
1873
2080
|
// Controller
|
|
1874
|
-
[fe],
|
|
1875
2081
|
[Se],
|
|
1876
2082
|
[me],
|
|
1877
2083
|
[ve],
|
|
1878
|
-
[
|
|
2084
|
+
[Ce],
|
|
1879
2085
|
[Re],
|
|
2086
|
+
[Te],
|
|
1880
2087
|
[be],
|
|
1881
2088
|
[Ie],
|
|
1882
|
-
[
|
|
2089
|
+
[Me],
|
|
1883
2090
|
[
|
|
1884
2091
|
// controllers
|
|
1885
|
-
|
|
2092
|
+
se,
|
|
1886
2093
|
{
|
|
1887
|
-
useFactory: () => this._injector.createInstance(
|
|
2094
|
+
useFactory: () => this._injector.createInstance(se, this._config)
|
|
1888
2095
|
}
|
|
1889
2096
|
],
|
|
1890
2097
|
[
|
|
1891
2098
|
ue,
|
|
1892
2099
|
{
|
|
1893
|
-
useClass:
|
|
2100
|
+
useClass: Ye
|
|
1894
2101
|
}
|
|
1895
2102
|
],
|
|
1896
2103
|
// Render views
|
|
1897
|
-
[
|
|
2104
|
+
[Oe]
|
|
1898
2105
|
].forEach((t) => {
|
|
1899
|
-
|
|
2106
|
+
r.add(t);
|
|
1900
2107
|
});
|
|
1901
2108
|
}
|
|
1902
2109
|
_markDocAsFocused() {
|
|
1903
|
-
const
|
|
2110
|
+
const r = this._injector.get(D), e = this._injector.get(N);
|
|
1904
2111
|
try {
|
|
1905
|
-
const t =
|
|
1906
|
-
e.isEditor(n) ||
|
|
2112
|
+
const t = r.getCurrentUniverDocInstance(), n = t.getUnitId();
|
|
2113
|
+
e.isEditor(n) || r.focusUniverInstance(t.getUnitId());
|
|
1907
2114
|
} catch (t) {
|
|
1908
2115
|
this._logService.warn(t);
|
|
1909
2116
|
}
|
|
1910
2117
|
}
|
|
1911
2118
|
_initModules() {
|
|
1912
|
-
this._injector.get(
|
|
1913
|
-
}
|
|
1914
|
-
}, S(
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
],
|
|
2119
|
+
this._injector.get(se);
|
|
2120
|
+
}
|
|
2121
|
+
}, S(Ve, "type", Yt.Doc), Ve);
|
|
2122
|
+
vt = Wi([
|
|
2123
|
+
ze(1, C(De)),
|
|
2124
|
+
ze(2, C(Ge)),
|
|
2125
|
+
ze(3, Ot)
|
|
2126
|
+
], vt);
|
|
1920
2127
|
export {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2128
|
+
Xn as DOC_UI_PLUGIN_NAME,
|
|
2129
|
+
Hn as DefaultDocContainerConfig,
|
|
2130
|
+
Yn as DefaultDocUiConfig,
|
|
2131
|
+
kn as DefaultToolbarConfig,
|
|
2132
|
+
Oe as DocCanvasView,
|
|
2133
|
+
vt as UniverDocsUIPlugin,
|
|
2134
|
+
Ji as enUS,
|
|
2135
|
+
jr as zhCN
|
|
1929
2136
|
};
|