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