@univerjs/docs-ui 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/index.js +481 -450
- package/lib/types/basics/interfaces/component-config/i-doc-ui-plugin-config.d.ts +3 -15
- package/lib/types/controllers/app-ui-controller.d.ts +5 -5
- package/lib/types/controllers/back-scroll.controller.d.ts +3 -3
- package/lib/types/controllers/clipboard.controller.d.ts +3 -3
- package/lib/types/controllers/doc-container-ui-controller.d.ts +3 -3
- package/lib/types/controllers/doc-editor-bridge.controller.d.ts +3 -3
- package/lib/types/controllers/doc-floating-object.controller.d.ts +3 -3
- package/lib/types/controllers/doc-render.controller.d.ts +3 -3
- package/lib/types/controllers/doc-ui.controller.d.ts +6 -4
- package/lib/types/controllers/menu/menu.d.ts +1 -1
- package/lib/types/controllers/text-selection.controller.d.ts +3 -3
- package/lib/types/controllers/zoom.controller.d.ts +3 -3
- package/lib/types/docs-ui-plugin.d.ts +2 -2
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/index.d.ts +1 -0
- package/lib/types/locale/ru-RU.d.ts +4 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +3 -3
- package/lib/types/services/clipboard/html-to-udm/converter.d.ts +1 -1
- package/lib/types/views/doc-canvas-view.d.ts +2 -2
- package/lib/types/views/doc-container/DocContainer.d.ts +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +16 -16
package/lib/es/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var Bt = Object.defineProperty;
|
|
2
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
|
|
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
|
|
3
|
+
var p = (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 de, 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
5
|
import { Inject as R, Injector as Ue, Optional as Gt, createIdentifier as Xt } from "@wendellhu/redi";
|
|
6
|
-
import { KeyCode as D, MetaKeys as
|
|
6
|
+
import { KeyCode as D, MetaKeys as ue, 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, BuiltInUIPart as Qt, ComponentManager as en, IEditorService as $, IMenuService as tn, IUIPartsService 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
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
8
|
import { connectInjector as Nn } from "@wendellhu/redi/react-bindings";
|
|
9
|
-
import { ITextSelectionRenderManager as
|
|
9
|
+
import { ITextSelectionRenderManager as he, 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 M, takeUntil as
|
|
11
|
+
import { Observable as M, takeUntil as le, fromEvent as pt, BehaviorSubject as kn } from "rxjs";
|
|
12
12
|
import { ColorPicker as zn } from "@univerjs/design";
|
|
13
13
|
const Hn = {
|
|
14
14
|
undo: !0,
|
|
@@ -93,47 +93,47 @@ const Zn = {
|
|
|
93
93
|
}
|
|
94
94
|
}, ei = {
|
|
95
95
|
id: Ae.id,
|
|
96
|
-
binding: D.ARROW_UP |
|
|
96
|
+
binding: D.ARROW_UP | ue.SHIFT,
|
|
97
97
|
preconditions: A,
|
|
98
98
|
staticParameters: {
|
|
99
99
|
direction: V.UP
|
|
100
100
|
}
|
|
101
101
|
}, ti = {
|
|
102
102
|
id: Ae.id,
|
|
103
|
-
binding: D.ARROW_DOWN |
|
|
103
|
+
binding: D.ARROW_DOWN | ue.SHIFT,
|
|
104
104
|
preconditions: A,
|
|
105
105
|
staticParameters: {
|
|
106
106
|
direction: V.DOWN
|
|
107
107
|
}
|
|
108
108
|
}, ni = {
|
|
109
109
|
id: Ae.id,
|
|
110
|
-
binding: D.ARROW_LEFT |
|
|
110
|
+
binding: D.ARROW_LEFT | ue.SHIFT,
|
|
111
111
|
preconditions: A,
|
|
112
112
|
staticParameters: {
|
|
113
113
|
direction: V.LEFT
|
|
114
114
|
}
|
|
115
115
|
}, ii = {
|
|
116
116
|
id: Ae.id,
|
|
117
|
-
binding: D.ARROW_RIGHT |
|
|
117
|
+
binding: D.ARROW_RIGHT | ue.SHIFT,
|
|
118
118
|
preconditions: A,
|
|
119
119
|
staticParameters: {
|
|
120
120
|
direction: V.RIGHT
|
|
121
121
|
}
|
|
122
122
|
}, ri = {
|
|
123
123
|
id: un.id,
|
|
124
|
-
binding: D.A |
|
|
124
|
+
binding: D.A | ue.CTRL_COMMAND,
|
|
125
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
|
-
for (var r = n > 1 ? void 0 : n ? si(e, t) : e,
|
|
129
|
-
(
|
|
128
|
+
for (var r = n > 1 ? void 0 : n ? si(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
129
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
130
130
|
return n && r && oi(e, t, r), r;
|
|
131
131
|
}, ft = (i, e) => (t, n) => e(t, n, i);
|
|
132
132
|
let Ge = class {
|
|
133
133
|
constructor(i, e, t) {
|
|
134
|
-
|
|
134
|
+
p(this, "_docContainer");
|
|
135
135
|
// 获取SheetContainer组件
|
|
136
|
-
|
|
136
|
+
p(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
|
+
p(this, "changeLocale", (i) => {
|
|
148
148
|
this._localeService.setLocale(i);
|
|
149
149
|
});
|
|
150
150
|
this._config = i, this._localeService = e, this._injector = t;
|
|
@@ -173,14 +173,14 @@ Ge = ai([
|
|
|
173
173
|
ft(2, R(Ue))
|
|
174
174
|
], Ge);
|
|
175
175
|
var ci = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (i, e, t, n) => {
|
|
176
|
-
for (var r = n > 1 ? void 0 : n ? li(e, t) : e,
|
|
177
|
-
(
|
|
176
|
+
for (var r = n > 1 ? void 0 : n ? li(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
177
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
178
178
|
return n && r && ci(e, t, r), r;
|
|
179
|
-
},
|
|
180
|
-
let ae = class extends
|
|
181
|
-
constructor(e, t, n, r,
|
|
179
|
+
}, me = (i, e) => (t, n) => e(t, n, i);
|
|
180
|
+
let ae = class extends de {
|
|
181
|
+
constructor(e, t, n, r, o) {
|
|
182
182
|
super();
|
|
183
|
-
|
|
183
|
+
p(this, "_docContainerController");
|
|
184
184
|
/**
|
|
185
185
|
* Change language
|
|
186
186
|
* @param {string} locale new language
|
|
@@ -188,10 +188,10 @@ let ae = class extends le {
|
|
|
188
188
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
189
189
|
*
|
|
190
190
|
*/
|
|
191
|
-
|
|
191
|
+
p(this, "changeLocale", (e) => {
|
|
192
192
|
this._localeService.setLocale(e);
|
|
193
193
|
});
|
|
194
|
-
this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService =
|
|
194
|
+
this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService = o, this._docContainerController = this._injector.createInstance(Ge, e), this._registerContainer();
|
|
195
195
|
}
|
|
196
196
|
_registerContainer() {
|
|
197
197
|
this._layoutService && this.disposeWithMe(
|
|
@@ -204,10 +204,10 @@ let ae = class extends le {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
ae = di([
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
me(1, R(Ze)),
|
|
208
|
+
me(2, R(Ue)),
|
|
209
|
+
me(3, he),
|
|
210
|
+
me(4, Gt(yt))
|
|
211
211
|
], ae);
|
|
212
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
213
|
var Nt = { exports: {} }, Fe = {};
|
|
@@ -222,14 +222,14 @@ var Nt = { exports: {} }, Fe = {};
|
|
|
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
224
|
function At(i, e, t) {
|
|
225
|
-
var n, r = {},
|
|
226
|
-
t !== void 0 && (
|
|
225
|
+
var n, r = {}, o = null, s = null;
|
|
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
|
_i.call(e, n) && !fi.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: hi, type: i, key:
|
|
232
|
+
return { $$typeof: hi, type: i, key: o, ref: s, props: r, _owner: pi.current };
|
|
233
233
|
}
|
|
234
234
|
Fe.Fragment = gi;
|
|
235
235
|
Fe.jsx = At;
|
|
@@ -251,13 +251,13 @@ function Oi(i) {
|
|
|
251
251
|
positions: [b.TOOLBAR_START],
|
|
252
252
|
activated$: new M((t) => {
|
|
253
253
|
const n = e.onCommandExecuted((r) => {
|
|
254
|
-
var
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
254
|
+
var s;
|
|
255
|
+
const o = r.id;
|
|
256
|
+
if (o === P.id || o === te.id) {
|
|
257
257
|
const a = W(i);
|
|
258
258
|
if (a == null)
|
|
259
259
|
return;
|
|
260
|
-
const c = (
|
|
260
|
+
const c = (s = a.ts) == null ? void 0 : s.bl;
|
|
261
261
|
t.next(c === C.TRUE);
|
|
262
262
|
}
|
|
263
263
|
});
|
|
@@ -278,13 +278,13 @@ function Ri(i) {
|
|
|
278
278
|
positions: [b.TOOLBAR_START],
|
|
279
279
|
activated$: new M((t) => {
|
|
280
280
|
const n = e.onCommandExecuted((r) => {
|
|
281
|
-
var
|
|
282
|
-
const
|
|
283
|
-
if (
|
|
281
|
+
var s;
|
|
282
|
+
const o = r.id;
|
|
283
|
+
if (o === P.id || o === te.id) {
|
|
284
284
|
const a = W(i);
|
|
285
285
|
if (a == null)
|
|
286
286
|
return;
|
|
287
|
-
const c = (
|
|
287
|
+
const c = (s = a.ts) == null ? void 0 : s.it;
|
|
288
288
|
t.next(c === C.TRUE);
|
|
289
289
|
}
|
|
290
290
|
});
|
|
@@ -305,13 +305,13 @@ function Ti(i) {
|
|
|
305
305
|
positions: [b.TOOLBAR_START],
|
|
306
306
|
activated$: new M((t) => {
|
|
307
307
|
const n = e.onCommandExecuted((r) => {
|
|
308
|
-
var
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
308
|
+
var s;
|
|
309
|
+
const o = r.id;
|
|
310
|
+
if (o === P.id || o === te.id) {
|
|
311
311
|
const a = W(i);
|
|
312
312
|
if (a == null)
|
|
313
313
|
return;
|
|
314
|
-
const c = (
|
|
314
|
+
const c = (s = a.ts) == null ? void 0 : s.ul;
|
|
315
315
|
t.next((c == null ? void 0 : c.s) === C.TRUE);
|
|
316
316
|
}
|
|
317
317
|
});
|
|
@@ -332,13 +332,13 @@ function Ii(i) {
|
|
|
332
332
|
positions: [b.TOOLBAR_START],
|
|
333
333
|
activated$: new M((t) => {
|
|
334
334
|
const n = e.onCommandExecuted((r) => {
|
|
335
|
-
var
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
335
|
+
var s;
|
|
336
|
+
const o = r.id;
|
|
337
|
+
if (o === P.id || o === te.id) {
|
|
338
338
|
const a = W(i);
|
|
339
339
|
if (a == null)
|
|
340
340
|
return;
|
|
341
|
-
const c = (
|
|
341
|
+
const c = (s = a.ts) == null ? void 0 : s.st;
|
|
342
342
|
t.next((c == null ? void 0 : c.s) === C.TRUE);
|
|
343
343
|
}
|
|
344
344
|
});
|
|
@@ -358,13 +358,13 @@ function bi(i) {
|
|
|
358
358
|
positions: [b.TOOLBAR_START],
|
|
359
359
|
activated$: new M((t) => {
|
|
360
360
|
const n = e.onCommandExecuted((r) => {
|
|
361
|
-
var
|
|
362
|
-
const
|
|
363
|
-
if (
|
|
361
|
+
var s;
|
|
362
|
+
const o = r.id;
|
|
363
|
+
if (o === P.id || o === te.id) {
|
|
364
364
|
const a = W(i);
|
|
365
365
|
if (a == null)
|
|
366
366
|
return;
|
|
367
|
-
const c = (
|
|
367
|
+
const c = (s = a.ts) == null ? void 0 : s.va;
|
|
368
368
|
t.next(c === J.SUBSCRIPT);
|
|
369
369
|
}
|
|
370
370
|
});
|
|
@@ -384,13 +384,13 @@ function yi(i) {
|
|
|
384
384
|
positions: [b.TOOLBAR_START],
|
|
385
385
|
activated$: new M((t) => {
|
|
386
386
|
const n = e.onCommandExecuted((r) => {
|
|
387
|
-
var
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
387
|
+
var s;
|
|
388
|
+
const o = r.id;
|
|
389
|
+
if (o === P.id || o === te.id) {
|
|
390
390
|
const a = W(i);
|
|
391
391
|
if (a == null)
|
|
392
392
|
return;
|
|
393
|
-
const c = (
|
|
393
|
+
const c = (s = a.ts) == null ? void 0 : s.va;
|
|
394
394
|
t.next(c === J.SUPERSCRIPT);
|
|
395
395
|
}
|
|
396
396
|
});
|
|
@@ -417,15 +417,15 @@ function Mi(i) {
|
|
|
417
417
|
})),
|
|
418
418
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
419
419
|
value$: new M((t) => {
|
|
420
|
-
const n = st[0].value, r = e.onCommandExecuted((
|
|
420
|
+
const n = st[0].value, r = e.onCommandExecuted((o) => {
|
|
421
421
|
var a;
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
422
|
+
const s = o.id;
|
|
423
|
+
if (s === P.id || s === at.id) {
|
|
424
424
|
const c = W(i);
|
|
425
425
|
if (c == null)
|
|
426
426
|
return;
|
|
427
|
-
const
|
|
428
|
-
t.next(
|
|
427
|
+
const l = (a = c.ts) == null ? void 0 : a.ff;
|
|
428
|
+
t.next(l != null ? l : n);
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
431
|
return t.next(n), r.dispose;
|
|
@@ -452,15 +452,15 @@ function Ei(i) {
|
|
|
452
452
|
selections: Kt,
|
|
453
453
|
// disabled$,
|
|
454
454
|
value$: new M((t) => {
|
|
455
|
-
const r = e.onCommandExecuted((
|
|
455
|
+
const r = e.onCommandExecuted((o) => {
|
|
456
456
|
var a;
|
|
457
|
-
const
|
|
458
|
-
if (
|
|
457
|
+
const s = o.id;
|
|
458
|
+
if (s === P.id || s === ct.id) {
|
|
459
459
|
const c = W(i);
|
|
460
460
|
if (c == null)
|
|
461
461
|
return;
|
|
462
|
-
const
|
|
463
|
-
t.next(
|
|
462
|
+
const l = (a = c.ts) == null ? void 0 : a.fs;
|
|
463
|
+
t.next(l != null ? l : 14);
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
466
|
return t.next(14), r.dispose;
|
|
@@ -486,13 +486,13 @@ function xi(i) {
|
|
|
486
486
|
}
|
|
487
487
|
],
|
|
488
488
|
value$: new M((n) => {
|
|
489
|
-
const r = t.getCurrentTheme().textColor,
|
|
490
|
-
if (
|
|
491
|
-
const a =
|
|
489
|
+
const r = t.getCurrentTheme().textColor, o = e.onCommandExecuted((s) => {
|
|
490
|
+
if (s.id === lt.id) {
|
|
491
|
+
const a = s.params.value;
|
|
492
492
|
n.next(a != null ? a : r);
|
|
493
493
|
}
|
|
494
494
|
});
|
|
495
|
-
return n.next(r),
|
|
495
|
+
return n.next(r), o.dispose;
|
|
496
496
|
}),
|
|
497
497
|
hidden$: y(i, m.UNIVER_DOC)
|
|
498
498
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
@@ -509,13 +509,13 @@ function Di(i) {
|
|
|
509
509
|
positions: [b.TOOLBAR_START],
|
|
510
510
|
activated$: new M((t) => {
|
|
511
511
|
const n = e.onCommandExecuted((r) => {
|
|
512
|
-
var
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
512
|
+
var s;
|
|
513
|
+
const o = r.id;
|
|
514
|
+
if (o === P.id || o === Le.id) {
|
|
515
515
|
const a = we(i);
|
|
516
516
|
if (a == null)
|
|
517
517
|
return;
|
|
518
|
-
const c = (
|
|
518
|
+
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
519
519
|
t.next(c === Pe.LEFT);
|
|
520
520
|
}
|
|
521
521
|
});
|
|
@@ -535,13 +535,13 @@ function Pi(i) {
|
|
|
535
535
|
positions: [b.TOOLBAR_START],
|
|
536
536
|
activated$: new M((t) => {
|
|
537
537
|
const n = e.onCommandExecuted((r) => {
|
|
538
|
-
var
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
538
|
+
var s;
|
|
539
|
+
const o = r.id;
|
|
540
|
+
if (o === P.id || o === Le.id) {
|
|
541
541
|
const a = we(i);
|
|
542
542
|
if (a == null)
|
|
543
543
|
return;
|
|
544
|
-
const c = (
|
|
544
|
+
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
545
545
|
t.next(c === Pe.CENTER);
|
|
546
546
|
}
|
|
547
547
|
});
|
|
@@ -561,13 +561,13 @@ function Ui(i) {
|
|
|
561
561
|
positions: [b.TOOLBAR_START],
|
|
562
562
|
activated$: new M((t) => {
|
|
563
563
|
const n = e.onCommandExecuted((r) => {
|
|
564
|
-
var
|
|
565
|
-
const
|
|
566
|
-
if (
|
|
564
|
+
var s;
|
|
565
|
+
const o = r.id;
|
|
566
|
+
if (o === P.id || o === Le.id) {
|
|
567
567
|
const a = we(i);
|
|
568
568
|
if (a == null)
|
|
569
569
|
return;
|
|
570
|
-
const c = (
|
|
570
|
+
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
571
571
|
t.next(c === Pe.RIGHT);
|
|
572
572
|
}
|
|
573
573
|
});
|
|
@@ -587,13 +587,13 @@ function Ni(i) {
|
|
|
587
587
|
positions: [b.TOOLBAR_START],
|
|
588
588
|
activated$: new M((t) => {
|
|
589
589
|
const n = e.onCommandExecuted((r) => {
|
|
590
|
-
var
|
|
591
|
-
const
|
|
592
|
-
if (
|
|
590
|
+
var s;
|
|
591
|
+
const o = r.id;
|
|
592
|
+
if (o === P.id || o === Le.id) {
|
|
593
593
|
const a = we(i);
|
|
594
594
|
if (a == null)
|
|
595
595
|
return;
|
|
596
|
-
const c = (
|
|
596
|
+
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
597
597
|
t.next(c === Pe.JUSTIFIED);
|
|
598
598
|
}
|
|
599
599
|
});
|
|
@@ -651,13 +651,13 @@ function $i(i) {
|
|
|
651
651
|
}
|
|
652
652
|
],
|
|
653
653
|
value$: new M((n) => {
|
|
654
|
-
const r = t.getCurrentTheme().primaryColor,
|
|
655
|
-
if (
|
|
656
|
-
const a =
|
|
654
|
+
const r = t.getCurrentTheme().primaryColor, o = e.onCommandExecuted((s) => {
|
|
655
|
+
if (s.id === He.id) {
|
|
656
|
+
const a = s.params.value;
|
|
657
657
|
n.next(a != null ? a : r);
|
|
658
658
|
}
|
|
659
659
|
});
|
|
660
|
-
return n.next(r),
|
|
660
|
+
return n.next(r), o.dispose;
|
|
661
661
|
}),
|
|
662
662
|
hidden$: y(i, m.UNIVER_DOC)
|
|
663
663
|
};
|
|
@@ -667,44 +667,45 @@ function W(i) {
|
|
|
667
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
|
-
const
|
|
671
|
-
if (
|
|
670
|
+
const o = (c = n.getBody()) == null ? void 0 : c.textRuns;
|
|
671
|
+
if (o == null)
|
|
672
672
|
return;
|
|
673
|
-
const { startOffset:
|
|
674
|
-
return
|
|
673
|
+
const { startOffset: s } = r;
|
|
674
|
+
return o.find(({ st: l, ed: u }) => s >= l && s < u);
|
|
675
675
|
}
|
|
676
676
|
function we(i) {
|
|
677
677
|
var c;
|
|
678
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
|
-
const
|
|
682
|
-
if (
|
|
681
|
+
const o = (c = n.getBody()) == null ? void 0 : c.paragraphs;
|
|
682
|
+
if (o == null)
|
|
683
683
|
return;
|
|
684
|
-
const { startOffset:
|
|
684
|
+
const { startOffset: s } = r;
|
|
685
685
|
let a = -1;
|
|
686
|
-
for (const
|
|
687
|
-
const { startIndex: u } =
|
|
688
|
-
if (
|
|
689
|
-
return
|
|
686
|
+
for (const l of o) {
|
|
687
|
+
const { startIndex: u } = l;
|
|
688
|
+
if (s > a && s <= u)
|
|
689
|
+
return l;
|
|
690
690
|
a = u;
|
|
691
691
|
}
|
|
692
692
|
return null;
|
|
693
693
|
}
|
|
694
694
|
var Fi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, ji = (i, e, t, n) => {
|
|
695
|
-
for (var r = n > 1 ? void 0 : n ? wi(e, t) : e,
|
|
696
|
-
(
|
|
695
|
+
for (var r = n > 1 ? void 0 : n ? wi(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
696
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(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
|
|
700
|
-
constructor(i, e, t, n, r, s,
|
|
701
|
-
super(), this.
|
|
699
|
+
let ce = class extends ee {
|
|
700
|
+
constructor(i, e, t, n, r, o, s, a) {
|
|
701
|
+
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
702
|
}
|
|
703
703
|
_initCustomComponents() {
|
|
704
704
|
const i = this._componentManager;
|
|
705
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
|
+
const { menu: i = {} } = this._config;
|
|
708
709
|
[
|
|
709
710
|
Oi,
|
|
710
711
|
Ri,
|
|
@@ -723,8 +724,8 @@ let Ce = class extends ee {
|
|
|
723
724
|
Li,
|
|
724
725
|
Bi,
|
|
725
726
|
$i
|
|
726
|
-
].forEach((
|
|
727
|
-
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(i))
|
|
727
|
+
].forEach((e) => {
|
|
728
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e), i));
|
|
728
729
|
});
|
|
729
730
|
}
|
|
730
731
|
_init() {
|
|
@@ -735,27 +736,27 @@ let Ce = class extends ee {
|
|
|
735
736
|
if (i == null)
|
|
736
737
|
return;
|
|
737
738
|
this._editorService.isEditor(i) || this.disposeWithMe(
|
|
738
|
-
this.
|
|
739
|
+
this._uiPartsService.registerComponent(Qt.CONTENT, () => Nn(Ci, this._injector))
|
|
739
740
|
);
|
|
740
741
|
}
|
|
741
742
|
_initFocusHandler() {
|
|
742
743
|
this.disposeWithMe(
|
|
743
744
|
this._layoutService.registerFocusHandler(m.UNIVER_DOC, () => {
|
|
744
|
-
this._injector.get(
|
|
745
|
+
this._injector.get(he).focus();
|
|
745
746
|
})
|
|
746
747
|
);
|
|
747
748
|
}
|
|
748
749
|
};
|
|
749
|
-
|
|
750
|
-
L(B.Rendered,
|
|
751
|
-
k(
|
|
752
|
-
k(
|
|
753
|
-
k(
|
|
754
|
-
k(
|
|
755
|
-
k(
|
|
756
|
-
k(
|
|
757
|
-
k(
|
|
758
|
-
],
|
|
750
|
+
ce = ji([
|
|
751
|
+
L(B.Rendered, ce),
|
|
752
|
+
k(1, R(Ue)),
|
|
753
|
+
k(2, R(en)),
|
|
754
|
+
k(3, yt),
|
|
755
|
+
k(4, $),
|
|
756
|
+
k(5, tn),
|
|
757
|
+
k(6, nn),
|
|
758
|
+
k(7, U)
|
|
759
|
+
], ce);
|
|
759
760
|
const Vi = {
|
|
760
761
|
toolbar: {
|
|
761
762
|
undo: "Undo",
|
|
@@ -784,7 +785,7 @@ const Vi = {
|
|
|
784
785
|
alignRight: "Align Right",
|
|
785
786
|
alignJustify: "Justify"
|
|
786
787
|
}
|
|
787
|
-
},
|
|
788
|
+
}, qr = Vi, Wi = {
|
|
788
789
|
toolbar: {
|
|
789
790
|
undo: "撤销",
|
|
790
791
|
redo: "重做",
|
|
@@ -813,28 +814,56 @@ const Vi = {
|
|
|
813
814
|
alignJustify: "两端对齐"
|
|
814
815
|
}
|
|
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 = {
|
|
816
845
|
id: bn.id,
|
|
817
846
|
preconditions: Kn,
|
|
818
847
|
binding: D.ENTER
|
|
819
|
-
},
|
|
848
|
+
}, Yi = {
|
|
820
849
|
id: yn.id,
|
|
821
850
|
preconditions: A,
|
|
822
851
|
binding: D.BACKSPACE
|
|
823
|
-
},
|
|
852
|
+
}, Gi = {
|
|
824
853
|
id: Mn.id,
|
|
825
854
|
preconditions: A,
|
|
826
855
|
binding: D.DELETE
|
|
827
|
-
},
|
|
828
|
-
function
|
|
829
|
-
return qe.generateRandomId(
|
|
856
|
+
}, Xi = 10, Ki = 6;
|
|
857
|
+
function Zi() {
|
|
858
|
+
return qe.generateRandomId(Ki);
|
|
830
859
|
}
|
|
831
|
-
function
|
|
860
|
+
function qi(i) {
|
|
832
861
|
const e = i.match(/data-copy-id="([^\s]+)"/);
|
|
833
862
|
return e && e[1] ? e[1] : null;
|
|
834
863
|
}
|
|
835
|
-
class
|
|
864
|
+
class Ji {
|
|
836
865
|
constructor() {
|
|
837
|
-
|
|
866
|
+
p(this, "_cache", new wt(Xi));
|
|
838
867
|
}
|
|
839
868
|
set(e, t) {
|
|
840
869
|
this._cache.set(e, t);
|
|
@@ -846,7 +875,7 @@ class qi {
|
|
|
846
875
|
this._cache.clear();
|
|
847
876
|
}
|
|
848
877
|
}
|
|
849
|
-
const mt = new
|
|
878
|
+
const mt = new Ji();
|
|
850
879
|
function it(i) {
|
|
851
880
|
const e = i.style, t = {}, n = i.tagName.toLowerCase();
|
|
852
881
|
switch (n) {
|
|
@@ -879,44 +908,44 @@ function it(i) {
|
|
|
879
908
|
}
|
|
880
909
|
}
|
|
881
910
|
for (let r = 0; r < e.length; r++) {
|
|
882
|
-
const
|
|
883
|
-
switch (
|
|
911
|
+
const o = e[r], s = e.getPropertyValue(o);
|
|
912
|
+
switch (o) {
|
|
884
913
|
case "font-family": {
|
|
885
|
-
t.ff =
|
|
914
|
+
t.ff = s;
|
|
886
915
|
break;
|
|
887
916
|
}
|
|
888
917
|
case "font-size": {
|
|
889
|
-
const a = Number.parseInt(
|
|
890
|
-
Number.isNaN(a) || (
|
|
918
|
+
const a = Number.parseInt(s);
|
|
919
|
+
Number.isNaN(a) || (s.endsWith("pt") ? t.fs = a : s.endsWith("px") && (t.fs = An(a)));
|
|
891
920
|
break;
|
|
892
921
|
}
|
|
893
922
|
case "font-style": {
|
|
894
|
-
|
|
923
|
+
s === "italic" && (t.it = C.TRUE);
|
|
895
924
|
break;
|
|
896
925
|
}
|
|
897
926
|
case "font-weight": {
|
|
898
|
-
Number(
|
|
927
|
+
Number(s) > 400 && (t.bl = C.TRUE);
|
|
899
928
|
break;
|
|
900
929
|
}
|
|
901
930
|
case "text-decoration": {
|
|
902
|
-
/underline/.test(
|
|
931
|
+
/underline/.test(s) ? t.ul = {
|
|
903
932
|
s: C.TRUE
|
|
904
|
-
} : /overline/.test(
|
|
933
|
+
} : /overline/.test(s) ? t.ol = {
|
|
905
934
|
s: C.TRUE
|
|
906
|
-
} : /line-through/.test(
|
|
935
|
+
} : /line-through/.test(s) && (t.st = {
|
|
907
936
|
s: C.TRUE
|
|
908
937
|
});
|
|
909
938
|
break;
|
|
910
939
|
}
|
|
911
940
|
case "color": {
|
|
912
|
-
const a = new ot(
|
|
941
|
+
const a = new ot(s);
|
|
913
942
|
a.isValid && (t.cl = {
|
|
914
943
|
rgb: a.toRgbString()
|
|
915
944
|
});
|
|
916
945
|
break;
|
|
917
946
|
}
|
|
918
947
|
case "background-color": {
|
|
919
|
-
const a = new ot(
|
|
948
|
+
const a = new ot(s);
|
|
920
949
|
a.isValid && (t.bg = {
|
|
921
950
|
rgb: a.toRgbString()
|
|
922
951
|
});
|
|
@@ -926,7 +955,7 @@ function it(i) {
|
|
|
926
955
|
}
|
|
927
956
|
return t;
|
|
928
957
|
}
|
|
929
|
-
function
|
|
958
|
+
function Qi(i) {
|
|
930
959
|
const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
|
|
931
960
|
return e.parseFromString(t, "text/html").querySelector("#univer-root");
|
|
932
961
|
}
|
|
@@ -936,9 +965,9 @@ function St(i, e) {
|
|
|
936
965
|
}
|
|
937
966
|
const xe = class xe {
|
|
938
967
|
constructor() {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
968
|
+
p(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
969
|
+
p(this, "_styleRules", []);
|
|
970
|
+
p(this, "_afterProcessRules", []);
|
|
942
971
|
}
|
|
943
972
|
static use(e) {
|
|
944
973
|
if (this._pluginList.includes(e))
|
|
@@ -946,7 +975,7 @@ const xe = class xe {
|
|
|
946
975
|
this._pluginList.push(e);
|
|
947
976
|
}
|
|
948
977
|
convert(e) {
|
|
949
|
-
const t = xe._pluginList.find((
|
|
978
|
+
const t = xe._pluginList.find((o) => o.checkPasteType(e)), n = Qi(e), r = {
|
|
950
979
|
dataStream: "",
|
|
951
980
|
textRuns: []
|
|
952
981
|
};
|
|
@@ -954,30 +983,30 @@ const xe = class xe {
|
|
|
954
983
|
}
|
|
955
984
|
_process(e, t, n) {
|
|
956
985
|
var r;
|
|
957
|
-
for (const
|
|
958
|
-
if (
|
|
959
|
-
const
|
|
986
|
+
for (const o of t)
|
|
987
|
+
if (o.nodeType === Node.TEXT_NODE) {
|
|
988
|
+
const s = (r = o.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
|
|
960
989
|
let a;
|
|
961
|
-
e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream +=
|
|
962
|
-
st: n.dataStream.length -
|
|
990
|
+
e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += s, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
|
|
991
|
+
st: n.dataStream.length - s.length,
|
|
963
992
|
ed: n.dataStream.length,
|
|
964
993
|
ts: a
|
|
965
994
|
});
|
|
966
|
-
} else if (
|
|
967
|
-
const
|
|
968
|
-
this._styleCache.set(
|
|
969
|
-
const { childNodes:
|
|
970
|
-
this._process(
|
|
995
|
+
} else if (o.nodeType === Node.ELEMENT_NODE) {
|
|
996
|
+
const s = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => St(o, h)), c = a ? a.getStyle(o) : it(o);
|
|
997
|
+
this._styleCache.set(o, { ...s, ...c });
|
|
998
|
+
const { childNodes: l } = o;
|
|
999
|
+
this._process(o, l, n);
|
|
971
1000
|
const u = this._afterProcessRules.find(
|
|
972
|
-
({ filter: h }) => St(
|
|
1001
|
+
({ filter: h }) => St(o, h)
|
|
973
1002
|
);
|
|
974
|
-
u && u.handler(n,
|
|
1003
|
+
u && u.handler(n, o);
|
|
975
1004
|
}
|
|
976
1005
|
}
|
|
977
1006
|
};
|
|
978
|
-
|
|
1007
|
+
p(xe, "_pluginList", []);
|
|
979
1008
|
let Q = xe;
|
|
980
|
-
const
|
|
1009
|
+
const er = {
|
|
981
1010
|
name: "univer-doc-paste-plugin-lark",
|
|
982
1011
|
checkPasteType(i) {
|
|
983
1012
|
return /lark-record-clipboard/i.test(i);
|
|
@@ -1009,32 +1038,32 @@ const Qi = {
|
|
|
1009
1038
|
}
|
|
1010
1039
|
}
|
|
1011
1040
|
]
|
|
1012
|
-
},
|
|
1041
|
+
}, tr = er;
|
|
1013
1042
|
function Lt(i) {
|
|
1014
1043
|
const e = i.style, t = {};
|
|
1015
1044
|
for (let n = 0; n < e.length; n++) {
|
|
1016
|
-
const r = e[n],
|
|
1045
|
+
const r = e[n], o = e.getPropertyValue(r);
|
|
1017
1046
|
switch (r) {
|
|
1018
1047
|
case "margin-top": {
|
|
1019
|
-
const
|
|
1020
|
-
t.spaceAbove = /pt/.test(
|
|
1048
|
+
const s = Number.parseInt(o);
|
|
1049
|
+
t.spaceAbove = /pt/.test(o) ? ut(s) : s;
|
|
1021
1050
|
break;
|
|
1022
1051
|
}
|
|
1023
1052
|
case "margin-bottom": {
|
|
1024
|
-
const
|
|
1025
|
-
t.spaceBelow = /pt/.test(
|
|
1053
|
+
const s = Number.parseInt(o);
|
|
1054
|
+
t.spaceBelow = /pt/.test(o) ? ut(s) : s;
|
|
1026
1055
|
break;
|
|
1027
1056
|
}
|
|
1028
1057
|
case "line-height": {
|
|
1029
|
-
const
|
|
1030
|
-
t.lineSpacing =
|
|
1058
|
+
const s = Number.parseFloat(o);
|
|
1059
|
+
t.lineSpacing = s;
|
|
1031
1060
|
break;
|
|
1032
1061
|
}
|
|
1033
1062
|
}
|
|
1034
1063
|
}
|
|
1035
1064
|
return Object.getOwnPropertyNames(t).length ? t : null;
|
|
1036
1065
|
}
|
|
1037
|
-
const
|
|
1066
|
+
const nr = {
|
|
1038
1067
|
name: "univer-doc-paste-plugin-word",
|
|
1039
1068
|
checkPasteType(i) {
|
|
1040
1069
|
return /word|mso/i.test(i);
|
|
@@ -1062,7 +1091,7 @@ const tr = {
|
|
|
1062
1091
|
}
|
|
1063
1092
|
}
|
|
1064
1093
|
]
|
|
1065
|
-
},
|
|
1094
|
+
}, ir = nr, rr = {
|
|
1066
1095
|
name: "univer-doc-paste-plugin-univer",
|
|
1067
1096
|
checkPasteType(i) {
|
|
1068
1097
|
return /UniverNormal/i.test(i);
|
|
@@ -1082,44 +1111,44 @@ const tr = {
|
|
|
1082
1111
|
}
|
|
1083
1112
|
}
|
|
1084
1113
|
]
|
|
1085
|
-
},
|
|
1114
|
+
}, or = rr;
|
|
1086
1115
|
function vt(i, e) {
|
|
1087
|
-
const { st: t, ed: n, ts: r = {} } = e, { ff:
|
|
1088
|
-
let
|
|
1116
|
+
const { st: t, ed: n, ts: r = {} } = e, { ff: o, fs: s, it: a, bl: c, ul: l, st: u, ol: h, bg: f, cl: g, va: S } = r;
|
|
1117
|
+
let d = i.slice(t, n);
|
|
1089
1118
|
const _ = [];
|
|
1090
|
-
return a === C.TRUE && (
|
|
1119
|
+
return a === C.TRUE && (d = `<i>${d}</i>`), S === J.SUPERSCRIPT ? d = `<sup>${d}</sup>` : S === J.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}`), g && _.push(`color: ${g.rgb}`), s && _.push(`font-size: ${s}pt`), h && _.push("text-decoration: overline"), f && _.push(`background: ${f.rgb}`), _.length ? `<span style="${_.join("; ")};">${d}</span>` : d;
|
|
1091
1120
|
}
|
|
1092
1121
|
function ke(i, e, t) {
|
|
1093
1122
|
const { dataStream: n, textRuns: r = [] } = i;
|
|
1094
|
-
let
|
|
1095
|
-
const
|
|
1123
|
+
let o = e;
|
|
1124
|
+
const s = [];
|
|
1096
1125
|
for (const a of r) {
|
|
1097
|
-
const { st: c, ed:
|
|
1098
|
-
qe.hasIntersectionBetweenTwoRanges(e, t, c,
|
|
1126
|
+
const { st: c, ed: l } = a;
|
|
1127
|
+
qe.hasIntersectionBetweenTwoRanges(e, t, c, l) && (c > o ? (s.push(n.slice(o, c)), s.push(vt(n, {
|
|
1099
1128
|
...a,
|
|
1100
|
-
ed: Math.min(
|
|
1101
|
-
}))) :
|
|
1129
|
+
ed: Math.min(l, t)
|
|
1130
|
+
}))) : s.push(vt(n, {
|
|
1102
1131
|
...a,
|
|
1103
|
-
st:
|
|
1104
|
-
ed: Math.min(
|
|
1105
|
-
}))),
|
|
1132
|
+
st: o,
|
|
1133
|
+
ed: Math.min(l, t)
|
|
1134
|
+
}))), o = Math.max(e, Math.min(l, t));
|
|
1106
1135
|
}
|
|
1107
|
-
return
|
|
1136
|
+
return o !== t && s.push(n.slice(o, t)), s.join("");
|
|
1108
1137
|
}
|
|
1109
1138
|
function Ct(i, e = !0) {
|
|
1110
1139
|
var t;
|
|
1111
1140
|
if (e && ((t = i.paragraphs) != null && t.length)) {
|
|
1112
1141
|
const { dataStream: n, paragraphs: r = [] } = i;
|
|
1113
|
-
let
|
|
1142
|
+
let o = "", s = -1;
|
|
1114
1143
|
for (const a of r) {
|
|
1115
|
-
const { startIndex: c, paragraphStyle:
|
|
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`)),
|
|
1144
|
+
const { startIndex: c, paragraphStyle: l = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: f } = l, g = [];
|
|
1145
|
+
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`)), f != null && g.push(`line-height: ${f}`), c > s + 1 ? o += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}>${ke(i, s + 1, c)}</p>` : o += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}></p>`, s = c;
|
|
1117
1146
|
}
|
|
1118
|
-
return
|
|
1147
|
+
return s !== n.length && (o += ke(i, s, n.length)), o;
|
|
1119
1148
|
} else
|
|
1120
1149
|
return ke(i, 0, i.dataStream.length);
|
|
1121
1150
|
}
|
|
1122
|
-
class
|
|
1151
|
+
class sr {
|
|
1123
1152
|
convert(e) {
|
|
1124
1153
|
if (e.length === 0)
|
|
1125
1154
|
throw new Error("The bodyList length at least to be 1");
|
|
@@ -1131,15 +1160,15 @@ class or {
|
|
|
1131
1160
|
return t;
|
|
1132
1161
|
}
|
|
1133
1162
|
}
|
|
1134
|
-
var
|
|
1135
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1136
|
-
(
|
|
1137
|
-
return n && r &&
|
|
1163
|
+
var ar = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, lr = (i, e, t, n) => {
|
|
1164
|
+
for (var r = n > 1 ? void 0 : n ? cr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1165
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1166
|
+
return n && r && ar(e, t, r), r;
|
|
1138
1167
|
}, re = (i, e) => (t, n) => e(t, n, i);
|
|
1139
|
-
Q.use(
|
|
1140
|
-
Q.use(
|
|
1141
|
-
Q.use(
|
|
1142
|
-
function
|
|
1168
|
+
Q.use(ir);
|
|
1169
|
+
Q.use(tr);
|
|
1170
|
+
Q.use(or);
|
|
1171
|
+
function dr(i) {
|
|
1143
1172
|
const e = i.replace(/\n/g, "\r"), t = [];
|
|
1144
1173
|
for (let n = 0; n < e.length; n++)
|
|
1145
1174
|
e[n] === "\r" && t.push({ startIndex: n });
|
|
@@ -1148,14 +1177,14 @@ function lr(i) {
|
|
|
1148
1177
|
paragraphs: t
|
|
1149
1178
|
};
|
|
1150
1179
|
}
|
|
1151
|
-
const
|
|
1180
|
+
const ge = Xt("doc.clipboard-service");
|
|
1152
1181
|
let Xe = class extends ee {
|
|
1153
|
-
constructor(e, t, n, r,
|
|
1182
|
+
constructor(e, t, n, r, o) {
|
|
1154
1183
|
super();
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService =
|
|
1184
|
+
p(this, "_clipboardHooks", []);
|
|
1185
|
+
p(this, "_htmlToUDM", new Q());
|
|
1186
|
+
p(this, "_umdToHtml", new sr());
|
|
1187
|
+
this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = o;
|
|
1159
1188
|
}
|
|
1160
1189
|
async copy() {
|
|
1161
1190
|
const e = this._getDocumentBodyInRanges();
|
|
@@ -1180,25 +1209,25 @@ let Xe = class extends ee {
|
|
|
1180
1209
|
return this._paste(n);
|
|
1181
1210
|
}
|
|
1182
1211
|
async _cut() {
|
|
1183
|
-
var
|
|
1212
|
+
var o;
|
|
1184
1213
|
const {
|
|
1185
1214
|
segmentId: e,
|
|
1186
1215
|
endOffset: t,
|
|
1187
1216
|
style: n
|
|
1188
|
-
} = (
|
|
1217
|
+
} = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, r = this._textSelectionManagerService.getSelections();
|
|
1189
1218
|
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || r == null)
|
|
1190
1219
|
return !1;
|
|
1191
1220
|
this.copy();
|
|
1192
1221
|
try {
|
|
1193
|
-
let
|
|
1222
|
+
let s = t;
|
|
1194
1223
|
for (const c of r) {
|
|
1195
|
-
const { startOffset:
|
|
1196
|
-
|
|
1224
|
+
const { startOffset: l, endOffset: u } = c;
|
|
1225
|
+
l == null || u == null || u <= t && (s -= u - l);
|
|
1197
1226
|
}
|
|
1198
1227
|
const a = [
|
|
1199
1228
|
{
|
|
1200
|
-
startOffset:
|
|
1201
|
-
endOffset:
|
|
1229
|
+
startOffset: s,
|
|
1230
|
+
endOffset: s,
|
|
1202
1231
|
style: n
|
|
1203
1232
|
}
|
|
1204
1233
|
];
|
|
@@ -1208,14 +1237,14 @@ let Xe = class extends ee {
|
|
|
1208
1237
|
}
|
|
1209
1238
|
}
|
|
1210
1239
|
async _paste(e) {
|
|
1211
|
-
var
|
|
1212
|
-
const { segmentId: t, endOffset: n, style: r } = (
|
|
1213
|
-
if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null ||
|
|
1240
|
+
var s;
|
|
1241
|
+
const { segmentId: t, endOffset: n, style: r } = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, o = this._textSelectionManagerService.getSelections();
|
|
1242
|
+
if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || o == null)
|
|
1214
1243
|
return !1;
|
|
1215
1244
|
try {
|
|
1216
1245
|
let a = n;
|
|
1217
|
-
for (const
|
|
1218
|
-
const { startOffset: u, endOffset: h } =
|
|
1246
|
+
for (const l of o) {
|
|
1247
|
+
const { startOffset: u, endOffset: h } = l;
|
|
1219
1248
|
u == null || h == null || h <= n && (a += e.dataStream.length - (h - u));
|
|
1220
1249
|
}
|
|
1221
1250
|
const c = [
|
|
@@ -1231,10 +1260,10 @@ let Xe = class extends ee {
|
|
|
1231
1260
|
}
|
|
1232
1261
|
}
|
|
1233
1262
|
async _setClipboardData(e) {
|
|
1234
|
-
const t =
|
|
1263
|
+
const t = Zi(), n = e.length > 1 ? e.map((o) => o.dataStream).join(`
|
|
1235
1264
|
`) : e[0].dataStream;
|
|
1236
1265
|
let r = this._umdToHtml.convert(e);
|
|
1237
|
-
return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (
|
|
1266
|
+
return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (o, s) => `${s} data-copy-id="${t}"`), mt.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
|
|
1238
1267
|
}
|
|
1239
1268
|
addClipboardHook(e) {
|
|
1240
1269
|
return this._clipboardHooks.push(e), j(() => {
|
|
@@ -1247,10 +1276,10 @@ let Xe = class extends ee {
|
|
|
1247
1276
|
if (e == null || !t)
|
|
1248
1277
|
return n;
|
|
1249
1278
|
for (const r of e) {
|
|
1250
|
-
const { startOffset:
|
|
1251
|
-
if (a ||
|
|
1279
|
+
const { startOffset: o, endOffset: s, collapsed: a } = r;
|
|
1280
|
+
if (a || o == null || s == null)
|
|
1252
1281
|
continue;
|
|
1253
|
-
const c = t.sliceBody(
|
|
1282
|
+
const c = t.sliceBody(o, s);
|
|
1254
1283
|
c != null && n.push(c);
|
|
1255
1284
|
}
|
|
1256
1285
|
return n;
|
|
@@ -1259,8 +1288,8 @@ let Xe = class extends ee {
|
|
|
1259
1288
|
try {
|
|
1260
1289
|
let t = "", n = "";
|
|
1261
1290
|
for (const r of e)
|
|
1262
|
-
for (const
|
|
1263
|
-
|
|
1291
|
+
for (const o of r.types)
|
|
1292
|
+
o === rn ? n = await r.getType(o).then((s) => s && s.text()) : o === on && (t = await r.getType(o).then((s) => s && s.text()));
|
|
1264
1293
|
return this._generateBodyFromHtmlAndText(t, n);
|
|
1265
1294
|
} catch (t) {
|
|
1266
1295
|
return Promise.reject(t);
|
|
@@ -1269,10 +1298,10 @@ let Xe = class extends ee {
|
|
|
1269
1298
|
_generateBodyFromHtmlAndText(e, t) {
|
|
1270
1299
|
if (!e) {
|
|
1271
1300
|
if (t)
|
|
1272
|
-
return
|
|
1301
|
+
return dr(t);
|
|
1273
1302
|
throw new Error("[DocClipboardService] html and text cannot be both empty!");
|
|
1274
1303
|
}
|
|
1275
|
-
const n =
|
|
1304
|
+
const n = qi(e);
|
|
1276
1305
|
if (n) {
|
|
1277
1306
|
const r = mt.get(n);
|
|
1278
1307
|
if (r)
|
|
@@ -1281,7 +1310,7 @@ let Xe = class extends ee {
|
|
|
1281
1310
|
return this._htmlToUDM.convert(e);
|
|
1282
1311
|
}
|
|
1283
1312
|
};
|
|
1284
|
-
Xe =
|
|
1313
|
+
Xe = lr([
|
|
1285
1314
|
re(0, U),
|
|
1286
1315
|
re(1, bt),
|
|
1287
1316
|
re(2, v),
|
|
@@ -1291,23 +1320,23 @@ Xe = cr([
|
|
|
1291
1320
|
function je(i) {
|
|
1292
1321
|
return i.getContextValue(De) || i.getContextValue(Tt);
|
|
1293
1322
|
}
|
|
1294
|
-
const rt = 999,
|
|
1323
|
+
const rt = 999, ur = {
|
|
1295
1324
|
id: sn.id,
|
|
1296
1325
|
name: "doc.command.copy",
|
|
1297
1326
|
type: Je.COMMAND,
|
|
1298
1327
|
multi: !0,
|
|
1299
1328
|
priority: rt,
|
|
1300
1329
|
preconditions: je,
|
|
1301
|
-
handler: async (i) => i.get(
|
|
1302
|
-
},
|
|
1330
|
+
handler: async (i) => i.get(ge).copy()
|
|
1331
|
+
}, hr = {
|
|
1303
1332
|
id: an.id,
|
|
1304
1333
|
name: "doc.command.cut",
|
|
1305
1334
|
type: Je.COMMAND,
|
|
1306
1335
|
multi: !0,
|
|
1307
1336
|
priority: rt,
|
|
1308
1337
|
preconditions: je,
|
|
1309
|
-
handler: async (i) => i.get(
|
|
1310
|
-
},
|
|
1338
|
+
handler: async (i) => i.get(ge).cut()
|
|
1339
|
+
}, gr = {
|
|
1311
1340
|
id: cn.id,
|
|
1312
1341
|
name: "doc.command.paste",
|
|
1313
1342
|
type: Je.COMMAND,
|
|
@@ -1315,52 +1344,52 @@ const rt = 999, dr = {
|
|
|
1315
1344
|
priority: rt,
|
|
1316
1345
|
preconditions: je,
|
|
1317
1346
|
handler: async (i) => {
|
|
1318
|
-
const e = i.get(
|
|
1347
|
+
const e = i.get(ge), n = await i.get(Qe).read();
|
|
1319
1348
|
return n.length === 0 ? !1 : e.paste(n);
|
|
1320
1349
|
}
|
|
1321
1350
|
};
|
|
1322
|
-
var
|
|
1323
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1324
|
-
(
|
|
1325
|
-
return n && r &&
|
|
1351
|
+
var _r = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, fr = (i, e, t, n) => {
|
|
1352
|
+
for (var r = n > 1 ? void 0 : n ? pr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1353
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1354
|
+
return n && r && _r(e, t, r), r;
|
|
1326
1355
|
}, oe = (i, e) => (t, n) => e(t, n, i);
|
|
1327
|
-
let Oe = class extends
|
|
1356
|
+
let Oe = class extends de {
|
|
1328
1357
|
constructor(i, e, t, n, r) {
|
|
1329
1358
|
super(), this._commandService = i, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = r, this._init();
|
|
1330
1359
|
}
|
|
1331
1360
|
_init() {
|
|
1332
|
-
[
|
|
1361
|
+
[ur, hr, gr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [Et, Mt].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))), this._initLegacyPasteCommand();
|
|
1333
1362
|
}
|
|
1334
1363
|
_initLegacyPasteCommand() {
|
|
1335
1364
|
var i;
|
|
1336
|
-
(i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(
|
|
1337
|
-
var
|
|
1365
|
+
(i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(le(this.dispose$)).subscribe((e) => {
|
|
1366
|
+
var o, s;
|
|
1338
1367
|
if (!je(this._contextService))
|
|
1339
1368
|
return;
|
|
1340
1369
|
e.event.preventDefault();
|
|
1341
|
-
const t = e.event, n = (
|
|
1370
|
+
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");
|
|
1342
1371
|
this._docClipboardService.legacyPaste(n, r);
|
|
1343
1372
|
});
|
|
1344
1373
|
}
|
|
1345
1374
|
};
|
|
1346
|
-
Oe =
|
|
1375
|
+
Oe = fr([
|
|
1347
1376
|
L(B.Rendered, Oe),
|
|
1348
1377
|
oe(0, v),
|
|
1349
1378
|
oe(1, Qe),
|
|
1350
|
-
oe(2,
|
|
1351
|
-
oe(3,
|
|
1379
|
+
oe(2, ge),
|
|
1380
|
+
oe(3, he),
|
|
1352
1381
|
oe(4, jt)
|
|
1353
1382
|
], Oe);
|
|
1354
|
-
var
|
|
1355
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1356
|
-
(
|
|
1357
|
-
return n && r &&
|
|
1383
|
+
var mr = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, vr = (i, e, t, n) => {
|
|
1384
|
+
for (var r = n > 1 ? void 0 : n ? Sr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1385
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1386
|
+
return n && r && mr(e, t, r), r;
|
|
1358
1387
|
}, X = (i, e) => (t, n) => e(t, n, i);
|
|
1359
1388
|
let Re = class extends ee {
|
|
1360
|
-
constructor(e, t, n, r,
|
|
1389
|
+
constructor(e, t, n, r, o, s) {
|
|
1361
1390
|
super();
|
|
1362
|
-
|
|
1363
|
-
this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager =
|
|
1391
|
+
p(this, "_initialEditors", /* @__PURE__ */ new Set());
|
|
1392
|
+
this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = o, this._renderManagerService = s, this._initialize();
|
|
1364
1393
|
}
|
|
1365
1394
|
_initialize() {
|
|
1366
1395
|
this.disposeWithMe(
|
|
@@ -1383,16 +1412,16 @@ let Re = class extends ee {
|
|
|
1383
1412
|
if (t == null || t.render == null || n == null || r == null)
|
|
1384
1413
|
return;
|
|
1385
1414
|
n.calculate();
|
|
1386
|
-
const { marginTop:
|
|
1387
|
-
let { actualHeight: h, actualWidth:
|
|
1388
|
-
h +=
|
|
1389
|
-
const { width: g, height:
|
|
1390
|
-
let _ =
|
|
1391
|
-
const O = Math.max(
|
|
1392
|
-
|
|
1415
|
+
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: f } = n.getActualSize();
|
|
1417
|
+
h += o + s, f += a + c;
|
|
1418
|
+
const { width: g, height: S } = t.getBoundingClientRect(), d = l.getViewport(Be.VIEW_MAIN);
|
|
1419
|
+
let _ = d == null ? void 0 : d.getScrollBar();
|
|
1420
|
+
const O = Math.max(f, g), E = Math.max(h, S);
|
|
1421
|
+
l.transformByState({
|
|
1393
1422
|
width: O,
|
|
1394
1423
|
height: E
|
|
1395
|
-
}), u == null || u.resize(O, E), t.isSingle() ?
|
|
1424
|
+
}), u == null || u.resize(O, E), t.isSingle() ? f > g ? _ == null ? d && new Ye(d, { barSize: 8, enableVertical: !1 }) : d == null || d.resetSizeAndScrollBar() : (_ = null, d == null || d.scrollTo({ x: 0, y: 0 }), (w = d == null ? void 0 : d.getScrollBar()) == null || w.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 }), (F = d == null ? void 0 : d.getScrollBar()) == null || F.dispose());
|
|
1396
1425
|
}
|
|
1397
1426
|
_initialSetValue() {
|
|
1398
1427
|
this.disposeWithMe(
|
|
@@ -1435,16 +1464,16 @@ let Re = class extends ee {
|
|
|
1435
1464
|
];
|
|
1436
1465
|
this.disposeWithMe(
|
|
1437
1466
|
pt(window, "mousedown").subscribe((n) => {
|
|
1438
|
-
const
|
|
1439
|
-
if (Vt(
|
|
1467
|
+
const o = n.target.classList[0] || "";
|
|
1468
|
+
if (Vt(o, e)) {
|
|
1440
1469
|
this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
|
|
1441
1470
|
return;
|
|
1442
1471
|
}
|
|
1443
1472
|
this._editorService.changeSpreadsheetFocusState(!1);
|
|
1444
1473
|
})
|
|
1445
1474
|
), this._univerInstanceService.getAllUnitsForType(m.UNIVER_SHEET).forEach((n) => {
|
|
1446
|
-
const r = n.getUnitId(),
|
|
1447
|
-
|
|
1475
|
+
const r = n.getUnitId(), o = this._renderManagerService.getRenderById(r), s = o == null ? void 0 : o.engine.getCanvas().getCanvasEle();
|
|
1476
|
+
s != null && pt(s, "mousedown").subscribe((a) => {
|
|
1448
1477
|
this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
|
|
1449
1478
|
});
|
|
1450
1479
|
});
|
|
@@ -1485,28 +1514,28 @@ let Re = class extends ee {
|
|
|
1485
1514
|
);
|
|
1486
1515
|
}
|
|
1487
1516
|
};
|
|
1488
|
-
Re =
|
|
1517
|
+
Re = vr([
|
|
1489
1518
|
L(B.Rendered, Re),
|
|
1490
1519
|
X(0, U),
|
|
1491
1520
|
X(1, R(ie)),
|
|
1492
1521
|
X(2, $),
|
|
1493
1522
|
X(3, v),
|
|
1494
|
-
X(4,
|
|
1523
|
+
X(4, he),
|
|
1495
1524
|
X(5, H)
|
|
1496
1525
|
], Re);
|
|
1497
|
-
var
|
|
1498
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1499
|
-
(
|
|
1500
|
-
return n && r &&
|
|
1501
|
-
},
|
|
1502
|
-
let Te = class extends
|
|
1526
|
+
var Cr = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, Rr = (i, e, t, n) => {
|
|
1527
|
+
for (var r = n > 1 ? void 0 : n ? Or(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1528
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1529
|
+
return n && r && Cr(e, t, r), r;
|
|
1530
|
+
}, Se = (i, e) => (t, n) => e(t, n, i);
|
|
1531
|
+
let Te = class extends de {
|
|
1503
1532
|
constructor(e, t, n, r) {
|
|
1504
1533
|
super();
|
|
1505
|
-
|
|
1534
|
+
p(this, "_docRenderMap", /* @__PURE__ */ new Set());
|
|
1506
1535
|
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
|
|
1507
1536
|
}
|
|
1508
1537
|
_initialRenderRefresh() {
|
|
1509
|
-
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(
|
|
1538
|
+
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(le(this.dispose$)).subscribe((e) => {
|
|
1510
1539
|
this._create(e);
|
|
1511
1540
|
});
|
|
1512
1541
|
}
|
|
@@ -1516,20 +1545,20 @@ let Te = class extends le {
|
|
|
1516
1545
|
const { skeleton: t, unitId: n } = e;
|
|
1517
1546
|
let r = this._renderManagerService.getRenderById(n);
|
|
1518
1547
|
r == null && (this._renderManagerService.create(n), r = this._renderManagerService.getRenderById(n));
|
|
1519
|
-
const { mainComponent:
|
|
1548
|
+
const { mainComponent: o, components: s } = r, a = o, c = s.get(q.BACKGROUND);
|
|
1520
1549
|
a.changeSkeleton(t), c.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
|
|
1521
1550
|
}
|
|
1522
1551
|
_recalculateSizeBySkeleton(e, t) {
|
|
1523
|
-
var
|
|
1524
|
-
const { mainComponent: n, scene: r, unitId:
|
|
1525
|
-
if (
|
|
1552
|
+
var f;
|
|
1553
|
+
const { mainComponent: n, scene: r, unitId: o, components: s } = e, a = n, c = s.get(q.BACKGROUND), l = (f = t.getSkeletonData()) == null ? void 0 : f.pages;
|
|
1554
|
+
if (l == null)
|
|
1526
1555
|
return;
|
|
1527
1556
|
let u = 0, h = 0;
|
|
1528
|
-
for (let g = 0,
|
|
1529
|
-
const
|
|
1530
|
-
a.pageLayoutType === ht.VERTICAL ? (h += O, h += a.pageMarginTop, g ===
|
|
1557
|
+
for (let g = 0, S = l.length; g < S; g++) {
|
|
1558
|
+
const d = l[g], { pageWidth: _, pageHeight: O } = d;
|
|
1559
|
+
a.pageLayoutType === ht.VERTICAL ? (h += O, h += a.pageMarginTop, g === S - 1 && (h += a.pageMarginTop), u = Math.max(u, _)) : a.pageLayoutType === ht.HORIZONTAL && (u += _, g !== S - 1 && (u += a.pageMarginLeft), h = Math.max(h, O));
|
|
1531
1560
|
}
|
|
1532
|
-
a.resize(u, h), c.resize(u, h), this._editorService.isEditor(
|
|
1561
|
+
a.resize(u, h), c.resize(u, h), this._editorService.isEditor(o) || r.resize(u, h);
|
|
1533
1562
|
}
|
|
1534
1563
|
_commandExecutedListener() {
|
|
1535
1564
|
const e = [et.id];
|
|
@@ -1537,13 +1566,13 @@ let Te = class extends le {
|
|
|
1537
1566
|
this._commandService.onCommandExecuted((t) => {
|
|
1538
1567
|
var n;
|
|
1539
1568
|
if (e.includes(t.id)) {
|
|
1540
|
-
const r = t.params, { unitId:
|
|
1541
|
-
if (
|
|
1569
|
+
const r = t.params, { unitId: o } = r, s = this._docSkeletonManagerService.getSkeletonByUnitId(o);
|
|
1570
|
+
if (s == null)
|
|
1542
1571
|
return;
|
|
1543
|
-
const { skeleton: a } =
|
|
1572
|
+
const { skeleton: a } = s, c = this._renderManagerService.getRenderById(o);
|
|
1544
1573
|
if (c == null || !!a.getViewModel().getDataModel().getSnapshot().disabled)
|
|
1545
1574
|
return;
|
|
1546
|
-
if (a.calculate(), this._editorService.isEditor(
|
|
1575
|
+
if (a.calculate(), this._editorService.isEditor(o)) {
|
|
1547
1576
|
(n = c.mainComponent) == null || n.makeDirty();
|
|
1548
1577
|
return;
|
|
1549
1578
|
}
|
|
@@ -1553,31 +1582,31 @@ let Te = class extends le {
|
|
|
1553
1582
|
);
|
|
1554
1583
|
}
|
|
1555
1584
|
};
|
|
1556
|
-
Te =
|
|
1585
|
+
Te = Rr([
|
|
1557
1586
|
L(B.Rendered, Te),
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1587
|
+
Se(0, R(ie)),
|
|
1588
|
+
Se(1, H),
|
|
1589
|
+
Se(2, v),
|
|
1590
|
+
Se(3, $)
|
|
1562
1591
|
], Te);
|
|
1563
|
-
var
|
|
1564
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1565
|
-
(
|
|
1566
|
-
return n && r &&
|
|
1567
|
-
},
|
|
1568
|
-
let Ie = class extends
|
|
1592
|
+
var Tr = Object.defineProperty, Ir = Object.getOwnPropertyDescriptor, br = (i, e, t, n) => {
|
|
1593
|
+
for (var r = n > 1 ? void 0 : n ? Ir(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1594
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1595
|
+
return n && r && Tr(e, t, r), r;
|
|
1596
|
+
}, ve = (i, e) => (t, n) => e(t, n, i);
|
|
1597
|
+
let Ie = class extends de {
|
|
1569
1598
|
constructor(e, t, n, r) {
|
|
1570
1599
|
super();
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1600
|
+
p(this, "_scene");
|
|
1601
|
+
p(this, "_currentDocumentModel");
|
|
1602
|
+
p(this, "_fps$", new kn(""));
|
|
1603
|
+
p(this, "fps$", this._fps$.asObservable());
|
|
1575
1604
|
this._renderManagerService = e, this._configService = t, this._univerInstanceService = n, this._editorService = r, this._initialize();
|
|
1576
1605
|
}
|
|
1577
1606
|
_initialize() {
|
|
1578
|
-
this._renderManagerService.createRender$.pipe(
|
|
1607
|
+
this._renderManagerService.createRender$.pipe(le(this.dispose$)).subscribe((e) => {
|
|
1579
1608
|
this._create(e);
|
|
1580
|
-
}), this._univerInstanceService.getCurrentTypeOfUnit$(m.UNIVER_DOC).pipe(
|
|
1609
|
+
}), this._univerInstanceService.getCurrentTypeOfUnit$(m.UNIVER_DOC).pipe(le(this.dispose$)).subscribe((e) => {
|
|
1581
1610
|
this._create(e == null ? void 0 : e.getUnitId());
|
|
1582
1611
|
}), this._univerInstanceService.getAllUnitsForType(m.UNIVER_DOC).forEach((e) => {
|
|
1583
1612
|
this._create(e.getUnitId());
|
|
@@ -1592,65 +1621,62 @@ let Ie = class extends le {
|
|
|
1592
1621
|
const t = this._univerInstanceService.getUniverDocInstance(e);
|
|
1593
1622
|
t != null && (this._currentDocumentModel = t, this._renderManagerService.has(e) || this._addNewRender());
|
|
1594
1623
|
}
|
|
1595
|
-
// eslint-disable-next-line max-lines-per-function
|
|
1596
1624
|
_addNewRender() {
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
n == null
|
|
1601
|
-
const s = this._renderManagerService.getRenderById(t);
|
|
1602
|
-
if (s == null)
|
|
1625
|
+
const t = this._currentDocumentModel.getUnitId();
|
|
1626
|
+
this._renderManagerService.createRender(t);
|
|
1627
|
+
const n = this._renderManagerService.getRenderById(t);
|
|
1628
|
+
if (n == null)
|
|
1603
1629
|
return;
|
|
1604
|
-
const { scene:
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1630
|
+
const { scene: r, engine: o } = n;
|
|
1631
|
+
r.openTransformer(), this._scene = r;
|
|
1632
|
+
const s = new Ln(Be.VIEW_MAIN, r, {
|
|
1607
1633
|
left: 0,
|
|
1608
1634
|
top: 0,
|
|
1609
1635
|
bottom: 0,
|
|
1610
1636
|
right: 0,
|
|
1611
1637
|
isWheelPreventDefaultX: !0
|
|
1612
1638
|
});
|
|
1613
|
-
|
|
1614
|
-
const
|
|
1615
|
-
if (
|
|
1616
|
-
const
|
|
1617
|
-
let
|
|
1618
|
-
|
|
1639
|
+
r.attachControl(), r.on(Bn.wheel, (l, u) => {
|
|
1640
|
+
const h = l;
|
|
1641
|
+
if (h.ctrlKey) {
|
|
1642
|
+
const f = Math.abs(h.deltaX);
|
|
1643
|
+
let g = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
|
|
1644
|
+
g *= h.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (g /= 2), r.scaleX + g > 4 ? r.scale(4, 4) : r.scaleX + g < 0.1 ? r.scale(0.1, 0.1) : h.preventDefault();
|
|
1619
1645
|
} else
|
|
1620
|
-
|
|
1621
|
-
}), this._configService.getConfig("hasScroll") !== !1 && new Ye(
|
|
1622
|
-
new gt(
|
|
1623
|
-
new gt(
|
|
1624
|
-
), this._addComponent(
|
|
1625
|
-
|
|
1646
|
+
s.onMouseWheel(h, u);
|
|
1647
|
+
}), this._configService.getConfig("hasScroll") !== !1 && new Ye(s), r.addLayer(
|
|
1648
|
+
new gt(r, [], We),
|
|
1649
|
+
new gt(r, [], xn)
|
|
1650
|
+
), this._addComponent(n), this._currentDocumentModel.getShouldRenderLoopImmediately() && o.runRenderLoop(() => {
|
|
1651
|
+
r.render(), this._fps$.next(Math.round(o.getFps()).toString());
|
|
1626
1652
|
}), this._renderManagerService.setCurrent(t);
|
|
1627
1653
|
}
|
|
1628
1654
|
_addComponent(e) {
|
|
1629
1655
|
const t = this._scene, n = this._currentDocumentModel, r = {
|
|
1630
1656
|
pageMarginLeft: n.documentStyle.marginLeft || 0,
|
|
1631
1657
|
pageMarginTop: n.documentStyle.marginTop || 0
|
|
1632
|
-
},
|
|
1633
|
-
|
|
1658
|
+
}, o = new $n(q.MAIN, void 0, r), s = new Fn(q.BACKGROUND, void 0, r);
|
|
1659
|
+
o.zIndex = dt, s.zIndex = dt, e.mainComponent = o, e.components.set(q.MAIN, o), e.components.set(q.BACKGROUND, s), t.addObjects([o], We), t.addObjects([s], Dn), this._editorService.getEditor(n.getUnitId()) == null && t.enableLayerCache(We);
|
|
1634
1660
|
}
|
|
1635
1661
|
};
|
|
1636
|
-
Ie =
|
|
1662
|
+
Ie = br([
|
|
1637
1663
|
L(B.Starting, Ie),
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1664
|
+
ve(0, H),
|
|
1665
|
+
ve(1, Wt),
|
|
1666
|
+
ve(2, U),
|
|
1667
|
+
ve(3, $)
|
|
1642
1668
|
], Ie);
|
|
1643
|
-
var
|
|
1644
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1645
|
-
(
|
|
1646
|
-
return n && r &&
|
|
1669
|
+
var yr = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, Er = (i, e, t, n) => {
|
|
1670
|
+
for (var r = n > 1 ? void 0 : n ? Mr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1671
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1672
|
+
return n && r && yr(e, t, r), r;
|
|
1647
1673
|
}, K = (i, e) => (t, n) => e(t, n, i);
|
|
1648
1674
|
let be = class extends ee {
|
|
1649
|
-
constructor(e, t, n, r,
|
|
1675
|
+
constructor(e, t, n, r, o, s) {
|
|
1650
1676
|
super();
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService =
|
|
1677
|
+
p(this, "_liquid", new wn());
|
|
1678
|
+
p(this, "_pageMarginCache", /* @__PURE__ */ new Map());
|
|
1679
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = o, this._editorService = s, this._initialize(), this._commandExecutedListener();
|
|
1654
1680
|
}
|
|
1655
1681
|
_initialize() {
|
|
1656
1682
|
this._initialRenderRefresh(), this._updateOnPluginChange();
|
|
@@ -1660,19 +1686,19 @@ let be = class extends ee {
|
|
|
1660
1686
|
const t = this._docSkeletonManagerService.getCurrent();
|
|
1661
1687
|
if (t == null)
|
|
1662
1688
|
return;
|
|
1663
|
-
const { unitId: n, skeleton: r } = t,
|
|
1664
|
-
if (
|
|
1689
|
+
const { unitId: n, skeleton: r } = t, o = this._renderManagerService.getRenderById(n);
|
|
1690
|
+
if (o == null)
|
|
1665
1691
|
return;
|
|
1666
|
-
const { mainComponent:
|
|
1667
|
-
e.forEach((
|
|
1668
|
-
const { unitId: g, subUnitId:
|
|
1669
|
-
r == null || r.getViewModel().getDataModel().updateDrawing(
|
|
1670
|
-
left: O - u -
|
|
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,
|
|
1671
1697
|
top: E - h - Ve,
|
|
1672
1698
|
height: F,
|
|
1673
1699
|
width: N
|
|
1674
1700
|
});
|
|
1675
|
-
}), r == null || r.calculate(),
|
|
1701
|
+
}), r == null || r.calculate(), s == null || s.makeDirty();
|
|
1676
1702
|
});
|
|
1677
1703
|
}
|
|
1678
1704
|
_initialRenderRefresh() {
|
|
@@ -1682,8 +1708,8 @@ let be = class extends ee {
|
|
|
1682
1708
|
const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
|
|
1683
1709
|
if (r == null)
|
|
1684
1710
|
return;
|
|
1685
|
-
const { mainComponent:
|
|
1686
|
-
|
|
1711
|
+
const { mainComponent: o } = r;
|
|
1712
|
+
o.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
|
|
1687
1713
|
});
|
|
1688
1714
|
}
|
|
1689
1715
|
_commandExecutedListener() {
|
|
@@ -1692,55 +1718,55 @@ let be = class extends ee {
|
|
|
1692
1718
|
this._commandService.onCommandExecuted((t) => {
|
|
1693
1719
|
var n;
|
|
1694
1720
|
if (e.includes(t.id)) {
|
|
1695
|
-
const r = t.params, { unitId:
|
|
1696
|
-
if (
|
|
1721
|
+
const r = t.params, { unitId: o } = r, s = this._docSkeletonManagerService.getCurrent();
|
|
1722
|
+
if (s == null)
|
|
1697
1723
|
return;
|
|
1698
|
-
const { unitId: a, skeleton: c } =
|
|
1699
|
-
if (
|
|
1724
|
+
const { unitId: a, skeleton: c } = s;
|
|
1725
|
+
if (o !== a)
|
|
1700
1726
|
return;
|
|
1701
|
-
const
|
|
1702
|
-
if (
|
|
1727
|
+
const l = this._renderManagerService.getRenderById(a);
|
|
1728
|
+
if (l == null)
|
|
1703
1729
|
return;
|
|
1704
1730
|
if (this._editorService.isEditor(a)) {
|
|
1705
|
-
(n =
|
|
1731
|
+
(n = l.mainComponent) == null || n.makeDirty();
|
|
1706
1732
|
return;
|
|
1707
1733
|
}
|
|
1708
|
-
this._refreshFloatingObject(a, c,
|
|
1734
|
+
this._refreshFloatingObject(a, c, l);
|
|
1709
1735
|
}
|
|
1710
1736
|
})
|
|
1711
1737
|
);
|
|
1712
1738
|
}
|
|
1713
1739
|
_refreshFloatingObject(e, t, n) {
|
|
1714
|
-
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent:
|
|
1740
|
+
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: o, scene: s } = n, a = o;
|
|
1715
1741
|
if (!r)
|
|
1716
1742
|
return;
|
|
1717
|
-
const { left: c, top:
|
|
1718
|
-
|
|
1719
|
-
for (let
|
|
1720
|
-
const O = g[
|
|
1743
|
+
const { left: c, top: l, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: f } = a, { pages: g } = r, S = [];
|
|
1744
|
+
s.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
|
|
1745
|
+
for (let d = 0, _ = g.length; d < _; d++) {
|
|
1746
|
+
const O = g[d], { skeDrawings: E, marginLeft: N, marginTop: F } = O;
|
|
1721
1747
|
this._liquid.translatePagePadding(O), E.forEach((w) => {
|
|
1722
|
-
const { aLeft: Y, aTop: G, height:
|
|
1723
|
-
|
|
1748
|
+
const { aLeft: Y, aTop: G, height: _e, width: pe, objectId: x, drawingOrigin: fe } = w, Ve = fe.layoutType === kt.WRAP_NONE && fe.behindDoc === C.TRUE;
|
|
1749
|
+
S.push({
|
|
1724
1750
|
unitId: e,
|
|
1725
1751
|
subUnitId: zt,
|
|
1726
1752
|
floatingObjectId: x,
|
|
1727
1753
|
behindText: Ve,
|
|
1728
1754
|
floatingObject: {
|
|
1729
1755
|
left: Y + c + this._liquid.x,
|
|
1730
|
-
top: G +
|
|
1731
|
-
width:
|
|
1732
|
-
height:
|
|
1756
|
+
top: G + l + this._liquid.y,
|
|
1757
|
+
width: pe,
|
|
1758
|
+
height: _e
|
|
1733
1759
|
}
|
|
1734
1760
|
}), this._pageMarginCache.set(x, {
|
|
1735
1761
|
marginLeft: this._liquid.x,
|
|
1736
1762
|
marginTop: this._liquid.y
|
|
1737
1763
|
});
|
|
1738
|
-
}), this._liquid.restorePagePadding(O), this._liquid.translatePage(O, u, h,
|
|
1764
|
+
}), this._liquid.restorePagePadding(O), this._liquid.translatePage(O, u, h, f);
|
|
1739
1765
|
}
|
|
1740
|
-
this._floatingObjectManagerService.batchAddOrUpdate(
|
|
1766
|
+
this._floatingObjectManagerService.batchAddOrUpdate(S);
|
|
1741
1767
|
}
|
|
1742
1768
|
};
|
|
1743
|
-
be =
|
|
1769
|
+
be = Er([
|
|
1744
1770
|
L(B.Steady, be),
|
|
1745
1771
|
K(0, R(ie)),
|
|
1746
1772
|
K(1, U),
|
|
@@ -1749,16 +1775,16 @@ be = Mr([
|
|
|
1749
1775
|
K(4, Ht),
|
|
1750
1776
|
K(5, $)
|
|
1751
1777
|
], be);
|
|
1752
|
-
var
|
|
1753
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1754
|
-
(
|
|
1755
|
-
return n && r &&
|
|
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--)
|
|
1780
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1781
|
+
return n && r && xr(e, t, r), r;
|
|
1756
1782
|
}, Z = (i, e) => (t, n) => e(t, n, i);
|
|
1757
1783
|
let ye = class extends ee {
|
|
1758
|
-
constructor(e, t, n, r,
|
|
1784
|
+
constructor(e, t, n, r, o, s) {
|
|
1759
1785
|
super();
|
|
1760
|
-
|
|
1761
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService =
|
|
1786
|
+
p(this, "_initializedRender", /* @__PURE__ */ new Set());
|
|
1787
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = o, this._editorService = s, this._initialize();
|
|
1762
1788
|
}
|
|
1763
1789
|
dispose() {
|
|
1764
1790
|
super.dispose();
|
|
@@ -1777,21 +1803,21 @@ let ye = class extends ee {
|
|
|
1777
1803
|
const { scene: r } = n;
|
|
1778
1804
|
this.disposeWithMe(
|
|
1779
1805
|
j(
|
|
1780
|
-
r.onMouseWheelObserver.add((
|
|
1781
|
-
if (!
|
|
1806
|
+
r.onMouseWheelObserver.add((o) => {
|
|
1807
|
+
if (!o.ctrlKey)
|
|
1782
1808
|
return;
|
|
1783
|
-
const
|
|
1784
|
-
if (!
|
|
1809
|
+
const s = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1810
|
+
if (!s)
|
|
1785
1811
|
return;
|
|
1786
|
-
const a = Math.abs(
|
|
1812
|
+
const a = Math.abs(o.deltaX);
|
|
1787
1813
|
let c = a < 40 ? 0.2 : a < 80 ? 0.4 : 0.2;
|
|
1788
|
-
c *=
|
|
1789
|
-
const
|
|
1790
|
-
let u = +Number.parseFloat(`${
|
|
1814
|
+
c *= o.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (c /= 2);
|
|
1815
|
+
const l = s.zoomRatio;
|
|
1816
|
+
let u = +Number.parseFloat(`${l + c}`).toFixed(1);
|
|
1791
1817
|
u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Pn.id, {
|
|
1792
1818
|
zoomRatio: u,
|
|
1793
|
-
unitId:
|
|
1794
|
-
}),
|
|
1819
|
+
unitId: s.getUnitId()
|
|
1820
|
+
}), o.preventDefault();
|
|
1795
1821
|
})
|
|
1796
1822
|
)
|
|
1797
1823
|
);
|
|
@@ -1827,11 +1853,11 @@ let ye = class extends ee {
|
|
|
1827
1853
|
const n = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1828
1854
|
if (!n)
|
|
1829
1855
|
return;
|
|
1830
|
-
const r = t.params, { unitId:
|
|
1831
|
-
if (
|
|
1856
|
+
const r = t.params, { unitId: o } = r;
|
|
1857
|
+
if (o !== n.getUnitId())
|
|
1832
1858
|
return;
|
|
1833
|
-
const
|
|
1834
|
-
this._updateViewZoom(
|
|
1859
|
+
const s = n.zoomRatio || 1;
|
|
1860
|
+
this._updateViewZoom(s);
|
|
1835
1861
|
}
|
|
1836
1862
|
})
|
|
1837
1863
|
);
|
|
@@ -1842,12 +1868,12 @@ let ye = class extends ee {
|
|
|
1842
1868
|
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
|
|
1843
1869
|
}
|
|
1844
1870
|
_calculatePagePosition(e, t) {
|
|
1845
|
-
const { document: n, scene: r, docBackground:
|
|
1846
|
-
if (
|
|
1871
|
+
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
|
+
if (s == null || a === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
|
|
1847
1873
|
return;
|
|
1848
|
-
const { width: h, height:
|
|
1849
|
-
let g = 0,
|
|
1850
|
-
h > (a +
|
|
1874
|
+
const { width: h, height: f } = s;
|
|
1875
|
+
let g = 0, S = 0, d = 0, _ = 0, O = Number.POSITIVE_INFINITY;
|
|
1876
|
+
h > (a + l * 2) * t ? (g = h / 2 - a * t / 2, g /= t, d = (h - l * 2) / t, O = 0) : (g = l, d = a + l * 2, O = (d - h / t) / 2), f > c ? (S = f / 2 - c / 2, _ = (f - u * 2) / t) : (S = u, _ = c + u * 2), r.resize(d, _ + 200), n.translate(g, S), o.translate(g, S);
|
|
1851
1877
|
const E = r.getViewport(Be.VIEW_MAIN);
|
|
1852
1878
|
if (O !== Number.POSITIVE_INFINITY && E != null) {
|
|
1853
1879
|
const N = E.getBarScroll(O, 0).x;
|
|
@@ -1861,7 +1887,7 @@ let ye = class extends ee {
|
|
|
1861
1887
|
return xt(this._univerInstanceService, this._renderManagerService);
|
|
1862
1888
|
}
|
|
1863
1889
|
};
|
|
1864
|
-
ye =
|
|
1890
|
+
ye = Pr([
|
|
1865
1891
|
L(B.Rendered, ye),
|
|
1866
1892
|
Z(0, R(ie)),
|
|
1867
1893
|
Z(1, U),
|
|
@@ -1870,16 +1896,16 @@ ye = Dr([
|
|
|
1870
1896
|
Z(4, R(ne)),
|
|
1871
1897
|
Z(5, $)
|
|
1872
1898
|
], ye);
|
|
1873
|
-
var
|
|
1874
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1875
|
-
(
|
|
1876
|
-
return n && r &&
|
|
1899
|
+
var Ur = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, Ar = (i, e, t, n) => {
|
|
1900
|
+
for (var r = n > 1 ? void 0 : n ? Nr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1901
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1902
|
+
return n && r && Ur(e, t, r), r;
|
|
1877
1903
|
}, z = (i, e) => (t, n) => e(t, n, i);
|
|
1878
1904
|
let Me = class extends ee {
|
|
1879
|
-
constructor(e, t, n, r,
|
|
1905
|
+
constructor(e, t, n, r, o, s, a) {
|
|
1880
1906
|
super();
|
|
1881
|
-
|
|
1882
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager =
|
|
1907
|
+
p(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
1908
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = o, this._textSelectionManagerService = s, this._editorService = a, this._initialize();
|
|
1883
1909
|
}
|
|
1884
1910
|
_initialize() {
|
|
1885
1911
|
this._init(), this._skeletonListener(), this._commandExecutedListener();
|
|
@@ -1899,6 +1925,7 @@ let Me = class extends ee {
|
|
|
1899
1925
|
const t = this._getDocObjectById(e);
|
|
1900
1926
|
t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
|
|
1901
1927
|
}
|
|
1928
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1902
1929
|
_initialMain(e) {
|
|
1903
1930
|
const t = this._getDocObjectById(e);
|
|
1904
1931
|
if (t == null)
|
|
@@ -1918,27 +1945,27 @@ let Me = class extends ee {
|
|
|
1918
1945
|
)
|
|
1919
1946
|
), this.disposeWithMe(
|
|
1920
1947
|
j(
|
|
1921
|
-
n == null ? void 0 : n.onPointerDownObserver.add((
|
|
1948
|
+
n == null ? void 0 : n.onPointerDownObserver.add((o, s) => {
|
|
1922
1949
|
if (this._isEditorReadOnly(e))
|
|
1923
1950
|
return;
|
|
1924
1951
|
const a = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1925
|
-
(a == null ? void 0 : a.getUnitId()) !== e && this._univerInstanceService.setCurrentUnitForType(e), this._textSelectionRenderManager.eventTrigger(
|
|
1926
|
-
const { offsetX: c, offsetY:
|
|
1927
|
-
this._editorService.getEditor(e) && setTimeout(() => {
|
|
1928
|
-
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c,
|
|
1929
|
-
}, 0),
|
|
1952
|
+
(a == null ? void 0 : a.getUnitId()) !== e && this._univerInstanceService.setCurrentUnitForType(e), this._textSelectionRenderManager.eventTrigger(o);
|
|
1953
|
+
const { offsetX: c, offsetY: l } = o;
|
|
1954
|
+
this._editorService.getEditor(e) && (this._setEditorFocus(e), setTimeout(() => {
|
|
1955
|
+
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, l);
|
|
1956
|
+
}, 0)), o.button !== 2 && s.stopPropagation();
|
|
1930
1957
|
})
|
|
1931
1958
|
)
|
|
1932
1959
|
), this.disposeWithMe(
|
|
1933
1960
|
j(
|
|
1934
|
-
n == null ? void 0 : n.onDblclickObserver.add((
|
|
1935
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(
|
|
1961
|
+
n == null ? void 0 : n.onDblclickObserver.add((o) => {
|
|
1962
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(o);
|
|
1936
1963
|
})
|
|
1937
1964
|
)
|
|
1938
1965
|
), this.disposeWithMe(
|
|
1939
1966
|
j(
|
|
1940
|
-
n == null ? void 0 : n.onTripleClickObserver.add((
|
|
1941
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(
|
|
1967
|
+
n == null ? void 0 : n.onTripleClickObserver.add((o) => {
|
|
1968
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(o);
|
|
1942
1969
|
})
|
|
1943
1970
|
)
|
|
1944
1971
|
);
|
|
@@ -1960,8 +1987,8 @@ let Me = class extends ee {
|
|
|
1960
1987
|
this._commandService.onCommandExecuted((t) => {
|
|
1961
1988
|
var n;
|
|
1962
1989
|
if (e.includes(t.id)) {
|
|
1963
|
-
const r = t.params, { unitId:
|
|
1964
|
-
if (
|
|
1990
|
+
const r = t.params, { unitId: o } = r, s = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
|
|
1991
|
+
if (o !== s)
|
|
1965
1992
|
return;
|
|
1966
1993
|
this._textSelectionManagerService.refreshSelection();
|
|
1967
1994
|
}
|
|
@@ -1976,8 +2003,8 @@ let Me = class extends ee {
|
|
|
1976
2003
|
const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
|
|
1977
2004
|
if (r == null)
|
|
1978
2005
|
return;
|
|
1979
|
-
const { scene:
|
|
1980
|
-
this._textSelectionRenderManager.changeRuntime(n,
|
|
2006
|
+
const { scene: o, mainComponent: s } = r;
|
|
2007
|
+
this._textSelectionRenderManager.changeRuntime(n, o, s), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
1981
2008
|
unitId: t,
|
|
1982
2009
|
subUnitId: ""
|
|
1983
2010
|
});
|
|
@@ -1988,28 +2015,28 @@ let Me = class extends ee {
|
|
|
1988
2015
|
return this._univerInstanceService.getUnitType(e) !== m.UNIVER_DOC ? null : Un(e, this._renderManagerService);
|
|
1989
2016
|
}
|
|
1990
2017
|
};
|
|
1991
|
-
Me =
|
|
2018
|
+
Me = Ar([
|
|
1992
2019
|
L(B.Rendered, Me),
|
|
1993
2020
|
z(0, R(ie)),
|
|
1994
2021
|
z(1, U),
|
|
1995
2022
|
z(2, v),
|
|
1996
2023
|
z(3, H),
|
|
1997
|
-
z(4,
|
|
2024
|
+
z(4, he),
|
|
1998
2025
|
z(5, R(ne)),
|
|
1999
2026
|
z(6, $)
|
|
2000
2027
|
], Me);
|
|
2001
|
-
var
|
|
2002
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2003
|
-
(
|
|
2004
|
-
return n && r &&
|
|
2028
|
+
var Lr = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, $r = (i, e, t, n) => {
|
|
2029
|
+
for (var r = n > 1 ? void 0 : n ? Br(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2030
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
2031
|
+
return n && r && Lr(e, t, r), r;
|
|
2005
2032
|
}, se = (i, e) => (t, n) => e(t, n, i);
|
|
2006
2033
|
const Ot = 1.5;
|
|
2007
|
-
let Ee = class extends
|
|
2034
|
+
let Ee = class extends de {
|
|
2008
2035
|
constructor(i, e, t, n, r) {
|
|
2009
2036
|
super(), this._docSkeletonManagerService = i, this._textSelectionManagerService = e, this._editorService = t, this._univerInstanceService = n, this._renderManagerService = r, this._init();
|
|
2010
2037
|
}
|
|
2011
2038
|
_init() {
|
|
2012
|
-
this._textSelectionManagerService.textSelection$.pipe(
|
|
2039
|
+
this._textSelectionManagerService.textSelection$.pipe(le(this.dispose$)).subscribe((i) => {
|
|
2013
2040
|
if (i == null)
|
|
2014
2041
|
return;
|
|
2015
2042
|
const { isEditing: e, unitId: t } = i;
|
|
@@ -2022,10 +2049,10 @@ let Ee = class extends le {
|
|
|
2022
2049
|
const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (x = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : x.skeleton;
|
|
2023
2050
|
if (e == null || t == null || n == null)
|
|
2024
2051
|
return;
|
|
2025
|
-
const { collapsed: r, startNodePosition:
|
|
2052
|
+
const { collapsed: r, startNodePosition: o } = e;
|
|
2026
2053
|
if (!r)
|
|
2027
2054
|
return;
|
|
2028
|
-
const
|
|
2055
|
+
const s = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = s, l = new jn(s, n), { contentBoxPointGroup: u } = l.getRangePointData(o, o), { left: h, top: f, height: g } = Vn(u), S = h + a, d = f + c, _ = t.scene.getViewport(Be.VIEW_MAIN), O = !!this._editorService.getEditor(i);
|
|
2029
2056
|
if (_ == null)
|
|
2030
2057
|
return;
|
|
2031
2058
|
const {
|
|
@@ -2035,16 +2062,16 @@ let Ee = class extends le {
|
|
|
2035
2062
|
bottom: w
|
|
2036
2063
|
} = _.getBounding().viewBound;
|
|
2037
2064
|
let Y = 0, G = 0;
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
const
|
|
2041
|
-
_.scrollBy(
|
|
2065
|
+
const _e = O ? 0 : 100;
|
|
2066
|
+
d < N ? Y = d - N : d > w - g && (Y = d - w + g + _e), S < E ? G = S - E : S > F - Ot && (G = S - F + Ot);
|
|
2067
|
+
const pe = _.getBarScroll(G, Y);
|
|
2068
|
+
_.scrollBy(pe);
|
|
2042
2069
|
}
|
|
2043
2070
|
_getDocObject() {
|
|
2044
2071
|
return xt(this._univerInstanceService, this._renderManagerService);
|
|
2045
2072
|
}
|
|
2046
2073
|
};
|
|
2047
|
-
Ee =
|
|
2074
|
+
Ee = $r([
|
|
2048
2075
|
L(B.Rendered, Ee),
|
|
2049
2076
|
se(0, R(ie)),
|
|
2050
2077
|
se(1, R(ne)),
|
|
@@ -2052,16 +2079,14 @@ Ee = Br([
|
|
|
2052
2079
|
se(3, U),
|
|
2053
2080
|
se(4, H)
|
|
2054
2081
|
], Ee);
|
|
2055
|
-
var
|
|
2056
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2057
|
-
(
|
|
2058
|
-
return n && r &&
|
|
2059
|
-
}, ze = (i, e) => (t, n) => e(t, n, i),
|
|
2060
|
-
let Rt = (
|
|
2082
|
+
var Fr = Object.defineProperty, wr = Object.getOwnPropertyDescriptor, jr = (i, e, t, n) => {
|
|
2083
|
+
for (var r = n > 1 ? void 0 : n ? wr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2084
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
2085
|
+
return n && r && Fr(e, t, r), r;
|
|
2086
|
+
}, ze = (i, e) => (t, n) => e(t, n, i), Ce;
|
|
2087
|
+
let Rt = (Ce = class extends Yt {
|
|
2061
2088
|
constructor(i, e, t, n) {
|
|
2062
|
-
super(), this._config = i, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
|
|
2063
|
-
zhCN: ki
|
|
2064
|
-
}), this._config = qe.deepMerge({}, Gn, this._config), this._initDependencies(e), this._initializeCommands();
|
|
2089
|
+
super(), this._config = i, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({ zhCN: ki }), this._config = qe.deepMerge({}, Gn, this._config), this._initDependencies(e), this._initializeCommands();
|
|
2065
2090
|
}
|
|
2066
2091
|
onRendered() {
|
|
2067
2092
|
this._initModules(), this._markDocAsFocused();
|
|
@@ -2077,9 +2102,9 @@ let Rt = (ve = class extends Yt {
|
|
|
2077
2102
|
ni,
|
|
2078
2103
|
ii,
|
|
2079
2104
|
ri,
|
|
2080
|
-
Hi,
|
|
2081
2105
|
Yi,
|
|
2082
|
-
|
|
2106
|
+
Gi,
|
|
2107
|
+
Hi
|
|
2083
2108
|
].forEach((i) => {
|
|
2084
2109
|
this._injector.get(dn).registerShortcut(i);
|
|
2085
2110
|
});
|
|
@@ -2087,7 +2112,12 @@ let Rt = (ve = class extends Yt {
|
|
|
2087
2112
|
_initDependencies(i) {
|
|
2088
2113
|
[
|
|
2089
2114
|
// Controller
|
|
2090
|
-
[
|
|
2115
|
+
[
|
|
2116
|
+
ce,
|
|
2117
|
+
{
|
|
2118
|
+
useFactory: () => this._injector.createInstance(ce, this._config)
|
|
2119
|
+
}
|
|
2120
|
+
],
|
|
2091
2121
|
[Oe],
|
|
2092
2122
|
[Re],
|
|
2093
2123
|
[Te],
|
|
@@ -2103,7 +2133,7 @@ let Rt = (ve = class extends Yt {
|
|
|
2103
2133
|
}
|
|
2104
2134
|
],
|
|
2105
2135
|
[
|
|
2106
|
-
|
|
2136
|
+
ge,
|
|
2107
2137
|
{
|
|
2108
2138
|
useClass: Xe
|
|
2109
2139
|
}
|
|
@@ -2129,8 +2159,8 @@ let Rt = (ve = class extends Yt {
|
|
|
2129
2159
|
_initModules() {
|
|
2130
2160
|
this._injector.get(ae);
|
|
2131
2161
|
}
|
|
2132
|
-
},
|
|
2133
|
-
Rt =
|
|
2162
|
+
}, p(Ce, "pluginName", Xn), p(Ce, "type", m.UNIVER_DOC), Ce);
|
|
2163
|
+
Rt = jr([
|
|
2134
2164
|
ze(1, R(Ue)),
|
|
2135
2165
|
ze(2, R(Ze)),
|
|
2136
2166
|
ze(3, bt)
|
|
@@ -2141,10 +2171,11 @@ export {
|
|
|
2141
2171
|
Gn as DefaultDocUiConfig,
|
|
2142
2172
|
Hn as DefaultToolbarConfig,
|
|
2143
2173
|
Ie as DocCanvasView,
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2174
|
+
tr as PastePluginLark,
|
|
2175
|
+
or as PastePluginUniver,
|
|
2176
|
+
ir as PastePluginWord,
|
|
2147
2177
|
Rt as UniverDocsUIPlugin,
|
|
2148
|
-
|
|
2178
|
+
qr as enUS,
|
|
2179
|
+
Jr as ruRU,
|
|
2149
2180
|
ki as zhCN
|
|
2150
2181
|
};
|