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