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