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