@univerjs/docs-ui 0.1.8 → 0.1.10
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/es/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var Bt = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { FOCUSING_DOC as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { KeyCode as
|
|
7
|
-
import { MoveCursorOperation as
|
|
8
|
-
import { connectInjector as
|
|
9
|
-
import { ITextSelectionRenderManager as
|
|
2
|
+
var $t = (i, e, t) => e in i ? Bt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var f = (i, e, t) => ($t(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { FOCUSING_DOC as De, FOCUSING_UNIVER_EDITOR as Ke, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as Ft, Direction as V, EDITOR_ACTIVATED as Tt, LocaleService as Ze, RxDisposable as le, ICommandService as v, BooleanNumber as C, UniverInstanceType as m, BaselineOffset as J, ThemeService as It, HorizontalAlign as Pe, IUniverInstanceService as U, Disposable as ee, OnLifecycle as L, LifecycleStages as B, Tools as qe, LRUMap as wt, ColorKit as ot, toDisposable as j, ILogService as bt, CommandType as Je, IContextService as jt, checkForSubstrings as Vt, IConfigService as Wt, PositionedObjectLayoutType as kt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as zt, IFloatingObjectManagerService as Ht, Plugin as Yt } from "@univerjs/core";
|
|
5
|
+
import { Inject as R, Injector as Ue, Optional as Gt, createIdentifier as Xt } from "@wendellhu/redi";
|
|
6
|
+
import { KeyCode as D, MetaKeys as de, ILayoutService as yt, MenuGroup as I, MenuItemType as T, MenuPosition as b, getMenuHiddenObservable as y, FONT_FAMILY_LIST as st, FONT_SIZE_LIST as Kt, FontFamily as Zt, FontFamilyItem as qt, FontSize as Jt, DesktopUIPart as Qt, ComponentManager as en, IEditorService as $, IMenuService as tn, IUIController as nn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as rn, HTML_CLIPBOARD_MIME_TYPE as on, IClipboardInterfaceService as Qe, CopyCommand as sn, CutCommand as an, PasteCommand as cn, SetEditorResizeOperation as ln, IShortcutService as dn } from "@univerjs/ui";
|
|
7
|
+
import { MoveCursorOperation as Ne, MoveSelectionOperation as Ae, SelectAllOperation as un, SetInlineFormatBoldCommand as hn, SetTextSelectionsOperation as P, SetInlineFormatCommand as te, SetInlineFormatItalicCommand as gn, SetInlineFormatUnderlineCommand as _n, SetInlineFormatStrikethroughCommand as pn, SetInlineFormatSubscriptCommand as fn, SetInlineFormatSuperscriptCommand as mn, SetInlineFormatFontFamilyCommand as at, SetInlineFormatFontSizeCommand as ct, SetInlineFormatTextColorCommand as lt, AlignLeftCommand as Sn, AlignOperationCommand as Le, AlignCenterCommand as vn, AlignRightCommand as Cn, AlignJustifyCommand as On, OrderListCommand as Rn, BulletListCommand as Tn, ResetInlineFormatTextBackgroundColorCommand as In, SetInlineFormatTextBackgroundColorCommand as He, TextSelectionManagerService as ne, BreakLineCommand as bn, DeleteLeftCommand as yn, DeleteRightCommand as Mn, CutContentCommand as Mt, InnerPasteCommand as Et, VIEWPORT_KEY as Be, CoverContentCommand as En, RichTextEditingMutation as et, DocSkeletonManagerService as ie, DOCS_VIEW_KEY as q, DOCS_COMPONENT_MAIN_LAYER_INDEX as We, DOCS_COMPONENT_HEADER_LAYER_INDEX as xn, DOCS_COMPONENT_DEFAULT_Z_INDEX as dt, DOCS_COMPONENT_BACKGROUND_LAYER_INDEX as Dn, SetDocZoomRatioOperation as tt, SetDocZoomRatioCommand as Pn, getDocObject as xt, getDocObjectById as Un } from "@univerjs/docs";
|
|
8
|
+
import { connectInjector as Nn } from "@wendellhu/redi/react-bindings";
|
|
9
|
+
import { ITextSelectionRenderManager as ue, pixelToPt as An, ptToPixel as ut, ScrollBar as Ye, IRenderManagerService as H, PageLayoutType as ht, Viewport as Ln, EVENT_TYPE as Bn, Layer as gt, Documents as $n, DocBackground as Fn, Liquid as wn, CURSOR_TYPE as _t, NodePositionConvertToCursor as jn, getAnchorBounding as Vn } from "@univerjs/engine-render";
|
|
10
10
|
import Wn from "react";
|
|
11
|
-
import { Observable as
|
|
12
|
-
import { ColorPicker as
|
|
11
|
+
import { Observable as M, takeUntil as ce, fromEvent as pt, BehaviorSubject as kn } from "rxjs";
|
|
12
|
+
import { ColorPicker as zn } from "@univerjs/design";
|
|
13
13
|
const Hn = {
|
|
14
14
|
undo: !0,
|
|
15
15
|
redo: !0,
|
|
@@ -51,89 +51,89 @@ const Hn = {
|
|
|
51
51
|
frozenContent: !1,
|
|
52
52
|
infoBar: !0,
|
|
53
53
|
toolbar: !0
|
|
54
|
-
},
|
|
54
|
+
}, Gn = {
|
|
55
55
|
layout: {
|
|
56
56
|
docContainerConfig: Yn,
|
|
57
57
|
toolbarConfig: Hn
|
|
58
58
|
}
|
|
59
|
-
},
|
|
60
|
-
function
|
|
61
|
-
return i.getContextValue(
|
|
59
|
+
}, Xn = "DocUI";
|
|
60
|
+
function A(i) {
|
|
61
|
+
return i.getContextValue(De) && i.getContextValue(Ke);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
return i.getContextValue(
|
|
63
|
+
function Kn(i) {
|
|
64
|
+
return i.getContextValue(De) && i.getContextValue(Ke) && !i.getContextValue(Ft);
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
id:
|
|
68
|
-
binding:
|
|
69
|
-
preconditions:
|
|
66
|
+
const Zn = {
|
|
67
|
+
id: Ne.id,
|
|
68
|
+
binding: D.ARROW_UP,
|
|
69
|
+
preconditions: A,
|
|
70
70
|
staticParameters: {
|
|
71
71
|
direction: V.UP
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
id:
|
|
75
|
-
binding:
|
|
76
|
-
preconditions:
|
|
73
|
+
}, qn = {
|
|
74
|
+
id: Ne.id,
|
|
75
|
+
binding: D.ARROW_DOWN,
|
|
76
|
+
preconditions: A,
|
|
77
77
|
staticParameters: {
|
|
78
78
|
direction: V.DOWN
|
|
79
79
|
}
|
|
80
80
|
}, Jn = {
|
|
81
|
-
id:
|
|
82
|
-
binding:
|
|
83
|
-
preconditions:
|
|
81
|
+
id: Ne.id,
|
|
82
|
+
binding: D.ARROW_LEFT,
|
|
83
|
+
preconditions: A,
|
|
84
84
|
staticParameters: {
|
|
85
85
|
direction: V.LEFT
|
|
86
86
|
}
|
|
87
87
|
}, Qn = {
|
|
88
|
-
id:
|
|
89
|
-
binding:
|
|
90
|
-
preconditions:
|
|
88
|
+
id: Ne.id,
|
|
89
|
+
binding: D.ARROW_RIGHT,
|
|
90
|
+
preconditions: A,
|
|
91
91
|
staticParameters: {
|
|
92
92
|
direction: V.RIGHT
|
|
93
93
|
}
|
|
94
94
|
}, ei = {
|
|
95
|
-
id:
|
|
96
|
-
binding:
|
|
97
|
-
preconditions:
|
|
95
|
+
id: Ae.id,
|
|
96
|
+
binding: D.ARROW_UP | de.SHIFT,
|
|
97
|
+
preconditions: A,
|
|
98
98
|
staticParameters: {
|
|
99
99
|
direction: V.UP
|
|
100
100
|
}
|
|
101
101
|
}, ti = {
|
|
102
|
-
id:
|
|
103
|
-
binding:
|
|
104
|
-
preconditions:
|
|
102
|
+
id: Ae.id,
|
|
103
|
+
binding: D.ARROW_DOWN | de.SHIFT,
|
|
104
|
+
preconditions: A,
|
|
105
105
|
staticParameters: {
|
|
106
106
|
direction: V.DOWN
|
|
107
107
|
}
|
|
108
108
|
}, ni = {
|
|
109
|
-
id:
|
|
110
|
-
binding:
|
|
111
|
-
preconditions:
|
|
109
|
+
id: Ae.id,
|
|
110
|
+
binding: D.ARROW_LEFT | de.SHIFT,
|
|
111
|
+
preconditions: A,
|
|
112
112
|
staticParameters: {
|
|
113
113
|
direction: V.LEFT
|
|
114
114
|
}
|
|
115
115
|
}, ii = {
|
|
116
|
-
id:
|
|
117
|
-
binding:
|
|
118
|
-
preconditions:
|
|
116
|
+
id: Ae.id,
|
|
117
|
+
binding: D.ARROW_RIGHT | de.SHIFT,
|
|
118
|
+
preconditions: A,
|
|
119
119
|
staticParameters: {
|
|
120
120
|
direction: V.RIGHT
|
|
121
121
|
}
|
|
122
122
|
}, ri = {
|
|
123
123
|
id: un.id,
|
|
124
|
-
binding:
|
|
125
|
-
preconditions: (i) => i.getContextValue(
|
|
124
|
+
binding: D.A | de.CTRL_COMMAND,
|
|
125
|
+
preconditions: (i) => i.getContextValue(Ke) && (i.getContextValue(De) || i.getContextValue(Tt))
|
|
126
126
|
};
|
|
127
127
|
var oi = Object.defineProperty, si = Object.getOwnPropertyDescriptor, ai = (i, e, t, n) => {
|
|
128
128
|
for (var r = n > 1 ? void 0 : n ? si(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
129
129
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
130
130
|
return n && r && oi(e, t, r), r;
|
|
131
|
-
},
|
|
132
|
-
let
|
|
131
|
+
}, ft = (i, e) => (t, n) => e(t, n, i);
|
|
132
|
+
let Ge = class {
|
|
133
133
|
constructor(i, e, t) {
|
|
134
|
-
|
|
134
|
+
f(this, "_docContainer");
|
|
135
135
|
// 获取SheetContainer组件
|
|
136
|
-
|
|
136
|
+
f(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 Ye = class {
|
|
|
144
144
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
145
145
|
*
|
|
146
146
|
*/
|
|
147
|
-
|
|
147
|
+
f(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 Ye = class {
|
|
|
168
168
|
return this._docContainer;
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
],
|
|
171
|
+
Ge = ai([
|
|
172
|
+
ft(1, R(Ze)),
|
|
173
|
+
ft(2, R(Ue))
|
|
174
|
+
], Ge);
|
|
175
175
|
var ci = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (i, e, t, n) => {
|
|
176
176
|
for (var r = n > 1 ? void 0 : n ? li(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
177
177
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
178
178
|
return n && r && ci(e, t, r), r;
|
|
179
|
-
},
|
|
180
|
-
let
|
|
179
|
+
}, fe = (i, e) => (t, n) => e(t, n, i);
|
|
180
|
+
let ae = class extends le {
|
|
181
181
|
constructor(e, t, n, r, s) {
|
|
182
182
|
super();
|
|
183
|
-
|
|
183
|
+
f(this, "_docContainerController");
|
|
184
184
|
/**
|
|
185
185
|
* Change language
|
|
186
186
|
* @param {string} locale new language
|
|
@@ -188,10 +188,10 @@ let se = class extends ce {
|
|
|
188
188
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
189
189
|
*
|
|
190
190
|
*/
|
|
191
|
-
|
|
191
|
+
f(this, "changeLocale", (e) => {
|
|
192
192
|
this._localeService.setLocale(e);
|
|
193
193
|
});
|
|
194
|
-
this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService = s, this._docContainerController = this._injector.createInstance(
|
|
194
|
+
this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService = s, this._docContainerController = this._injector.createInstance(Ge, e), this._registerContainer();
|
|
195
195
|
}
|
|
196
196
|
_registerContainer() {
|
|
197
197
|
this._layoutService && this.disposeWithMe(
|
|
@@ -203,14 +203,14 @@ let se = class extends ce {
|
|
|
203
203
|
return this._docContainerController;
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
],
|
|
212
|
-
const $e = "UI_PLUGIN_DOCS",
|
|
213
|
-
var
|
|
206
|
+
ae = di([
|
|
207
|
+
fe(1, R(Ze)),
|
|
208
|
+
fe(2, R(Ue)),
|
|
209
|
+
fe(3, ue),
|
|
210
|
+
fe(4, Gt(yt))
|
|
211
|
+
], ae);
|
|
212
|
+
const $e = "UI_PLUGIN_DOCS", nt = `${$e}_COLOR_PICKER_COMPONENT`, Dt = `${$e}_FONT_FAMILY_COMPONENT`, Pt = `${$e}_FONT_FAMILY_ITEM_COMPONENT`, Ut = `${$e}_FONT_SIZE_COMPONENT`;
|
|
213
|
+
var Nt = { exports: {} }, Fe = {};
|
|
214
214
|
/**
|
|
215
215
|
* @license React
|
|
216
216
|
* react-jsx-runtime.production.min.js
|
|
@@ -221,7 +221,7 @@ var Ut = { exports: {} }, Be = {};
|
|
|
221
221
|
* LICENSE file in the root directory of this source tree.
|
|
222
222
|
*/
|
|
223
223
|
var ui = Wn, hi = Symbol.for("react.element"), gi = Symbol.for("react.fragment"), _i = Object.prototype.hasOwnProperty, pi = ui.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, fi = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
224
|
-
function
|
|
224
|
+
function At(i, e, t) {
|
|
225
225
|
var n, r = {}, s = null, o = null;
|
|
226
226
|
t !== void 0 && (s = "" + t), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
|
|
227
227
|
for (n in e)
|
|
@@ -231,11 +231,11 @@ function Lt(i, e, t) {
|
|
|
231
231
|
r[n] === void 0 && (r[n] = e[n]);
|
|
232
232
|
return { $$typeof: hi, type: i, key: s, ref: o, props: r, _owner: pi.current };
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var mi =
|
|
234
|
+
Fe.Fragment = gi;
|
|
235
|
+
Fe.jsx = At;
|
|
236
|
+
Fe.jsxs = At;
|
|
237
|
+
Nt.exports = Fe;
|
|
238
|
+
var mi = Nt.exports;
|
|
239
239
|
const Si = "univer-docs-ui-canvas-background", vi = {
|
|
240
240
|
docsUiCanvasBackground: Si
|
|
241
241
|
}, Ci = () => /* @__PURE__ */ mi.jsx("div", { className: vi.docsUiCanvasBackground });
|
|
@@ -249,12 +249,12 @@ function Oi(i) {
|
|
|
249
249
|
title: "Set bold",
|
|
250
250
|
tooltip: "toolbar.bold",
|
|
251
251
|
positions: [b.TOOLBAR_START],
|
|
252
|
-
activated$: new
|
|
252
|
+
activated$: new M((t) => {
|
|
253
253
|
const n = e.onCommandExecuted((r) => {
|
|
254
254
|
var o;
|
|
255
255
|
const s = r.id;
|
|
256
|
-
if (s ===
|
|
257
|
-
const a =
|
|
256
|
+
if (s === P.id || s === te.id) {
|
|
257
|
+
const a = W(i);
|
|
258
258
|
if (a == null)
|
|
259
259
|
return;
|
|
260
260
|
const c = (o = a.ts) == null ? void 0 : o.bl;
|
|
@@ -263,7 +263,7 @@ function Oi(i) {
|
|
|
263
263
|
});
|
|
264
264
|
return t.next(!1), n.dispose;
|
|
265
265
|
}),
|
|
266
|
-
hidden$:
|
|
266
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
function Ri(i) {
|
|
@@ -276,12 +276,12 @@ function Ri(i) {
|
|
|
276
276
|
title: "Set italic",
|
|
277
277
|
tooltip: "toolbar.italic",
|
|
278
278
|
positions: [b.TOOLBAR_START],
|
|
279
|
-
activated$: new
|
|
279
|
+
activated$: new M((t) => {
|
|
280
280
|
const n = e.onCommandExecuted((r) => {
|
|
281
281
|
var o;
|
|
282
282
|
const s = r.id;
|
|
283
|
-
if (s ===
|
|
284
|
-
const a =
|
|
283
|
+
if (s === P.id || s === te.id) {
|
|
284
|
+
const a = W(i);
|
|
285
285
|
if (a == null)
|
|
286
286
|
return;
|
|
287
287
|
const c = (o = a.ts) == null ? void 0 : o.it;
|
|
@@ -290,7 +290,7 @@ function Ri(i) {
|
|
|
290
290
|
});
|
|
291
291
|
return t.next(!1), n.dispose;
|
|
292
292
|
}),
|
|
293
|
-
hidden$:
|
|
293
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
296
|
function Ti(i) {
|
|
@@ -303,12 +303,12 @@ function Ti(i) {
|
|
|
303
303
|
title: "Set underline",
|
|
304
304
|
tooltip: "toolbar.underline",
|
|
305
305
|
positions: [b.TOOLBAR_START],
|
|
306
|
-
activated$: new
|
|
306
|
+
activated$: new M((t) => {
|
|
307
307
|
const n = e.onCommandExecuted((r) => {
|
|
308
308
|
var o;
|
|
309
309
|
const s = r.id;
|
|
310
|
-
if (s ===
|
|
311
|
-
const a =
|
|
310
|
+
if (s === P.id || s === te.id) {
|
|
311
|
+
const a = W(i);
|
|
312
312
|
if (a == null)
|
|
313
313
|
return;
|
|
314
314
|
const c = (o = a.ts) == null ? void 0 : o.ul;
|
|
@@ -317,7 +317,7 @@ function Ti(i) {
|
|
|
317
317
|
});
|
|
318
318
|
return t.next(!1), n.dispose;
|
|
319
319
|
}),
|
|
320
|
-
hidden$:
|
|
320
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
function Ii(i) {
|
|
@@ -330,12 +330,12 @@ function Ii(i) {
|
|
|
330
330
|
title: "Set strike through",
|
|
331
331
|
tooltip: "toolbar.strikethrough",
|
|
332
332
|
positions: [b.TOOLBAR_START],
|
|
333
|
-
activated$: new
|
|
333
|
+
activated$: new M((t) => {
|
|
334
334
|
const n = e.onCommandExecuted((r) => {
|
|
335
335
|
var o;
|
|
336
336
|
const s = r.id;
|
|
337
|
-
if (s ===
|
|
338
|
-
const a =
|
|
337
|
+
if (s === P.id || s === te.id) {
|
|
338
|
+
const a = W(i);
|
|
339
339
|
if (a == null)
|
|
340
340
|
return;
|
|
341
341
|
const c = (o = a.ts) == null ? void 0 : o.st;
|
|
@@ -344,7 +344,7 @@ function Ii(i) {
|
|
|
344
344
|
});
|
|
345
345
|
return t.next(!1), n.dispose;
|
|
346
346
|
}),
|
|
347
|
-
hidden$:
|
|
347
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
350
|
function bi(i) {
|
|
@@ -356,12 +356,12 @@ function bi(i) {
|
|
|
356
356
|
icon: "SubscriptSingle",
|
|
357
357
|
tooltip: "toolbar.subscript",
|
|
358
358
|
positions: [b.TOOLBAR_START],
|
|
359
|
-
activated$: new
|
|
359
|
+
activated$: new M((t) => {
|
|
360
360
|
const n = e.onCommandExecuted((r) => {
|
|
361
361
|
var o;
|
|
362
362
|
const s = r.id;
|
|
363
|
-
if (s ===
|
|
364
|
-
const a =
|
|
363
|
+
if (s === P.id || s === te.id) {
|
|
364
|
+
const a = W(i);
|
|
365
365
|
if (a == null)
|
|
366
366
|
return;
|
|
367
367
|
const c = (o = a.ts) == null ? void 0 : o.va;
|
|
@@ -370,10 +370,10 @@ function bi(i) {
|
|
|
370
370
|
});
|
|
371
371
|
return t.next(!1), n.dispose;
|
|
372
372
|
}),
|
|
373
|
-
hidden$:
|
|
373
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function yi(i) {
|
|
377
377
|
const e = i.get(v);
|
|
378
378
|
return {
|
|
379
379
|
id: mn.id,
|
|
@@ -382,12 +382,12 @@ function Mi(i) {
|
|
|
382
382
|
icon: "SuperscriptSingle",
|
|
383
383
|
tooltip: "toolbar.superscript",
|
|
384
384
|
positions: [b.TOOLBAR_START],
|
|
385
|
-
activated$: new
|
|
385
|
+
activated$: new M((t) => {
|
|
386
386
|
const n = e.onCommandExecuted((r) => {
|
|
387
387
|
var o;
|
|
388
388
|
const s = r.id;
|
|
389
|
-
if (s ===
|
|
390
|
-
const a =
|
|
389
|
+
if (s === P.id || s === te.id) {
|
|
390
|
+
const a = W(i);
|
|
391
391
|
if (a == null)
|
|
392
392
|
return;
|
|
393
393
|
const c = (o = a.ts) == null ? void 0 : o.va;
|
|
@@ -396,32 +396,32 @@ function Mi(i) {
|
|
|
396
396
|
});
|
|
397
397
|
return t.next(!1), n.dispose;
|
|
398
398
|
}),
|
|
399
|
-
hidden$:
|
|
399
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Mi(i) {
|
|
403
403
|
const e = i.get(v);
|
|
404
404
|
return {
|
|
405
|
-
id:
|
|
405
|
+
id: at.id,
|
|
406
406
|
tooltip: "toolbar.font",
|
|
407
407
|
group: I.TOOLBAR_FORMAT,
|
|
408
408
|
type: T.SELECTOR,
|
|
409
|
-
label:
|
|
409
|
+
label: Dt,
|
|
410
410
|
positions: [b.TOOLBAR_START],
|
|
411
|
-
selections:
|
|
411
|
+
selections: st.map((t) => ({
|
|
412
412
|
label: {
|
|
413
|
-
name:
|
|
413
|
+
name: Pt,
|
|
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 M((t) => {
|
|
420
|
+
const n = st[0].value, r = e.onCommandExecuted((s) => {
|
|
421
421
|
var a;
|
|
422
422
|
const o = s.id;
|
|
423
|
-
if (o ===
|
|
424
|
-
const c =
|
|
423
|
+
if (o === P.id || o === at.id) {
|
|
424
|
+
const c = W(i);
|
|
425
425
|
if (c == null)
|
|
426
426
|
return;
|
|
427
427
|
const d = (a = c.ts) == null ? void 0 : a.ff;
|
|
@@ -430,18 +430,18 @@ function yi(i) {
|
|
|
430
430
|
});
|
|
431
431
|
return t.next(n), r.dispose;
|
|
432
432
|
}),
|
|
433
|
-
hidden$:
|
|
433
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
436
|
function Ei(i) {
|
|
437
437
|
const e = i.get(v);
|
|
438
438
|
return {
|
|
439
|
-
id:
|
|
439
|
+
id: ct.id,
|
|
440
440
|
group: I.TOOLBAR_FORMAT,
|
|
441
441
|
type: T.SELECTOR,
|
|
442
442
|
tooltip: "toolbar.fontSize",
|
|
443
443
|
label: {
|
|
444
|
-
name:
|
|
444
|
+
name: Ut,
|
|
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: Kt,
|
|
453
453
|
// disabled$,
|
|
454
|
-
value$: new
|
|
454
|
+
value$: new M((t) => {
|
|
455
455
|
const r = e.onCommandExecuted((s) => {
|
|
456
456
|
var a;
|
|
457
457
|
const o = s.id;
|
|
458
|
-
if (o ===
|
|
459
|
-
const c =
|
|
458
|
+
if (o === P.id || o === ct.id) {
|
|
459
|
+
const c = W(i);
|
|
460
460
|
if (c == null)
|
|
461
461
|
return;
|
|
462
462
|
const d = (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$: y(i, m.UNIVER_DOC)
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
471
|
function xi(i) {
|
|
472
|
-
const e = i.get(v), t = i.get(
|
|
472
|
+
const e = i.get(v), t = i.get(It);
|
|
473
473
|
return {
|
|
474
|
-
id:
|
|
474
|
+
id: lt.id,
|
|
475
475
|
icon: "FontColor",
|
|
476
476
|
tooltip: "toolbar.textColor.main",
|
|
477
477
|
group: I.TOOLBAR_FORMAT,
|
|
@@ -480,21 +480,21 @@ function xi(i) {
|
|
|
480
480
|
selections: [
|
|
481
481
|
{
|
|
482
482
|
label: {
|
|
483
|
-
name:
|
|
483
|
+
name: nt,
|
|
484
484
|
hoverable: !1
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
],
|
|
488
|
-
value$: new
|
|
488
|
+
value$: new M((n) => {
|
|
489
489
|
const r = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
|
|
490
|
-
if (o.id ===
|
|
490
|
+
if (o.id === lt.id) {
|
|
491
491
|
const a = o.params.value;
|
|
492
492
|
n.next(a != null ? a : r);
|
|
493
493
|
}
|
|
494
494
|
});
|
|
495
495
|
return n.next(r), s.dispose;
|
|
496
496
|
}),
|
|
497
|
-
hidden$:
|
|
497
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
498
498
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
499
499
|
};
|
|
500
500
|
}
|
|
@@ -507,21 +507,21 @@ function Di(i) {
|
|
|
507
507
|
icon: "LeftJustifyingSingle",
|
|
508
508
|
tooltip: "toolbar.alignLeft",
|
|
509
509
|
positions: [b.TOOLBAR_START],
|
|
510
|
-
activated$: new
|
|
510
|
+
activated$: new M((t) => {
|
|
511
511
|
const n = e.onCommandExecuted((r) => {
|
|
512
512
|
var o;
|
|
513
513
|
const s = r.id;
|
|
514
|
-
if (s ===
|
|
515
|
-
const a =
|
|
514
|
+
if (s === P.id || s === Le.id) {
|
|
515
|
+
const a = we(i);
|
|
516
516
|
if (a == null)
|
|
517
517
|
return;
|
|
518
518
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
519
|
-
t.next(c ===
|
|
519
|
+
t.next(c === Pe.LEFT);
|
|
520
520
|
}
|
|
521
521
|
});
|
|
522
522
|
return t.next(!1), n.dispose;
|
|
523
523
|
}),
|
|
524
|
-
hidden$:
|
|
524
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
527
|
function Pi(i) {
|
|
@@ -533,21 +533,21 @@ function Pi(i) {
|
|
|
533
533
|
icon: "HorizontallySingle",
|
|
534
534
|
tooltip: "toolbar.alignCenter",
|
|
535
535
|
positions: [b.TOOLBAR_START],
|
|
536
|
-
activated$: new
|
|
536
|
+
activated$: new M((t) => {
|
|
537
537
|
const n = e.onCommandExecuted((r) => {
|
|
538
538
|
var o;
|
|
539
539
|
const s = r.id;
|
|
540
|
-
if (s ===
|
|
541
|
-
const a =
|
|
540
|
+
if (s === P.id || s === Le.id) {
|
|
541
|
+
const a = we(i);
|
|
542
542
|
if (a == null)
|
|
543
543
|
return;
|
|
544
544
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
545
|
-
t.next(c ===
|
|
545
|
+
t.next(c === Pe.CENTER);
|
|
546
546
|
}
|
|
547
547
|
});
|
|
548
548
|
return t.next(!1), n.dispose;
|
|
549
549
|
}),
|
|
550
|
-
hidden$:
|
|
550
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
553
|
function Ui(i) {
|
|
@@ -559,24 +559,24 @@ function Ui(i) {
|
|
|
559
559
|
icon: "RightJustifyingSingle",
|
|
560
560
|
tooltip: "toolbar.alignRight",
|
|
561
561
|
positions: [b.TOOLBAR_START],
|
|
562
|
-
activated$: new
|
|
562
|
+
activated$: new M((t) => {
|
|
563
563
|
const n = e.onCommandExecuted((r) => {
|
|
564
564
|
var o;
|
|
565
565
|
const s = r.id;
|
|
566
|
-
if (s ===
|
|
567
|
-
const a =
|
|
566
|
+
if (s === P.id || s === Le.id) {
|
|
567
|
+
const a = we(i);
|
|
568
568
|
if (a == null)
|
|
569
569
|
return;
|
|
570
570
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
571
|
-
t.next(c ===
|
|
571
|
+
t.next(c === Pe.RIGHT);
|
|
572
572
|
}
|
|
573
573
|
});
|
|
574
574
|
return t.next(!1), n.dispose;
|
|
575
575
|
}),
|
|
576
|
-
hidden$:
|
|
576
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function Ni(i) {
|
|
580
580
|
const e = i.get(v);
|
|
581
581
|
return {
|
|
582
582
|
id: On.id,
|
|
@@ -585,24 +585,24 @@ function Li(i) {
|
|
|
585
585
|
icon: "AlignTextBothSingle",
|
|
586
586
|
tooltip: "toolbar.alignJustify",
|
|
587
587
|
positions: [b.TOOLBAR_START],
|
|
588
|
-
activated$: new
|
|
588
|
+
activated$: new M((t) => {
|
|
589
589
|
const n = e.onCommandExecuted((r) => {
|
|
590
590
|
var o;
|
|
591
591
|
const s = r.id;
|
|
592
|
-
if (s ===
|
|
593
|
-
const a =
|
|
592
|
+
if (s === P.id || s === Le.id) {
|
|
593
|
+
const a = we(i);
|
|
594
594
|
if (a == null)
|
|
595
595
|
return;
|
|
596
596
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
597
|
-
t.next(c ===
|
|
597
|
+
t.next(c === Pe.JUSTIFIED);
|
|
598
598
|
}
|
|
599
599
|
});
|
|
600
600
|
return t.next(!1), n.dispose;
|
|
601
601
|
}),
|
|
602
|
-
hidden$:
|
|
602
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function Ai(i) {
|
|
606
606
|
return {
|
|
607
607
|
id: Rn.id,
|
|
608
608
|
group: I.TOOLBAR_LAYOUT,
|
|
@@ -610,10 +610,10 @@ function Ni(i) {
|
|
|
610
610
|
icon: "OrderSingle",
|
|
611
611
|
tooltip: "toolbar.order",
|
|
612
612
|
positions: [b.TOOLBAR_START],
|
|
613
|
-
hidden$:
|
|
613
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function Li(i) {
|
|
617
617
|
return {
|
|
618
618
|
id: Tn.id,
|
|
619
619
|
group: I.TOOLBAR_LAYOUT,
|
|
@@ -621,22 +621,22 @@ function Ai(i) {
|
|
|
621
621
|
icon: "UnorderSingle",
|
|
622
622
|
tooltip: "toolbar.unorder",
|
|
623
623
|
positions: [b.TOOLBAR_START],
|
|
624
|
-
hidden$:
|
|
624
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
625
625
|
};
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function Bi(i) {
|
|
628
628
|
return {
|
|
629
629
|
id: In.id,
|
|
630
630
|
type: T.BUTTON,
|
|
631
631
|
title: "toolbar.resetColor",
|
|
632
632
|
icon: "NoColor",
|
|
633
|
-
positions:
|
|
633
|
+
positions: He.id
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
|
-
function
|
|
637
|
-
const e = i.get(v), t = i.get(
|
|
636
|
+
function $i(i) {
|
|
637
|
+
const e = i.get(v), t = i.get(It);
|
|
638
638
|
return {
|
|
639
|
-
id:
|
|
639
|
+
id: He.id,
|
|
640
640
|
tooltip: "toolbar.fillColor.main",
|
|
641
641
|
group: I.TOOLBAR_FORMAT,
|
|
642
642
|
type: T.BUTTON_SELECTOR,
|
|
@@ -645,26 +645,26 @@ function Bi(i) {
|
|
|
645
645
|
selections: [
|
|
646
646
|
{
|
|
647
647
|
label: {
|
|
648
|
-
name:
|
|
648
|
+
name: nt,
|
|
649
649
|
hoverable: !1
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
],
|
|
653
|
-
value$: new
|
|
653
|
+
value$: new M((n) => {
|
|
654
654
|
const r = t.getCurrentTheme().primaryColor, s = e.onCommandExecuted((o) => {
|
|
655
|
-
if (o.id ===
|
|
655
|
+
if (o.id === He.id) {
|
|
656
656
|
const a = o.params.value;
|
|
657
657
|
n.next(a != null ? a : r);
|
|
658
658
|
}
|
|
659
659
|
});
|
|
660
660
|
return n.next(r), s.dispose;
|
|
661
661
|
}),
|
|
662
|
-
hidden$:
|
|
662
|
+
hidden$: y(i, m.UNIVER_DOC)
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
|
-
function
|
|
665
|
+
function W(i) {
|
|
666
666
|
var c;
|
|
667
|
-
const e = i.get(
|
|
667
|
+
const e = i.get(U), t = i.get(ne), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
|
|
668
668
|
if (n == null || r == null)
|
|
669
669
|
return;
|
|
670
670
|
const s = (c = n.getBody()) == null ? void 0 : c.textRuns;
|
|
@@ -673,9 +673,9 @@ function z(i) {
|
|
|
673
673
|
const { startOffset: o } = r;
|
|
674
674
|
return s.find(({ st: d, ed: u }) => o >= d && o < u);
|
|
675
675
|
}
|
|
676
|
-
function
|
|
676
|
+
function we(i) {
|
|
677
677
|
var c;
|
|
678
|
-
const e = i.get(
|
|
678
|
+
const e = i.get(U), t = i.get(ne), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
|
|
679
679
|
if (n == null || r == null)
|
|
680
680
|
return;
|
|
681
681
|
const s = (c = n.getBody()) == null ? void 0 : c.paragraphs;
|
|
@@ -696,13 +696,13 @@ var Fi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, ji = (i, e
|
|
|
696
696
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
697
697
|
return n && r && Fi(e, t, r), r;
|
|
698
698
|
}, k = (i, e) => (t, n) => e(t, n, i);
|
|
699
|
-
let
|
|
699
|
+
let Ce = class extends ee {
|
|
700
700
|
constructor(i, e, t, n, r, s, o) {
|
|
701
701
|
super(), this._injector = i, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = r, this._uiController = s, this._univerInstanceService = o, this._init();
|
|
702
702
|
}
|
|
703
703
|
_initCustomComponents() {
|
|
704
704
|
const i = this._componentManager;
|
|
705
|
-
this.disposeWithMe(i.register(
|
|
705
|
+
this.disposeWithMe(i.register(nt, zn)), this.disposeWithMe(i.register(Dt, Zt)), this.disposeWithMe(i.register(Pt, qt)), this.disposeWithMe(i.register(Ut, Jt));
|
|
706
706
|
}
|
|
707
707
|
_initMenus() {
|
|
708
708
|
[
|
|
@@ -711,18 +711,18 @@ let Se = class extends Y {
|
|
|
711
711
|
Ti,
|
|
712
712
|
Ii,
|
|
713
713
|
bi,
|
|
714
|
-
Mi,
|
|
715
|
-
Ei,
|
|
716
714
|
yi,
|
|
715
|
+
Ei,
|
|
716
|
+
Mi,
|
|
717
717
|
xi,
|
|
718
718
|
Di,
|
|
719
719
|
Pi,
|
|
720
720
|
Ui,
|
|
721
|
-
Li,
|
|
722
721
|
Ni,
|
|
723
722
|
Ai,
|
|
724
|
-
|
|
725
|
-
Bi
|
|
723
|
+
Li,
|
|
724
|
+
Bi,
|
|
725
|
+
$i
|
|
726
726
|
].forEach((i) => {
|
|
727
727
|
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(i)));
|
|
728
728
|
});
|
|
@@ -731,31 +731,31 @@ let Se = class extends Y {
|
|
|
731
731
|
this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
|
|
732
732
|
}
|
|
733
733
|
_initDocBackground() {
|
|
734
|
-
const i = this._univerInstanceService.getAllUnitsForType(
|
|
734
|
+
const i = this._univerInstanceService.getAllUnitsForType(m.UNIVER_DOC)[0].getUnitId();
|
|
735
735
|
if (i == null)
|
|
736
736
|
return;
|
|
737
737
|
this._editorService.isEditor(i) || this.disposeWithMe(
|
|
738
|
-
this._uiController.registerComponent(Qt.CONTENT, () =>
|
|
738
|
+
this._uiController.registerComponent(Qt.CONTENT, () => Nn(Ci, this._injector))
|
|
739
739
|
);
|
|
740
740
|
}
|
|
741
741
|
_initFocusHandler() {
|
|
742
742
|
this.disposeWithMe(
|
|
743
|
-
this._layoutService.registerFocusHandler(
|
|
744
|
-
this._injector.get(
|
|
743
|
+
this._layoutService.registerFocusHandler(m.UNIVER_DOC, () => {
|
|
744
|
+
this._injector.get(ue).focus();
|
|
745
745
|
})
|
|
746
746
|
);
|
|
747
747
|
}
|
|
748
748
|
};
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
k(0,
|
|
752
|
-
k(1,
|
|
753
|
-
k(2,
|
|
749
|
+
Ce = ji([
|
|
750
|
+
L(B.Rendered, Ce),
|
|
751
|
+
k(0, R(Ue)),
|
|
752
|
+
k(1, R(en)),
|
|
753
|
+
k(2, yt),
|
|
754
754
|
k(3, $),
|
|
755
755
|
k(4, tn),
|
|
756
756
|
k(5, nn),
|
|
757
|
-
k(6,
|
|
758
|
-
],
|
|
757
|
+
k(6, U)
|
|
758
|
+
], Ce);
|
|
759
759
|
const Vi = {
|
|
760
760
|
toolbar: {
|
|
761
761
|
undo: "Undo",
|
|
@@ -784,7 +784,7 @@ const Vi = {
|
|
|
784
784
|
alignRight: "Align Right",
|
|
785
785
|
alignJustify: "Justify"
|
|
786
786
|
}
|
|
787
|
-
},
|
|
787
|
+
}, Zr = Vi, Wi = {
|
|
788
788
|
toolbar: {
|
|
789
789
|
undo: "撤销",
|
|
790
790
|
redo: "重做",
|
|
@@ -812,29 +812,29 @@ const Vi = {
|
|
|
812
812
|
alignRight: "右对齐",
|
|
813
813
|
alignJustify: "两端对齐"
|
|
814
814
|
}
|
|
815
|
-
},
|
|
815
|
+
}, ki = Wi, zi = {
|
|
816
816
|
id: bn.id,
|
|
817
|
-
preconditions:
|
|
818
|
-
binding:
|
|
817
|
+
preconditions: Kn,
|
|
818
|
+
binding: D.ENTER
|
|
819
819
|
}, Hi = {
|
|
820
|
-
id: Mn.id,
|
|
821
|
-
preconditions: B,
|
|
822
|
-
binding: P.BACKSPACE
|
|
823
|
-
}, Yi = {
|
|
824
820
|
id: yn.id,
|
|
825
|
-
preconditions:
|
|
826
|
-
binding:
|
|
827
|
-
},
|
|
828
|
-
|
|
829
|
-
|
|
821
|
+
preconditions: A,
|
|
822
|
+
binding: D.BACKSPACE
|
|
823
|
+
}, Yi = {
|
|
824
|
+
id: Mn.id,
|
|
825
|
+
preconditions: A,
|
|
826
|
+
binding: D.DELETE
|
|
827
|
+
}, Gi = 10, Xi = 6;
|
|
828
|
+
function Ki() {
|
|
829
|
+
return qe.generateRandomId(Xi);
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function Zi(i) {
|
|
832
832
|
const e = i.match(/data-copy-id="([^\s]+)"/);
|
|
833
833
|
return e && e[1] ? e[1] : null;
|
|
834
834
|
}
|
|
835
|
-
class
|
|
835
|
+
class qi {
|
|
836
836
|
constructor() {
|
|
837
|
-
|
|
837
|
+
f(this, "_cache", new wt(Gi));
|
|
838
838
|
}
|
|
839
839
|
set(e, t) {
|
|
840
840
|
this._cache.set(e, t);
|
|
@@ -846,8 +846,8 @@ class Ki {
|
|
|
846
846
|
this._cache.clear();
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
const
|
|
850
|
-
function
|
|
849
|
+
const mt = new qi();
|
|
850
|
+
function it(i) {
|
|
851
851
|
const e = i.style, t = {}, n = i.tagName.toLowerCase();
|
|
852
852
|
switch (n) {
|
|
853
853
|
case "b":
|
|
@@ -887,7 +887,7 @@ function nt(i) {
|
|
|
887
887
|
}
|
|
888
888
|
case "font-size": {
|
|
889
889
|
const a = Number.parseInt(o);
|
|
890
|
-
Number.isNaN(a) || (o.endsWith("pt") ? t.fs = a : o.endsWith("px") && (t.fs =
|
|
890
|
+
Number.isNaN(a) || (o.endsWith("pt") ? t.fs = a : o.endsWith("px") && (t.fs = An(a)));
|
|
891
891
|
break;
|
|
892
892
|
}
|
|
893
893
|
case "font-style": {
|
|
@@ -909,14 +909,14 @@ function nt(i) {
|
|
|
909
909
|
break;
|
|
910
910
|
}
|
|
911
911
|
case "color": {
|
|
912
|
-
const a = new
|
|
912
|
+
const a = new ot(o);
|
|
913
913
|
a.isValid && (t.cl = {
|
|
914
914
|
rgb: a.toRgbString()
|
|
915
915
|
});
|
|
916
916
|
break;
|
|
917
917
|
}
|
|
918
918
|
case "background-color": {
|
|
919
|
-
const a = new
|
|
919
|
+
const a = new ot(o);
|
|
920
920
|
a.isValid && (t.bg = {
|
|
921
921
|
rgb: a.toRgbString()
|
|
922
922
|
});
|
|
@@ -930,15 +930,15 @@ function Ji(i) {
|
|
|
930
930
|
const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
|
|
931
931
|
return e.parseFromString(t, "text/html").querySelector("#univer-root");
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function St(i, e) {
|
|
934
934
|
const t = i.tagName.toLowerCase();
|
|
935
935
|
return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(i);
|
|
936
936
|
}
|
|
937
|
-
const
|
|
937
|
+
const xe = class xe {
|
|
938
938
|
constructor() {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
939
|
+
f(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
940
|
+
f(this, "_styleRules", []);
|
|
941
|
+
f(this, "_afterProcessRules", []);
|
|
942
942
|
}
|
|
943
943
|
static use(e) {
|
|
944
944
|
if (this._pluginList.includes(e))
|
|
@@ -946,7 +946,7 @@ const Ee = class Ee {
|
|
|
946
946
|
this._pluginList.push(e);
|
|
947
947
|
}
|
|
948
948
|
convert(e) {
|
|
949
|
-
const t =
|
|
949
|
+
const t = xe._pluginList.find((s) => s.checkPasteType(e)), n = Ji(e), r = {
|
|
950
950
|
dataStream: "",
|
|
951
951
|
textRuns: []
|
|
952
952
|
};
|
|
@@ -964,19 +964,19 @@ const Ee = class Ee {
|
|
|
964
964
|
ts: a
|
|
965
965
|
});
|
|
966
966
|
} else if (s.nodeType === Node.ELEMENT_NODE) {
|
|
967
|
-
const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) =>
|
|
967
|
+
const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => St(s, h)), c = a ? a.getStyle(s) : it(s);
|
|
968
968
|
this._styleCache.set(s, { ...o, ...c });
|
|
969
969
|
const { childNodes: d } = s;
|
|
970
970
|
this._process(s, d, n);
|
|
971
971
|
const u = this._afterProcessRules.find(
|
|
972
|
-
({ filter: h }) =>
|
|
972
|
+
({ filter: h }) => St(s, h)
|
|
973
973
|
);
|
|
974
974
|
u && u.handler(n, s);
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
977
|
};
|
|
978
|
-
|
|
979
|
-
let Q =
|
|
978
|
+
f(xe, "_pluginList", []);
|
|
979
|
+
let Q = xe;
|
|
980
980
|
const Qi = {
|
|
981
981
|
name: "univer-doc-paste-plugin-lark",
|
|
982
982
|
checkPasteType(i) {
|
|
@@ -987,7 +987,7 @@ const Qi = {
|
|
|
987
987
|
{
|
|
988
988
|
filter: ["s"],
|
|
989
989
|
getStyle(i) {
|
|
990
|
-
const e =
|
|
990
|
+
const e = it(i);
|
|
991
991
|
return {
|
|
992
992
|
st: {
|
|
993
993
|
s: C.TRUE
|
|
@@ -1010,19 +1010,19 @@ const Qi = {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
]
|
|
1012
1012
|
}, er = Qi;
|
|
1013
|
-
function
|
|
1013
|
+
function Lt(i) {
|
|
1014
1014
|
const e = i.style, t = {};
|
|
1015
1015
|
for (let n = 0; n < e.length; n++) {
|
|
1016
1016
|
const r = e[n], s = e.getPropertyValue(r);
|
|
1017
1017
|
switch (r) {
|
|
1018
1018
|
case "margin-top": {
|
|
1019
1019
|
const o = Number.parseInt(s);
|
|
1020
|
-
t.spaceAbove = /pt/.test(s) ?
|
|
1020
|
+
t.spaceAbove = /pt/.test(s) ? ut(o) : o;
|
|
1021
1021
|
break;
|
|
1022
1022
|
}
|
|
1023
1023
|
case "margin-bottom": {
|
|
1024
1024
|
const o = Number.parseInt(s);
|
|
1025
|
-
t.spaceBelow = /pt/.test(s) ?
|
|
1025
|
+
t.spaceBelow = /pt/.test(s) ? ut(o) : o;
|
|
1026
1026
|
break;
|
|
1027
1027
|
}
|
|
1028
1028
|
case "line-height": {
|
|
@@ -1043,7 +1043,7 @@ const tr = {
|
|
|
1043
1043
|
{
|
|
1044
1044
|
filter: ["b"],
|
|
1045
1045
|
getStyle(i) {
|
|
1046
|
-
const e =
|
|
1046
|
+
const e = it(i);
|
|
1047
1047
|
return { bl: C.TRUE, ...e };
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
@@ -1057,7 +1057,7 @@ const tr = {
|
|
|
1057
1057
|
i.paragraphs == null && (i.paragraphs = []);
|
|
1058
1058
|
const t = {
|
|
1059
1059
|
startIndex: i.dataStream.length
|
|
1060
|
-
}, n =
|
|
1060
|
+
}, n = Lt(e);
|
|
1061
1061
|
n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
@@ -1077,28 +1077,28 @@ const tr = {
|
|
|
1077
1077
|
i.paragraphs == null && (i.paragraphs = []);
|
|
1078
1078
|
const t = {
|
|
1079
1079
|
startIndex: i.dataStream.length
|
|
1080
|
-
}, n =
|
|
1080
|
+
}, n = Lt(e);
|
|
1081
1081
|
n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
1084
|
]
|
|
1085
1085
|
}, rr = ir;
|
|
1086
|
-
function
|
|
1087
|
-
const { st: t, ed: n, ts: r = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: u, ol: h, bg:
|
|
1086
|
+
function vt(i, e) {
|
|
1087
|
+
const { st: t, ed: n, ts: r = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: u, ol: h, bg: S, cl: g, va: p } = r;
|
|
1088
1088
|
let l = i.slice(t, n);
|
|
1089
1089
|
const _ = [];
|
|
1090
|
-
return a === C.TRUE && (l = `<i>${l}</i>`),
|
|
1090
|
+
return a === C.TRUE && (l = `<i>${l}</i>`), p === J.SUPERSCRIPT ? l = `<sup>${l}</sup>` : p === J.SUBSCRIPT && (l = `<sub>${l}</sub>`), (d == null ? void 0 : d.s) === C.TRUE && (l = `<u>${l}</u>`), (u == null ? void 0 : u.s) === C.TRUE && (l = `<s>${l}</s>`), c === C.TRUE && (l = `<strong>${l}</strong>`), s && _.push(`font-family: ${s}`), g && _.push(`color: ${g.rgb}`), o && _.push(`font-size: ${o}pt`), h && _.push("text-decoration: overline"), S && _.push(`background: ${S.rgb}`), _.length ? `<span style="${_.join("; ")};">${l}</span>` : l;
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function ke(i, e, t) {
|
|
1093
1093
|
const { dataStream: n, textRuns: r = [] } = i;
|
|
1094
1094
|
let s = e;
|
|
1095
1095
|
const o = [];
|
|
1096
1096
|
for (const a of r) {
|
|
1097
1097
|
const { st: c, ed: d } = a;
|
|
1098
|
-
qe.hasIntersectionBetweenTwoRanges(e, t, c, d) && (c > s ? (o.push(n.slice(s, c)), o.push(
|
|
1098
|
+
qe.hasIntersectionBetweenTwoRanges(e, t, c, d) && (c > s ? (o.push(n.slice(s, c)), o.push(vt(n, {
|
|
1099
1099
|
...a,
|
|
1100
1100
|
ed: Math.min(d, t)
|
|
1101
|
-
}))) : o.push(
|
|
1101
|
+
}))) : o.push(vt(n, {
|
|
1102
1102
|
...a,
|
|
1103
1103
|
st: s,
|
|
1104
1104
|
ed: Math.min(d, t)
|
|
@@ -1106,28 +1106,28 @@ function Ve(i, e, t) {
|
|
|
1106
1106
|
}
|
|
1107
1107
|
return s !== t && o.push(n.slice(s, t)), o.join("");
|
|
1108
1108
|
}
|
|
1109
|
-
function
|
|
1109
|
+
function Ct(i, e = !0) {
|
|
1110
1110
|
var t;
|
|
1111
1111
|
if (e && ((t = i.paragraphs) != null && t.length)) {
|
|
1112
1112
|
const { dataStream: n, paragraphs: r = [] } = i;
|
|
1113
1113
|
let s = "", o = -1;
|
|
1114
1114
|
for (const a of r) {
|
|
1115
|
-
const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing:
|
|
1116
|
-
u != null && (typeof u == "number" ? g.push(`margin-top: ${u}px`) : g.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? g.push(`margin-bottom: ${h}px`) : g.push(`margin-bottom: ${h.v}px`)),
|
|
1115
|
+
const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: S } = d, g = [];
|
|
1116
|
+
u != null && (typeof u == "number" ? g.push(`margin-top: ${u}px`) : g.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? g.push(`margin-bottom: ${h}px`) : g.push(`margin-bottom: ${h.v}px`)), S != null && g.push(`line-height: ${S}`), c > o + 1 ? s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}>${ke(i, o + 1, c)}</p>` : s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}></p>`, o = c;
|
|
1117
1117
|
}
|
|
1118
|
-
return o !== n.length && (s +=
|
|
1118
|
+
return o !== n.length && (s += ke(i, o, n.length)), s;
|
|
1119
1119
|
} else
|
|
1120
|
-
return
|
|
1120
|
+
return ke(i, 0, i.dataStream.length);
|
|
1121
1121
|
}
|
|
1122
1122
|
class or {
|
|
1123
1123
|
convert(e) {
|
|
1124
1124
|
if (e.length === 0)
|
|
1125
1125
|
throw new Error("The bodyList length at least to be 1");
|
|
1126
1126
|
if (e.length === 1)
|
|
1127
|
-
return
|
|
1127
|
+
return Ct(e[0]);
|
|
1128
1128
|
let t = "";
|
|
1129
1129
|
for (const n of e)
|
|
1130
|
-
t += '<p className="UniverNormal">', t +=
|
|
1130
|
+
t += '<p className="UniverNormal">', t += Ct(n, !1), t += "</p>";
|
|
1131
1131
|
return t;
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
@@ -1135,7 +1135,7 @@ var sr = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, cr = (i, e
|
|
|
1135
1135
|
for (var r = n > 1 ? void 0 : n ? ar(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1136
1136
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1137
1137
|
return n && r && sr(e, t, r), r;
|
|
1138
|
-
},
|
|
1138
|
+
}, re = (i, e) => (t, n) => e(t, n, i);
|
|
1139
1139
|
Q.use(nr);
|
|
1140
1140
|
Q.use(er);
|
|
1141
1141
|
Q.use(rr);
|
|
@@ -1148,13 +1148,13 @@ function lr(i) {
|
|
|
1148
1148
|
paragraphs: t
|
|
1149
1149
|
};
|
|
1150
1150
|
}
|
|
1151
|
-
const
|
|
1152
|
-
let Xe = class extends
|
|
1151
|
+
const he = Xt("doc.clipboard-service");
|
|
1152
|
+
let Xe = class extends ee {
|
|
1153
1153
|
constructor(e, t, n, r, s) {
|
|
1154
1154
|
super();
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1155
|
+
f(this, "_clipboardHooks", []);
|
|
1156
|
+
f(this, "_htmlToUDM", new Q());
|
|
1157
|
+
f(this, "_umdToHtml", new or());
|
|
1158
1158
|
this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = s;
|
|
1159
1159
|
}
|
|
1160
1160
|
async copy() {
|
|
@@ -1225,19 +1225,19 @@ let Xe = class extends Y {
|
|
|
1225
1225
|
style: r
|
|
1226
1226
|
}
|
|
1227
1227
|
];
|
|
1228
|
-
return this._commandService.executeCommand(
|
|
1228
|
+
return this._commandService.executeCommand(Et.id, { body: e, segmentId: t, textRanges: c });
|
|
1229
1229
|
} catch {
|
|
1230
1230
|
return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
1233
|
async _setClipboardData(e) {
|
|
1234
|
-
const t =
|
|
1234
|
+
const t = Ki(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
|
|
1235
1235
|
`) : e[0].dataStream;
|
|
1236
1236
|
let r = this._umdToHtml.convert(e);
|
|
1237
|
-
return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`),
|
|
1237
|
+
return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), mt.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
|
|
1238
1238
|
}
|
|
1239
1239
|
addClipboardHook(e) {
|
|
1240
|
-
return this._clipboardHooks.push(e),
|
|
1240
|
+
return this._clipboardHooks.push(e), j(() => {
|
|
1241
1241
|
const t = this._clipboardHooks.indexOf(e);
|
|
1242
1242
|
t > -1 && this._clipboardHooks.splice(t, 1);
|
|
1243
1243
|
});
|
|
@@ -1272,9 +1272,9 @@ let Xe = class extends Y {
|
|
|
1272
1272
|
return lr(t);
|
|
1273
1273
|
throw new Error("[DocClipboardService] html and text cannot be both empty!");
|
|
1274
1274
|
}
|
|
1275
|
-
const n =
|
|
1275
|
+
const n = Zi(e);
|
|
1276
1276
|
if (n) {
|
|
1277
|
-
const r =
|
|
1277
|
+
const r = mt.get(n);
|
|
1278
1278
|
if (r)
|
|
1279
1279
|
return r;
|
|
1280
1280
|
}
|
|
@@ -1282,40 +1282,40 @@ let Xe = class extends Y {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
};
|
|
1284
1284
|
Xe = cr([
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1285
|
+
re(0, U),
|
|
1286
|
+
re(1, bt),
|
|
1287
|
+
re(2, v),
|
|
1288
|
+
re(3, Qe),
|
|
1289
|
+
re(4, R(ne))
|
|
1290
1290
|
], Xe);
|
|
1291
|
-
function
|
|
1292
|
-
return i.getContextValue(
|
|
1291
|
+
function je(i) {
|
|
1292
|
+
return i.getContextValue(De) || i.getContextValue(Tt);
|
|
1293
1293
|
}
|
|
1294
|
-
const
|
|
1294
|
+
const rt = 999, dr = {
|
|
1295
1295
|
id: sn.id,
|
|
1296
1296
|
name: "doc.command.copy",
|
|
1297
|
-
type:
|
|
1297
|
+
type: Je.COMMAND,
|
|
1298
1298
|
multi: !0,
|
|
1299
|
-
priority:
|
|
1300
|
-
preconditions:
|
|
1301
|
-
handler: async (i) => i.get(
|
|
1299
|
+
priority: rt,
|
|
1300
|
+
preconditions: je,
|
|
1301
|
+
handler: async (i) => i.get(he).copy()
|
|
1302
1302
|
}, ur = {
|
|
1303
1303
|
id: an.id,
|
|
1304
1304
|
name: "doc.command.cut",
|
|
1305
|
-
type:
|
|
1305
|
+
type: Je.COMMAND,
|
|
1306
1306
|
multi: !0,
|
|
1307
|
-
priority:
|
|
1308
|
-
preconditions:
|
|
1309
|
-
handler: async (i) => i.get(
|
|
1307
|
+
priority: rt,
|
|
1308
|
+
preconditions: je,
|
|
1309
|
+
handler: async (i) => i.get(he).cut()
|
|
1310
1310
|
}, hr = {
|
|
1311
1311
|
id: cn.id,
|
|
1312
1312
|
name: "doc.command.paste",
|
|
1313
|
-
type:
|
|
1313
|
+
type: Je.COMMAND,
|
|
1314
1314
|
multi: !0,
|
|
1315
|
-
priority:
|
|
1316
|
-
preconditions:
|
|
1315
|
+
priority: rt,
|
|
1316
|
+
preconditions: je,
|
|
1317
1317
|
handler: async (i) => {
|
|
1318
|
-
const e = i.get(
|
|
1318
|
+
const e = i.get(he), n = await i.get(Qe).read();
|
|
1319
1319
|
return n.length === 0 ? !1 : e.paste(n);
|
|
1320
1320
|
}
|
|
1321
1321
|
};
|
|
@@ -1323,19 +1323,19 @@ var gr = Object.defineProperty, _r = Object.getOwnPropertyDescriptor, pr = (i, e
|
|
|
1323
1323
|
for (var r = n > 1 ? void 0 : n ? _r(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1324
1324
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1325
1325
|
return n && r && gr(e, t, r), r;
|
|
1326
|
-
},
|
|
1327
|
-
let
|
|
1326
|
+
}, oe = (i, e) => (t, n) => e(t, n, i);
|
|
1327
|
+
let Oe = class extends le {
|
|
1328
1328
|
constructor(i, e, t, n, r) {
|
|
1329
1329
|
super(), this._commandService = i, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = r, this._init();
|
|
1330
1330
|
}
|
|
1331
1331
|
_init() {
|
|
1332
|
-
[dr, ur, hr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [
|
|
1332
|
+
[dr, ur, hr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [Et, Mt].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))), this._initLegacyPasteCommand();
|
|
1333
1333
|
}
|
|
1334
1334
|
_initLegacyPasteCommand() {
|
|
1335
1335
|
var i;
|
|
1336
|
-
(i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(
|
|
1336
|
+
(i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
1337
1337
|
var s, o;
|
|
1338
|
-
if (!
|
|
1338
|
+
if (!je(this._contextService))
|
|
1339
1339
|
return;
|
|
1340
1340
|
e.event.preventDefault();
|
|
1341
1341
|
const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"), r = (o = t.clipboardData) == null ? void 0 : o.getData("text/plain");
|
|
@@ -1343,23 +1343,23 @@ let ve = class extends ce {
|
|
|
1343
1343
|
});
|
|
1344
1344
|
}
|
|
1345
1345
|
};
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
],
|
|
1346
|
+
Oe = pr([
|
|
1347
|
+
L(B.Rendered, Oe),
|
|
1348
|
+
oe(0, v),
|
|
1349
|
+
oe(1, Qe),
|
|
1350
|
+
oe(2, he),
|
|
1351
|
+
oe(3, ue),
|
|
1352
|
+
oe(4, jt)
|
|
1353
|
+
], Oe);
|
|
1354
1354
|
var fr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, Sr = (i, e, t, n) => {
|
|
1355
1355
|
for (var r = n > 1 ? void 0 : n ? mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1356
1356
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1357
1357
|
return n && r && fr(e, t, r), r;
|
|
1358
|
-
},
|
|
1359
|
-
let
|
|
1358
|
+
}, X = (i, e) => (t, n) => e(t, n, i);
|
|
1359
|
+
let Re = class extends ee {
|
|
1360
1360
|
constructor(e, t, n, r, s, o) {
|
|
1361
1361
|
super();
|
|
1362
|
-
|
|
1362
|
+
f(this, "_initialEditors", /* @__PURE__ */ new Set());
|
|
1363
1363
|
this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = s, this._renderManagerService = o, this._initialize();
|
|
1364
1364
|
}
|
|
1365
1365
|
_initialize() {
|
|
@@ -1373,26 +1373,26 @@ let Ce = class extends Y {
|
|
|
1373
1373
|
}), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
|
|
1374
1374
|
}
|
|
1375
1375
|
_resize(e) {
|
|
1376
|
-
var
|
|
1376
|
+
var N, F, w;
|
|
1377
1377
|
if (e == null)
|
|
1378
1378
|
return;
|
|
1379
1379
|
const t = this._editorService.getEditor(e);
|
|
1380
1380
|
if ((t == null ? void 0 : t.cancelDefaultResizeListener) === !0)
|
|
1381
1381
|
return;
|
|
1382
|
-
const n = (
|
|
1382
|
+
const n = (N = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : N.skeleton, r = this._univerInstanceService.getUniverDocInstance(e);
|
|
1383
1383
|
if (t == null || t.render == null || n == null || r == null)
|
|
1384
1384
|
return;
|
|
1385
1385
|
n.calculate();
|
|
1386
1386
|
const { marginTop: s = 0, marginBottom: o = 0, marginLeft: a = 0, marginRight: c = 0 } = r.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
|
|
1387
|
-
let { actualHeight: h, actualWidth:
|
|
1388
|
-
h += s + o,
|
|
1389
|
-
const { width: g, height:
|
|
1387
|
+
let { actualHeight: h, actualWidth: S } = n.getActualSize();
|
|
1388
|
+
h += s + o, S += a + c;
|
|
1389
|
+
const { width: g, height: p } = t.getBoundingClientRect(), l = d.getViewport(Be.VIEW_MAIN);
|
|
1390
1390
|
let _ = l == null ? void 0 : l.getScrollBar();
|
|
1391
|
-
const
|
|
1391
|
+
const O = Math.max(S, g), E = Math.max(h, p);
|
|
1392
1392
|
d.transformByState({
|
|
1393
|
-
width:
|
|
1394
|
-
height:
|
|
1395
|
-
}), u == null || u.resize(
|
|
1393
|
+
width: O,
|
|
1394
|
+
height: E
|
|
1395
|
+
}), u == null || u.resize(O, E), t.isSingle() ? S > g ? _ == null ? l && new Ye(l, { barSize: 8, enableVertical: !1 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (w = l == null ? void 0 : l.getScrollBar()) == null || w.dispose()) : h > p ? _ == null ? l && new Ye(l, { enableHorizontal: !1, barSize: 8 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (F = l == null ? void 0 : l.getScrollBar()) == null || F.dispose());
|
|
1396
1396
|
}
|
|
1397
1397
|
_initialSetValue() {
|
|
1398
1398
|
this.disposeWithMe(
|
|
@@ -1434,17 +1434,17 @@ let Ce = class extends Y {
|
|
|
1434
1434
|
"univer-formula-help-param"
|
|
1435
1435
|
];
|
|
1436
1436
|
this.disposeWithMe(
|
|
1437
|
-
|
|
1437
|
+
pt(window, "mousedown").subscribe((n) => {
|
|
1438
1438
|
const s = n.target.classList[0] || "";
|
|
1439
|
-
if (
|
|
1439
|
+
if (Vt(s, e)) {
|
|
1440
1440
|
this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
|
|
1441
1441
|
return;
|
|
1442
1442
|
}
|
|
1443
1443
|
this._editorService.changeSpreadsheetFocusState(!1);
|
|
1444
1444
|
})
|
|
1445
|
-
), this._univerInstanceService.getAllUnitsForType(
|
|
1445
|
+
), this._univerInstanceService.getAllUnitsForType(m.UNIVER_SHEET).forEach((n) => {
|
|
1446
1446
|
const r = n.getUnitId(), s = this._renderManagerService.getRenderById(r), o = s == null ? void 0 : s.engine.getCanvas().getCanvasEle();
|
|
1447
|
-
o != null &&
|
|
1447
|
+
o != null && pt(o, "mousedown").subscribe((a) => {
|
|
1448
1448
|
this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
|
|
1449
1449
|
});
|
|
1450
1450
|
});
|
|
@@ -1472,7 +1472,7 @@ let Ce = class extends Y {
|
|
|
1472
1472
|
* Listen to document edits to refresh the size of the normula editor.
|
|
1473
1473
|
*/
|
|
1474
1474
|
_commandExecutedListener() {
|
|
1475
|
-
const e = [
|
|
1475
|
+
const e = [et.id, ln.id];
|
|
1476
1476
|
this.disposeWithMe(
|
|
1477
1477
|
this._commandService.onCommandExecuted((t) => {
|
|
1478
1478
|
if (e.includes(t.id)) {
|
|
@@ -1485,28 +1485,28 @@ let Ce = class extends Y {
|
|
|
1485
1485
|
);
|
|
1486
1486
|
}
|
|
1487
1487
|
};
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
],
|
|
1488
|
+
Re = Sr([
|
|
1489
|
+
L(B.Rendered, Re),
|
|
1490
|
+
X(0, U),
|
|
1491
|
+
X(1, R(ie)),
|
|
1492
|
+
X(2, $),
|
|
1493
|
+
X(3, v),
|
|
1494
|
+
X(4, ue),
|
|
1495
|
+
X(5, H)
|
|
1496
|
+
], Re);
|
|
1497
1497
|
var vr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Or = (i, e, t, n) => {
|
|
1498
1498
|
for (var r = n > 1 ? void 0 : n ? Cr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1499
1499
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1500
1500
|
return n && r && vr(e, t, r), r;
|
|
1501
|
-
},
|
|
1502
|
-
let
|
|
1501
|
+
}, me = (i, e) => (t, n) => e(t, n, i);
|
|
1502
|
+
let Te = class extends le {
|
|
1503
1503
|
constructor(e, t, n, r) {
|
|
1504
1504
|
super();
|
|
1505
|
-
|
|
1505
|
+
f(this, "_docRenderMap", /* @__PURE__ */ new Set());
|
|
1506
1506
|
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
|
|
1507
1507
|
}
|
|
1508
1508
|
_initialRenderRefresh() {
|
|
1509
|
-
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(
|
|
1509
|
+
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
1510
1510
|
this._create(e);
|
|
1511
1511
|
});
|
|
1512
1512
|
}
|
|
@@ -1516,23 +1516,23 @@ let Oe = class extends ce {
|
|
|
1516
1516
|
const { skeleton: t, unitId: n } = e;
|
|
1517
1517
|
let r = this._renderManagerService.getRenderById(n);
|
|
1518
1518
|
r == null && (this._renderManagerService.create(n), r = this._renderManagerService.getRenderById(n));
|
|
1519
|
-
const { mainComponent: s } = r;
|
|
1520
|
-
|
|
1519
|
+
const { mainComponent: s, components: o } = r, a = s, c = o.get(q.BACKGROUND);
|
|
1520
|
+
a.changeSkeleton(t), c.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
|
|
1521
1521
|
}
|
|
1522
1522
|
_recalculateSizeBySkeleton(e, t) {
|
|
1523
|
-
var
|
|
1524
|
-
const { mainComponent: n, scene: r, unitId: s } = e,
|
|
1525
|
-
if (
|
|
1523
|
+
var S;
|
|
1524
|
+
const { mainComponent: n, scene: r, unitId: s, components: o } = e, a = n, c = o.get(q.BACKGROUND), d = (S = t.getSkeletonData()) == null ? void 0 : S.pages;
|
|
1525
|
+
if (d == null)
|
|
1526
1526
|
return;
|
|
1527
|
-
let
|
|
1528
|
-
for (let
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1527
|
+
let u = 0, h = 0;
|
|
1528
|
+
for (let g = 0, p = d.length; g < p; g++) {
|
|
1529
|
+
const l = d[g], { pageWidth: _, pageHeight: O } = l;
|
|
1530
|
+
a.pageLayoutType === ht.VERTICAL ? (h += O, h += a.pageMarginTop, g === p - 1 && (h += a.pageMarginTop), u = Math.max(u, _)) : a.pageLayoutType === ht.HORIZONTAL && (u += _, g !== p - 1 && (u += a.pageMarginLeft), h = Math.max(h, O));
|
|
1531
1531
|
}
|
|
1532
|
-
|
|
1532
|
+
a.resize(u, h), c.resize(u, h), this._editorService.isEditor(s) || r.resize(u, h);
|
|
1533
1533
|
}
|
|
1534
1534
|
_commandExecutedListener() {
|
|
1535
|
-
const e = [
|
|
1535
|
+
const e = [et.id];
|
|
1536
1536
|
this.disposeWithMe(
|
|
1537
1537
|
this._commandService.onCommandExecuted((t) => {
|
|
1538
1538
|
var n;
|
|
@@ -1553,33 +1553,33 @@ let Oe = class extends ce {
|
|
|
1553
1553
|
);
|
|
1554
1554
|
}
|
|
1555
1555
|
};
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
],
|
|
1556
|
+
Te = Or([
|
|
1557
|
+
L(B.Rendered, Te),
|
|
1558
|
+
me(0, R(ie)),
|
|
1559
|
+
me(1, H),
|
|
1560
|
+
me(2, v),
|
|
1561
|
+
me(3, $)
|
|
1562
|
+
], Te);
|
|
1563
1563
|
var Rr = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Ir = (i, e, t, n) => {
|
|
1564
1564
|
for (var r = n > 1 ? void 0 : n ? Tr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1565
1565
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1566
1566
|
return n && r && Rr(e, t, r), r;
|
|
1567
|
-
},
|
|
1568
|
-
let
|
|
1567
|
+
}, Se = (i, e) => (t, n) => e(t, n, i);
|
|
1568
|
+
let Ie = class extends le {
|
|
1569
1569
|
constructor(e, t, n, r) {
|
|
1570
1570
|
super();
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1571
|
+
f(this, "_scene");
|
|
1572
|
+
f(this, "_currentDocumentModel");
|
|
1573
|
+
f(this, "_fps$", new kn(""));
|
|
1574
|
+
f(this, "fps$", this._fps$.asObservable());
|
|
1575
1575
|
this._renderManagerService = e, this._configService = t, this._univerInstanceService = n, this._editorService = r, this._initialize();
|
|
1576
1576
|
}
|
|
1577
1577
|
_initialize() {
|
|
1578
|
-
this._renderManagerService.createRender$.pipe(
|
|
1578
|
+
this._renderManagerService.createRender$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
1579
1579
|
this._create(e);
|
|
1580
|
-
}), this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
1580
|
+
}), this._univerInstanceService.getCurrentTypeOfUnit$(m.UNIVER_DOC).pipe(ce(this.dispose$)).subscribe((e) => {
|
|
1581
1581
|
this._create(e == null ? void 0 : e.getUnitId());
|
|
1582
|
-
}), this._univerInstanceService.getAllUnitsForType(
|
|
1582
|
+
}), this._univerInstanceService.getAllUnitsForType(m.UNIVER_DOC).forEach((e) => {
|
|
1583
1583
|
this._create(e.getUnitId());
|
|
1584
1584
|
});
|
|
1585
1585
|
}
|
|
@@ -1603,53 +1603,53 @@ let Re = class extends ce {
|
|
|
1603
1603
|
return;
|
|
1604
1604
|
const { scene: o, engine: a } = s;
|
|
1605
1605
|
o.openTransformer(), this._scene = o;
|
|
1606
|
-
const c = new
|
|
1606
|
+
const c = new Ln(Be.VIEW_MAIN, o, {
|
|
1607
1607
|
left: 0,
|
|
1608
1608
|
top: 0,
|
|
1609
1609
|
bottom: 0,
|
|
1610
1610
|
right: 0,
|
|
1611
1611
|
isWheelPreventDefaultX: !0
|
|
1612
1612
|
});
|
|
1613
|
-
o.attachControl(), o.on(
|
|
1613
|
+
o.attachControl(), o.on(Bn.wheel, (h, S) => {
|
|
1614
1614
|
const g = h;
|
|
1615
1615
|
if (g.ctrlKey) {
|
|
1616
|
-
const
|
|
1617
|
-
let l =
|
|
1616
|
+
const p = Math.abs(g.deltaX);
|
|
1617
|
+
let l = p < 40 ? 0.2 : p < 80 ? 0.4 : 0.2;
|
|
1618
1618
|
l *= g.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (l /= 2), o.scaleX + l > 4 ? o.scale(4, 4) : o.scaleX + l < 0.1 ? o.scale(0.1, 0.1) : g.preventDefault();
|
|
1619
1619
|
} else
|
|
1620
|
-
c.onMouseWheel(g,
|
|
1621
|
-
}), this._configService.getConfig("hasScroll") !== !1 && new
|
|
1622
|
-
new
|
|
1623
|
-
new
|
|
1620
|
+
c.onMouseWheel(g, S);
|
|
1621
|
+
}), this._configService.getConfig("hasScroll") !== !1 && new Ye(c), o.addLayer(
|
|
1622
|
+
new gt(o, [], We),
|
|
1623
|
+
new gt(o, [], xn)
|
|
1624
1624
|
), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
|
|
1625
1625
|
o.render(), this._fps$.next(Math.round(a.getFps()).toString());
|
|
1626
1626
|
}), this._renderManagerService.setCurrent(t);
|
|
1627
1627
|
}
|
|
1628
1628
|
_addComponent(e) {
|
|
1629
|
-
const t = this._scene, n = this._currentDocumentModel, r =
|
|
1629
|
+
const t = this._scene, n = this._currentDocumentModel, r = {
|
|
1630
1630
|
pageMarginLeft: n.documentStyle.marginLeft || 0,
|
|
1631
1631
|
pageMarginTop: n.documentStyle.marginTop || 0
|
|
1632
|
-
});
|
|
1633
|
-
|
|
1632
|
+
}, s = new $n(q.MAIN, void 0, r), o = new Fn(q.BACKGROUND, void 0, r);
|
|
1633
|
+
s.zIndex = dt, o.zIndex = dt, e.mainComponent = s, e.components.set(q.MAIN, s), e.components.set(q.BACKGROUND, o), t.addObjects([s], We), t.addObjects([o], Dn), this._editorService.getEditor(n.getUnitId()) == null && t.enableLayerCache(We);
|
|
1634
1634
|
}
|
|
1635
1635
|
};
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
],
|
|
1643
|
-
var br = Object.defineProperty,
|
|
1644
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1636
|
+
Ie = Ir([
|
|
1637
|
+
L(B.Starting, Ie),
|
|
1638
|
+
Se(0, H),
|
|
1639
|
+
Se(1, Wt),
|
|
1640
|
+
Se(2, U),
|
|
1641
|
+
Se(3, $)
|
|
1642
|
+
], Ie);
|
|
1643
|
+
var br = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, Mr = (i, e, t, n) => {
|
|
1644
|
+
for (var r = n > 1 ? void 0 : n ? yr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1645
1645
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1646
1646
|
return n && r && br(e, t, r), r;
|
|
1647
|
-
},
|
|
1648
|
-
let
|
|
1647
|
+
}, K = (i, e) => (t, n) => e(t, n, i);
|
|
1648
|
+
let be = class extends ee {
|
|
1649
1649
|
constructor(e, t, n, r, s, o) {
|
|
1650
1650
|
super();
|
|
1651
|
-
|
|
1652
|
-
|
|
1651
|
+
f(this, "_liquid", new wn());
|
|
1652
|
+
f(this, "_pageMarginCache", /* @__PURE__ */ new Map());
|
|
1653
1653
|
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
|
|
1654
1654
|
}
|
|
1655
1655
|
_initialize() {
|
|
@@ -1664,13 +1664,13 @@ let Te = class extends Y {
|
|
|
1664
1664
|
if (s == null)
|
|
1665
1665
|
return;
|
|
1666
1666
|
const { mainComponent: o, components: a, scene: c } = s, d = o, { left: u, top: h } = d;
|
|
1667
|
-
e.forEach((
|
|
1668
|
-
const { unitId: g, subUnitId:
|
|
1667
|
+
e.forEach((S) => {
|
|
1668
|
+
const { unitId: g, subUnitId: p, floatingObjectId: l, floatingObject: _ } = S, { left: O = 0, top: E = 0, width: N = 0, height: F = 0, angle: w, flipX: Y, flipY: G, skewX: ge, skewY: _e } = _, x = this._pageMarginCache.get(l), pe = (x == null ? void 0 : x.marginLeft) || 0, Ve = (x == null ? void 0 : x.marginTop) || 0;
|
|
1669
1669
|
r == null || r.getViewModel().getDataModel().updateDrawing(l, {
|
|
1670
|
-
left:
|
|
1671
|
-
top:
|
|
1672
|
-
height:
|
|
1673
|
-
width:
|
|
1670
|
+
left: O - u - pe,
|
|
1671
|
+
top: E - h - Ve,
|
|
1672
|
+
height: F,
|
|
1673
|
+
width: N
|
|
1674
1674
|
});
|
|
1675
1675
|
}), r == null || r.calculate(), o == null || o.makeDirty();
|
|
1676
1676
|
});
|
|
@@ -1687,7 +1687,7 @@ let Te = class extends Y {
|
|
|
1687
1687
|
});
|
|
1688
1688
|
}
|
|
1689
1689
|
_commandExecutedListener() {
|
|
1690
|
-
const e = [
|
|
1690
|
+
const e = [et.id, tt.id];
|
|
1691
1691
|
this.disposeWithMe(
|
|
1692
1692
|
this._commandService.onCommandExecuted((t) => {
|
|
1693
1693
|
var n;
|
|
@@ -1714,102 +1714,50 @@ let Te = class extends Y {
|
|
|
1714
1714
|
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
|
|
1715
1715
|
if (!r)
|
|
1716
1716
|
return;
|
|
1717
|
-
const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop:
|
|
1717
|
+
const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: S } = a, { pages: g } = r, p = [];
|
|
1718
1718
|
o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
|
|
1719
1719
|
for (let l = 0, _ = g.length; l < _; l++) {
|
|
1720
|
-
const
|
|
1721
|
-
this._liquid.translatePagePadding(
|
|
1722
|
-
const { aLeft:
|
|
1723
|
-
|
|
1720
|
+
const O = g[l], { skeDrawings: E, marginLeft: N, marginTop: F } = O;
|
|
1721
|
+
this._liquid.translatePagePadding(O), E.forEach((w) => {
|
|
1722
|
+
const { aLeft: Y, aTop: G, height: ge, width: _e, objectId: x, drawingOrigin: pe } = w, Ve = pe.layoutType === kt.WRAP_NONE && pe.behindDoc === C.TRUE;
|
|
1723
|
+
p.push({
|
|
1724
1724
|
unitId: e,
|
|
1725
|
-
subUnitId:
|
|
1725
|
+
subUnitId: zt,
|
|
1726
1726
|
floatingObjectId: x,
|
|
1727
|
+
behindText: Ve,
|
|
1727
1728
|
floatingObject: {
|
|
1728
|
-
left:
|
|
1729
|
+
left: Y + c + this._liquid.x,
|
|
1729
1730
|
top: G + d + this._liquid.y,
|
|
1730
|
-
width:
|
|
1731
|
-
height:
|
|
1731
|
+
width: _e,
|
|
1732
|
+
height: ge
|
|
1732
1733
|
}
|
|
1733
1734
|
}), this._pageMarginCache.set(x, {
|
|
1734
1735
|
marginLeft: this._liquid.x,
|
|
1735
1736
|
marginTop: this._liquid.y
|
|
1736
1737
|
});
|
|
1737
|
-
}), this._liquid.translatePage(
|
|
1738
|
+
}), this._liquid.restorePagePadding(O), this._liquid.translatePage(O, u, h, S);
|
|
1738
1739
|
}
|
|
1739
|
-
this._floatingObjectManagerService.
|
|
1740
|
+
this._floatingObjectManagerService.batchAddOrUpdate(p);
|
|
1740
1741
|
}
|
|
1741
1742
|
};
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
],
|
|
1743
|
+
be = Mr([
|
|
1744
|
+
L(B.Steady, be),
|
|
1745
|
+
K(0, R(ie)),
|
|
1746
|
+
K(1, U),
|
|
1747
|
+
K(2, H),
|
|
1748
|
+
K(3, v),
|
|
1749
|
+
K(4, Ht),
|
|
1750
|
+
K(5, $)
|
|
1751
|
+
], be);
|
|
1751
1752
|
var Er = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Dr = (i, e, t, n) => {
|
|
1752
1753
|
for (var r = n > 1 ? void 0 : n ? xr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1753
1754
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1754
1755
|
return n && r && Er(e, t, r), r;
|
|
1755
|
-
},
|
|
1756
|
-
|
|
1757
|
-
let Ie = class extends Y {
|
|
1758
|
-
constructor(i, e, t) {
|
|
1759
|
-
super(), this._renderManagerService = i, this._editorService = e, this._univerInstanceService = t, this._initialize(), this._commandExecutedListener();
|
|
1760
|
-
}
|
|
1761
|
-
_initialize() {
|
|
1762
|
-
this._initialRenderRefresh();
|
|
1763
|
-
}
|
|
1764
|
-
_initialRenderRefresh() {
|
|
1765
|
-
this._renderManagerService.currentRender$.subscribe((i) => {
|
|
1766
|
-
var s;
|
|
1767
|
-
if (i == null)
|
|
1768
|
-
return;
|
|
1769
|
-
const e = this._renderManagerService.getRenderById(i);
|
|
1770
|
-
if (this._editorService.isEditor(i) || this._univerInstanceService.getUniverDocInstance(i) == null || e == null)
|
|
1771
|
-
return;
|
|
1772
|
-
const { mainComponent: t } = e, n = t, r = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
|
|
1773
|
-
this.disposeWithMe(
|
|
1774
|
-
F(
|
|
1775
|
-
n.onPageRenderObservable.add((o) => {
|
|
1776
|
-
var _, R, y, L;
|
|
1777
|
-
if (this._editorService.isEditor(i))
|
|
1778
|
-
return;
|
|
1779
|
-
const { page: a, pageLeft: c, pageTop: d, ctx: u } = o, { width: h, pageWidth: p, height: g, pageHeight: f } = a;
|
|
1780
|
-
u.save(), u.translate(c - 0.5, d - 0.5);
|
|
1781
|
-
const l = {
|
|
1782
|
-
width: (R = (_ = r == null ? void 0 : r.width) != null ? _ : p) != null ? R : h,
|
|
1783
|
-
height: (L = (y = r == null ? void 0 : r.height) != null ? y : f) != null ? L : g,
|
|
1784
|
-
strokeWidth: 1,
|
|
1785
|
-
stroke: Pr,
|
|
1786
|
-
fill: Ur,
|
|
1787
|
-
zIndex: 3
|
|
1788
|
-
};
|
|
1789
|
-
wn.drawWith(u, l), u.restore();
|
|
1790
|
-
})
|
|
1791
|
-
)
|
|
1792
|
-
);
|
|
1793
|
-
});
|
|
1794
|
-
}
|
|
1795
|
-
_commandExecutedListener() {
|
|
1796
|
-
}
|
|
1797
|
-
};
|
|
1798
|
-
Ie = Dr([
|
|
1799
|
-
N(A.Rendered, Ie),
|
|
1800
|
-
We(0, W),
|
|
1801
|
-
We(1, $),
|
|
1802
|
-
We(2, D)
|
|
1803
|
-
], Ie);
|
|
1804
|
-
var Lr = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, Ar = (i, e, t, n) => {
|
|
1805
|
-
for (var r = n > 1 ? void 0 : n ? Nr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1806
|
-
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1807
|
-
return n && r && Lr(e, t, r), r;
|
|
1808
|
-
}, K = (i, e) => (t, n) => e(t, n, i);
|
|
1809
|
-
let be = class extends Y {
|
|
1756
|
+
}, Z = (i, e) => (t, n) => e(t, n, i);
|
|
1757
|
+
let ye = class extends ee {
|
|
1810
1758
|
constructor(e, t, n, r, s, o) {
|
|
1811
1759
|
super();
|
|
1812
|
-
|
|
1760
|
+
f(this, "_initializedRender", /* @__PURE__ */ new Set());
|
|
1813
1761
|
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
|
|
1814
1762
|
}
|
|
1815
1763
|
dispose() {
|
|
@@ -1828,7 +1776,7 @@ let be = class extends Y {
|
|
|
1828
1776
|
this._initializedRender.add(t);
|
|
1829
1777
|
const { scene: r } = n;
|
|
1830
1778
|
this.disposeWithMe(
|
|
1831
|
-
|
|
1779
|
+
j(
|
|
1832
1780
|
r.onMouseWheelObserver.add((s) => {
|
|
1833
1781
|
if (!s.ctrlKey)
|
|
1834
1782
|
return;
|
|
@@ -1858,7 +1806,7 @@ let be = class extends Y {
|
|
|
1858
1806
|
// }
|
|
1859
1807
|
_skeletonListener() {
|
|
1860
1808
|
this.disposeWithMe(
|
|
1861
|
-
|
|
1809
|
+
j(
|
|
1862
1810
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1863
1811
|
if (e == null)
|
|
1864
1812
|
return;
|
|
@@ -1872,7 +1820,7 @@ let be = class extends Y {
|
|
|
1872
1820
|
);
|
|
1873
1821
|
}
|
|
1874
1822
|
_commandExecutedListener() {
|
|
1875
|
-
const e = [
|
|
1823
|
+
const e = [tt.id];
|
|
1876
1824
|
this.disposeWithMe(
|
|
1877
1825
|
this._commandService.onCommandExecuted((t) => {
|
|
1878
1826
|
if (e.includes(t.id)) {
|
|
@@ -1894,43 +1842,43 @@ let be = class extends Y {
|
|
|
1894
1842
|
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
|
|
1895
1843
|
}
|
|
1896
1844
|
_calculatePagePosition(e, t) {
|
|
1897
|
-
const { document: n, scene: r } = e,
|
|
1898
|
-
if (
|
|
1845
|
+
const { document: n, scene: r, docBackground: s } = e, o = r == null ? void 0 : r.getParent(), { width: a, height: c, pageMarginLeft: d, pageMarginTop: u } = n;
|
|
1846
|
+
if (o == null || a === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
|
|
1899
1847
|
return;
|
|
1900
|
-
const { width:
|
|
1901
|
-
let
|
|
1902
|
-
|
|
1903
|
-
const
|
|
1904
|
-
if (
|
|
1905
|
-
const
|
|
1906
|
-
|
|
1907
|
-
x:
|
|
1848
|
+
const { width: h, height: S } = o;
|
|
1849
|
+
let g = 0, p = 0, l = 0, _ = 0, O = Number.POSITIVE_INFINITY;
|
|
1850
|
+
h > (a + d * 2) * t ? (g = h / 2 - a * t / 2, g /= t, l = (h - d * 2) / t, O = 0) : (g = d, l = a + d * 2, O = (l - h / t) / 2), S > c ? (p = S / 2 - c / 2, _ = (S - u * 2) / t) : (p = u, _ = c + u * 2), r.resize(l, _ + 200), n.translate(g, p), s.translate(g, p);
|
|
1851
|
+
const E = r.getViewport(Be.VIEW_MAIN);
|
|
1852
|
+
if (O !== Number.POSITIVE_INFINITY && E != null) {
|
|
1853
|
+
const N = E.getBarScroll(O, 0).x;
|
|
1854
|
+
E.scrollTo({
|
|
1855
|
+
x: N
|
|
1908
1856
|
});
|
|
1909
1857
|
}
|
|
1910
1858
|
return this;
|
|
1911
1859
|
}
|
|
1912
1860
|
_getDocObject() {
|
|
1913
|
-
return
|
|
1861
|
+
return xt(this._univerInstanceService, this._renderManagerService);
|
|
1914
1862
|
}
|
|
1915
1863
|
};
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
],
|
|
1925
|
-
var
|
|
1926
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1864
|
+
ye = Dr([
|
|
1865
|
+
L(B.Rendered, ye),
|
|
1866
|
+
Z(0, R(ie)),
|
|
1867
|
+
Z(1, U),
|
|
1868
|
+
Z(2, v),
|
|
1869
|
+
Z(3, H),
|
|
1870
|
+
Z(4, R(ne)),
|
|
1871
|
+
Z(5, $)
|
|
1872
|
+
], ye);
|
|
1873
|
+
var Pr = Object.defineProperty, Ur = Object.getOwnPropertyDescriptor, Nr = (i, e, t, n) => {
|
|
1874
|
+
for (var r = n > 1 ? void 0 : n ? Ur(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1927
1875
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1928
|
-
return n && r &&
|
|
1929
|
-
},
|
|
1930
|
-
let Me = class extends
|
|
1876
|
+
return n && r && Pr(e, t, r), r;
|
|
1877
|
+
}, z = (i, e) => (t, n) => e(t, n, i);
|
|
1878
|
+
let Me = class extends ee {
|
|
1931
1879
|
constructor(e, t, n, r, s, o, a) {
|
|
1932
1880
|
super();
|
|
1933
|
-
|
|
1881
|
+
f(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
1934
1882
|
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = a, this._initialize();
|
|
1935
1883
|
}
|
|
1936
1884
|
_initialize() {
|
|
@@ -1957,19 +1905,19 @@ let Me = class extends Y {
|
|
|
1957
1905
|
return;
|
|
1958
1906
|
const { document: n, scene: r } = t;
|
|
1959
1907
|
this.disposeWithMe(
|
|
1960
|
-
|
|
1908
|
+
j(
|
|
1961
1909
|
n.onPointerEnterObserver.add(() => {
|
|
1962
|
-
this._isEditorReadOnly(e) || (n.cursor =
|
|
1910
|
+
this._isEditorReadOnly(e) || (n.cursor = _t.TEXT);
|
|
1963
1911
|
})
|
|
1964
1912
|
)
|
|
1965
1913
|
), this.disposeWithMe(
|
|
1966
|
-
|
|
1914
|
+
j(
|
|
1967
1915
|
n.onPointerLeaveObserver.add(() => {
|
|
1968
|
-
n.cursor =
|
|
1916
|
+
n.cursor = _t.DEFAULT, r.resetCursor();
|
|
1969
1917
|
})
|
|
1970
1918
|
)
|
|
1971
1919
|
), this.disposeWithMe(
|
|
1972
|
-
|
|
1920
|
+
j(
|
|
1973
1921
|
n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
|
|
1974
1922
|
if (this._isEditorReadOnly(e))
|
|
1975
1923
|
return;
|
|
@@ -1982,13 +1930,13 @@ let Me = class extends Y {
|
|
|
1982
1930
|
})
|
|
1983
1931
|
)
|
|
1984
1932
|
), this.disposeWithMe(
|
|
1985
|
-
|
|
1933
|
+
j(
|
|
1986
1934
|
n == null ? void 0 : n.onDblclickObserver.add((s) => {
|
|
1987
1935
|
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(s);
|
|
1988
1936
|
})
|
|
1989
1937
|
)
|
|
1990
1938
|
), this.disposeWithMe(
|
|
1991
|
-
|
|
1939
|
+
j(
|
|
1992
1940
|
n == null ? void 0 : n.onTripleClickObserver.add((s) => {
|
|
1993
1941
|
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(s);
|
|
1994
1942
|
})
|
|
@@ -2000,14 +1948,14 @@ let Me = class extends Y {
|
|
|
2000
1948
|
return t ? t.isReadOnly() : !1;
|
|
2001
1949
|
}
|
|
2002
1950
|
_setEditorFocus(e) {
|
|
2003
|
-
if (this._univerInstanceService.getAllUnitsForType(
|
|
2004
|
-
const n = this._univerInstanceService.getCurrentUnitForType(
|
|
1951
|
+
if (this._univerInstanceService.getAllUnitsForType(m.UNIVER_SHEET).length > 0) {
|
|
1952
|
+
const n = this._univerInstanceService.getCurrentUnitForType(m.UNIVER_SHEET);
|
|
2005
1953
|
this._editorService.setOperationSheetUnitId(n.getUnitId());
|
|
2006
1954
|
}
|
|
2007
1955
|
this._editorService.focusStyle(e);
|
|
2008
1956
|
}
|
|
2009
1957
|
_commandExecutedListener() {
|
|
2010
|
-
const e = [
|
|
1958
|
+
const e = [tt.id];
|
|
2011
1959
|
this.disposeWithMe(
|
|
2012
1960
|
this._commandService.onCommandExecuted((t) => {
|
|
2013
1961
|
var n;
|
|
@@ -2037,31 +1985,31 @@ let Me = class extends Y {
|
|
|
2037
1985
|
);
|
|
2038
1986
|
}
|
|
2039
1987
|
_getDocObjectById(e) {
|
|
2040
|
-
return this._univerInstanceService.getUnitType(e) !==
|
|
1988
|
+
return this._univerInstanceService.getUnitType(e) !== m.UNIVER_DOC ? null : Un(e, this._renderManagerService);
|
|
2041
1989
|
}
|
|
2042
1990
|
};
|
|
2043
|
-
Me =
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
1991
|
+
Me = Nr([
|
|
1992
|
+
L(B.Rendered, Me),
|
|
1993
|
+
z(0, R(ie)),
|
|
1994
|
+
z(1, U),
|
|
1995
|
+
z(2, v),
|
|
1996
|
+
z(3, H),
|
|
1997
|
+
z(4, ue),
|
|
1998
|
+
z(5, R(ne)),
|
|
1999
|
+
z(6, $)
|
|
2052
2000
|
], Me);
|
|
2053
|
-
var
|
|
2054
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2001
|
+
var Ar = Object.defineProperty, Lr = Object.getOwnPropertyDescriptor, Br = (i, e, t, n) => {
|
|
2002
|
+
for (var r = n > 1 ? void 0 : n ? Lr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2055
2003
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
2056
|
-
return n && r &&
|
|
2057
|
-
},
|
|
2058
|
-
const
|
|
2059
|
-
let
|
|
2004
|
+
return n && r && Ar(e, t, r), r;
|
|
2005
|
+
}, se = (i, e) => (t, n) => e(t, n, i);
|
|
2006
|
+
const Ot = 1.5;
|
|
2007
|
+
let Ee = class extends le {
|
|
2060
2008
|
constructor(i, e, t, n, r) {
|
|
2061
2009
|
super(), this._docSkeletonManagerService = i, this._textSelectionManagerService = e, this._editorService = t, this._univerInstanceService = n, this._renderManagerService = r, this._init();
|
|
2062
2010
|
}
|
|
2063
2011
|
_init() {
|
|
2064
|
-
this._textSelectionManagerService.textSelection$.pipe(
|
|
2012
|
+
this._textSelectionManagerService.textSelection$.pipe(ce(this.dispose$)).subscribe((i) => {
|
|
2065
2013
|
if (i == null)
|
|
2066
2014
|
return;
|
|
2067
2015
|
const { isEditing: e, unitId: t } = i;
|
|
@@ -2077,51 +2025,51 @@ let ye = class extends ce {
|
|
|
2077
2025
|
const { collapsed: r, startNodePosition: s } = e;
|
|
2078
2026
|
if (!r)
|
|
2079
2027
|
return;
|
|
2080
|
-
const o = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = o, d = new jn(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: h, top:
|
|
2028
|
+
const o = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = o, d = new jn(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: h, top: S, height: g } = Vn(u), p = h + a, l = S + c, _ = t.scene.getViewport(Be.VIEW_MAIN), O = !!this._editorService.getEditor(i);
|
|
2081
2029
|
if (_ == null)
|
|
2082
2030
|
return;
|
|
2083
2031
|
const {
|
|
2084
|
-
left:
|
|
2085
|
-
top:
|
|
2086
|
-
right:
|
|
2087
|
-
bottom:
|
|
2032
|
+
left: E,
|
|
2033
|
+
top: N,
|
|
2034
|
+
right: F,
|
|
2035
|
+
bottom: w
|
|
2088
2036
|
} = _.getBounding().viewBound;
|
|
2089
|
-
let
|
|
2090
|
-
const
|
|
2091
|
-
l <
|
|
2092
|
-
const
|
|
2093
|
-
_.scrollBy(
|
|
2037
|
+
let Y = 0, G = 0;
|
|
2038
|
+
const ge = O ? 0 : 100;
|
|
2039
|
+
l < N ? Y = l - N : l > w - g && (Y = l - w + g + ge), p < E ? G = p - E : p > F - Ot && (G = p - F + Ot);
|
|
2040
|
+
const _e = _.getBarScroll(G, Y);
|
|
2041
|
+
_.scrollBy(_e);
|
|
2094
2042
|
}
|
|
2095
2043
|
_getDocObject() {
|
|
2096
|
-
return
|
|
2044
|
+
return xt(this._univerInstanceService, this._renderManagerService);
|
|
2097
2045
|
}
|
|
2098
2046
|
};
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
],
|
|
2107
|
-
var
|
|
2108
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2047
|
+
Ee = Br([
|
|
2048
|
+
L(B.Rendered, Ee),
|
|
2049
|
+
se(0, R(ie)),
|
|
2050
|
+
se(1, R(ne)),
|
|
2051
|
+
se(2, $),
|
|
2052
|
+
se(3, U),
|
|
2053
|
+
se(4, H)
|
|
2054
|
+
], Ee);
|
|
2055
|
+
var $r = Object.defineProperty, Fr = Object.getOwnPropertyDescriptor, wr = (i, e, t, n) => {
|
|
2056
|
+
for (var r = n > 1 ? void 0 : n ? Fr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2109
2057
|
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
2110
|
-
return n && r &&
|
|
2111
|
-
}, ze = (i, e) => (t, n) => e(t, n, i),
|
|
2112
|
-
let
|
|
2058
|
+
return n && r && $r(e, t, r), r;
|
|
2059
|
+
}, ze = (i, e) => (t, n) => e(t, n, i), ve;
|
|
2060
|
+
let Rt = (ve = class extends Yt {
|
|
2113
2061
|
constructor(i, e, t, n) {
|
|
2114
2062
|
super(), this._config = i, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
|
|
2115
|
-
zhCN:
|
|
2116
|
-
}), this._config = qe.deepMerge({},
|
|
2063
|
+
zhCN: ki
|
|
2064
|
+
}), this._config = qe.deepMerge({}, Gn, this._config), this._initDependencies(e), this._initializeCommands();
|
|
2117
2065
|
}
|
|
2118
2066
|
onRendered() {
|
|
2119
2067
|
this._initModules(), this._markDocAsFocused();
|
|
2120
2068
|
}
|
|
2121
2069
|
_initializeCommands() {
|
|
2122
2070
|
[
|
|
2071
|
+
Zn,
|
|
2123
2072
|
qn,
|
|
2124
|
-
Kn,
|
|
2125
2073
|
Qn,
|
|
2126
2074
|
Jn,
|
|
2127
2075
|
ei,
|
|
@@ -2131,7 +2079,7 @@ let Ot = (me = class extends Yt {
|
|
|
2131
2079
|
ri,
|
|
2132
2080
|
Hi,
|
|
2133
2081
|
Yi,
|
|
2134
|
-
|
|
2082
|
+
zi
|
|
2135
2083
|
].forEach((i) => {
|
|
2136
2084
|
this._injector.get(dn).registerShortcut(i);
|
|
2137
2085
|
});
|
|
@@ -2139,36 +2087,35 @@ let Ot = (me = class extends Yt {
|
|
|
2139
2087
|
_initDependencies(i) {
|
|
2140
2088
|
[
|
|
2141
2089
|
// Controller
|
|
2142
|
-
[Se],
|
|
2143
|
-
[ve],
|
|
2144
2090
|
[Ce],
|
|
2145
2091
|
[Oe],
|
|
2092
|
+
[Re],
|
|
2146
2093
|
[Te],
|
|
2147
|
-
[Ie],
|
|
2148
2094
|
[be],
|
|
2149
|
-
[Me],
|
|
2150
2095
|
[ye],
|
|
2096
|
+
[Me],
|
|
2097
|
+
[Ee],
|
|
2151
2098
|
[
|
|
2152
2099
|
// controllers
|
|
2153
|
-
|
|
2100
|
+
ae,
|
|
2154
2101
|
{
|
|
2155
|
-
useFactory: () => this._injector.createInstance(
|
|
2102
|
+
useFactory: () => this._injector.createInstance(ae, this._config)
|
|
2156
2103
|
}
|
|
2157
2104
|
],
|
|
2158
2105
|
[
|
|
2159
|
-
|
|
2106
|
+
he,
|
|
2160
2107
|
{
|
|
2161
2108
|
useClass: Xe
|
|
2162
2109
|
}
|
|
2163
2110
|
],
|
|
2164
2111
|
// Render views
|
|
2165
|
-
[
|
|
2112
|
+
[Ie]
|
|
2166
2113
|
].forEach((t) => {
|
|
2167
2114
|
i.add(t);
|
|
2168
2115
|
});
|
|
2169
2116
|
}
|
|
2170
2117
|
_markDocAsFocused() {
|
|
2171
|
-
const i = this._injector.get(
|
|
2118
|
+
const i = this._injector.get(U), e = this._injector.get($);
|
|
2172
2119
|
try {
|
|
2173
2120
|
const t = i.getCurrentUniverDocInstance();
|
|
2174
2121
|
if (!t)
|
|
@@ -2180,24 +2127,24 @@ let Ot = (me = class extends Yt {
|
|
|
2180
2127
|
}
|
|
2181
2128
|
}
|
|
2182
2129
|
_initModules() {
|
|
2183
|
-
this._injector.get(
|
|
2184
|
-
}
|
|
2185
|
-
},
|
|
2186
|
-
|
|
2187
|
-
ze(1,
|
|
2188
|
-
ze(2,
|
|
2189
|
-
ze(3,
|
|
2190
|
-
],
|
|
2130
|
+
this._injector.get(ae);
|
|
2131
|
+
}
|
|
2132
|
+
}, f(ve, "pluginName", Xn), f(ve, "type", m.UNIVER_DOC), ve);
|
|
2133
|
+
Rt = wr([
|
|
2134
|
+
ze(1, R(Ue)),
|
|
2135
|
+
ze(2, R(Ze)),
|
|
2136
|
+
ze(3, bt)
|
|
2137
|
+
], Rt);
|
|
2191
2138
|
export {
|
|
2192
|
-
|
|
2139
|
+
Xn as DOC_UI_PLUGIN_NAME,
|
|
2193
2140
|
Yn as DefaultDocContainerConfig,
|
|
2194
|
-
|
|
2141
|
+
Gn as DefaultDocUiConfig,
|
|
2195
2142
|
Hn as DefaultToolbarConfig,
|
|
2196
|
-
|
|
2143
|
+
Ie as DocCanvasView,
|
|
2197
2144
|
er as PastePluginLark,
|
|
2198
2145
|
rr as PastePluginUniver,
|
|
2199
2146
|
nr as PastePluginWord,
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2147
|
+
Rt as UniverDocsUIPlugin,
|
|
2148
|
+
Zr as enUS,
|
|
2149
|
+
ki as zhCN
|
|
2203
2150
|
};
|