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