@univerjs/docs 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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +193 -207
- package/lib/types/basics/component-tools.d.ts +1 -1
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +1 -1
- package/lib/types/commands/commands/__tests__/mock-text-selection-render-manager.d.ts +1 -1
- package/lib/types/commands/commands/clipboard.inner.command.d.ts +1 -1
- package/lib/types/commands/commands/core-editing.command.d.ts +1 -1
- package/lib/types/commands/commands/delete.command.d.ts +2 -2
- package/lib/types/commands/commands/list.command.d.ts +1 -1
- package/lib/types/commands/commands/replace-content.command.d.ts +1 -1
- package/lib/types/commands/mutations/core-editing.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/insert-floating-object.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/remove-floating-object.mutation.d.ts +1 -1
- package/lib/types/commands/mutations/set-floating-object.mutation.d.ts +1 -1
- package/lib/types/commands/operations/set-doc-zoom-ratio.operation.d.ts +1 -1
- package/lib/types/commands/operations/text-selection.operation.d.ts +1 -1
- package/lib/types/controllers/ime-input.controller.d.ts +3 -3
- package/lib/types/controllers/move-cursor.controller.d.ts +3 -4
- package/lib/types/controllers/normal-input.controller.d.ts +3 -5
- package/lib/types/doc-plugin.d.ts +2 -5
- package/lib/types/services/doc-skeleton-manager.service.d.ts +2 -2
- package/lib/types/services/doc-state-change-manager.service.d.ts +1 -1
- package/lib/types/services/doc-view-model-manager.service.d.ts +1 -1
- package/lib/types/services/ime-input-manager.service.d.ts +3 -3
- package/lib/types/services/text-selection-manager.service.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
package/lib/es/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UniverInstanceType as W, CommandType as v, RxDisposable as ge, ICommandService as I, TextXActionType as
|
|
5
|
-
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Pt, ITextSelectionRenderManager as fe, DocumentViewModel as
|
|
1
|
+
var yt = Object.defineProperty;
|
|
2
|
+
var Ot = (o, e, t) => e in o ? yt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var y = (o, e, t) => (Ot(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { UniverInstanceType as W, CommandType as v, RxDisposable as ge, ICommandService as I, TextXActionType as x, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as ut, IUniverInstanceService as E, IUndoRedoService as Te, UndoCommandId as Ye, RedoCommandId as We, TextX as b, DataStreamTreeTokenType as xe, Tools as Q, LocaleService as Tt, MemoryCursor as se, getDocsUpdateBody as Et, UpdateDocsAttributeType as Ee, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as Dt, BooleanNumber as z, BaselineOffset as G, PRESET_LIST_TYPE as At, PresetListType as mt, HorizontalAlign as re, OnLifecycle as De, LifecycleStages as Ae, Disposable as Ne, Direction as N, Plugin as Nt } from "@univerjs/core";
|
|
5
|
+
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Pt, ITextSelectionRenderManager as fe, DocumentViewModel as bt, DocumentSkeleton as Ut, hasListGlyph as wt, isIndentByGlyph as Lt, isFirstGlyph as Bt, getParagraphByGlyph as Ft, getCharSpaceApply as $t, getNumberUnitValue as Me, RANGE_DIRECTION as Ze, NodePositionConvertToCursor as Ke, IRenderManagerService as gt, TextSelectionRenderManager as Vt } from "@univerjs/engine-render";
|
|
6
6
|
import { BehaviorSubject as ee, takeUntil as te } from "rxjs";
|
|
7
7
|
import { Inject as V, Injector as kt } from "@wendellhu/redi";
|
|
8
|
-
var
|
|
9
|
-
const
|
|
10
|
-
function
|
|
8
|
+
var Pe = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o.BACKGROUND = "__Document_Render_Background__", o))(Pe || {}), zt = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(zt || {});
|
|
9
|
+
const Gn = 0, jn = 2, Hn = 4, Xn = 10, Yn = "normalTextSelectionPluginName";
|
|
10
|
+
function Gt(o, e) {
|
|
11
11
|
const t = o.getCurrentUnitForType(W.UNIVER_DOC);
|
|
12
12
|
if (!t)
|
|
13
13
|
return null;
|
|
14
14
|
const n = t.getUnitId(), s = e.getRenderById(n);
|
|
15
15
|
if (s == null)
|
|
16
16
|
return;
|
|
17
|
-
const { mainComponent: r, scene: i, engine: a, components: c } = s, d = r, l = c.get(
|
|
17
|
+
const { mainComponent: r, scene: i, engine: a, components: c } = s, d = r, l = c.get(Pe.BACKGROUND);
|
|
18
18
|
return {
|
|
19
19
|
document: d,
|
|
20
20
|
docBackground: l,
|
|
@@ -22,11 +22,11 @@ function ft(o, e) {
|
|
|
22
22
|
engine: a
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function Wn(o, e) {
|
|
26
26
|
const t = e.getRenderById(o);
|
|
27
27
|
if (t == null)
|
|
28
28
|
return;
|
|
29
|
-
const { mainComponent: n, scene: s, engine: r, components: i } = t, a = n, c = i.get(
|
|
29
|
+
const { mainComponent: n, scene: s, engine: r, components: i } = t, a = n, c = i.get(Pe.BACKGROUND);
|
|
30
30
|
return {
|
|
31
31
|
document: a,
|
|
32
32
|
docBackground: c,
|
|
@@ -34,7 +34,7 @@ function Zn(o, e) {
|
|
|
34
34
|
engine: r
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const ft = {
|
|
38
38
|
id: "doc.operation.set-selections",
|
|
39
39
|
type: v.OPERATION,
|
|
40
40
|
handler: (o, e) => !0
|
|
@@ -55,10 +55,10 @@ function Z(o) {
|
|
|
55
55
|
let T = class extends ge {
|
|
56
56
|
constructor(e, t) {
|
|
57
57
|
super();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
y(this, "_currentSelection", null);
|
|
59
|
+
y(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
|
|
60
|
+
y(this, "_textSelection$", new ee(null));
|
|
61
|
+
y(this, "textSelection$", this._textSelection$.asObservable());
|
|
62
62
|
this._textSelectionRenderManager = e, this._commandService = t, this._syncSelectionFromRenderService();
|
|
63
63
|
}
|
|
64
64
|
getCurrentSelection() {
|
|
@@ -133,7 +133,7 @@ let T = class extends ge {
|
|
|
133
133
|
};
|
|
134
134
|
this._replaceByParam(t), this._textSelection$.next(t);
|
|
135
135
|
const { unitId: n, subUnitId: s, segmentId: r, style: i, textRanges: a, isEditing: c } = t;
|
|
136
|
-
this._commandService.executeCommand(
|
|
136
|
+
this._commandService.executeCommand(ft.id, {
|
|
137
137
|
unitId: n,
|
|
138
138
|
subUnitId: s,
|
|
139
139
|
segmentId: r,
|
|
@@ -168,14 +168,14 @@ T = Xt([
|
|
|
168
168
|
Je(0, fe),
|
|
169
169
|
Je(1, I)
|
|
170
170
|
], T);
|
|
171
|
-
function
|
|
171
|
+
function be(o, e = "", t = 0) {
|
|
172
172
|
const { startOffset: n, endOffset: s } = o, r = [], i = n - t, a = s - t;
|
|
173
173
|
return i > 0 && r.push({
|
|
174
|
-
t:
|
|
174
|
+
t: x.RETAIN,
|
|
175
175
|
len: i,
|
|
176
176
|
segmentId: e
|
|
177
177
|
}), r.push({
|
|
178
|
-
t:
|
|
178
|
+
t: x.DELETE,
|
|
179
179
|
len: a - i,
|
|
180
180
|
line: 0,
|
|
181
181
|
segmentId: e
|
|
@@ -189,9 +189,9 @@ var Yt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, Zt = (o, e
|
|
|
189
189
|
let ne = class extends ge {
|
|
190
190
|
constructor(e) {
|
|
191
191
|
super();
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
y(this, "_docViewModelMap", /* @__PURE__ */ new Map());
|
|
193
|
+
y(this, "_currentDocViewModel$", new ee(null));
|
|
194
|
+
y(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
|
|
195
195
|
this._univerInstanceService = e, this._initialize();
|
|
196
196
|
}
|
|
197
197
|
_initialize() {
|
|
@@ -245,7 +245,7 @@ let ne = class extends ge {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
_buildDocViewModel(e) {
|
|
248
|
-
return new
|
|
248
|
+
return new bt(e);
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
ne = Zt([
|
|
@@ -260,10 +260,10 @@ const en = 300;
|
|
|
260
260
|
let me = class extends ge {
|
|
261
261
|
constructor(e, t, n) {
|
|
262
262
|
super();
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
263
|
+
y(this, "_docStateChange$", new ee(null));
|
|
264
|
+
y(this, "docStateChange$", this._docStateChange$.asObservable());
|
|
265
|
+
y(this, "_stateCache", /* @__PURE__ */ new Map());
|
|
266
|
+
y(this, "_timer", null);
|
|
267
267
|
this._undoRedoService = e, this._commandService = t, this._univerInstanceService = n, this._initialize();
|
|
268
268
|
}
|
|
269
269
|
setChangeState(e) {
|
|
@@ -302,12 +302,12 @@ let me = class extends ge {
|
|
|
302
302
|
return;
|
|
303
303
|
const s = n.length, r = n[0].commandId, i = n[0], a = n[s - 1], c = {
|
|
304
304
|
unitId: e,
|
|
305
|
-
actions: n.reduce((l, u) =>
|
|
305
|
+
actions: n.reduce((l, u) => b.compose(l, u.redoState.actions), []),
|
|
306
306
|
textRanges: a.redoState.textRanges
|
|
307
307
|
}, d = {
|
|
308
308
|
unitId: e,
|
|
309
309
|
// Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
|
|
310
|
-
actions: n.reverse().reduce((l, u) =>
|
|
310
|
+
actions: n.reverse().reduce((l, u) => b.compose(l, u.undoState.actions), []),
|
|
311
311
|
textRanges: i.undoState.textRanges
|
|
312
312
|
};
|
|
313
313
|
t.pushUndoRedo({
|
|
@@ -324,9 +324,9 @@ me = Qt([
|
|
|
324
324
|
], me);
|
|
325
325
|
class he {
|
|
326
326
|
constructor() {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
y(this, "_previousActiveRange", null);
|
|
328
|
+
y(this, "_undoMutationParamsCache", []);
|
|
329
|
+
y(this, "_redoMutationParamsCache", []);
|
|
330
330
|
}
|
|
331
331
|
clearUndoRedoMutationParamsCache() {
|
|
332
332
|
this._undoMutationParamsCache = [], this._redoMutationParamsCache = [];
|
|
@@ -354,13 +354,13 @@ class he {
|
|
|
354
354
|
return null;
|
|
355
355
|
const { unitId: e } = this._undoMutationParamsCache[0], t = {
|
|
356
356
|
unitId: e,
|
|
357
|
-
actions: this._undoMutationParamsCache.reverse().reduce((s, r) =>
|
|
357
|
+
actions: this._undoMutationParamsCache.reverse().reduce((s, r) => b.compose(s, r.actions), []),
|
|
358
358
|
textRanges: []
|
|
359
359
|
// Add empty array, will never use, just fix type error
|
|
360
360
|
};
|
|
361
361
|
return { redoMutationParams: {
|
|
362
362
|
unitId: e,
|
|
363
|
-
actions: this._redoMutationParamsCache.reduce((s, r) =>
|
|
363
|
+
actions: this._redoMutationParamsCache.reduce((s, r) => b.compose(s, r.actions), []),
|
|
364
364
|
textRanges: []
|
|
365
365
|
// Add empty array, will never use, just fix type error
|
|
366
366
|
}, undoMutationParams: t, previousActiveRange: this._previousActiveRange };
|
|
@@ -398,7 +398,7 @@ const qe = "doc.mutation.rich-text-editing", L = {
|
|
|
398
398
|
g.getSelfOrHeaderFooterViewModel(C).reset(D), !d && s && i != null && queueMicrotask(() => {
|
|
399
399
|
p.replaceTextRanges(s);
|
|
400
400
|
});
|
|
401
|
-
const
|
|
401
|
+
const P = {
|
|
402
402
|
commandId: qe,
|
|
403
403
|
unitId: t,
|
|
404
404
|
trigger: i,
|
|
@@ -417,9 +417,9 @@ const qe = "doc.mutation.rich-text-editing", L = {
|
|
|
417
417
|
if (O == null)
|
|
418
418
|
throw new Error("historyParams is null in RichTextEditingMutation");
|
|
419
419
|
const { undoMutationParams: U, redoMutationParams: w, previousActiveRange: X } = O;
|
|
420
|
-
|
|
420
|
+
P.redoState.actions = w.actions, P.undoState.actions = U.actions, P.undoState.textRanges = [X];
|
|
421
421
|
}
|
|
422
|
-
return S.setChangeState(
|
|
422
|
+
return S.setChangeState(P), {
|
|
423
423
|
unitId: t,
|
|
424
424
|
actions: M,
|
|
425
425
|
textRanges: f
|
|
@@ -436,13 +436,13 @@ const qe = "doc.mutation.rich-text-editing", L = {
|
|
|
436
436
|
actions: [],
|
|
437
437
|
textRanges: a
|
|
438
438
|
}
|
|
439
|
-
}, u = new
|
|
439
|
+
}, u = new b();
|
|
440
440
|
return d ? c > 0 && u.push({
|
|
441
|
-
t:
|
|
441
|
+
t: x.RETAIN,
|
|
442
442
|
len: c,
|
|
443
443
|
segmentId: s
|
|
444
|
-
}) : u.push(...
|
|
445
|
-
t:
|
|
444
|
+
}) : u.push(...be(n, s)), u.push({
|
|
445
|
+
t: x.INSERT,
|
|
446
446
|
body: r,
|
|
447
447
|
len: r.dataStream.length,
|
|
448
448
|
line: 0,
|
|
@@ -462,19 +462,19 @@ const Se = {
|
|
|
462
462
|
actions: [],
|
|
463
463
|
textRanges: a
|
|
464
464
|
}
|
|
465
|
-
}, u = new
|
|
465
|
+
}, u = new b();
|
|
466
466
|
return d > 0 && u.push({
|
|
467
|
-
t:
|
|
467
|
+
t: x.RETAIN,
|
|
468
468
|
len: i === 0 ? d - c : d,
|
|
469
469
|
segmentId: s
|
|
470
470
|
}), u.push({
|
|
471
|
-
t:
|
|
471
|
+
t: x.DELETE,
|
|
472
472
|
len: c,
|
|
473
473
|
line: 0,
|
|
474
474
|
segmentId: s
|
|
475
475
|
}), l.params.actions = u.serialize(), !!t.syncExecuteCommand(l.id, l.params);
|
|
476
476
|
}
|
|
477
|
-
},
|
|
477
|
+
}, ht = {
|
|
478
478
|
id: "doc.command.update-text",
|
|
479
479
|
type: v.COMMAND,
|
|
480
480
|
handler: async (o, e) => {
|
|
@@ -485,13 +485,13 @@ const Se = {
|
|
|
485
485
|
actions: [],
|
|
486
486
|
textRanges: a
|
|
487
487
|
}
|
|
488
|
-
}, l = new
|
|
488
|
+
}, l = new b(), { startOffset: u, endOffset: m } = t;
|
|
489
489
|
return l.push({
|
|
490
|
-
t:
|
|
490
|
+
t: x.RETAIN,
|
|
491
491
|
len: u,
|
|
492
492
|
segmentId: n
|
|
493
493
|
}), l.push({
|
|
494
|
-
t:
|
|
494
|
+
t: x.RETAIN,
|
|
495
495
|
body: s,
|
|
496
496
|
len: m - u,
|
|
497
497
|
segmentId: n,
|
|
@@ -548,13 +548,13 @@ var on = Object.defineProperty, sn = Object.getOwnPropertyDescriptor, rn = (o, e
|
|
|
548
548
|
let H = class extends ge {
|
|
549
549
|
constructor(e, t, n) {
|
|
550
550
|
super();
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
551
|
+
y(this, "_currentSkeletonUnitId", "");
|
|
552
|
+
y(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
|
|
553
|
+
y(this, "_currentSkeleton$", new ee(null));
|
|
554
|
+
y(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
|
|
555
555
|
// CurrentSkeletonBefore for pre-triggered logic during registration
|
|
556
|
-
|
|
557
|
-
|
|
556
|
+
y(this, "_currentSkeletonBefore$", new ee(null));
|
|
557
|
+
y(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
|
|
558
558
|
this._localeService = e, this._docViewModelManagerService = t, this._univerInstanceService = n, this._initialize();
|
|
559
559
|
}
|
|
560
560
|
_initialize() {
|
|
@@ -605,15 +605,15 @@ let H = class extends ge {
|
|
|
605
605
|
return this._currentSkeletonUnitId = t, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
|
|
606
606
|
}
|
|
607
607
|
_buildSkeleton(e) {
|
|
608
|
-
return
|
|
608
|
+
return Ut.create(e, this._localeService);
|
|
609
609
|
}
|
|
610
610
|
};
|
|
611
611
|
H = rn([
|
|
612
|
-
Re(0, V(
|
|
612
|
+
Re(0, V(Tt)),
|
|
613
613
|
Re(1, V(ne)),
|
|
614
614
|
Re(2, E)
|
|
615
615
|
], H);
|
|
616
|
-
const
|
|
616
|
+
const Zn = {
|
|
617
617
|
id: "doc.command.inner-paste",
|
|
618
618
|
type: v.COMMAND,
|
|
619
619
|
handler: async (o, e) => {
|
|
@@ -632,15 +632,15 @@ const Kn = {
|
|
|
632
632
|
}
|
|
633
633
|
}, m = new se();
|
|
634
634
|
m.reset();
|
|
635
|
-
const g = new
|
|
635
|
+
const g = new b();
|
|
636
636
|
for (const h of c) {
|
|
637
637
|
const { startOffset: f, endOffset: S, collapsed: _ } = h, R = f - m.cursor;
|
|
638
638
|
_ ? g.push({
|
|
639
|
-
t:
|
|
639
|
+
t: x.RETAIN,
|
|
640
640
|
len: R,
|
|
641
641
|
segmentId: t
|
|
642
|
-
}) : g.push(...
|
|
643
|
-
t:
|
|
642
|
+
}) : g.push(...be(h, t, m.cursor)), g.push({
|
|
643
|
+
t: x.INSERT,
|
|
644
644
|
body: n,
|
|
645
645
|
len: n.dataStream.length,
|
|
646
646
|
line: 0,
|
|
@@ -649,7 +649,7 @@ const Kn = {
|
|
|
649
649
|
}
|
|
650
650
|
return u.params.actions = g.serialize(), !!r.syncExecuteCommand(u.id, u.params);
|
|
651
651
|
}
|
|
652
|
-
},
|
|
652
|
+
}, pt = {
|
|
653
653
|
id: "doc.command.inner-cut",
|
|
654
654
|
type: v.COMMAND,
|
|
655
655
|
handler: async (o, e) => {
|
|
@@ -660,7 +660,7 @@ const Kn = {
|
|
|
660
660
|
const c = (h = i.getCurrentUniverDocInstance()) == null ? void 0 : h.getUnitId();
|
|
661
661
|
if (!c)
|
|
662
662
|
return !1;
|
|
663
|
-
const d = i.getUniverDocInstance(c), l =
|
|
663
|
+
const d = i.getUniverDocInstance(c), l = Et(d.snapshot, t);
|
|
664
664
|
if (l == null)
|
|
665
665
|
return !1;
|
|
666
666
|
const u = {
|
|
@@ -672,11 +672,11 @@ const Kn = {
|
|
|
672
672
|
}
|
|
673
673
|
}, m = new se();
|
|
674
674
|
m.reset();
|
|
675
|
-
const g = new
|
|
675
|
+
const g = new b();
|
|
676
676
|
for (const f of a) {
|
|
677
677
|
const { startOffset: S, endOffset: _, collapsed: R } = f, M = S - m.cursor;
|
|
678
678
|
R ? g.push({
|
|
679
|
-
t:
|
|
679
|
+
t: x.RETAIN,
|
|
680
680
|
len: M,
|
|
681
681
|
segmentId: t
|
|
682
682
|
}) : g.push(...an(f, l, t, m.cursor)), m.reset(), m.moveCursor(_);
|
|
@@ -689,29 +689,29 @@ function an(o, e, t = "", n = 0) {
|
|
|
689
689
|
(u) => u.startIndex - n >= c && u.startIndex - n <= d
|
|
690
690
|
);
|
|
691
691
|
if (c > 0 && i.push({
|
|
692
|
-
t:
|
|
692
|
+
t: x.RETAIN,
|
|
693
693
|
len: c,
|
|
694
694
|
segmentId: t
|
|
695
695
|
}), l && l.startIndex - n > c) {
|
|
696
696
|
const u = l.startIndex - n;
|
|
697
697
|
i.push({
|
|
698
|
-
t:
|
|
698
|
+
t: x.DELETE,
|
|
699
699
|
len: u - c,
|
|
700
700
|
line: 0,
|
|
701
701
|
segmentId: t
|
|
702
702
|
}), i.push({
|
|
703
|
-
t:
|
|
703
|
+
t: x.RETAIN,
|
|
704
704
|
len: 1,
|
|
705
705
|
segmentId: t
|
|
706
706
|
}), d > u + 1 && i.push({
|
|
707
|
-
t:
|
|
707
|
+
t: x.DELETE,
|
|
708
708
|
len: d - u - 1,
|
|
709
709
|
line: 0,
|
|
710
710
|
segmentId: t
|
|
711
711
|
});
|
|
712
712
|
} else
|
|
713
713
|
i.push({
|
|
714
|
-
t:
|
|
714
|
+
t: x.DELETE,
|
|
715
715
|
len: d - c,
|
|
716
716
|
line: 0,
|
|
717
717
|
segmentId: t
|
|
@@ -721,6 +721,7 @@ function an(o, e, t = "", n = 0) {
|
|
|
721
721
|
const cn = {
|
|
722
722
|
id: "doc.command.delete-left",
|
|
723
723
|
type: v.COMMAND,
|
|
724
|
+
// eslint-disable-next-line max-lines-per-function
|
|
724
725
|
handler: async (o) => {
|
|
725
726
|
var M;
|
|
726
727
|
const e = o.get(T), t = o.get(H), n = o.get(E), s = o.get(I), r = e.getActiveRange(), i = e.getSelections(), a = (M = t.getCurrent()) == null ? void 0 : M.skeleton;
|
|
@@ -730,14 +731,14 @@ const cn = {
|
|
|
730
731
|
const d = n.getCurrentUniverDocInstance();
|
|
731
732
|
if (!d)
|
|
732
733
|
return !1;
|
|
733
|
-
const { startOffset: l, collapsed: u, segmentId: m, style: g } = r, p = a.findNodeByCharIndex(l), h =
|
|
734
|
+
const { startOffset: l, collapsed: u, segmentId: m, style: g } = r, p = a.findNodeByCharIndex(l), h = wt(p), f = Lt(p, d.getBody());
|
|
734
735
|
let S = l;
|
|
735
736
|
const _ = a.findNodeByCharIndex(l - 1);
|
|
736
|
-
if (
|
|
737
|
-
const C =
|
|
737
|
+
if (Bt(p) && _ !== p && (h === !0 || f === !0) && u) {
|
|
738
|
+
const C = Ft(p, d.getBody());
|
|
738
739
|
if (C == null)
|
|
739
740
|
return !1;
|
|
740
|
-
const D = C == null ? void 0 : C.startIndex, A = { startIndex: 0 },
|
|
741
|
+
const D = C == null ? void 0 : C.startIndex, A = { startIndex: 0 }, P = C.paragraphStyle;
|
|
741
742
|
if (h === !0) {
|
|
742
743
|
const O = C.paragraphStyle;
|
|
743
744
|
if (O) {
|
|
@@ -747,7 +748,7 @@ const cn = {
|
|
|
747
748
|
}
|
|
748
749
|
} else if (f === !0) {
|
|
749
750
|
const O = C.bullet;
|
|
750
|
-
O && (A.bullet = O),
|
|
751
|
+
O && (A.bullet = O), P != null && (A.paragraphStyle = { ...P }, delete A.paragraphStyle.hanging, delete A.paragraphStyle.indentStart);
|
|
751
752
|
}
|
|
752
753
|
const B = [
|
|
753
754
|
{
|
|
@@ -756,7 +757,7 @@ const cn = {
|
|
|
756
757
|
style: g
|
|
757
758
|
}
|
|
758
759
|
];
|
|
759
|
-
c = await s.executeCommand(
|
|
760
|
+
c = await s.executeCommand(ht.id, {
|
|
760
761
|
unitId: d.getUnitId(),
|
|
761
762
|
updateBody: {
|
|
762
763
|
dataStream: "",
|
|
@@ -797,8 +798,8 @@ const cn = {
|
|
|
797
798
|
});
|
|
798
799
|
}
|
|
799
800
|
} else {
|
|
800
|
-
const C =
|
|
801
|
-
c = await s.executeCommand(
|
|
801
|
+
const C = St(r, i);
|
|
802
|
+
c = await s.executeCommand(pt.id, {
|
|
802
803
|
segmentId: m,
|
|
803
804
|
textRanges: C
|
|
804
805
|
});
|
|
@@ -845,8 +846,8 @@ const cn = {
|
|
|
845
846
|
});
|
|
846
847
|
}
|
|
847
848
|
} else {
|
|
848
|
-
const h =
|
|
849
|
-
c = await s.executeCommand(
|
|
849
|
+
const h = St(r, i);
|
|
850
|
+
c = await s.executeCommand(pt.id, {
|
|
850
851
|
segmentId: m,
|
|
851
852
|
textRanges: h
|
|
852
853
|
});
|
|
@@ -856,8 +857,9 @@ const cn = {
|
|
|
856
857
|
}, Ue = {
|
|
857
858
|
id: "doc.command.merge-two-paragraph",
|
|
858
859
|
type: v.COMMAND,
|
|
860
|
+
// eslint-disable-next-line max-lines-per-function
|
|
859
861
|
handler: async (o, e) => {
|
|
860
|
-
var A,
|
|
862
|
+
var A, P, B;
|
|
861
863
|
const t = o.get(T), n = o.get(E), s = o.get(I), { direction: r, range: i } = e, a = t.getActiveRange(), c = t.getSelections();
|
|
862
864
|
if (a == null || c == null)
|
|
863
865
|
return !1;
|
|
@@ -867,7 +869,7 @@ const cn = {
|
|
|
867
869
|
const { startOffset: l, collapsed: u, segmentId: m, style: g } = a;
|
|
868
870
|
if (!u)
|
|
869
871
|
return !1;
|
|
870
|
-
const p = r === j.LEFT ? l : l + 1, h = (B = (
|
|
872
|
+
const p = r === j.LEFT ? l : l + 1, h = (B = (P = (A = d.getBody()) == null ? void 0 : A.paragraphs) == null ? void 0 : P.find((O) => O.startIndex >= p)) == null ? void 0 : B.startIndex, f = dn(d.getBody(), p, h), S = r === j.LEFT ? l - 1 : l, _ = d.getUnitId(), R = [
|
|
871
873
|
{
|
|
872
874
|
startOffset: S,
|
|
873
875
|
endOffset: S,
|
|
@@ -881,23 +883,23 @@ const cn = {
|
|
|
881
883
|
textRanges: R,
|
|
882
884
|
prevTextRanges: [i]
|
|
883
885
|
}
|
|
884
|
-
}, C = new
|
|
886
|
+
}, C = new b();
|
|
885
887
|
return C.push({
|
|
886
|
-
t:
|
|
888
|
+
t: x.RETAIN,
|
|
887
889
|
len: r === j.LEFT ? l - 1 : l,
|
|
888
890
|
segmentId: m
|
|
889
891
|
}), f.dataStream.length && C.push({
|
|
890
|
-
t:
|
|
892
|
+
t: x.INSERT,
|
|
891
893
|
body: f,
|
|
892
894
|
len: f.dataStream.length,
|
|
893
895
|
line: 0,
|
|
894
896
|
segmentId: m
|
|
895
897
|
}), C.push({
|
|
896
|
-
t:
|
|
898
|
+
t: x.RETAIN,
|
|
897
899
|
len: 1,
|
|
898
900
|
segmentId: m
|
|
899
901
|
}), C.push({
|
|
900
|
-
t:
|
|
902
|
+
t: x.DELETE,
|
|
901
903
|
len: h + 1 - p,
|
|
902
904
|
line: 0,
|
|
903
905
|
segmentId: m
|
|
@@ -932,7 +934,7 @@ function dn(o, e, t) {
|
|
|
932
934
|
textRuns: r
|
|
933
935
|
};
|
|
934
936
|
}
|
|
935
|
-
function
|
|
937
|
+
function St(o, e) {
|
|
936
938
|
let t = o.endOffset;
|
|
937
939
|
for (const s of e) {
|
|
938
940
|
const { startOffset: r, endOffset: i } = s;
|
|
@@ -946,7 +948,7 @@ function _t(o, e) {
|
|
|
946
948
|
}
|
|
947
949
|
];
|
|
948
950
|
}
|
|
949
|
-
const
|
|
951
|
+
const _t = {
|
|
950
952
|
id: "doc.command.ime-input",
|
|
951
953
|
type: v.COMMAND,
|
|
952
954
|
handler: async (o, e) => {
|
|
@@ -967,18 +969,18 @@ const vt = {
|
|
|
967
969
|
actions: [],
|
|
968
970
|
textRanges: p
|
|
969
971
|
}
|
|
970
|
-
}, f = new
|
|
971
|
-
!d.collapsed && i ? f.push(...
|
|
972
|
-
t:
|
|
972
|
+
}, f = new b();
|
|
973
|
+
!d.collapsed && i ? f.push(...be(d, m)) : f.push({
|
|
974
|
+
t: x.RETAIN,
|
|
973
975
|
len: l,
|
|
974
976
|
segmentId: m
|
|
975
977
|
}), s > 0 && f.push({
|
|
976
|
-
t:
|
|
978
|
+
t: x.DELETE,
|
|
977
979
|
len: s,
|
|
978
980
|
line: 0,
|
|
979
981
|
segmentId: m
|
|
980
982
|
}), f.push({
|
|
981
|
-
t:
|
|
983
|
+
t: x.INSERT,
|
|
982
984
|
body: {
|
|
983
985
|
dataStream: n
|
|
984
986
|
},
|
|
@@ -993,7 +995,7 @@ const vt = {
|
|
|
993
995
|
function F(o, e, t, n) {
|
|
994
996
|
var r;
|
|
995
997
|
const { segmentId: s } = (r = t.getActiveRange()) != null ? r : {};
|
|
996
|
-
return s == null ? !1 : n.executeCommand(
|
|
998
|
+
return s == null ? !1 : n.executeCommand(It.id, {
|
|
997
999
|
segmentId: s,
|
|
998
1000
|
preCommandId: o,
|
|
999
1001
|
...e != null ? e : {}
|
|
@@ -1083,7 +1085,7 @@ const Qe = "doc.command.set-inline-format-bold", we = {
|
|
|
1083
1085
|
t
|
|
1084
1086
|
);
|
|
1085
1087
|
}
|
|
1086
|
-
}, it = "doc.command.set-inline-format-font-family",
|
|
1088
|
+
}, it = "doc.command.set-inline-format-font-family", ke = {
|
|
1087
1089
|
id: it,
|
|
1088
1090
|
type: v.COMMAND,
|
|
1089
1091
|
handler: async (o, e) => {
|
|
@@ -1095,7 +1097,7 @@ const Qe = "doc.command.set-inline-format-bold", we = {
|
|
|
1095
1097
|
t
|
|
1096
1098
|
);
|
|
1097
1099
|
}
|
|
1098
|
-
}, at = "doc.command.set-inline-format-text-color",
|
|
1100
|
+
}, at = "doc.command.set-inline-format-text-color", ze = {
|
|
1099
1101
|
id: at,
|
|
1100
1102
|
type: v.COMMAND,
|
|
1101
1103
|
handler: async (o, e) => {
|
|
@@ -1131,19 +1133,19 @@ const Qe = "doc.command.set-inline-format-bold", we = {
|
|
|
1131
1133
|
t
|
|
1132
1134
|
);
|
|
1133
1135
|
}
|
|
1134
|
-
},
|
|
1136
|
+
}, vt = {
|
|
1135
1137
|
[we.id]: "bl",
|
|
1136
1138
|
[Le.id]: "it",
|
|
1137
1139
|
[Be.id]: "ul",
|
|
1138
1140
|
[Fe.id]: "st",
|
|
1139
1141
|
[Ve.id]: "fs",
|
|
1140
|
-
[
|
|
1141
|
-
[
|
|
1142
|
+
[ke.id]: "ff",
|
|
1143
|
+
[ze.id]: "cl",
|
|
1142
1144
|
[Ge.id]: "bg",
|
|
1143
1145
|
[je.id]: "bg",
|
|
1144
1146
|
[oe.id]: "va",
|
|
1145
1147
|
[$e.id]: "va"
|
|
1146
|
-
},
|
|
1148
|
+
}, It = {
|
|
1147
1149
|
id: "doc.command.set-inline-format",
|
|
1148
1150
|
type: v.COMMAND,
|
|
1149
1151
|
handler: async (o, e) => {
|
|
@@ -1154,7 +1156,7 @@ const Qe = "doc.command.set-inline-format-bold", we = {
|
|
|
1154
1156
|
if (!d)
|
|
1155
1157
|
return !1;
|
|
1156
1158
|
let l = d.getUnitId();
|
|
1157
|
-
l ===
|
|
1159
|
+
l === Dt && (d = a.getUniverDocInstance(ut), l = d.getUnitId());
|
|
1158
1160
|
let u;
|
|
1159
1161
|
switch (s) {
|
|
1160
1162
|
case we.id:
|
|
@@ -1171,11 +1173,11 @@ const Qe = "doc.command.set-inline-format-bold", we = {
|
|
|
1171
1173
|
break;
|
|
1172
1174
|
}
|
|
1173
1175
|
case Ve.id:
|
|
1174
|
-
case
|
|
1176
|
+
case ke.id: {
|
|
1175
1177
|
u = n;
|
|
1176
1178
|
break;
|
|
1177
1179
|
}
|
|
1178
|
-
case
|
|
1180
|
+
case ze.id:
|
|
1179
1181
|
case Ge.id: {
|
|
1180
1182
|
u = {
|
|
1181
1183
|
rgb: n
|
|
@@ -1198,7 +1200,7 @@ const Qe = "doc.command.set-inline-format-bold", we = {
|
|
|
1198
1200
|
actions: [],
|
|
1199
1201
|
textRanges: c.map(Z)
|
|
1200
1202
|
}
|
|
1201
|
-
}, g = new
|
|
1203
|
+
}, g = new b(), p = new se();
|
|
1202
1204
|
p.reset();
|
|
1203
1205
|
for (const f of c) {
|
|
1204
1206
|
const { startOffset: S, endOffset: _ } = f, R = {
|
|
@@ -1208,17 +1210,17 @@ const Qe = "doc.command.set-inline-format-bold", we = {
|
|
|
1208
1210
|
st: 0,
|
|
1209
1211
|
ed: _ - S,
|
|
1210
1212
|
ts: {
|
|
1211
|
-
[
|
|
1213
|
+
[vt[s]]: u
|
|
1212
1214
|
}
|
|
1213
1215
|
}
|
|
1214
1216
|
]
|
|
1215
1217
|
}, M = S - p.cursor;
|
|
1216
1218
|
M !== 0 && g.push({
|
|
1217
|
-
t:
|
|
1219
|
+
t: x.RETAIN,
|
|
1218
1220
|
len: M,
|
|
1219
1221
|
segmentId: t
|
|
1220
1222
|
}), g.push({
|
|
1221
|
-
t:
|
|
1223
|
+
t: x.RETAIN,
|
|
1222
1224
|
body: R,
|
|
1223
1225
|
len: _ - S,
|
|
1224
1226
|
segmentId: t
|
|
@@ -1232,7 +1234,7 @@ function un(o) {
|
|
|
1232
1234
|
}
|
|
1233
1235
|
function mn(o, e, t) {
|
|
1234
1236
|
let n = 0, s = 0;
|
|
1235
|
-
const r =
|
|
1237
|
+
const r = vt[e];
|
|
1236
1238
|
for (; n !== o.length && s !== t.length; ) {
|
|
1237
1239
|
const { startOffset: i, endOffset: a } = t[s], { st: c, ed: d, ts: l } = o[n];
|
|
1238
1240
|
if (a <= c)
|
|
@@ -1241,20 +1243,20 @@ function mn(o, e, t) {
|
|
|
1241
1243
|
n++;
|
|
1242
1244
|
else {
|
|
1243
1245
|
if (/bl|it/.test(r))
|
|
1244
|
-
return (l == null ? void 0 : l[r]) ===
|
|
1246
|
+
return (l == null ? void 0 : l[r]) === z.TRUE ? z.FALSE : z.TRUE;
|
|
1245
1247
|
if (/ul|st/.test(r))
|
|
1246
|
-
return un(l == null ? void 0 : l[r]) && (l == null ? void 0 : l[r]).s ===
|
|
1247
|
-
s:
|
|
1248
|
+
return un(l == null ? void 0 : l[r]) && (l == null ? void 0 : l[r]).s === z.TRUE ? {
|
|
1249
|
+
s: z.FALSE
|
|
1248
1250
|
} : {
|
|
1249
|
-
s:
|
|
1251
|
+
s: z.TRUE
|
|
1250
1252
|
};
|
|
1251
1253
|
if (/va/.test(r))
|
|
1252
1254
|
return e === oe.id ? (l == null ? void 0 : l[r]) === G.SUBSCRIPT ? G.NORMAL : G.SUBSCRIPT : (l == null ? void 0 : l[r]) === G.SUPERSCRIPT ? G.NORMAL : G.SUPERSCRIPT;
|
|
1253
1255
|
n++;
|
|
1254
1256
|
}
|
|
1255
1257
|
}
|
|
1256
|
-
return /bl|it/.test(r) ?
|
|
1257
|
-
s:
|
|
1258
|
+
return /bl|it/.test(r) ? z.TRUE : /ul|st/.test(r) ? {
|
|
1259
|
+
s: z.TRUE
|
|
1258
1260
|
} : e === oe.id ? G.SUBSCRIPT : G.SUPERSCRIPT;
|
|
1259
1261
|
}
|
|
1260
1262
|
const He = {
|
|
@@ -1268,14 +1270,14 @@ const He = {
|
|
|
1268
1270
|
const a = t.getActiveRange(), c = (O = t.getSelections()) != null ? O : [], d = (U = i.getBody()) == null ? void 0 : U.paragraphs, l = c.map(Z);
|
|
1269
1271
|
if (a == null || d == null)
|
|
1270
1272
|
return !1;
|
|
1271
|
-
const u =
|
|
1273
|
+
const u = Mt(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((Y) => {
|
|
1272
1274
|
var $;
|
|
1273
1275
|
return (($ = Y.bullet) == null ? void 0 : $.listType) === r;
|
|
1274
1276
|
});
|
|
1275
1277
|
let f = Q.generateRandomId(6);
|
|
1276
1278
|
if (u.length === 1) {
|
|
1277
|
-
const Y = d.indexOf(u[0]), $ = d[Y - 1],
|
|
1278
|
-
$ && $.bullet && $.bullet.listType === r ? f = $.bullet.listId :
|
|
1279
|
+
const Y = d.indexOf(u[0]), $ = d[Y - 1], k = d[Y + 1];
|
|
1280
|
+
$ && $.bullet && $.bullet.listType === r ? f = $.bullet.listId : k && k.bullet && k.bullet.listType === r && (f = k.bullet.listId);
|
|
1279
1281
|
}
|
|
1280
1282
|
const S = {
|
|
1281
1283
|
id: L.id,
|
|
@@ -1286,25 +1288,25 @@ const He = {
|
|
|
1286
1288
|
}
|
|
1287
1289
|
}, _ = new se();
|
|
1288
1290
|
_.reset();
|
|
1289
|
-
const R = new
|
|
1290
|
-
...
|
|
1291
|
+
const R = new b(), M = (w = i.getSnapshot().lists) != null ? w : {}, C = {
|
|
1292
|
+
...At,
|
|
1291
1293
|
...M
|
|
1292
|
-
}, { charSpace: D, defaultTabStop: A = 36, gridType:
|
|
1294
|
+
}, { charSpace: D, defaultTabStop: A = 36, gridType: P } = i.getSnapshot().documentStyle;
|
|
1293
1295
|
for (const Y of u) {
|
|
1294
|
-
const { startIndex: $, paragraphStyle:
|
|
1296
|
+
const { startIndex: $, paragraphStyle: k = {} } = Y, { indentFirstLine: Rt = 0, snapToGrid: xt, indentStart: _e = 0 } = k, { hanging: ve, indentStart: Xe } = C[r].nestingLevel[0], Ie = $t(D, A, P, xt);
|
|
1295
1297
|
R.push({
|
|
1296
|
-
t:
|
|
1298
|
+
t: x.RETAIN,
|
|
1297
1299
|
len: $ - _.cursor,
|
|
1298
1300
|
segmentId: m
|
|
1299
1301
|
}), R.push({
|
|
1300
|
-
t:
|
|
1302
|
+
t: x.RETAIN,
|
|
1301
1303
|
len: 1,
|
|
1302
1304
|
body: {
|
|
1303
1305
|
dataStream: "",
|
|
1304
1306
|
paragraphs: [
|
|
1305
1307
|
p ? {
|
|
1306
1308
|
paragraphStyle: {
|
|
1307
|
-
...
|
|
1309
|
+
...k,
|
|
1308
1310
|
hanging: void 0,
|
|
1309
1311
|
indentStart: _e ? Math.max(0, Me(_e, Ie) + ve - Xe) : void 0
|
|
1310
1312
|
},
|
|
@@ -1312,10 +1314,10 @@ const He = {
|
|
|
1312
1314
|
} : {
|
|
1313
1315
|
startIndex: 0,
|
|
1314
1316
|
paragraphStyle: {
|
|
1315
|
-
...
|
|
1317
|
+
...k,
|
|
1316
1318
|
indentFirstLine: void 0,
|
|
1317
1319
|
hanging: ve,
|
|
1318
|
-
indentStart: Xe - ve + Me(
|
|
1320
|
+
indentStart: Xe - ve + Me(Rt, Ie) + Me(_e, Ie)
|
|
1319
1321
|
},
|
|
1320
1322
|
bullet: {
|
|
1321
1323
|
...(X = Y.bullet) != null ? X : {
|
|
@@ -1349,7 +1351,7 @@ const He = {
|
|
|
1349
1351
|
listType: mt.ORDER_LIST
|
|
1350
1352
|
})
|
|
1351
1353
|
};
|
|
1352
|
-
function
|
|
1354
|
+
function Mt(o, e) {
|
|
1353
1355
|
const { startOffset: t, endOffset: n } = o, s = [];
|
|
1354
1356
|
let r = -1;
|
|
1355
1357
|
for (const i of e) {
|
|
@@ -1369,7 +1371,7 @@ const ie = {
|
|
|
1369
1371
|
const a = t.getActiveRange(), c = (R = t.getSelections()) != null ? R : [], d = (M = i.getBody()) == null ? void 0 : M.paragraphs, l = c.map(Z);
|
|
1370
1372
|
if (a == null || d == null)
|
|
1371
1373
|
return !1;
|
|
1372
|
-
const u =
|
|
1374
|
+
const u = Mt(a, d), { segmentId: m } = a, g = i.getUnitId(), p = u.every((C) => {
|
|
1373
1375
|
var D;
|
|
1374
1376
|
return ((D = C.paragraphStyle) == null ? void 0 : D.horizontalAlign) === r;
|
|
1375
1377
|
}), h = {
|
|
@@ -1381,11 +1383,11 @@ const ie = {
|
|
|
1381
1383
|
}
|
|
1382
1384
|
}, f = new se();
|
|
1383
1385
|
f.reset();
|
|
1384
|
-
const S = new
|
|
1386
|
+
const S = new b();
|
|
1385
1387
|
for (const C of u) {
|
|
1386
1388
|
const { startIndex: D } = C;
|
|
1387
1389
|
S.push({
|
|
1388
|
-
t:
|
|
1390
|
+
t: x.RETAIN,
|
|
1389
1391
|
len: D - f.cursor,
|
|
1390
1392
|
segmentId: m
|
|
1391
1393
|
});
|
|
@@ -1394,7 +1396,7 @@ const ie = {
|
|
|
1394
1396
|
horizontalAlign: p ? re.UNSPECIFIED : r
|
|
1395
1397
|
};
|
|
1396
1398
|
S.push({
|
|
1397
|
-
t:
|
|
1399
|
+
t: x.RETAIN,
|
|
1398
1400
|
len: 1,
|
|
1399
1401
|
body: {
|
|
1400
1402
|
dataStream: "",
|
|
@@ -1444,7 +1446,7 @@ const ie = {
|
|
|
1444
1446
|
const { unitId: t, body: n, textRanges: s, segmentId: r = "" } = e, i = o.get(E), a = o.get(I), c = o.get(T), d = (g = i.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, l = c.getSelections();
|
|
1445
1447
|
if (d == null || !Array.isArray(l) || l.length === 0)
|
|
1446
1448
|
return !1;
|
|
1447
|
-
const u =
|
|
1449
|
+
const u = Ct(t, r, d, n);
|
|
1448
1450
|
return u.params.textRanges = s, !!a.syncExecuteCommand(u.id, u.params);
|
|
1449
1451
|
}
|
|
1450
1452
|
}, In = {
|
|
@@ -1455,14 +1457,14 @@ const ie = {
|
|
|
1455
1457
|
const { unitId: t, body: n, segmentId: s = "" } = e, r = o.get(E), i = o.get(I), a = o.get(Te), c = (l = r.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
|
|
1456
1458
|
if (c == null)
|
|
1457
1459
|
return !1;
|
|
1458
|
-
const d =
|
|
1460
|
+
const d = Ct(t, s, c, n);
|
|
1459
1461
|
return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0, i.syncExecuteCommand(
|
|
1460
1462
|
d.id,
|
|
1461
1463
|
d.params
|
|
1462
1464
|
), a.clearUndoRedo(t), !0;
|
|
1463
1465
|
}
|
|
1464
1466
|
};
|
|
1465
|
-
function
|
|
1467
|
+
function Ct(o, e, t, n) {
|
|
1466
1468
|
const s = {
|
|
1467
1469
|
id: L.id,
|
|
1468
1470
|
params: {
|
|
@@ -1470,14 +1472,14 @@ function Rt(o, e, t, n) {
|
|
|
1470
1472
|
actions: [],
|
|
1471
1473
|
textRanges: []
|
|
1472
1474
|
}
|
|
1473
|
-
}, r = new
|
|
1475
|
+
}, r = new b(), i = (t == null ? void 0 : t.dataStream.length) - 2;
|
|
1474
1476
|
return i > 0 && r.push({
|
|
1475
|
-
t:
|
|
1477
|
+
t: x.DELETE,
|
|
1476
1478
|
len: i,
|
|
1477
1479
|
line: 0,
|
|
1478
1480
|
segmentId: e
|
|
1479
1481
|
}), n.dataStream.length > 0 && r.push({
|
|
1480
|
-
t:
|
|
1482
|
+
t: x.INSERT,
|
|
1481
1483
|
body: n,
|
|
1482
1484
|
len: n.dataStream.length,
|
|
1483
1485
|
line: 0,
|
|
@@ -1559,11 +1561,11 @@ var xn = Object.defineProperty, yn = Object.getOwnPropertyDescriptor, On = (o, e
|
|
|
1559
1561
|
let le = class extends Ne {
|
|
1560
1562
|
constructor(e, t, n, s, r) {
|
|
1561
1563
|
super();
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1564
|
+
y(this, "_previousIMEContent", "");
|
|
1565
|
+
y(this, "_isCompositionStart", !0);
|
|
1566
|
+
y(this, "_onStartSubscription");
|
|
1567
|
+
y(this, "_onUpdateSubscription");
|
|
1568
|
+
y(this, "_onEndSubscription");
|
|
1567
1569
|
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = s, this._commandService = r, this._initialize();
|
|
1568
1570
|
}
|
|
1569
1571
|
dispose() {
|
|
@@ -1604,7 +1606,7 @@ let le = class extends Ne {
|
|
|
1604
1606
|
if (n == null || i == null)
|
|
1605
1607
|
return;
|
|
1606
1608
|
const c = r.data;
|
|
1607
|
-
c === this._previousIMEContent && t || (await this._commandService.executeCommand(
|
|
1609
|
+
c === this._previousIMEContent && t || (await this._commandService.executeCommand(_t.id, {
|
|
1608
1610
|
unitId: s.getUnitId(),
|
|
1609
1611
|
newText: c,
|
|
1610
1612
|
oldTextLen: this._previousIMEContent.length,
|
|
@@ -1632,14 +1634,12 @@ var Tn = Object.defineProperty, En = Object.getOwnPropertyDescriptor, Dn = (o, e
|
|
|
1632
1634
|
let de = class extends Ne {
|
|
1633
1635
|
constructor(e, t, n, s, r) {
|
|
1634
1636
|
super();
|
|
1635
|
-
|
|
1636
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionManagerService = s, this._commandService = r, this.
|
|
1637
|
+
y(this, "_onInputSubscription");
|
|
1638
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionManagerService = s, this._commandService = r, this._commandExecutedListener();
|
|
1637
1639
|
}
|
|
1638
1640
|
dispose() {
|
|
1639
1641
|
var e;
|
|
1640
|
-
(e = this._onInputSubscription) == null || e.unsubscribe();
|
|
1641
|
-
}
|
|
1642
|
-
_initialize() {
|
|
1642
|
+
super.dispose(), (e = this._onInputSubscription) == null || e.unsubscribe();
|
|
1643
1643
|
}
|
|
1644
1644
|
_commandExecutedListener() {
|
|
1645
1645
|
const e = [ye.id, Oe.id];
|
|
@@ -1809,7 +1809,7 @@ let de = class extends Ne {
|
|
|
1809
1809
|
return e.findPositionByGlyph(s.glyph);
|
|
1810
1810
|
}
|
|
1811
1811
|
_getNextOrPrevLine(e, t) {
|
|
1812
|
-
var p, h, f, S, _, R, M, C, D, A,
|
|
1812
|
+
var p, h, f, S, _, R, M, C, D, A, P, B;
|
|
1813
1813
|
const n = e.parent;
|
|
1814
1814
|
if (n == null)
|
|
1815
1815
|
return;
|
|
@@ -1861,7 +1861,7 @@ let de = class extends Ne {
|
|
|
1861
1861
|
if (t === !0)
|
|
1862
1862
|
a = (A = (D = (C = m.pages[g + 1]) == null ? void 0 : C.sections[0]) == null ? void 0 : D.columns[0]) == null ? void 0 : A.lines[0];
|
|
1863
1863
|
else {
|
|
1864
|
-
const O = (
|
|
1864
|
+
const O = (P = m.pages[g - 1]) == null ? void 0 : P.sections;
|
|
1865
1865
|
if (O == null)
|
|
1866
1866
|
return;
|
|
1867
1867
|
const U = (B = O[O.length - 1]) == null ? void 0 : B.columns, w = U[U.length - 1], X = w == null ? void 0 : w.lines;
|
|
@@ -1872,7 +1872,7 @@ let de = class extends Ne {
|
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
1874
|
_getDocObject() {
|
|
1875
|
-
return
|
|
1875
|
+
return Gt(this._univerInstanceService, this._renderManagerService);
|
|
1876
1876
|
}
|
|
1877
1877
|
};
|
|
1878
1878
|
de = Dn([
|
|
@@ -1883,7 +1883,7 @@ de = Dn([
|
|
|
1883
1883
|
J(3, V(T)),
|
|
1884
1884
|
J(4, I)
|
|
1885
1885
|
], de);
|
|
1886
|
-
var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor,
|
|
1886
|
+
var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, Pn = (o, e, t, n) => {
|
|
1887
1887
|
for (var s = n > 1 ? void 0 : n ? Nn(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
1888
1888
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1889
1889
|
return n && s && An(e, t, s), s;
|
|
@@ -1891,14 +1891,14 @@ var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, bn = (o, e
|
|
|
1891
1891
|
let ue = class extends Ne {
|
|
1892
1892
|
constructor(e, t, n, s, r) {
|
|
1893
1893
|
super();
|
|
1894
|
-
|
|
1895
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionRenderManager = s, this._commandService = r, this.
|
|
1894
|
+
y(this, "_onInputSubscription");
|
|
1895
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._textSelectionRenderManager = s, this._commandService = r, this._init();
|
|
1896
1896
|
}
|
|
1897
1897
|
dispose() {
|
|
1898
1898
|
var e;
|
|
1899
|
-
(e = this._onInputSubscription) == null || e.unsubscribe();
|
|
1899
|
+
super.dispose(), (e = this._onInputSubscription) == null || e.unsubscribe();
|
|
1900
1900
|
}
|
|
1901
|
-
|
|
1901
|
+
_init() {
|
|
1902
1902
|
this._initialNormalInput();
|
|
1903
1903
|
}
|
|
1904
1904
|
_initialNormalInput() {
|
|
@@ -1930,13 +1930,8 @@ let ue = class extends Ne {
|
|
|
1930
1930
|
});
|
|
1931
1931
|
});
|
|
1932
1932
|
}
|
|
1933
|
-
_commandExecutedListener() {
|
|
1934
|
-
}
|
|
1935
|
-
_getDocObject() {
|
|
1936
|
-
return ft(this._univerInstanceService, this._renderManagerService);
|
|
1937
|
-
}
|
|
1938
1933
|
};
|
|
1939
|
-
ue =
|
|
1934
|
+
ue = Pn([
|
|
1940
1935
|
De(Ae.Rendered, ue),
|
|
1941
1936
|
q(0, V(H)),
|
|
1942
1937
|
q(1, E),
|
|
@@ -1944,22 +1939,16 @@ ue = bn([
|
|
|
1944
1939
|
q(3, fe),
|
|
1945
1940
|
q(4, I)
|
|
1946
1941
|
], ue);
|
|
1947
|
-
var
|
|
1942
|
+
var bn = Object.defineProperty, Un = Object.getOwnPropertyDescriptor, wn = (o, e, t, n) => {
|
|
1948
1943
|
for (var s = n > 1 ? void 0 : n ? Un(e, t) : e, r = o.length - 1, i; r >= 0; r--)
|
|
1949
1944
|
(i = o[r]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1950
|
-
return n && s &&
|
|
1945
|
+
return n && s && bn(e, t, s), s;
|
|
1951
1946
|
}, Ln = (o, e) => (t, n) => e(t, n, o);
|
|
1952
|
-
const Bn =
|
|
1953
|
-
hasScroll: !0
|
|
1954
|
-
}, Fn = "docs";
|
|
1947
|
+
const Bn = "docs";
|
|
1955
1948
|
var ae;
|
|
1956
|
-
let dt = (ae = class extends
|
|
1957
|
-
constructor(
|
|
1958
|
-
super();
|
|
1959
|
-
x(this, "_config");
|
|
1960
|
-
this._injector = t, this._config = Object.assign(Bn, e), this._initializeDependencies(t), this._initializeCommands();
|
|
1961
|
-
}
|
|
1962
|
-
initialize() {
|
|
1949
|
+
let dt = (ae = class extends Nt {
|
|
1950
|
+
constructor(o = {}, e) {
|
|
1951
|
+
super(), this._injector = e, this._initializeDependencies(e), this._initializeCommands();
|
|
1963
1952
|
}
|
|
1964
1953
|
_initializeCommands() {
|
|
1965
1954
|
[
|
|
@@ -1974,23 +1963,23 @@ let dt = (ae = class extends bt {
|
|
|
1974
1963
|
oe,
|
|
1975
1964
|
$e,
|
|
1976
1965
|
Ve,
|
|
1977
|
-
ze,
|
|
1978
1966
|
ke,
|
|
1967
|
+
ze,
|
|
1979
1968
|
je,
|
|
1980
1969
|
Ge,
|
|
1981
|
-
|
|
1970
|
+
It,
|
|
1982
1971
|
nn,
|
|
1983
1972
|
pe,
|
|
1984
1973
|
Se,
|
|
1985
|
-
|
|
1986
|
-
|
|
1974
|
+
ht,
|
|
1975
|
+
_t,
|
|
1987
1976
|
Ue,
|
|
1988
1977
|
L,
|
|
1989
1978
|
vn,
|
|
1990
1979
|
In,
|
|
1991
1980
|
Cn,
|
|
1992
1981
|
ce,
|
|
1993
|
-
|
|
1982
|
+
ft,
|
|
1994
1983
|
Rn,
|
|
1995
1984
|
fn,
|
|
1996
1985
|
gn,
|
|
@@ -2000,14 +1989,11 @@ let dt = (ae = class extends bt {
|
|
|
2000
1989
|
Sn,
|
|
2001
1990
|
ie,
|
|
2002
1991
|
_n
|
|
2003
|
-
].forEach((
|
|
2004
|
-
this._injector.get(I).registerCommand(
|
|
1992
|
+
].forEach((o) => {
|
|
1993
|
+
this._injector.get(I).registerCommand(o);
|
|
2005
1994
|
});
|
|
2006
1995
|
}
|
|
2007
|
-
|
|
2008
|
-
this.initialize();
|
|
2009
|
-
}
|
|
2010
|
-
_initializeDependencies(e) {
|
|
1996
|
+
_initializeDependencies(o) {
|
|
2011
1997
|
[
|
|
2012
1998
|
// services
|
|
2013
1999
|
[H],
|
|
@@ -2017,7 +2003,7 @@ let dt = (ae = class extends bt {
|
|
|
2017
2003
|
[
|
|
2018
2004
|
fe,
|
|
2019
2005
|
{
|
|
2020
|
-
useClass:
|
|
2006
|
+
useClass: Vt
|
|
2021
2007
|
}
|
|
2022
2008
|
],
|
|
2023
2009
|
[T],
|
|
@@ -2025,9 +2011,9 @@ let dt = (ae = class extends bt {
|
|
|
2025
2011
|
[ue],
|
|
2026
2012
|
[le],
|
|
2027
2013
|
[de]
|
|
2028
|
-
].forEach((
|
|
2014
|
+
].forEach((e) => o.add(e));
|
|
2029
2015
|
}
|
|
2030
|
-
},
|
|
2016
|
+
}, y(ae, "pluginName", Bn), y(ae, "type", W.UNIVER_DOC), ae);
|
|
2031
2017
|
dt = wn([
|
|
2032
2018
|
Ln(1, V(kt))
|
|
2033
2019
|
], dt);
|
|
@@ -2040,25 +2026,25 @@ export {
|
|
|
2040
2026
|
nn as BreakLineCommand,
|
|
2041
2027
|
gn as BulletListCommand,
|
|
2042
2028
|
In as CoverContentCommand,
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2029
|
+
pt as CutContentCommand,
|
|
2030
|
+
Gn as DOCS_COMPONENT_BACKGROUND_LAYER_INDEX,
|
|
2031
|
+
Xn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
|
|
2032
|
+
Hn as DOCS_COMPONENT_HEADER_LAYER_INDEX,
|
|
2033
|
+
jn as DOCS_COMPONENT_MAIN_LAYER_INDEX,
|
|
2034
|
+
Pe as DOCS_VIEW_KEY,
|
|
2049
2035
|
Se as DeleteCommand,
|
|
2050
2036
|
cn as DeleteLeftCommand,
|
|
2051
2037
|
ln as DeleteRightCommand,
|
|
2052
2038
|
H as DocSkeletonManagerService,
|
|
2053
2039
|
me as DocStateChangeManagerService,
|
|
2054
2040
|
ne as DocViewModelManagerService,
|
|
2055
|
-
|
|
2041
|
+
_t as IMEInputCommand,
|
|
2056
2042
|
he as IMEInputManagerService,
|
|
2057
|
-
|
|
2043
|
+
Zn as InnerPasteCommand,
|
|
2058
2044
|
pe as InsertCommand,
|
|
2059
2045
|
ye as MoveCursorOperation,
|
|
2060
2046
|
Oe as MoveSelectionOperation,
|
|
2061
|
-
|
|
2047
|
+
Yn as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
|
|
2062
2048
|
fn as OrderListCommand,
|
|
2063
2049
|
vn as ReplaceContentCommand,
|
|
2064
2050
|
je as ResetInlineFormatTextBackgroundColorCommand,
|
|
@@ -2067,22 +2053,22 @@ export {
|
|
|
2067
2053
|
Cn as SetDocZoomRatioCommand,
|
|
2068
2054
|
ce as SetDocZoomRatioOperation,
|
|
2069
2055
|
we as SetInlineFormatBoldCommand,
|
|
2070
|
-
|
|
2071
|
-
|
|
2056
|
+
It as SetInlineFormatCommand,
|
|
2057
|
+
ke as SetInlineFormatFontFamilyCommand,
|
|
2072
2058
|
Ve as SetInlineFormatFontSizeCommand,
|
|
2073
2059
|
Le as SetInlineFormatItalicCommand,
|
|
2074
2060
|
Fe as SetInlineFormatStrikethroughCommand,
|
|
2075
2061
|
oe as SetInlineFormatSubscriptCommand,
|
|
2076
2062
|
$e as SetInlineFormatSuperscriptCommand,
|
|
2077
2063
|
Ge as SetInlineFormatTextBackgroundColorCommand,
|
|
2078
|
-
|
|
2064
|
+
ze as SetInlineFormatTextColorCommand,
|
|
2079
2065
|
Be as SetInlineFormatUnderlineCommand,
|
|
2080
|
-
|
|
2066
|
+
ft as SetTextSelectionsOperation,
|
|
2081
2067
|
T as TextSelectionManagerService,
|
|
2082
2068
|
dt as UniverDocsPlugin,
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2069
|
+
ht as UpdateCommand,
|
|
2070
|
+
zt as VIEWPORT_KEY,
|
|
2071
|
+
Gt as getDocObject,
|
|
2072
|
+
Wn as getDocObjectById,
|
|
2087
2073
|
Z as serializeTextRange
|
|
2088
2074
|
};
|