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