@univerjs/docs-ui 0.1.10 → 0.1.11
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 +406 -379
- 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 +2 -2
- 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,6 +1,6 @@
|
|
|
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
|
|
3
|
+
var p = (i, e, t) => ($t(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
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
5
|
import { Inject as R, Injector as Ue, Optional as Gt, createIdentifier as Xt } from "@wendellhu/redi";
|
|
6
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";
|
|
@@ -125,15 +125,15 @@ const Zn = {
|
|
|
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
179
|
}, fe = (i, e) => (t, n) => e(t, n, i);
|
|
180
180
|
let ae = class extends le {
|
|
181
|
-
constructor(e, t, n, r,
|
|
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(
|
|
@@ -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,38 +667,38 @@ 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
699
|
let Ce = class extends ee {
|
|
700
|
-
constructor(i, e, t, n, r,
|
|
701
|
-
super(), this._injector = i, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = r, this._uiController =
|
|
700
|
+
constructor(i, e, t, n, r, o, s) {
|
|
701
|
+
super(), this._injector = i, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = r, this._uiController = o, this._univerInstanceService = s, this._init();
|
|
702
702
|
}
|
|
703
703
|
_initCustomComponents() {
|
|
704
704
|
const i = this._componentManager;
|
|
@@ -784,7 +784,7 @@ const Vi = {
|
|
|
784
784
|
alignRight: "Align Right",
|
|
785
785
|
alignJustify: "Justify"
|
|
786
786
|
}
|
|
787
|
-
},
|
|
787
|
+
}, qr = Vi, Wi = {
|
|
788
788
|
toolbar: {
|
|
789
789
|
undo: "撤销",
|
|
790
790
|
redo: "重做",
|
|
@@ -813,28 +813,56 @@ const Vi = {
|
|
|
813
813
|
alignJustify: "两端对齐"
|
|
814
814
|
}
|
|
815
815
|
}, ki = Wi, zi = {
|
|
816
|
+
toolbar: {
|
|
817
|
+
undo: "Отменить",
|
|
818
|
+
redo: "Повторить",
|
|
819
|
+
font: "Шрифт",
|
|
820
|
+
fontSize: "Размер шрифта",
|
|
821
|
+
bold: "Полужирный",
|
|
822
|
+
italic: "Курсив",
|
|
823
|
+
strikethrough: "Зачеркнутый",
|
|
824
|
+
subscript: "Нижний индекс",
|
|
825
|
+
superscript: "Верхний индекс",
|
|
826
|
+
underline: "Подчеркнутый",
|
|
827
|
+
textColor: {
|
|
828
|
+
main: "Цвет текста",
|
|
829
|
+
right: "Выбрать цвет"
|
|
830
|
+
},
|
|
831
|
+
fillColor: {
|
|
832
|
+
main: "Цвет фона текста",
|
|
833
|
+
right: "Выбрать цвет"
|
|
834
|
+
},
|
|
835
|
+
resetColor: "Сбросить",
|
|
836
|
+
order: "Упорядоченный список",
|
|
837
|
+
unorder: "Неупорядоченный список",
|
|
838
|
+
alignLeft: "Выровнять по левому краю",
|
|
839
|
+
alignCenter: "Выровнять по центру",
|
|
840
|
+
alignRight: "Выровнять по правому краю",
|
|
841
|
+
alignJustify: "Выровнять по ширине"
|
|
842
|
+
}
|
|
843
|
+
}, Jr = zi, Hi = {
|
|
816
844
|
id: bn.id,
|
|
817
845
|
preconditions: Kn,
|
|
818
846
|
binding: D.ENTER
|
|
819
|
-
},
|
|
847
|
+
}, Yi = {
|
|
820
848
|
id: yn.id,
|
|
821
849
|
preconditions: A,
|
|
822
850
|
binding: D.BACKSPACE
|
|
823
|
-
},
|
|
851
|
+
}, Gi = {
|
|
824
852
|
id: Mn.id,
|
|
825
853
|
preconditions: A,
|
|
826
854
|
binding: D.DELETE
|
|
827
|
-
},
|
|
828
|
-
function
|
|
829
|
-
return qe.generateRandomId(
|
|
855
|
+
}, Xi = 10, Ki = 6;
|
|
856
|
+
function Zi() {
|
|
857
|
+
return qe.generateRandomId(Ki);
|
|
830
858
|
}
|
|
831
|
-
function
|
|
859
|
+
function qi(i) {
|
|
832
860
|
const e = i.match(/data-copy-id="([^\s]+)"/);
|
|
833
861
|
return e && e[1] ? e[1] : null;
|
|
834
862
|
}
|
|
835
|
-
class
|
|
863
|
+
class Ji {
|
|
836
864
|
constructor() {
|
|
837
|
-
|
|
865
|
+
p(this, "_cache", new wt(Xi));
|
|
838
866
|
}
|
|
839
867
|
set(e, t) {
|
|
840
868
|
this._cache.set(e, t);
|
|
@@ -846,7 +874,7 @@ class qi {
|
|
|
846
874
|
this._cache.clear();
|
|
847
875
|
}
|
|
848
876
|
}
|
|
849
|
-
const mt = new
|
|
877
|
+
const mt = new Ji();
|
|
850
878
|
function it(i) {
|
|
851
879
|
const e = i.style, t = {}, n = i.tagName.toLowerCase();
|
|
852
880
|
switch (n) {
|
|
@@ -879,44 +907,44 @@ function it(i) {
|
|
|
879
907
|
}
|
|
880
908
|
}
|
|
881
909
|
for (let r = 0; r < e.length; r++) {
|
|
882
|
-
const
|
|
883
|
-
switch (
|
|
910
|
+
const o = e[r], s = e.getPropertyValue(o);
|
|
911
|
+
switch (o) {
|
|
884
912
|
case "font-family": {
|
|
885
|
-
t.ff =
|
|
913
|
+
t.ff = s;
|
|
886
914
|
break;
|
|
887
915
|
}
|
|
888
916
|
case "font-size": {
|
|
889
|
-
const a = Number.parseInt(
|
|
890
|
-
Number.isNaN(a) || (
|
|
917
|
+
const a = Number.parseInt(s);
|
|
918
|
+
Number.isNaN(a) || (s.endsWith("pt") ? t.fs = a : s.endsWith("px") && (t.fs = An(a)));
|
|
891
919
|
break;
|
|
892
920
|
}
|
|
893
921
|
case "font-style": {
|
|
894
|
-
|
|
922
|
+
s === "italic" && (t.it = C.TRUE);
|
|
895
923
|
break;
|
|
896
924
|
}
|
|
897
925
|
case "font-weight": {
|
|
898
|
-
Number(
|
|
926
|
+
Number(s) > 400 && (t.bl = C.TRUE);
|
|
899
927
|
break;
|
|
900
928
|
}
|
|
901
929
|
case "text-decoration": {
|
|
902
|
-
/underline/.test(
|
|
930
|
+
/underline/.test(s) ? t.ul = {
|
|
903
931
|
s: C.TRUE
|
|
904
|
-
} : /overline/.test(
|
|
932
|
+
} : /overline/.test(s) ? t.ol = {
|
|
905
933
|
s: C.TRUE
|
|
906
|
-
} : /line-through/.test(
|
|
934
|
+
} : /line-through/.test(s) && (t.st = {
|
|
907
935
|
s: C.TRUE
|
|
908
936
|
});
|
|
909
937
|
break;
|
|
910
938
|
}
|
|
911
939
|
case "color": {
|
|
912
|
-
const a = new ot(
|
|
940
|
+
const a = new ot(s);
|
|
913
941
|
a.isValid && (t.cl = {
|
|
914
942
|
rgb: a.toRgbString()
|
|
915
943
|
});
|
|
916
944
|
break;
|
|
917
945
|
}
|
|
918
946
|
case "background-color": {
|
|
919
|
-
const a = new ot(
|
|
947
|
+
const a = new ot(s);
|
|
920
948
|
a.isValid && (t.bg = {
|
|
921
949
|
rgb: a.toRgbString()
|
|
922
950
|
});
|
|
@@ -926,7 +954,7 @@ function it(i) {
|
|
|
926
954
|
}
|
|
927
955
|
return t;
|
|
928
956
|
}
|
|
929
|
-
function
|
|
957
|
+
function Qi(i) {
|
|
930
958
|
const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
|
|
931
959
|
return e.parseFromString(t, "text/html").querySelector("#univer-root");
|
|
932
960
|
}
|
|
@@ -936,9 +964,9 @@ function St(i, e) {
|
|
|
936
964
|
}
|
|
937
965
|
const xe = class xe {
|
|
938
966
|
constructor() {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
967
|
+
p(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
968
|
+
p(this, "_styleRules", []);
|
|
969
|
+
p(this, "_afterProcessRules", []);
|
|
942
970
|
}
|
|
943
971
|
static use(e) {
|
|
944
972
|
if (this._pluginList.includes(e))
|
|
@@ -946,7 +974,7 @@ const xe = class xe {
|
|
|
946
974
|
this._pluginList.push(e);
|
|
947
975
|
}
|
|
948
976
|
convert(e) {
|
|
949
|
-
const t = xe._pluginList.find((
|
|
977
|
+
const t = xe._pluginList.find((o) => o.checkPasteType(e)), n = Qi(e), r = {
|
|
950
978
|
dataStream: "",
|
|
951
979
|
textRuns: []
|
|
952
980
|
};
|
|
@@ -954,30 +982,30 @@ const xe = class xe {
|
|
|
954
982
|
}
|
|
955
983
|
_process(e, t, n) {
|
|
956
984
|
var r;
|
|
957
|
-
for (const
|
|
958
|
-
if (
|
|
959
|
-
const
|
|
985
|
+
for (const o of t)
|
|
986
|
+
if (o.nodeType === Node.TEXT_NODE) {
|
|
987
|
+
const s = (r = o.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
|
|
960
988
|
let a;
|
|
961
|
-
e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream +=
|
|
962
|
-
st: n.dataStream.length -
|
|
989
|
+
e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += s, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
|
|
990
|
+
st: n.dataStream.length - s.length,
|
|
963
991
|
ed: n.dataStream.length,
|
|
964
992
|
ts: a
|
|
965
993
|
});
|
|
966
|
-
} else if (
|
|
967
|
-
const
|
|
968
|
-
this._styleCache.set(
|
|
969
|
-
const { childNodes:
|
|
970
|
-
this._process(
|
|
994
|
+
} else if (o.nodeType === Node.ELEMENT_NODE) {
|
|
995
|
+
const s = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => St(o, h)), c = a ? a.getStyle(o) : it(o);
|
|
996
|
+
this._styleCache.set(o, { ...s, ...c });
|
|
997
|
+
const { childNodes: l } = o;
|
|
998
|
+
this._process(o, l, n);
|
|
971
999
|
const u = this._afterProcessRules.find(
|
|
972
|
-
({ filter: h }) => St(
|
|
1000
|
+
({ filter: h }) => St(o, h)
|
|
973
1001
|
);
|
|
974
|
-
u && u.handler(n,
|
|
1002
|
+
u && u.handler(n, o);
|
|
975
1003
|
}
|
|
976
1004
|
}
|
|
977
1005
|
};
|
|
978
|
-
|
|
1006
|
+
p(xe, "_pluginList", []);
|
|
979
1007
|
let Q = xe;
|
|
980
|
-
const
|
|
1008
|
+
const er = {
|
|
981
1009
|
name: "univer-doc-paste-plugin-lark",
|
|
982
1010
|
checkPasteType(i) {
|
|
983
1011
|
return /lark-record-clipboard/i.test(i);
|
|
@@ -1009,32 +1037,32 @@ const Qi = {
|
|
|
1009
1037
|
}
|
|
1010
1038
|
}
|
|
1011
1039
|
]
|
|
1012
|
-
},
|
|
1040
|
+
}, tr = er;
|
|
1013
1041
|
function Lt(i) {
|
|
1014
1042
|
const e = i.style, t = {};
|
|
1015
1043
|
for (let n = 0; n < e.length; n++) {
|
|
1016
|
-
const r = e[n],
|
|
1044
|
+
const r = e[n], o = e.getPropertyValue(r);
|
|
1017
1045
|
switch (r) {
|
|
1018
1046
|
case "margin-top": {
|
|
1019
|
-
const
|
|
1020
|
-
t.spaceAbove = /pt/.test(
|
|
1047
|
+
const s = Number.parseInt(o);
|
|
1048
|
+
t.spaceAbove = /pt/.test(o) ? ut(s) : s;
|
|
1021
1049
|
break;
|
|
1022
1050
|
}
|
|
1023
1051
|
case "margin-bottom": {
|
|
1024
|
-
const
|
|
1025
|
-
t.spaceBelow = /pt/.test(
|
|
1052
|
+
const s = Number.parseInt(o);
|
|
1053
|
+
t.spaceBelow = /pt/.test(o) ? ut(s) : s;
|
|
1026
1054
|
break;
|
|
1027
1055
|
}
|
|
1028
1056
|
case "line-height": {
|
|
1029
|
-
const
|
|
1030
|
-
t.lineSpacing =
|
|
1057
|
+
const s = Number.parseFloat(o);
|
|
1058
|
+
t.lineSpacing = s;
|
|
1031
1059
|
break;
|
|
1032
1060
|
}
|
|
1033
1061
|
}
|
|
1034
1062
|
}
|
|
1035
1063
|
return Object.getOwnPropertyNames(t).length ? t : null;
|
|
1036
1064
|
}
|
|
1037
|
-
const
|
|
1065
|
+
const nr = {
|
|
1038
1066
|
name: "univer-doc-paste-plugin-word",
|
|
1039
1067
|
checkPasteType(i) {
|
|
1040
1068
|
return /word|mso/i.test(i);
|
|
@@ -1062,7 +1090,7 @@ const tr = {
|
|
|
1062
1090
|
}
|
|
1063
1091
|
}
|
|
1064
1092
|
]
|
|
1065
|
-
},
|
|
1093
|
+
}, ir = nr, rr = {
|
|
1066
1094
|
name: "univer-doc-paste-plugin-univer",
|
|
1067
1095
|
checkPasteType(i) {
|
|
1068
1096
|
return /UniverNormal/i.test(i);
|
|
@@ -1082,44 +1110,44 @@ const tr = {
|
|
|
1082
1110
|
}
|
|
1083
1111
|
}
|
|
1084
1112
|
]
|
|
1085
|
-
},
|
|
1113
|
+
}, or = rr;
|
|
1086
1114
|
function vt(i, e) {
|
|
1087
|
-
const { st: t, ed: n, ts: r = {} } = e, { ff:
|
|
1088
|
-
let
|
|
1115
|
+
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;
|
|
1116
|
+
let d = i.slice(t, n);
|
|
1089
1117
|
const _ = [];
|
|
1090
|
-
return a === C.TRUE && (
|
|
1118
|
+
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
1119
|
}
|
|
1092
1120
|
function ke(i, e, t) {
|
|
1093
1121
|
const { dataStream: n, textRuns: r = [] } = i;
|
|
1094
|
-
let
|
|
1095
|
-
const
|
|
1122
|
+
let o = e;
|
|
1123
|
+
const s = [];
|
|
1096
1124
|
for (const a of r) {
|
|
1097
|
-
const { st: c, ed:
|
|
1098
|
-
qe.hasIntersectionBetweenTwoRanges(e, t, c,
|
|
1125
|
+
const { st: c, ed: l } = a;
|
|
1126
|
+
qe.hasIntersectionBetweenTwoRanges(e, t, c, l) && (c > o ? (s.push(n.slice(o, c)), s.push(vt(n, {
|
|
1099
1127
|
...a,
|
|
1100
|
-
ed: Math.min(
|
|
1101
|
-
}))) :
|
|
1128
|
+
ed: Math.min(l, t)
|
|
1129
|
+
}))) : s.push(vt(n, {
|
|
1102
1130
|
...a,
|
|
1103
|
-
st:
|
|
1104
|
-
ed: Math.min(
|
|
1105
|
-
}))),
|
|
1131
|
+
st: o,
|
|
1132
|
+
ed: Math.min(l, t)
|
|
1133
|
+
}))), o = Math.max(e, Math.min(l, t));
|
|
1106
1134
|
}
|
|
1107
|
-
return
|
|
1135
|
+
return o !== t && s.push(n.slice(o, t)), s.join("");
|
|
1108
1136
|
}
|
|
1109
1137
|
function Ct(i, e = !0) {
|
|
1110
1138
|
var t;
|
|
1111
1139
|
if (e && ((t = i.paragraphs) != null && t.length)) {
|
|
1112
1140
|
const { dataStream: n, paragraphs: r = [] } = i;
|
|
1113
|
-
let
|
|
1141
|
+
let o = "", s = -1;
|
|
1114
1142
|
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`)),
|
|
1143
|
+
const { startIndex: c, paragraphStyle: l = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: f } = l, g = [];
|
|
1144
|
+
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
1145
|
}
|
|
1118
|
-
return
|
|
1146
|
+
return s !== n.length && (o += ke(i, s, n.length)), o;
|
|
1119
1147
|
} else
|
|
1120
1148
|
return ke(i, 0, i.dataStream.length);
|
|
1121
1149
|
}
|
|
1122
|
-
class
|
|
1150
|
+
class sr {
|
|
1123
1151
|
convert(e) {
|
|
1124
1152
|
if (e.length === 0)
|
|
1125
1153
|
throw new Error("The bodyList length at least to be 1");
|
|
@@ -1131,15 +1159,15 @@ class or {
|
|
|
1131
1159
|
return t;
|
|
1132
1160
|
}
|
|
1133
1161
|
}
|
|
1134
|
-
var
|
|
1135
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1136
|
-
(
|
|
1137
|
-
return n && r &&
|
|
1162
|
+
var ar = Object.defineProperty, cr = Object.getOwnPropertyDescriptor, lr = (i, e, t, n) => {
|
|
1163
|
+
for (var r = n > 1 ? void 0 : n ? cr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1164
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1165
|
+
return n && r && ar(e, t, r), r;
|
|
1138
1166
|
}, re = (i, e) => (t, n) => e(t, n, i);
|
|
1139
|
-
Q.use(
|
|
1140
|
-
Q.use(
|
|
1141
|
-
Q.use(
|
|
1142
|
-
function
|
|
1167
|
+
Q.use(ir);
|
|
1168
|
+
Q.use(tr);
|
|
1169
|
+
Q.use(or);
|
|
1170
|
+
function dr(i) {
|
|
1143
1171
|
const e = i.replace(/\n/g, "\r"), t = [];
|
|
1144
1172
|
for (let n = 0; n < e.length; n++)
|
|
1145
1173
|
e[n] === "\r" && t.push({ startIndex: n });
|
|
@@ -1150,12 +1178,12 @@ function lr(i) {
|
|
|
1150
1178
|
}
|
|
1151
1179
|
const he = Xt("doc.clipboard-service");
|
|
1152
1180
|
let Xe = class extends ee {
|
|
1153
|
-
constructor(e, t, n, r,
|
|
1181
|
+
constructor(e, t, n, r, o) {
|
|
1154
1182
|
super();
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService =
|
|
1183
|
+
p(this, "_clipboardHooks", []);
|
|
1184
|
+
p(this, "_htmlToUDM", new Q());
|
|
1185
|
+
p(this, "_umdToHtml", new sr());
|
|
1186
|
+
this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = o;
|
|
1159
1187
|
}
|
|
1160
1188
|
async copy() {
|
|
1161
1189
|
const e = this._getDocumentBodyInRanges();
|
|
@@ -1180,25 +1208,25 @@ let Xe = class extends ee {
|
|
|
1180
1208
|
return this._paste(n);
|
|
1181
1209
|
}
|
|
1182
1210
|
async _cut() {
|
|
1183
|
-
var
|
|
1211
|
+
var o;
|
|
1184
1212
|
const {
|
|
1185
1213
|
segmentId: e,
|
|
1186
1214
|
endOffset: t,
|
|
1187
1215
|
style: n
|
|
1188
|
-
} = (
|
|
1216
|
+
} = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, r = this._textSelectionManagerService.getSelections();
|
|
1189
1217
|
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || r == null)
|
|
1190
1218
|
return !1;
|
|
1191
1219
|
this.copy();
|
|
1192
1220
|
try {
|
|
1193
|
-
let
|
|
1221
|
+
let s = t;
|
|
1194
1222
|
for (const c of r) {
|
|
1195
|
-
const { startOffset:
|
|
1196
|
-
|
|
1223
|
+
const { startOffset: l, endOffset: u } = c;
|
|
1224
|
+
l == null || u == null || u <= t && (s -= u - l);
|
|
1197
1225
|
}
|
|
1198
1226
|
const a = [
|
|
1199
1227
|
{
|
|
1200
|
-
startOffset:
|
|
1201
|
-
endOffset:
|
|
1228
|
+
startOffset: s,
|
|
1229
|
+
endOffset: s,
|
|
1202
1230
|
style: n
|
|
1203
1231
|
}
|
|
1204
1232
|
];
|
|
@@ -1208,14 +1236,14 @@ let Xe = class extends ee {
|
|
|
1208
1236
|
}
|
|
1209
1237
|
}
|
|
1210
1238
|
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 ||
|
|
1239
|
+
var s;
|
|
1240
|
+
const { segmentId: t, endOffset: n, style: r } = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, o = this._textSelectionManagerService.getSelections();
|
|
1241
|
+
if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || o == null)
|
|
1214
1242
|
return !1;
|
|
1215
1243
|
try {
|
|
1216
1244
|
let a = n;
|
|
1217
|
-
for (const
|
|
1218
|
-
const { startOffset: u, endOffset: h } =
|
|
1245
|
+
for (const l of o) {
|
|
1246
|
+
const { startOffset: u, endOffset: h } = l;
|
|
1219
1247
|
u == null || h == null || h <= n && (a += e.dataStream.length - (h - u));
|
|
1220
1248
|
}
|
|
1221
1249
|
const c = [
|
|
@@ -1231,10 +1259,10 @@ let Xe = class extends ee {
|
|
|
1231
1259
|
}
|
|
1232
1260
|
}
|
|
1233
1261
|
async _setClipboardData(e) {
|
|
1234
|
-
const t =
|
|
1262
|
+
const t = Zi(), n = e.length > 1 ? e.map((o) => o.dataStream).join(`
|
|
1235
1263
|
`) : e[0].dataStream;
|
|
1236
1264
|
let r = this._umdToHtml.convert(e);
|
|
1237
|
-
return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (
|
|
1265
|
+
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
1266
|
}
|
|
1239
1267
|
addClipboardHook(e) {
|
|
1240
1268
|
return this._clipboardHooks.push(e), j(() => {
|
|
@@ -1247,10 +1275,10 @@ let Xe = class extends ee {
|
|
|
1247
1275
|
if (e == null || !t)
|
|
1248
1276
|
return n;
|
|
1249
1277
|
for (const r of e) {
|
|
1250
|
-
const { startOffset:
|
|
1251
|
-
if (a ||
|
|
1278
|
+
const { startOffset: o, endOffset: s, collapsed: a } = r;
|
|
1279
|
+
if (a || o == null || s == null)
|
|
1252
1280
|
continue;
|
|
1253
|
-
const c = t.sliceBody(
|
|
1281
|
+
const c = t.sliceBody(o, s);
|
|
1254
1282
|
c != null && n.push(c);
|
|
1255
1283
|
}
|
|
1256
1284
|
return n;
|
|
@@ -1259,8 +1287,8 @@ let Xe = class extends ee {
|
|
|
1259
1287
|
try {
|
|
1260
1288
|
let t = "", n = "";
|
|
1261
1289
|
for (const r of e)
|
|
1262
|
-
for (const
|
|
1263
|
-
|
|
1290
|
+
for (const o of r.types)
|
|
1291
|
+
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
1292
|
return this._generateBodyFromHtmlAndText(t, n);
|
|
1265
1293
|
} catch (t) {
|
|
1266
1294
|
return Promise.reject(t);
|
|
@@ -1269,10 +1297,10 @@ let Xe = class extends ee {
|
|
|
1269
1297
|
_generateBodyFromHtmlAndText(e, t) {
|
|
1270
1298
|
if (!e) {
|
|
1271
1299
|
if (t)
|
|
1272
|
-
return
|
|
1300
|
+
return dr(t);
|
|
1273
1301
|
throw new Error("[DocClipboardService] html and text cannot be both empty!");
|
|
1274
1302
|
}
|
|
1275
|
-
const n =
|
|
1303
|
+
const n = qi(e);
|
|
1276
1304
|
if (n) {
|
|
1277
1305
|
const r = mt.get(n);
|
|
1278
1306
|
if (r)
|
|
@@ -1281,7 +1309,7 @@ let Xe = class extends ee {
|
|
|
1281
1309
|
return this._htmlToUDM.convert(e);
|
|
1282
1310
|
}
|
|
1283
1311
|
};
|
|
1284
|
-
Xe =
|
|
1312
|
+
Xe = lr([
|
|
1285
1313
|
re(0, U),
|
|
1286
1314
|
re(1, bt),
|
|
1287
1315
|
re(2, v),
|
|
@@ -1291,7 +1319,7 @@ Xe = cr([
|
|
|
1291
1319
|
function je(i) {
|
|
1292
1320
|
return i.getContextValue(De) || i.getContextValue(Tt);
|
|
1293
1321
|
}
|
|
1294
|
-
const rt = 999,
|
|
1322
|
+
const rt = 999, ur = {
|
|
1295
1323
|
id: sn.id,
|
|
1296
1324
|
name: "doc.command.copy",
|
|
1297
1325
|
type: Je.COMMAND,
|
|
@@ -1299,7 +1327,7 @@ const rt = 999, dr = {
|
|
|
1299
1327
|
priority: rt,
|
|
1300
1328
|
preconditions: je,
|
|
1301
1329
|
handler: async (i) => i.get(he).copy()
|
|
1302
|
-
},
|
|
1330
|
+
}, hr = {
|
|
1303
1331
|
id: an.id,
|
|
1304
1332
|
name: "doc.command.cut",
|
|
1305
1333
|
type: Je.COMMAND,
|
|
@@ -1307,7 +1335,7 @@ const rt = 999, dr = {
|
|
|
1307
1335
|
priority: rt,
|
|
1308
1336
|
preconditions: je,
|
|
1309
1337
|
handler: async (i) => i.get(he).cut()
|
|
1310
|
-
},
|
|
1338
|
+
}, gr = {
|
|
1311
1339
|
id: cn.id,
|
|
1312
1340
|
name: "doc.command.paste",
|
|
1313
1341
|
type: Je.COMMAND,
|
|
@@ -1319,31 +1347,31 @@ const rt = 999, dr = {
|
|
|
1319
1347
|
return n.length === 0 ? !1 : e.paste(n);
|
|
1320
1348
|
}
|
|
1321
1349
|
};
|
|
1322
|
-
var
|
|
1323
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1324
|
-
(
|
|
1325
|
-
return n && r &&
|
|
1350
|
+
var _r = Object.defineProperty, pr = Object.getOwnPropertyDescriptor, fr = (i, e, t, n) => {
|
|
1351
|
+
for (var r = n > 1 ? void 0 : n ? pr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1352
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1353
|
+
return n && r && _r(e, t, r), r;
|
|
1326
1354
|
}, oe = (i, e) => (t, n) => e(t, n, i);
|
|
1327
1355
|
let Oe = class extends le {
|
|
1328
1356
|
constructor(i, e, t, n, r) {
|
|
1329
1357
|
super(), this._commandService = i, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = r, this._init();
|
|
1330
1358
|
}
|
|
1331
1359
|
_init() {
|
|
1332
|
-
[
|
|
1360
|
+
[ur, hr, gr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [Et, Mt].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))), this._initLegacyPasteCommand();
|
|
1333
1361
|
}
|
|
1334
1362
|
_initLegacyPasteCommand() {
|
|
1335
1363
|
var i;
|
|
1336
1364
|
(i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
1337
|
-
var
|
|
1365
|
+
var o, s;
|
|
1338
1366
|
if (!je(this._contextService))
|
|
1339
1367
|
return;
|
|
1340
1368
|
e.event.preventDefault();
|
|
1341
|
-
const t = e.event, n = (
|
|
1369
|
+
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
1370
|
this._docClipboardService.legacyPaste(n, r);
|
|
1343
1371
|
});
|
|
1344
1372
|
}
|
|
1345
1373
|
};
|
|
1346
|
-
Oe =
|
|
1374
|
+
Oe = fr([
|
|
1347
1375
|
L(B.Rendered, Oe),
|
|
1348
1376
|
oe(0, v),
|
|
1349
1377
|
oe(1, Qe),
|
|
@@ -1351,16 +1379,16 @@ Oe = pr([
|
|
|
1351
1379
|
oe(3, ue),
|
|
1352
1380
|
oe(4, jt)
|
|
1353
1381
|
], Oe);
|
|
1354
|
-
var
|
|
1355
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1356
|
-
(
|
|
1357
|
-
return n && r &&
|
|
1382
|
+
var mr = Object.defineProperty, Sr = Object.getOwnPropertyDescriptor, vr = (i, e, t, n) => {
|
|
1383
|
+
for (var r = n > 1 ? void 0 : n ? Sr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1384
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1385
|
+
return n && r && mr(e, t, r), r;
|
|
1358
1386
|
}, X = (i, e) => (t, n) => e(t, n, i);
|
|
1359
1387
|
let Re = class extends ee {
|
|
1360
|
-
constructor(e, t, n, r,
|
|
1388
|
+
constructor(e, t, n, r, o, s) {
|
|
1361
1389
|
super();
|
|
1362
|
-
|
|
1363
|
-
this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager =
|
|
1390
|
+
p(this, "_initialEditors", /* @__PURE__ */ new Set());
|
|
1391
|
+
this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = o, this._renderManagerService = s, this._initialize();
|
|
1364
1392
|
}
|
|
1365
1393
|
_initialize() {
|
|
1366
1394
|
this.disposeWithMe(
|
|
@@ -1383,16 +1411,16 @@ let Re = class extends ee {
|
|
|
1383
1411
|
if (t == null || t.render == null || n == null || r == null)
|
|
1384
1412
|
return;
|
|
1385
1413
|
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
|
-
|
|
1414
|
+
const { marginTop: o = 0, marginBottom: s = 0, marginLeft: a = 0, marginRight: c = 0 } = r.getSnapshot().documentStyle, { scene: l, mainComponent: u } = t.render;
|
|
1415
|
+
let { actualHeight: h, actualWidth: f } = n.getActualSize();
|
|
1416
|
+
h += o + s, f += a + c;
|
|
1417
|
+
const { width: g, height: S } = t.getBoundingClientRect(), d = l.getViewport(Be.VIEW_MAIN);
|
|
1418
|
+
let _ = d == null ? void 0 : d.getScrollBar();
|
|
1419
|
+
const O = Math.max(f, g), E = Math.max(h, S);
|
|
1420
|
+
l.transformByState({
|
|
1393
1421
|
width: O,
|
|
1394
1422
|
height: E
|
|
1395
|
-
}), u == null || u.resize(O, E), t.isSingle() ?
|
|
1423
|
+
}), 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
1424
|
}
|
|
1397
1425
|
_initialSetValue() {
|
|
1398
1426
|
this.disposeWithMe(
|
|
@@ -1435,16 +1463,16 @@ let Re = class extends ee {
|
|
|
1435
1463
|
];
|
|
1436
1464
|
this.disposeWithMe(
|
|
1437
1465
|
pt(window, "mousedown").subscribe((n) => {
|
|
1438
|
-
const
|
|
1439
|
-
if (Vt(
|
|
1466
|
+
const o = n.target.classList[0] || "";
|
|
1467
|
+
if (Vt(o, e)) {
|
|
1440
1468
|
this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
|
|
1441
1469
|
return;
|
|
1442
1470
|
}
|
|
1443
1471
|
this._editorService.changeSpreadsheetFocusState(!1);
|
|
1444
1472
|
})
|
|
1445
1473
|
), this._univerInstanceService.getAllUnitsForType(m.UNIVER_SHEET).forEach((n) => {
|
|
1446
|
-
const r = n.getUnitId(),
|
|
1447
|
-
|
|
1474
|
+
const r = n.getUnitId(), o = this._renderManagerService.getRenderById(r), s = o == null ? void 0 : o.engine.getCanvas().getCanvasEle();
|
|
1475
|
+
s != null && pt(s, "mousedown").subscribe((a) => {
|
|
1448
1476
|
this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
|
|
1449
1477
|
});
|
|
1450
1478
|
});
|
|
@@ -1485,7 +1513,7 @@ let Re = class extends ee {
|
|
|
1485
1513
|
);
|
|
1486
1514
|
}
|
|
1487
1515
|
};
|
|
1488
|
-
Re =
|
|
1516
|
+
Re = vr([
|
|
1489
1517
|
L(B.Rendered, Re),
|
|
1490
1518
|
X(0, U),
|
|
1491
1519
|
X(1, R(ie)),
|
|
@@ -1494,15 +1522,15 @@ Re = Sr([
|
|
|
1494
1522
|
X(4, ue),
|
|
1495
1523
|
X(5, H)
|
|
1496
1524
|
], Re);
|
|
1497
|
-
var
|
|
1498
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1499
|
-
(
|
|
1500
|
-
return n && r &&
|
|
1525
|
+
var Cr = Object.defineProperty, Or = Object.getOwnPropertyDescriptor, Rr = (i, e, t, n) => {
|
|
1526
|
+
for (var r = n > 1 ? void 0 : n ? Or(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1527
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1528
|
+
return n && r && Cr(e, t, r), r;
|
|
1501
1529
|
}, me = (i, e) => (t, n) => e(t, n, i);
|
|
1502
1530
|
let Te = class extends le {
|
|
1503
1531
|
constructor(e, t, n, r) {
|
|
1504
1532
|
super();
|
|
1505
|
-
|
|
1533
|
+
p(this, "_docRenderMap", /* @__PURE__ */ new Set());
|
|
1506
1534
|
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
|
|
1507
1535
|
}
|
|
1508
1536
|
_initialRenderRefresh() {
|
|
@@ -1516,20 +1544,20 @@ let Te = class extends le {
|
|
|
1516
1544
|
const { skeleton: t, unitId: n } = e;
|
|
1517
1545
|
let r = this._renderManagerService.getRenderById(n);
|
|
1518
1546
|
r == null && (this._renderManagerService.create(n), r = this._renderManagerService.getRenderById(n));
|
|
1519
|
-
const { mainComponent:
|
|
1547
|
+
const { mainComponent: o, components: s } = r, a = o, c = s.get(q.BACKGROUND);
|
|
1520
1548
|
a.changeSkeleton(t), c.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
|
|
1521
1549
|
}
|
|
1522
1550
|
_recalculateSizeBySkeleton(e, t) {
|
|
1523
|
-
var
|
|
1524
|
-
const { mainComponent: n, scene: r, unitId:
|
|
1525
|
-
if (
|
|
1551
|
+
var f;
|
|
1552
|
+
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;
|
|
1553
|
+
if (l == null)
|
|
1526
1554
|
return;
|
|
1527
1555
|
let u = 0, h = 0;
|
|
1528
|
-
for (let g = 0,
|
|
1529
|
-
const
|
|
1530
|
-
a.pageLayoutType === ht.VERTICAL ? (h += O, h += a.pageMarginTop, g ===
|
|
1556
|
+
for (let g = 0, S = l.length; g < S; g++) {
|
|
1557
|
+
const d = l[g], { pageWidth: _, pageHeight: O } = d;
|
|
1558
|
+
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
1559
|
}
|
|
1532
|
-
a.resize(u, h), c.resize(u, h), this._editorService.isEditor(
|
|
1560
|
+
a.resize(u, h), c.resize(u, h), this._editorService.isEditor(o) || r.resize(u, h);
|
|
1533
1561
|
}
|
|
1534
1562
|
_commandExecutedListener() {
|
|
1535
1563
|
const e = [et.id];
|
|
@@ -1537,13 +1565,13 @@ let Te = class extends le {
|
|
|
1537
1565
|
this._commandService.onCommandExecuted((t) => {
|
|
1538
1566
|
var n;
|
|
1539
1567
|
if (e.includes(t.id)) {
|
|
1540
|
-
const r = t.params, { unitId:
|
|
1541
|
-
if (
|
|
1568
|
+
const r = t.params, { unitId: o } = r, s = this._docSkeletonManagerService.getSkeletonByUnitId(o);
|
|
1569
|
+
if (s == null)
|
|
1542
1570
|
return;
|
|
1543
|
-
const { skeleton: a } =
|
|
1571
|
+
const { skeleton: a } = s, c = this._renderManagerService.getRenderById(o);
|
|
1544
1572
|
if (c == null || !!a.getViewModel().getDataModel().getSnapshot().disabled)
|
|
1545
1573
|
return;
|
|
1546
|
-
if (a.calculate(), this._editorService.isEditor(
|
|
1574
|
+
if (a.calculate(), this._editorService.isEditor(o)) {
|
|
1547
1575
|
(n = c.mainComponent) == null || n.makeDirty();
|
|
1548
1576
|
return;
|
|
1549
1577
|
}
|
|
@@ -1553,25 +1581,25 @@ let Te = class extends le {
|
|
|
1553
1581
|
);
|
|
1554
1582
|
}
|
|
1555
1583
|
};
|
|
1556
|
-
Te =
|
|
1584
|
+
Te = Rr([
|
|
1557
1585
|
L(B.Rendered, Te),
|
|
1558
1586
|
me(0, R(ie)),
|
|
1559
1587
|
me(1, H),
|
|
1560
1588
|
me(2, v),
|
|
1561
1589
|
me(3, $)
|
|
1562
1590
|
], Te);
|
|
1563
|
-
var
|
|
1564
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1565
|
-
(
|
|
1566
|
-
return n && r &&
|
|
1591
|
+
var Tr = Object.defineProperty, Ir = Object.getOwnPropertyDescriptor, br = (i, e, t, n) => {
|
|
1592
|
+
for (var r = n > 1 ? void 0 : n ? Ir(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1593
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1594
|
+
return n && r && Tr(e, t, r), r;
|
|
1567
1595
|
}, Se = (i, e) => (t, n) => e(t, n, i);
|
|
1568
1596
|
let Ie = class extends le {
|
|
1569
1597
|
constructor(e, t, n, r) {
|
|
1570
1598
|
super();
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1599
|
+
p(this, "_scene");
|
|
1600
|
+
p(this, "_currentDocumentModel");
|
|
1601
|
+
p(this, "_fps$", new kn(""));
|
|
1602
|
+
p(this, "fps$", this._fps$.asObservable());
|
|
1575
1603
|
this._renderManagerService = e, this._configService = t, this._univerInstanceService = n, this._editorService = r, this._initialize();
|
|
1576
1604
|
}
|
|
1577
1605
|
_initialize() {
|
|
@@ -1592,65 +1620,62 @@ let Ie = class extends le {
|
|
|
1592
1620
|
const t = this._univerInstanceService.getUniverDocInstance(e);
|
|
1593
1621
|
t != null && (this._currentDocumentModel = t, this._renderManagerService.has(e) || this._addNewRender());
|
|
1594
1622
|
}
|
|
1595
|
-
// eslint-disable-next-line max-lines-per-function
|
|
1596
1623
|
_addNewRender() {
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
n == null
|
|
1601
|
-
const s = this._renderManagerService.getRenderById(t);
|
|
1602
|
-
if (s == null)
|
|
1624
|
+
const t = this._currentDocumentModel.getUnitId();
|
|
1625
|
+
this._renderManagerService.createRender(t);
|
|
1626
|
+
const n = this._renderManagerService.getRenderById(t);
|
|
1627
|
+
if (n == null)
|
|
1603
1628
|
return;
|
|
1604
|
-
const { scene:
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1629
|
+
const { scene: r, engine: o } = n;
|
|
1630
|
+
r.openTransformer(), this._scene = r;
|
|
1631
|
+
const s = new Ln(Be.VIEW_MAIN, r, {
|
|
1607
1632
|
left: 0,
|
|
1608
1633
|
top: 0,
|
|
1609
1634
|
bottom: 0,
|
|
1610
1635
|
right: 0,
|
|
1611
1636
|
isWheelPreventDefaultX: !0
|
|
1612
1637
|
});
|
|
1613
|
-
|
|
1614
|
-
const
|
|
1615
|
-
if (
|
|
1616
|
-
const
|
|
1617
|
-
let
|
|
1618
|
-
|
|
1638
|
+
r.attachControl(), r.on(Bn.wheel, (l, u) => {
|
|
1639
|
+
const h = l;
|
|
1640
|
+
if (h.ctrlKey) {
|
|
1641
|
+
const f = Math.abs(h.deltaX);
|
|
1642
|
+
let g = f < 40 ? 0.2 : f < 80 ? 0.4 : 0.2;
|
|
1643
|
+
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
1644
|
} else
|
|
1620
|
-
|
|
1621
|
-
}), this._configService.getConfig("hasScroll") !== !1 && new Ye(
|
|
1622
|
-
new gt(
|
|
1623
|
-
new gt(
|
|
1624
|
-
), this._addComponent(
|
|
1625
|
-
|
|
1645
|
+
s.onMouseWheel(h, u);
|
|
1646
|
+
}), this._configService.getConfig("hasScroll") !== !1 && new Ye(s), r.addLayer(
|
|
1647
|
+
new gt(r, [], We),
|
|
1648
|
+
new gt(r, [], xn)
|
|
1649
|
+
), this._addComponent(n), this._currentDocumentModel.getShouldRenderLoopImmediately() && o.runRenderLoop(() => {
|
|
1650
|
+
r.render(), this._fps$.next(Math.round(o.getFps()).toString());
|
|
1626
1651
|
}), this._renderManagerService.setCurrent(t);
|
|
1627
1652
|
}
|
|
1628
1653
|
_addComponent(e) {
|
|
1629
1654
|
const t = this._scene, n = this._currentDocumentModel, r = {
|
|
1630
1655
|
pageMarginLeft: n.documentStyle.marginLeft || 0,
|
|
1631
1656
|
pageMarginTop: n.documentStyle.marginTop || 0
|
|
1632
|
-
},
|
|
1633
|
-
|
|
1657
|
+
}, o = new $n(q.MAIN, void 0, r), s = new Fn(q.BACKGROUND, void 0, r);
|
|
1658
|
+
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
1659
|
}
|
|
1635
1660
|
};
|
|
1636
|
-
Ie =
|
|
1661
|
+
Ie = br([
|
|
1637
1662
|
L(B.Starting, Ie),
|
|
1638
1663
|
Se(0, H),
|
|
1639
1664
|
Se(1, Wt),
|
|
1640
1665
|
Se(2, U),
|
|
1641
1666
|
Se(3, $)
|
|
1642
1667
|
], Ie);
|
|
1643
|
-
var
|
|
1644
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1645
|
-
(
|
|
1646
|
-
return n && r &&
|
|
1668
|
+
var yr = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, Er = (i, e, t, n) => {
|
|
1669
|
+
for (var r = n > 1 ? void 0 : n ? Mr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1670
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1671
|
+
return n && r && yr(e, t, r), r;
|
|
1647
1672
|
}, K = (i, e) => (t, n) => e(t, n, i);
|
|
1648
1673
|
let be = class extends ee {
|
|
1649
|
-
constructor(e, t, n, r,
|
|
1674
|
+
constructor(e, t, n, r, o, s) {
|
|
1650
1675
|
super();
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService =
|
|
1676
|
+
p(this, "_liquid", new wn());
|
|
1677
|
+
p(this, "_pageMarginCache", /* @__PURE__ */ new Map());
|
|
1678
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = o, this._editorService = s, this._initialize(), this._commandExecutedListener();
|
|
1654
1679
|
}
|
|
1655
1680
|
_initialize() {
|
|
1656
1681
|
this._initialRenderRefresh(), this._updateOnPluginChange();
|
|
@@ -1660,19 +1685,19 @@ let be = class extends ee {
|
|
|
1660
1685
|
const t = this._docSkeletonManagerService.getCurrent();
|
|
1661
1686
|
if (t == null)
|
|
1662
1687
|
return;
|
|
1663
|
-
const { unitId: n, skeleton: r } = t,
|
|
1664
|
-
if (
|
|
1688
|
+
const { unitId: n, skeleton: r } = t, o = this._renderManagerService.getRenderById(n);
|
|
1689
|
+
if (o == null)
|
|
1665
1690
|
return;
|
|
1666
|
-
const { mainComponent:
|
|
1667
|
-
e.forEach((
|
|
1668
|
-
const { unitId: g, subUnitId:
|
|
1669
|
-
r == null || r.getViewModel().getDataModel().updateDrawing(
|
|
1691
|
+
const { mainComponent: s, components: a, scene: c } = o, l = s, { left: u, top: h } = l;
|
|
1692
|
+
e.forEach((f) => {
|
|
1693
|
+
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: ge, skewY: _e } = _, x = this._pageMarginCache.get(d), pe = (x == null ? void 0 : x.marginLeft) || 0, Ve = (x == null ? void 0 : x.marginTop) || 0;
|
|
1694
|
+
r == null || r.getViewModel().getDataModel().updateDrawing(d, {
|
|
1670
1695
|
left: O - u - pe,
|
|
1671
1696
|
top: E - h - Ve,
|
|
1672
1697
|
height: F,
|
|
1673
1698
|
width: N
|
|
1674
1699
|
});
|
|
1675
|
-
}), r == null || r.calculate(),
|
|
1700
|
+
}), r == null || r.calculate(), s == null || s.makeDirty();
|
|
1676
1701
|
});
|
|
1677
1702
|
}
|
|
1678
1703
|
_initialRenderRefresh() {
|
|
@@ -1682,8 +1707,8 @@ let be = class extends ee {
|
|
|
1682
1707
|
const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
|
|
1683
1708
|
if (r == null)
|
|
1684
1709
|
return;
|
|
1685
|
-
const { mainComponent:
|
|
1686
|
-
|
|
1710
|
+
const { mainComponent: o } = r;
|
|
1711
|
+
o.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
|
|
1687
1712
|
});
|
|
1688
1713
|
}
|
|
1689
1714
|
_commandExecutedListener() {
|
|
@@ -1692,42 +1717,42 @@ let be = class extends ee {
|
|
|
1692
1717
|
this._commandService.onCommandExecuted((t) => {
|
|
1693
1718
|
var n;
|
|
1694
1719
|
if (e.includes(t.id)) {
|
|
1695
|
-
const r = t.params, { unitId:
|
|
1696
|
-
if (
|
|
1720
|
+
const r = t.params, { unitId: o } = r, s = this._docSkeletonManagerService.getCurrent();
|
|
1721
|
+
if (s == null)
|
|
1697
1722
|
return;
|
|
1698
|
-
const { unitId: a, skeleton: c } =
|
|
1699
|
-
if (
|
|
1723
|
+
const { unitId: a, skeleton: c } = s;
|
|
1724
|
+
if (o !== a)
|
|
1700
1725
|
return;
|
|
1701
|
-
const
|
|
1702
|
-
if (
|
|
1726
|
+
const l = this._renderManagerService.getRenderById(a);
|
|
1727
|
+
if (l == null)
|
|
1703
1728
|
return;
|
|
1704
1729
|
if (this._editorService.isEditor(a)) {
|
|
1705
|
-
(n =
|
|
1730
|
+
(n = l.mainComponent) == null || n.makeDirty();
|
|
1706
1731
|
return;
|
|
1707
1732
|
}
|
|
1708
|
-
this._refreshFloatingObject(a, c,
|
|
1733
|
+
this._refreshFloatingObject(a, c, l);
|
|
1709
1734
|
}
|
|
1710
1735
|
})
|
|
1711
1736
|
);
|
|
1712
1737
|
}
|
|
1713
1738
|
_refreshFloatingObject(e, t, n) {
|
|
1714
|
-
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent:
|
|
1739
|
+
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: o, scene: s } = n, a = o;
|
|
1715
1740
|
if (!r)
|
|
1716
1741
|
return;
|
|
1717
|
-
const { left: c, top:
|
|
1718
|
-
|
|
1719
|
-
for (let
|
|
1720
|
-
const O = g[
|
|
1742
|
+
const { left: c, top: l, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: f } = a, { pages: g } = r, S = [];
|
|
1743
|
+
s.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
|
|
1744
|
+
for (let d = 0, _ = g.length; d < _; d++) {
|
|
1745
|
+
const O = g[d], { skeDrawings: E, marginLeft: N, marginTop: F } = O;
|
|
1721
1746
|
this._liquid.translatePagePadding(O), E.forEach((w) => {
|
|
1722
1747
|
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
|
-
|
|
1748
|
+
S.push({
|
|
1724
1749
|
unitId: e,
|
|
1725
1750
|
subUnitId: zt,
|
|
1726
1751
|
floatingObjectId: x,
|
|
1727
1752
|
behindText: Ve,
|
|
1728
1753
|
floatingObject: {
|
|
1729
1754
|
left: Y + c + this._liquid.x,
|
|
1730
|
-
top: G +
|
|
1755
|
+
top: G + l + this._liquid.y,
|
|
1731
1756
|
width: _e,
|
|
1732
1757
|
height: ge
|
|
1733
1758
|
}
|
|
@@ -1735,12 +1760,12 @@ let be = class extends ee {
|
|
|
1735
1760
|
marginLeft: this._liquid.x,
|
|
1736
1761
|
marginTop: this._liquid.y
|
|
1737
1762
|
});
|
|
1738
|
-
}), this._liquid.restorePagePadding(O), this._liquid.translatePage(O, u, h,
|
|
1763
|
+
}), this._liquid.restorePagePadding(O), this._liquid.translatePage(O, u, h, f);
|
|
1739
1764
|
}
|
|
1740
|
-
this._floatingObjectManagerService.batchAddOrUpdate(
|
|
1765
|
+
this._floatingObjectManagerService.batchAddOrUpdate(S);
|
|
1741
1766
|
}
|
|
1742
1767
|
};
|
|
1743
|
-
be =
|
|
1768
|
+
be = Er([
|
|
1744
1769
|
L(B.Steady, be),
|
|
1745
1770
|
K(0, R(ie)),
|
|
1746
1771
|
K(1, U),
|
|
@@ -1749,16 +1774,16 @@ be = Mr([
|
|
|
1749
1774
|
K(4, Ht),
|
|
1750
1775
|
K(5, $)
|
|
1751
1776
|
], be);
|
|
1752
|
-
var
|
|
1753
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1754
|
-
(
|
|
1755
|
-
return n && r &&
|
|
1777
|
+
var xr = Object.defineProperty, Dr = Object.getOwnPropertyDescriptor, Pr = (i, e, t, n) => {
|
|
1778
|
+
for (var r = n > 1 ? void 0 : n ? Dr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1779
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1780
|
+
return n && r && xr(e, t, r), r;
|
|
1756
1781
|
}, Z = (i, e) => (t, n) => e(t, n, i);
|
|
1757
1782
|
let ye = class extends ee {
|
|
1758
|
-
constructor(e, t, n, r,
|
|
1783
|
+
constructor(e, t, n, r, o, s) {
|
|
1759
1784
|
super();
|
|
1760
|
-
|
|
1761
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService =
|
|
1785
|
+
p(this, "_initializedRender", /* @__PURE__ */ new Set());
|
|
1786
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = o, this._editorService = s, this._initialize();
|
|
1762
1787
|
}
|
|
1763
1788
|
dispose() {
|
|
1764
1789
|
super.dispose();
|
|
@@ -1777,21 +1802,21 @@ let ye = class extends ee {
|
|
|
1777
1802
|
const { scene: r } = n;
|
|
1778
1803
|
this.disposeWithMe(
|
|
1779
1804
|
j(
|
|
1780
|
-
r.onMouseWheelObserver.add((
|
|
1781
|
-
if (!
|
|
1805
|
+
r.onMouseWheelObserver.add((o) => {
|
|
1806
|
+
if (!o.ctrlKey)
|
|
1782
1807
|
return;
|
|
1783
|
-
const
|
|
1784
|
-
if (!
|
|
1808
|
+
const s = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1809
|
+
if (!s)
|
|
1785
1810
|
return;
|
|
1786
|
-
const a = Math.abs(
|
|
1811
|
+
const a = Math.abs(o.deltaX);
|
|
1787
1812
|
let c = a < 40 ? 0.2 : a < 80 ? 0.4 : 0.2;
|
|
1788
|
-
c *=
|
|
1789
|
-
const
|
|
1790
|
-
let u = +Number.parseFloat(`${
|
|
1813
|
+
c *= o.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (c /= 2);
|
|
1814
|
+
const l = s.zoomRatio;
|
|
1815
|
+
let u = +Number.parseFloat(`${l + c}`).toFixed(1);
|
|
1791
1816
|
u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Pn.id, {
|
|
1792
1817
|
zoomRatio: u,
|
|
1793
|
-
unitId:
|
|
1794
|
-
}),
|
|
1818
|
+
unitId: s.getUnitId()
|
|
1819
|
+
}), o.preventDefault();
|
|
1795
1820
|
})
|
|
1796
1821
|
)
|
|
1797
1822
|
);
|
|
@@ -1827,11 +1852,11 @@ let ye = class extends ee {
|
|
|
1827
1852
|
const n = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1828
1853
|
if (!n)
|
|
1829
1854
|
return;
|
|
1830
|
-
const r = t.params, { unitId:
|
|
1831
|
-
if (
|
|
1855
|
+
const r = t.params, { unitId: o } = r;
|
|
1856
|
+
if (o !== n.getUnitId())
|
|
1832
1857
|
return;
|
|
1833
|
-
const
|
|
1834
|
-
this._updateViewZoom(
|
|
1858
|
+
const s = n.zoomRatio || 1;
|
|
1859
|
+
this._updateViewZoom(s);
|
|
1835
1860
|
}
|
|
1836
1861
|
})
|
|
1837
1862
|
);
|
|
@@ -1842,12 +1867,12 @@ let ye = class extends ee {
|
|
|
1842
1867
|
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
|
|
1843
1868
|
}
|
|
1844
1869
|
_calculatePagePosition(e, t) {
|
|
1845
|
-
const { document: n, scene: r, docBackground:
|
|
1846
|
-
if (
|
|
1870
|
+
const { document: n, scene: r, docBackground: o } = e, s = r == null ? void 0 : r.getParent(), { width: a, height: c, pageMarginLeft: l, pageMarginTop: u } = n;
|
|
1871
|
+
if (s == null || a === Number.POSITIVE_INFINITY || c === Number.POSITIVE_INFINITY)
|
|
1847
1872
|
return;
|
|
1848
|
-
const { width: h, height:
|
|
1849
|
-
let g = 0,
|
|
1850
|
-
h > (a +
|
|
1873
|
+
const { width: h, height: f } = s;
|
|
1874
|
+
let g = 0, S = 0, d = 0, _ = 0, O = Number.POSITIVE_INFINITY;
|
|
1875
|
+
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
1876
|
const E = r.getViewport(Be.VIEW_MAIN);
|
|
1852
1877
|
if (O !== Number.POSITIVE_INFINITY && E != null) {
|
|
1853
1878
|
const N = E.getBarScroll(O, 0).x;
|
|
@@ -1861,7 +1886,7 @@ let ye = class extends ee {
|
|
|
1861
1886
|
return xt(this._univerInstanceService, this._renderManagerService);
|
|
1862
1887
|
}
|
|
1863
1888
|
};
|
|
1864
|
-
ye =
|
|
1889
|
+
ye = Pr([
|
|
1865
1890
|
L(B.Rendered, ye),
|
|
1866
1891
|
Z(0, R(ie)),
|
|
1867
1892
|
Z(1, U),
|
|
@@ -1870,16 +1895,16 @@ ye = Dr([
|
|
|
1870
1895
|
Z(4, R(ne)),
|
|
1871
1896
|
Z(5, $)
|
|
1872
1897
|
], ye);
|
|
1873
|
-
var
|
|
1874
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1875
|
-
(
|
|
1876
|
-
return n && r &&
|
|
1898
|
+
var Ur = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, Ar = (i, e, t, n) => {
|
|
1899
|
+
for (var r = n > 1 ? void 0 : n ? Nr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1900
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1901
|
+
return n && r && Ur(e, t, r), r;
|
|
1877
1902
|
}, z = (i, e) => (t, n) => e(t, n, i);
|
|
1878
1903
|
let Me = class extends ee {
|
|
1879
|
-
constructor(e, t, n, r,
|
|
1904
|
+
constructor(e, t, n, r, o, s, a) {
|
|
1880
1905
|
super();
|
|
1881
|
-
|
|
1882
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager =
|
|
1906
|
+
p(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
1907
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = o, this._textSelectionManagerService = s, this._editorService = a, this._initialize();
|
|
1883
1908
|
}
|
|
1884
1909
|
_initialize() {
|
|
1885
1910
|
this._init(), this._skeletonListener(), this._commandExecutedListener();
|
|
@@ -1899,6 +1924,7 @@ let Me = class extends ee {
|
|
|
1899
1924
|
const t = this._getDocObjectById(e);
|
|
1900
1925
|
t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
|
|
1901
1926
|
}
|
|
1927
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1902
1928
|
_initialMain(e) {
|
|
1903
1929
|
const t = this._getDocObjectById(e);
|
|
1904
1930
|
if (t == null)
|
|
@@ -1918,27 +1944,27 @@ let Me = class extends ee {
|
|
|
1918
1944
|
)
|
|
1919
1945
|
), this.disposeWithMe(
|
|
1920
1946
|
j(
|
|
1921
|
-
n == null ? void 0 : n.onPointerDownObserver.add((
|
|
1947
|
+
n == null ? void 0 : n.onPointerDownObserver.add((o, s) => {
|
|
1922
1948
|
if (this._isEditorReadOnly(e))
|
|
1923
1949
|
return;
|
|
1924
1950
|
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),
|
|
1951
|
+
(a == null ? void 0 : a.getUnitId()) !== e && this._univerInstanceService.setCurrentUnitForType(e), this._textSelectionRenderManager.eventTrigger(o);
|
|
1952
|
+
const { offsetX: c, offsetY: l } = o;
|
|
1953
|
+
this._editorService.getEditor(e) && (this._setEditorFocus(e), setTimeout(() => {
|
|
1954
|
+
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, l);
|
|
1955
|
+
}, 0)), o.button !== 2 && s.stopPropagation();
|
|
1930
1956
|
})
|
|
1931
1957
|
)
|
|
1932
1958
|
), this.disposeWithMe(
|
|
1933
1959
|
j(
|
|
1934
|
-
n == null ? void 0 : n.onDblclickObserver.add((
|
|
1935
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(
|
|
1960
|
+
n == null ? void 0 : n.onDblclickObserver.add((o) => {
|
|
1961
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(o);
|
|
1936
1962
|
})
|
|
1937
1963
|
)
|
|
1938
1964
|
), this.disposeWithMe(
|
|
1939
1965
|
j(
|
|
1940
|
-
n == null ? void 0 : n.onTripleClickObserver.add((
|
|
1941
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(
|
|
1966
|
+
n == null ? void 0 : n.onTripleClickObserver.add((o) => {
|
|
1967
|
+
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(o);
|
|
1942
1968
|
})
|
|
1943
1969
|
)
|
|
1944
1970
|
);
|
|
@@ -1960,8 +1986,8 @@ let Me = class extends ee {
|
|
|
1960
1986
|
this._commandService.onCommandExecuted((t) => {
|
|
1961
1987
|
var n;
|
|
1962
1988
|
if (e.includes(t.id)) {
|
|
1963
|
-
const r = t.params, { unitId:
|
|
1964
|
-
if (
|
|
1989
|
+
const r = t.params, { unitId: o } = r, s = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
|
|
1990
|
+
if (o !== s)
|
|
1965
1991
|
return;
|
|
1966
1992
|
this._textSelectionManagerService.refreshSelection();
|
|
1967
1993
|
}
|
|
@@ -1976,8 +2002,8 @@ let Me = class extends ee {
|
|
|
1976
2002
|
const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
|
|
1977
2003
|
if (r == null)
|
|
1978
2004
|
return;
|
|
1979
|
-
const { scene:
|
|
1980
|
-
this._textSelectionRenderManager.changeRuntime(n,
|
|
2005
|
+
const { scene: o, mainComponent: s } = r;
|
|
2006
|
+
this._textSelectionRenderManager.changeRuntime(n, o, s), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
1981
2007
|
unitId: t,
|
|
1982
2008
|
subUnitId: ""
|
|
1983
2009
|
});
|
|
@@ -1988,7 +2014,7 @@ let Me = class extends ee {
|
|
|
1988
2014
|
return this._univerInstanceService.getUnitType(e) !== m.UNIVER_DOC ? null : Un(e, this._renderManagerService);
|
|
1989
2015
|
}
|
|
1990
2016
|
};
|
|
1991
|
-
Me =
|
|
2017
|
+
Me = Ar([
|
|
1992
2018
|
L(B.Rendered, Me),
|
|
1993
2019
|
z(0, R(ie)),
|
|
1994
2020
|
z(1, U),
|
|
@@ -1998,10 +2024,10 @@ Me = Nr([
|
|
|
1998
2024
|
z(5, R(ne)),
|
|
1999
2025
|
z(6, $)
|
|
2000
2026
|
], Me);
|
|
2001
|
-
var
|
|
2002
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2003
|
-
(
|
|
2004
|
-
return n && r &&
|
|
2027
|
+
var Lr = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, $r = (i, e, t, n) => {
|
|
2028
|
+
for (var r = n > 1 ? void 0 : n ? Br(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2029
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
2030
|
+
return n && r && Lr(e, t, r), r;
|
|
2005
2031
|
}, se = (i, e) => (t, n) => e(t, n, i);
|
|
2006
2032
|
const Ot = 1.5;
|
|
2007
2033
|
let Ee = class extends le {
|
|
@@ -2022,10 +2048,10 @@ let Ee = class extends le {
|
|
|
2022
2048
|
const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (x = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : x.skeleton;
|
|
2023
2049
|
if (e == null || t == null || n == null)
|
|
2024
2050
|
return;
|
|
2025
|
-
const { collapsed: r, startNodePosition:
|
|
2051
|
+
const { collapsed: r, startNodePosition: o } = e;
|
|
2026
2052
|
if (!r)
|
|
2027
2053
|
return;
|
|
2028
|
-
const
|
|
2054
|
+
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
2055
|
if (_ == null)
|
|
2030
2056
|
return;
|
|
2031
2057
|
const {
|
|
@@ -2036,7 +2062,7 @@ let Ee = class extends le {
|
|
|
2036
2062
|
} = _.getBounding().viewBound;
|
|
2037
2063
|
let Y = 0, G = 0;
|
|
2038
2064
|
const ge = O ? 0 : 100;
|
|
2039
|
-
|
|
2065
|
+
d < N ? Y = d - N : d > w - g && (Y = d - w + g + ge), S < E ? G = S - E : S > F - Ot && (G = S - F + Ot);
|
|
2040
2066
|
const _e = _.getBarScroll(G, Y);
|
|
2041
2067
|
_.scrollBy(_e);
|
|
2042
2068
|
}
|
|
@@ -2044,7 +2070,7 @@ let Ee = class extends le {
|
|
|
2044
2070
|
return xt(this._univerInstanceService, this._renderManagerService);
|
|
2045
2071
|
}
|
|
2046
2072
|
};
|
|
2047
|
-
Ee =
|
|
2073
|
+
Ee = $r([
|
|
2048
2074
|
L(B.Rendered, Ee),
|
|
2049
2075
|
se(0, R(ie)),
|
|
2050
2076
|
se(1, R(ne)),
|
|
@@ -2052,10 +2078,10 @@ Ee = Br([
|
|
|
2052
2078
|
se(3, U),
|
|
2053
2079
|
se(4, H)
|
|
2054
2080
|
], Ee);
|
|
2055
|
-
var
|
|
2056
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2057
|
-
(
|
|
2058
|
-
return n && r &&
|
|
2081
|
+
var Fr = Object.defineProperty, wr = Object.getOwnPropertyDescriptor, jr = (i, e, t, n) => {
|
|
2082
|
+
for (var r = n > 1 ? void 0 : n ? wr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
2083
|
+
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
2084
|
+
return n && r && Fr(e, t, r), r;
|
|
2059
2085
|
}, ze = (i, e) => (t, n) => e(t, n, i), ve;
|
|
2060
2086
|
let Rt = (ve = class extends Yt {
|
|
2061
2087
|
constructor(i, e, t, n) {
|
|
@@ -2077,9 +2103,9 @@ let Rt = (ve = class extends Yt {
|
|
|
2077
2103
|
ni,
|
|
2078
2104
|
ii,
|
|
2079
2105
|
ri,
|
|
2080
|
-
Hi,
|
|
2081
2106
|
Yi,
|
|
2082
|
-
|
|
2107
|
+
Gi,
|
|
2108
|
+
Hi
|
|
2083
2109
|
].forEach((i) => {
|
|
2084
2110
|
this._injector.get(dn).registerShortcut(i);
|
|
2085
2111
|
});
|
|
@@ -2129,8 +2155,8 @@ let Rt = (ve = class extends Yt {
|
|
|
2129
2155
|
_initModules() {
|
|
2130
2156
|
this._injector.get(ae);
|
|
2131
2157
|
}
|
|
2132
|
-
},
|
|
2133
|
-
Rt =
|
|
2158
|
+
}, p(ve, "pluginName", Xn), p(ve, "type", m.UNIVER_DOC), ve);
|
|
2159
|
+
Rt = jr([
|
|
2134
2160
|
ze(1, R(Ue)),
|
|
2135
2161
|
ze(2, R(Ze)),
|
|
2136
2162
|
ze(3, bt)
|
|
@@ -2141,10 +2167,11 @@ export {
|
|
|
2141
2167
|
Gn as DefaultDocUiConfig,
|
|
2142
2168
|
Hn as DefaultToolbarConfig,
|
|
2143
2169
|
Ie as DocCanvasView,
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2170
|
+
tr as PastePluginLark,
|
|
2171
|
+
or as PastePluginUniver,
|
|
2172
|
+
ir as PastePluginWord,
|
|
2147
2173
|
Rt as UniverDocsUIPlugin,
|
|
2148
|
-
|
|
2174
|
+
qr as enUS,
|
|
2175
|
+
Jr as ruRU,
|
|
2149
2176
|
ki as zhCN
|
|
2150
2177
|
};
|