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