@univerjs/docs 0.2.4-alpha.0 → 0.2.4
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 +309 -306
- package/lib/types/basics/custom-decoration-factory.d.ts +2 -1
- package/lib/types/basics/custom-range-factory.d.ts +2 -1
- package/lib/types/basics/replace.d.ts +2 -1
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +8 -7
- package/lib/types/commands/commands/__tests__/mock-text-selection-render-manager.d.ts +1 -1
- package/lib/types/commands/operations/set-doc-zoom-ratio.operation.d.ts +2 -1
- package/lib/types/commands/util.d.ts +2 -1
- package/lib/types/doc-plugin.d.ts +2 -1
- package/lib/types/services/doc-custom-range.service.d.ts +2 -1
- package/lib/types/services/doc-interceptor/doc-interceptor.service.d.ts +1 -1
- package/lib/types/services/ime-input-manager.service.d.ts +2 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -6
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
var Qt = Object.defineProperty;
|
|
2
2
|
var en = (o, e, n) => e in o ? Qt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[e] = n;
|
|
3
3
|
var w = (o, e, n) => en(o, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CommandType as A, RxDisposable as ke, ICommandService as N,
|
|
5
|
-
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as
|
|
4
|
+
import { CommandType as A, RxDisposable as ke, ICommandService as N, IUndoRedoService as ze, UndoCommandId as ft, RedoCommandId as gt, JSONX as B, IUniverInstanceService as U, LocaleService as tn, UniverInstanceType as ee, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as bt, DataStreamTreeTokenType as b, TextXActionType as M, TextX as $, toDisposable as Pt, normalizeBody as nn, getBodySlice as wt, updateAttributeByInsert as sn, Tools as ne, MemoryCursor as de, getDocsUpdateBody as on, UpdateDocsAttributeType as Te, PositionedObjectLayoutType as Ut, getCustomRangeSlice as rn, getCustomDecorationSlice as an, BooleanNumber as K, BaselineOffset as Z, PRESET_LIST_TYPE as cn, GridType as dn, PresetListType as Bt, sortRulesFactory as ln, OnLifecycle as le, LifecycleStages as ue, Disposable as fe, Direction as F, HorizontalAlign as ge, Plugin as un, createInterceptorKey as Lt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as fn, remove as gn, composeInterceptors as mn, DisposableCollection as hn } from "@univerjs/core";
|
|
5
|
+
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as pn, ITextSelectionRenderManager as Ee, DocumentSkeleton as Sn, DocumentViewModel as In, IRenderManagerService as me, hasListGlyph as _n, isIndentByGlyph as vn, isFirstGlyph as Rn, getParagraphByGlyph as xn, getCharSpaceApply as On, getNumberUnitValue as Q, RANGE_DIRECTION as we, NodePositionConvertToCursor as mt, TextSelectionRenderManager as Cn } from "@univerjs/engine-render";
|
|
6
6
|
import { BehaviorSubject as ae, takeUntil as Ft } from "rxjs";
|
|
7
|
+
import { Inject as te, Injector as Mn } from "@wendellhu/redi";
|
|
7
8
|
const He = {
|
|
8
9
|
id: "doc.operation.set-selections",
|
|
9
10
|
type: A.OPERATION,
|
|
@@ -66,16 +67,16 @@ let P = class extends ke {
|
|
|
66
67
|
const e = this._getTextRanges(this._currentSelection);
|
|
67
68
|
if (e == null)
|
|
68
69
|
return;
|
|
69
|
-
const { textRanges: n, segmentId: t, style: s, segmentPage: r } = e, a = n.find((
|
|
70
|
+
const { textRanges: n, segmentId: t, style: s, segmentPage: r } = e, a = n.find((g) => g.isActive());
|
|
70
71
|
if (a == null)
|
|
71
72
|
return null;
|
|
72
|
-
const { startOffset: c, endOffset: i, collapsed: l, startNodePosition: d, endNodePosition:
|
|
73
|
+
const { startOffset: c, endOffset: i, collapsed: l, startNodePosition: d, endNodePosition: f, direction: u } = a;
|
|
73
74
|
return c == null || i == null ? null : {
|
|
74
75
|
startOffset: c,
|
|
75
76
|
endOffset: i,
|
|
76
77
|
collapsed: l,
|
|
77
78
|
startNodePosition: d,
|
|
78
|
-
endNodePosition:
|
|
79
|
+
endNodePosition: f,
|
|
79
80
|
direction: u,
|
|
80
81
|
segmentId: t,
|
|
81
82
|
segmentPage: r,
|
|
@@ -90,7 +91,7 @@ let P = class extends ke {
|
|
|
90
91
|
segmentId: "",
|
|
91
92
|
segmentPage: -1,
|
|
92
93
|
isEditing: n,
|
|
93
|
-
style:
|
|
94
|
+
style: pn
|
|
94
95
|
// mock style.
|
|
95
96
|
});
|
|
96
97
|
}
|
|
@@ -172,7 +173,7 @@ let Me = class extends ke {
|
|
|
172
173
|
_initialize() {
|
|
173
174
|
this.disposeWithMe(
|
|
174
175
|
this._commandService.beforeCommandExecuted((e) => {
|
|
175
|
-
if (e.id ===
|
|
176
|
+
if (e.id === ft || e.id === gt) {
|
|
176
177
|
const n = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
177
178
|
if (n == null)
|
|
178
179
|
return;
|
|
@@ -184,7 +185,7 @@ let Me = class extends ke {
|
|
|
184
185
|
}
|
|
185
186
|
_cacheChangeState(e, n = "history") {
|
|
186
187
|
const { trigger: t, unitId: s, noHistory: r, debounce: a = !1 } = e;
|
|
187
|
-
if (r || t == null || n === "history" && (t ===
|
|
188
|
+
if (r || t == null || n === "history" && (t === gt || t === ft))
|
|
188
189
|
return;
|
|
189
190
|
const c = n === "history" ? this._historyStateCache : this._changeStateCache, i = n === "history" ? this._pushHistory.bind(this) : this._emitChangeState.bind(this);
|
|
190
191
|
if (c.has(s)) {
|
|
@@ -204,12 +205,12 @@ let Me = class extends ke {
|
|
|
204
205
|
return;
|
|
205
206
|
const s = t.length, r = t[0].commandId, a = t[0], c = t[s - 1], i = {
|
|
206
207
|
unitId: e,
|
|
207
|
-
actions: t.reduce((d,
|
|
208
|
+
actions: t.reduce((d, f) => B.compose(d, f.redoState.actions), null),
|
|
208
209
|
textRanges: c.redoState.textRanges
|
|
209
210
|
}, l = {
|
|
210
211
|
unitId: e,
|
|
211
212
|
// Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
|
|
212
|
-
actions: t.reverse().reduce((d,
|
|
213
|
+
actions: t.reverse().reduce((d, f) => B.compose(d, f.undoState.actions), null),
|
|
213
214
|
textRanges: a.undoState.textRanges
|
|
214
215
|
};
|
|
215
216
|
n.pushUndoRedo({
|
|
@@ -222,7 +223,7 @@ let Me = class extends ke {
|
|
|
222
223
|
const n = this._changeStateCache.get(e);
|
|
223
224
|
if (!Array.isArray(n) || n.length === 0)
|
|
224
225
|
return;
|
|
225
|
-
const t = n.length, { commandId: s, trigger: r, segmentId: a, noHistory: c, debounce: i } = n[0], l = n[0], d = n[t - 1],
|
|
226
|
+
const t = n.length, { commandId: s, trigger: r, segmentId: a, noHistory: c, debounce: i } = n[0], l = n[0], d = n[t - 1], f = {
|
|
226
227
|
unitId: e,
|
|
227
228
|
actions: n.reduce((m, I) => B.compose(m, I.redoState.actions), null),
|
|
228
229
|
textRanges: d.redoState.textRanges
|
|
@@ -231,21 +232,21 @@ let Me = class extends ke {
|
|
|
231
232
|
// Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
|
|
232
233
|
actions: n.reverse().reduce((m, I) => B.compose(m, I.undoState.actions), null),
|
|
233
234
|
textRanges: l.undoState.textRanges
|
|
234
|
-
},
|
|
235
|
+
}, g = {
|
|
235
236
|
commandId: s,
|
|
236
237
|
unitId: e,
|
|
237
238
|
trigger: r,
|
|
238
|
-
redoState:
|
|
239
|
+
redoState: f,
|
|
239
240
|
undoState: u,
|
|
240
241
|
segmentId: a,
|
|
241
242
|
noHistory: c,
|
|
242
243
|
debounce: i
|
|
243
244
|
};
|
|
244
|
-
n.length = 0, this._docStateChange$.next(
|
|
245
|
+
n.length = 0, this._docStateChange$.next(g);
|
|
245
246
|
}
|
|
246
247
|
};
|
|
247
248
|
Me = Dn([
|
|
248
|
-
Ue(0,
|
|
249
|
+
Ue(0, te(ze)),
|
|
249
250
|
Ue(1, N),
|
|
250
251
|
Ue(2, U)
|
|
251
252
|
], Me);
|
|
@@ -313,7 +314,7 @@ let V = class extends ke {
|
|
|
313
314
|
w(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
|
|
314
315
|
w(this, "_currentViewModel$", new ae(null));
|
|
315
316
|
w(this, "currentViewModel$", this._currentViewModel$.asObservable());
|
|
316
|
-
this._context = e, this._localeService = n, this._univerInstanceService = t, this._init(), this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
317
|
+
this._context = e, this._localeService = n, this._univerInstanceService = t, this._init(), this._univerInstanceService.getCurrentTypeOfUnit$(ee.UNIVER_DOC).pipe(Ft(this.dispose$)).subscribe((s) => {
|
|
317
318
|
s && s.getUnitId() === this._context.unitId && this._update(s);
|
|
318
319
|
});
|
|
319
320
|
}
|
|
@@ -339,17 +340,17 @@ let V = class extends ke {
|
|
|
339
340
|
t.calculate(), this._currentSkeletonBefore$.next(t), this._currentSkeleton$.next(t), this._currentViewModel$.next(this._docViewModel);
|
|
340
341
|
}
|
|
341
342
|
_buildSkeleton(e) {
|
|
342
|
-
return
|
|
343
|
+
return Sn.create(e, this._localeService);
|
|
343
344
|
}
|
|
344
345
|
_buildDocViewModel(e) {
|
|
345
|
-
return new
|
|
346
|
+
return new In(e);
|
|
346
347
|
}
|
|
347
348
|
};
|
|
348
349
|
V = wn([
|
|
349
|
-
St(1,
|
|
350
|
+
St(1, te(tn)),
|
|
350
351
|
St(2, U)
|
|
351
352
|
], V);
|
|
352
|
-
const It = "doc.mutation.rich-text-editing",
|
|
353
|
+
const It = "doc.mutation.rich-text-editing", G = {
|
|
353
354
|
id: It,
|
|
354
355
|
type: A.MUTATION,
|
|
355
356
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -365,8 +366,8 @@ const It = "doc.mutation.rich-text-editing", F = {
|
|
|
365
366
|
noHistory: i,
|
|
366
367
|
isCompositionEnd: l,
|
|
367
368
|
noNeedSetTextRange: d,
|
|
368
|
-
debounce:
|
|
369
|
-
} = e, u = o.get(U),
|
|
369
|
+
debounce: f
|
|
370
|
+
} = e, u = o.get(U), g = o.get(me), m = u.getUniverDocInstance(n), I = (T = g.getRenderById(n)) == null ? void 0 : T.with(V).getViewModel();
|
|
370
371
|
if (m == null || I == null)
|
|
371
372
|
throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${n}`);
|
|
372
373
|
const p = o.get(P), S = ((C = p.getCurrentSelections()) != null ? C : []).map(se), _ = o.get(Me), O = o.get(Ae), E = !!m.getSnapshot().disabled;
|
|
@@ -386,7 +387,7 @@ const It = "doc.mutation.rich-text-editing", F = {
|
|
|
386
387
|
segmentId: t,
|
|
387
388
|
trigger: c,
|
|
388
389
|
noHistory: i,
|
|
389
|
-
debounce:
|
|
390
|
+
debounce: f,
|
|
390
391
|
redoState: {
|
|
391
392
|
actions: s,
|
|
392
393
|
textRanges: r
|
|
@@ -400,8 +401,8 @@ const It = "doc.mutation.rich-text-editing", F = {
|
|
|
400
401
|
const R = O.fetchComposedUndoRedoMutationParams();
|
|
401
402
|
if (R == null)
|
|
402
403
|
throw new Error("historyParams is null in RichTextEditingMutation");
|
|
403
|
-
const { undoMutationParams: y, redoMutationParams: D, previousActiveRange:
|
|
404
|
-
x.redoState.actions = D.actions, x.undoState.actions = y.actions, x.undoState.textRanges = [
|
|
404
|
+
const { undoMutationParams: y, redoMutationParams: D, previousActiveRange: L } = R;
|
|
405
|
+
x.redoState.actions = D.actions, x.undoState.actions = y.actions, x.undoState.textRanges = [L];
|
|
405
406
|
}
|
|
406
407
|
return _.setChangeState(x), {
|
|
407
408
|
unitId: n,
|
|
@@ -570,7 +571,7 @@ const Bn = [
|
|
|
570
571
|
b.CUSTOM_BLOCK
|
|
571
572
|
// 图片 mention 等不参与文档流的场景
|
|
572
573
|
];
|
|
573
|
-
function
|
|
574
|
+
function Bs(o, e, n) {
|
|
574
575
|
const t = o.slice(e, n);
|
|
575
576
|
return Bn.reduce((s, r) => s.replaceAll(r, ""), t);
|
|
576
577
|
}
|
|
@@ -579,17 +580,17 @@ function Gt(o, e, n, t) {
|
|
|
579
580
|
}
|
|
580
581
|
function Ke(o, e, n = "", t = 0) {
|
|
581
582
|
var h;
|
|
582
|
-
const { startOffset: s, endOffset: r } = Ne(o, e), a = [], { paragraphs: c = [], dataStream: i } = e, l = s - t, d = r - t,
|
|
583
|
+
const { startOffset: s, endOffset: r } = Ne(o, e), a = [], { paragraphs: c = [], dataStream: i } = e, l = s - t, d = r - t, f = c == null ? void 0 : c.find(
|
|
583
584
|
(S) => S.startIndex - t >= l && S.startIndex - t < d
|
|
584
|
-
), u = (h = e.customRanges) == null ? void 0 : h.filter((S) => Xe(S.startIndex, S.endIndex, s, r)),
|
|
585
|
+
), u = (h = e.customRanges) == null ? void 0 : h.filter((S) => Xe(S.startIndex, S.endIndex, s, r)), g = new Set(u == null ? void 0 : u.filter((S) => Ve(s, r - s, S, i))), m = /* @__PURE__ */ new Set();
|
|
585
586
|
if (u == null || u.forEach((S) => {
|
|
586
|
-
|
|
587
|
+
g.has(S) || (S.startIndex - t >= l && S.startIndex - t <= d && S.endIndex - t > d && m.add(S.startIndex), S.endIndex - t >= l && S.endIndex - t <= d && S.startIndex < l && m.add(S.endIndex));
|
|
587
588
|
}), l > 0 && a.push({
|
|
588
589
|
t: M.RETAIN,
|
|
589
590
|
len: l,
|
|
590
591
|
segmentId: n
|
|
591
|
-
}),
|
|
592
|
-
const S =
|
|
592
|
+
}), f && f.startIndex - t > l) {
|
|
593
|
+
const S = f.startIndex - t;
|
|
593
594
|
m.add(S);
|
|
594
595
|
}
|
|
595
596
|
const I = [...m].sort((S, _) => S - _);
|
|
@@ -613,12 +614,12 @@ function Ke(o, e, n = "", t = 0) {
|
|
|
613
614
|
segmentId: n
|
|
614
615
|
}), a;
|
|
615
616
|
}
|
|
616
|
-
function
|
|
617
|
-
var
|
|
617
|
+
function Ls(o, e) {
|
|
618
|
+
var g, m;
|
|
618
619
|
const { unitId: n, body: t } = e, r = o.get(U).getUnit(n), a = o.get(P);
|
|
619
620
|
if (!r)
|
|
620
621
|
return !1;
|
|
621
|
-
const c = r.getBody(), i = (
|
|
622
|
+
const c = r.getBody(), i = (g = e.selection) != null ? g : a.getActiveRange();
|
|
622
623
|
if (!i || !c)
|
|
623
624
|
return !1;
|
|
624
625
|
const l = (m = e.textRanges) != null ? m : [{
|
|
@@ -626,24 +627,24 @@ function Bs(o, e) {
|
|
|
626
627
|
endOffset: i.startOffset + t.dataStream.length,
|
|
627
628
|
collapsed: !0
|
|
628
629
|
}], d = {
|
|
629
|
-
id:
|
|
630
|
+
id: G.id,
|
|
630
631
|
params: {
|
|
631
632
|
unitId: n,
|
|
632
633
|
actions: [],
|
|
633
634
|
textRanges: l,
|
|
634
635
|
debounce: !0
|
|
635
636
|
}
|
|
636
|
-
},
|
|
637
|
-
return
|
|
637
|
+
}, f = new $(), u = B.getInstance();
|
|
638
|
+
return f.push(...Ke(i, c)), f.push({
|
|
638
639
|
t: M.INSERT,
|
|
639
640
|
body: t,
|
|
640
641
|
len: t.dataStream.length,
|
|
641
642
|
line: 0
|
|
642
|
-
}), d.params.actions = u.editOp(
|
|
643
|
+
}), d.params.actions = u.editOp(f.serialize()), d;
|
|
643
644
|
}
|
|
644
645
|
var De = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o.BACKGROUND = "__Document_Render_Background__", o))(De || {}), Ln = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(Ln || {});
|
|
645
|
-
const
|
|
646
|
-
function
|
|
646
|
+
const Fs = 0, Gs = 2, $s = 4, js = 10, ks = "normalTextSelectionPluginName";
|
|
647
|
+
function zs(o) {
|
|
647
648
|
const { mainComponent: e, scene: n, engine: t, components: s } = o, r = e, a = s.get(De.BACKGROUND);
|
|
648
649
|
return {
|
|
649
650
|
document: r,
|
|
@@ -653,7 +654,7 @@ function ks(o) {
|
|
|
653
654
|
};
|
|
654
655
|
}
|
|
655
656
|
function Fn(o, e) {
|
|
656
|
-
const n = o.getCurrentUnitForType(
|
|
657
|
+
const n = o.getCurrentUnitForType(ee.UNIVER_DOC);
|
|
657
658
|
if (!n)
|
|
658
659
|
return null;
|
|
659
660
|
const t = n.getUnitId(), s = e.getRenderById(t);
|
|
@@ -667,7 +668,7 @@ function Fn(o, e) {
|
|
|
667
668
|
engine: c
|
|
668
669
|
};
|
|
669
670
|
}
|
|
670
|
-
function
|
|
671
|
+
function Hs(o, e) {
|
|
671
672
|
const n = e.getRenderById(o);
|
|
672
673
|
if (n == null)
|
|
673
674
|
return;
|
|
@@ -698,17 +699,17 @@ class Ze {
|
|
|
698
699
|
}
|
|
699
700
|
function Je(o, e = "", n, t) {
|
|
700
701
|
var I;
|
|
701
|
-
const { startOffset: s, endOffset: r } = o, a = [], c = s - n, i = r - n, l = t.dataStream, d = (I = t.customRanges) == null ? void 0 : I.filter((p) => Xe(p.startIndex, p.endIndex, s, r)),
|
|
702
|
+
const { startOffset: s, endOffset: r } = o, a = [], c = s - n, i = r - n, l = t.dataStream, d = (I = t.customRanges) == null ? void 0 : I.filter((p) => Xe(p.startIndex, p.endIndex, s, r)), f = new Set(d == null ? void 0 : d.filter((p) => Ve(s, r - s, p, l))), u = /* @__PURE__ */ new Set();
|
|
702
703
|
d == null || d.forEach((p) => {
|
|
703
|
-
|
|
704
|
+
f.has(p) || (p.startIndex - n >= c && p.startIndex - n <= i && p.endIndex - n > i && u.add(p.startIndex), p.endIndex - n >= c && p.endIndex - n <= i && p.startIndex < c && u.add(p.endIndex));
|
|
704
705
|
}), c > 0 && a.push({
|
|
705
706
|
t: M.RETAIN,
|
|
706
707
|
len: c,
|
|
707
708
|
segmentId: e
|
|
708
709
|
});
|
|
709
|
-
const
|
|
710
|
+
const g = [...u].sort((p, h) => p - h);
|
|
710
711
|
let m = c;
|
|
711
|
-
return
|
|
712
|
+
return g.forEach((p) => {
|
|
712
713
|
const h = p - m;
|
|
713
714
|
h > 0 && a.push({
|
|
714
715
|
t: M.DELETE,
|
|
@@ -735,7 +736,7 @@ function $t(o, e) {
|
|
|
735
736
|
var t;
|
|
736
737
|
return (t = o.get(me).getRenderById(e)) == null ? void 0 : t.with(V);
|
|
737
738
|
}
|
|
738
|
-
function
|
|
739
|
+
function k(o, e = "") {
|
|
739
740
|
if (!e)
|
|
740
741
|
return ["body"];
|
|
741
742
|
const { headers: n, footers: t } = o.getSnapshot();
|
|
@@ -753,13 +754,13 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
753
754
|
// eslint-disable-next-line max-lines-per-function
|
|
754
755
|
handler: async (o, e) => {
|
|
755
756
|
var T;
|
|
756
|
-
const n = o.get(N), { range: t, segmentId: s, body: r, unitId: a, textRanges: c, cursorOffset: i } = e, l = o.get(P),
|
|
757
|
-
if (
|
|
757
|
+
const n = o.get(N), { range: t, segmentId: s, body: r, unitId: a, textRanges: c, cursorOffset: i } = e, l = o.get(P), f = o.get(U).getUnit(a, ee.UNIVER_DOC);
|
|
758
|
+
if (f == null)
|
|
758
759
|
return !1;
|
|
759
|
-
const u = l.getActiveRange(),
|
|
760
|
-
if (!
|
|
760
|
+
const u = l.getActiveRange(), g = f.getSelfOrHeaderFooterModel((T = u == null ? void 0 : u.segmentId) != null ? T : "").getBody();
|
|
761
|
+
if (!g)
|
|
761
762
|
return !1;
|
|
762
|
-
const m = Ye(t,
|
|
763
|
+
const m = Ye(t, g), { startOffset: I, collapsed: p } = m, h = i != null ? i : r.dataStream.length, S = [
|
|
763
764
|
{
|
|
764
765
|
startOffset: I + h,
|
|
765
766
|
endOffset: I + h,
|
|
@@ -767,14 +768,14 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
767
768
|
collapsed: p
|
|
768
769
|
}
|
|
769
770
|
], _ = {
|
|
770
|
-
id:
|
|
771
|
+
id: G.id,
|
|
771
772
|
params: {
|
|
772
773
|
unitId: a,
|
|
773
774
|
actions: [],
|
|
774
775
|
textRanges: c != null ? c : S,
|
|
775
776
|
debounce: !0
|
|
776
777
|
}
|
|
777
|
-
}, O = new
|
|
778
|
+
}, O = new $(), E = B.getInstance();
|
|
778
779
|
if (p)
|
|
779
780
|
I > 0 && O.push({
|
|
780
781
|
t: M.RETAIN,
|
|
@@ -782,7 +783,7 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
782
783
|
segmentId: s
|
|
783
784
|
});
|
|
784
785
|
else {
|
|
785
|
-
const { dos: C, retain: R } = Je(m, s, 0,
|
|
786
|
+
const { dos: C, retain: R } = Je(m, s, 0, g);
|
|
786
787
|
O.push(...C), c || (_.params.textRanges = [{
|
|
787
788
|
startOffset: I + h + R,
|
|
788
789
|
endOffset: I + h + R,
|
|
@@ -796,7 +797,7 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
796
797
|
line: 0,
|
|
797
798
|
segmentId: s
|
|
798
799
|
});
|
|
799
|
-
const v =
|
|
800
|
+
const v = k(f, s);
|
|
800
801
|
return _.params.actions = E.editOp(O.serialize(), v), !!n.syncExecuteCommand(_.id, _.params);
|
|
801
802
|
}
|
|
802
803
|
}, ie = {
|
|
@@ -804,17 +805,17 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
804
805
|
type: A.COMMAND,
|
|
805
806
|
handler: async (o, e) => {
|
|
806
807
|
var C;
|
|
807
|
-
const n = o.get(N), t = o.get(U), { range: s, segmentId: r, unitId: a, direction: c, len: i = 1 } = e, l = t.getUnit(a,
|
|
808
|
+
const n = o.get(N), t = o.get(U), { range: s, segmentId: r, unitId: a, direction: c, len: i = 1 } = e, l = t.getUnit(a, ee.UNIVER_DOC), d = l == null ? void 0 : l.getSelfOrHeaderFooterModel(r).getBody();
|
|
808
809
|
if (l == null || d == null)
|
|
809
810
|
return !1;
|
|
810
|
-
const { startOffset:
|
|
811
|
+
const { startOffset: f } = s, u = d.dataStream, g = c === j.LEFT ? f - i : f, m = g + i - 1, I = (C = d.customRanges) == null ? void 0 : C.filter((R) => Xe(R.startIndex, R.endIndex, g, m)), p = I == null ? void 0 : I.filter((R) => Ve(g, i, R, u)), h = [];
|
|
811
812
|
for (let R = 0; R < i; R++)
|
|
812
|
-
h.push(
|
|
813
|
+
h.push(g + R);
|
|
813
814
|
p == null || p.forEach((R) => {
|
|
814
815
|
h.push(R.startIndex, R.endIndex);
|
|
815
816
|
}), h.sort((R, y) => R - y);
|
|
816
817
|
const S = h[0], _ = {
|
|
817
|
-
id:
|
|
818
|
+
id: G.id,
|
|
818
819
|
params: {
|
|
819
820
|
unitId: a,
|
|
820
821
|
actions: [],
|
|
@@ -825,7 +826,7 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
825
826
|
}],
|
|
826
827
|
debounce: !0
|
|
827
828
|
}
|
|
828
|
-
}, O = new
|
|
829
|
+
}, O = new $(), E = B.getInstance();
|
|
829
830
|
let v = 0;
|
|
830
831
|
for (let R = 0; R < h.length; R++) {
|
|
831
832
|
const y = h[R];
|
|
@@ -840,7 +841,7 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
840
841
|
line: 0
|
|
841
842
|
}), v = y + 1;
|
|
842
843
|
}
|
|
843
|
-
const x =
|
|
844
|
+
const x = k(l, r);
|
|
844
845
|
return _.params.actions = E.editOp(O.serialize(), x), !!n.syncExecuteCommand(_.id, _.params);
|
|
845
846
|
}
|
|
846
847
|
}, jt = {
|
|
@@ -850,14 +851,14 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
850
851
|
const { range: n, segmentId: t, updateBody: s, coverType: r, unitId: a, textRanges: c } = e, i = o.get(N), d = o.get(U).getCurrentUniverDocInstance();
|
|
851
852
|
if (d == null)
|
|
852
853
|
return !1;
|
|
853
|
-
const
|
|
854
|
-
id:
|
|
854
|
+
const f = {
|
|
855
|
+
id: G.id,
|
|
855
856
|
params: {
|
|
856
857
|
unitId: a,
|
|
857
858
|
actions: [],
|
|
858
859
|
textRanges: c
|
|
859
860
|
}
|
|
860
|
-
}, u = new
|
|
861
|
+
}, u = new $(), g = B.getInstance(), { startOffset: m, endOffset: I } = n;
|
|
861
862
|
u.push({
|
|
862
863
|
t: M.RETAIN,
|
|
863
864
|
len: m,
|
|
@@ -869,8 +870,8 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
869
870
|
segmentId: t,
|
|
870
871
|
coverType: r
|
|
871
872
|
});
|
|
872
|
-
const p =
|
|
873
|
-
return
|
|
873
|
+
const p = k(d, t);
|
|
874
|
+
return f.params.actions = g.editOp(u.serialize(), p), !!i.syncExecuteCommand(f.id, f.params);
|
|
874
875
|
}
|
|
875
876
|
};
|
|
876
877
|
function _t(o, e) {
|
|
@@ -895,20 +896,20 @@ const $n = {
|
|
|
895
896
|
const { segmentId: a } = r, c = n.getCurrentUniverDocInstance(), i = c == null ? void 0 : c.getSelfOrHeaderFooterModel(a).getBody();
|
|
896
897
|
if (!c || !i)
|
|
897
898
|
return !1;
|
|
898
|
-
const l = c.getUnitId(), { startOffset: d, endOffset:
|
|
899
|
-
if (
|
|
900
|
-
const p = nn(wt(i,
|
|
899
|
+
const l = c.getUnitId(), { startOffset: d, endOffset: f } = Ye(r, i), g = ((m = i.paragraphs) != null ? m : []).find((p) => p.startIndex >= d);
|
|
900
|
+
if (g && g.startIndex > f) {
|
|
901
|
+
const p = nn(wt(i, f, g.startIndex));
|
|
901
902
|
p.customRanges = (I = p.customRanges) == null ? void 0 : I.map((_) => s.copyCustomRange(l, _));
|
|
902
903
|
const h = {
|
|
903
904
|
startOffset: d,
|
|
904
|
-
endOffset:
|
|
905
|
+
endOffset: g.startIndex,
|
|
905
906
|
collapsed: !1
|
|
906
907
|
};
|
|
907
908
|
return sn(
|
|
908
909
|
p,
|
|
909
910
|
{
|
|
910
911
|
dataStream: b.PARAGRAPH,
|
|
911
|
-
paragraphs: _t(b.PARAGRAPH,
|
|
912
|
+
paragraphs: _t(b.PARAGRAPH, g)
|
|
912
913
|
},
|
|
913
914
|
1,
|
|
914
915
|
0
|
|
@@ -924,34 +925,34 @@ const $n = {
|
|
|
924
925
|
unitId: l,
|
|
925
926
|
body: {
|
|
926
927
|
dataStream: b.PARAGRAPH,
|
|
927
|
-
paragraphs: _t(b.PARAGRAPH,
|
|
928
|
+
paragraphs: _t(b.PARAGRAPH, g)
|
|
928
929
|
},
|
|
929
930
|
range: r,
|
|
930
931
|
segmentId: a
|
|
931
932
|
});
|
|
932
933
|
}
|
|
933
|
-
},
|
|
934
|
+
}, Xs = {
|
|
934
935
|
id: "doc.command.inner-paste",
|
|
935
936
|
type: A.COMMAND,
|
|
936
937
|
handler: async (o, e) => {
|
|
937
|
-
const { segmentId: n, textRanges: t
|
|
938
|
+
const { segmentId: n, textRanges: t, body: s } = e, r = o.get(N), a = o.get(P), c = o.get(U), i = a.getCurrentSelections();
|
|
938
939
|
if (!Array.isArray(i) || i.length === 0)
|
|
939
940
|
return !1;
|
|
940
941
|
const l = c.getCurrentUniverDocInstance(), d = l == null ? void 0 : l.getSelfOrHeaderFooterModel(n).getBody();
|
|
941
942
|
if (l == null || d == null)
|
|
942
943
|
return !1;
|
|
943
|
-
const
|
|
944
|
-
id:
|
|
944
|
+
const f = l.getUnitId(), u = {
|
|
945
|
+
id: G.id,
|
|
945
946
|
params: {
|
|
946
|
-
unitId:
|
|
947
|
+
unitId: f,
|
|
947
948
|
actions: [],
|
|
948
949
|
textRanges: t
|
|
949
950
|
}
|
|
950
|
-
},
|
|
951
|
-
|
|
952
|
-
const m = new
|
|
951
|
+
}, g = new de();
|
|
952
|
+
g.reset();
|
|
953
|
+
const m = new $(), I = B.getInstance();
|
|
953
954
|
for (const S of i) {
|
|
954
|
-
const { startOffset: _, endOffset: O, collapsed: E } = S, v = _ -
|
|
955
|
+
const { startOffset: _, endOffset: O, collapsed: E } = S, v = _ - g.cursor;
|
|
955
956
|
if (E)
|
|
956
957
|
m.push({
|
|
957
958
|
t: M.RETAIN,
|
|
@@ -959,7 +960,7 @@ const $n = {
|
|
|
959
960
|
segmentId: n
|
|
960
961
|
});
|
|
961
962
|
else {
|
|
962
|
-
const { dos: x } = Je(S, n,
|
|
963
|
+
const { dos: x } = Je(S, n, g.cursor, d);
|
|
963
964
|
m.push(...x);
|
|
964
965
|
}
|
|
965
966
|
m.push({
|
|
@@ -968,9 +969,9 @@ const $n = {
|
|
|
968
969
|
len: s.dataStream.length,
|
|
969
970
|
line: 0,
|
|
970
971
|
segmentId: n
|
|
971
|
-
}),
|
|
972
|
+
}), g.reset(), g.moveCursor(O);
|
|
972
973
|
}
|
|
973
|
-
const p =
|
|
974
|
+
const p = k(l, n);
|
|
974
975
|
return u.params.actions = I.editOp(m.serialize(), p), !!r.syncExecuteCommand(u.id, u.params);
|
|
975
976
|
}
|
|
976
977
|
}, kt = {
|
|
@@ -988,8 +989,8 @@ const $n = {
|
|
|
988
989
|
const l = a.getUniverDocInstance(i), d = on(l.getSnapshot(), n);
|
|
989
990
|
if (l == null || d == null)
|
|
990
991
|
return !1;
|
|
991
|
-
const
|
|
992
|
-
id:
|
|
992
|
+
const f = {
|
|
993
|
+
id: G.id,
|
|
993
994
|
params: {
|
|
994
995
|
unitId: i,
|
|
995
996
|
actions: [],
|
|
@@ -997,30 +998,30 @@ const $n = {
|
|
|
997
998
|
}
|
|
998
999
|
}, u = new de();
|
|
999
1000
|
u.reset();
|
|
1000
|
-
const
|
|
1001
|
+
const g = new $(), m = B.getInstance(), I = [];
|
|
1001
1002
|
for (const R of c) {
|
|
1002
|
-
const { startOffset: y, endOffset: D, collapsed:
|
|
1003
|
+
const { startOffset: y, endOffset: D, collapsed: L } = R;
|
|
1003
1004
|
if (y == null || D == null)
|
|
1004
1005
|
continue;
|
|
1005
1006
|
const W = y - u.cursor;
|
|
1006
|
-
|
|
1007
|
+
L ? g.push({
|
|
1007
1008
|
t: M.RETAIN,
|
|
1008
1009
|
len: W,
|
|
1009
1010
|
segmentId: n
|
|
1010
|
-
}) :
|
|
1011
|
+
}) : g.push(...Ke(R, d, n, u.cursor)), u.reset(), u.moveCursor(D);
|
|
1011
1012
|
}
|
|
1012
|
-
const p =
|
|
1013
|
-
I.push(m.editOp(
|
|
1013
|
+
const p = k(l, n);
|
|
1014
|
+
I.push(m.editOp(g.serialize(), p));
|
|
1014
1015
|
const h = jn(d, c), S = (T = l.getDrawings()) != null ? T : {}, _ = (C = l.getDrawingsOrder()) != null ? C : [], O = h.sort((R, y) => _.indexOf(R) > _.indexOf(y) ? -1 : _.indexOf(R) < _.indexOf(y) ? 1 : 0);
|
|
1015
1016
|
if (O.length > 0)
|
|
1016
1017
|
for (const R of O) {
|
|
1017
1018
|
const y = S[R], D = _.indexOf(R);
|
|
1018
1019
|
if (y == null || D < 0)
|
|
1019
1020
|
continue;
|
|
1020
|
-
const
|
|
1021
|
-
I.push(
|
|
1021
|
+
const L = m.removeOp(["drawings", R], y), W = m.removeOp(["drawingsOrder", D], R);
|
|
1022
|
+
I.push(L), I.push(W);
|
|
1022
1023
|
}
|
|
1023
|
-
return
|
|
1024
|
+
return f.params.actions = I.reduce((R, y) => B.compose(R, y), null), !!s.syncExecuteCommand(f.id, f.params);
|
|
1024
1025
|
}
|
|
1025
1026
|
};
|
|
1026
1027
|
function jn(o, e) {
|
|
@@ -1039,37 +1040,39 @@ const qe = {
|
|
|
1039
1040
|
id: "doc.command.delete-custom-block",
|
|
1040
1041
|
type: A.COMMAND,
|
|
1041
1042
|
handler: async (o, e) => {
|
|
1042
|
-
var
|
|
1043
|
+
var y;
|
|
1043
1044
|
const n = o.get(P), t = o.get(U), s = o.get(N), r = n.getActiveRange(), a = t.getCurrentUniverDocInstance();
|
|
1044
1045
|
if (r == null || a == null)
|
|
1045
1046
|
return !1;
|
|
1046
|
-
const { direction: c, range: i, unitId: l, drawingId: d } = e, { startOffset:
|
|
1047
|
+
const { direction: c, range: i, unitId: l, drawingId: d } = e, { startOffset: f, segmentId: u, style: g } = r, m = c === j.LEFT ? f - 1 : f, I = [
|
|
1047
1048
|
{
|
|
1048
1049
|
startOffset: m,
|
|
1049
1050
|
endOffset: m,
|
|
1050
|
-
style:
|
|
1051
|
+
style: g
|
|
1051
1052
|
}
|
|
1052
1053
|
], p = {
|
|
1053
|
-
id:
|
|
1054
|
+
id: G.id,
|
|
1054
1055
|
params: {
|
|
1055
1056
|
unitId: l,
|
|
1056
1057
|
actions: [],
|
|
1057
1058
|
textRanges: I,
|
|
1058
1059
|
prevTextRanges: [i]
|
|
1059
1060
|
}
|
|
1060
|
-
}, h = new
|
|
1061
|
-
|
|
1061
|
+
}, h = new $(), S = B.getInstance(), _ = [];
|
|
1062
|
+
f > 0 && h.push({
|
|
1062
1063
|
t: M.RETAIN,
|
|
1063
|
-
len: c === j.LEFT ?
|
|
1064
|
+
len: c === j.LEFT ? f - 1 : f,
|
|
1064
1065
|
segmentId: u
|
|
1065
1066
|
}), h.push({
|
|
1066
1067
|
t: M.DELETE,
|
|
1067
1068
|
len: 1,
|
|
1068
1069
|
line: 0,
|
|
1069
1070
|
segmentId: u
|
|
1070
|
-
})
|
|
1071
|
-
const O = (
|
|
1072
|
-
|
|
1071
|
+
});
|
|
1072
|
+
const O = k(a, u);
|
|
1073
|
+
_.push(S.editOp(h.serialize(), O));
|
|
1074
|
+
const E = ((y = a.getDrawings()) != null ? y : {})[d], x = a.getDrawingsOrder().indexOf(d), T = S.removeOp(["drawings", d], E), C = S.removeOp(["drawingsOrder", x], d);
|
|
1075
|
+
return _.push(T), _.push(C), p.params.actions = _.reduce((D, L) => B.compose(D, L), null), !!s.syncExecuteCommand(p.id, p.params);
|
|
1073
1076
|
}
|
|
1074
1077
|
}, Qe = {
|
|
1075
1078
|
id: "doc.command.merge-two-paragraph",
|
|
@@ -1080,27 +1083,27 @@ const qe = {
|
|
|
1080
1083
|
const n = o.get(P), t = o.get(U), s = o.get(N), { direction: r, range: a } = e, c = n.getActiveRange(), i = n.getCurrentSelections();
|
|
1081
1084
|
if (c == null || i == null)
|
|
1082
1085
|
return !1;
|
|
1083
|
-
const { segmentId: l, style: d } = c,
|
|
1084
|
-
if (!
|
|
1086
|
+
const { segmentId: l, style: d } = c, f = t.getCurrentUniverDocInstance(), u = f == null ? void 0 : f.getSelfOrHeaderFooterModel(l).getBody();
|
|
1087
|
+
if (!f || !u)
|
|
1085
1088
|
return !1;
|
|
1086
|
-
const
|
|
1089
|
+
const g = Ne(c, u), m = f.getUnitId(), { startOffset: I, collapsed: p } = g;
|
|
1087
1090
|
if (!p)
|
|
1088
1091
|
return !1;
|
|
1089
|
-
const h = r === j.LEFT ? I : I + 1, S = (D = (y = u.paragraphs) == null ? void 0 : y.find((
|
|
1092
|
+
const h = r === j.LEFT ? I : I + 1, S = (D = (y = u.paragraphs) == null ? void 0 : y.find((L) => L.startIndex >= h)) == null ? void 0 : D.startIndex, _ = Hn(o, m, u, h, S), O = r === j.LEFT ? I - 1 : I, E = [
|
|
1090
1093
|
{
|
|
1091
1094
|
startOffset: O,
|
|
1092
1095
|
endOffset: O,
|
|
1093
1096
|
style: d
|
|
1094
1097
|
}
|
|
1095
1098
|
], v = {
|
|
1096
|
-
id:
|
|
1099
|
+
id: G.id,
|
|
1097
1100
|
params: {
|
|
1098
1101
|
unitId: m,
|
|
1099
1102
|
actions: [],
|
|
1100
1103
|
textRanges: E,
|
|
1101
1104
|
prevTextRanges: [a]
|
|
1102
1105
|
}
|
|
1103
|
-
}, x = new
|
|
1106
|
+
}, x = new $(), T = B.getInstance();
|
|
1104
1107
|
x.push({
|
|
1105
1108
|
t: M.RETAIN,
|
|
1106
1109
|
len: r === j.LEFT ? I - 1 : I,
|
|
@@ -1121,7 +1124,7 @@ const qe = {
|
|
|
1121
1124
|
line: 0,
|
|
1122
1125
|
segmentId: l
|
|
1123
1126
|
});
|
|
1124
|
-
const C =
|
|
1127
|
+
const C = k(f, l);
|
|
1125
1128
|
return v.params.actions = T.editOp(x.serialize(), C), !!s.syncExecuteCommand(v.id, v.params);
|
|
1126
1129
|
}
|
|
1127
1130
|
}, kn = {
|
|
@@ -1138,17 +1141,17 @@ const qe = {
|
|
|
1138
1141
|
const a = r.getUnitId(), c = $t(o, a), i = e.getActiveRange(), l = e.getCurrentSelections(), d = c == null ? void 0 : c.getSkeleton();
|
|
1139
1142
|
if (i == null || d == null || l == null)
|
|
1140
1143
|
return !1;
|
|
1141
|
-
const { segmentId:
|
|
1144
|
+
const { segmentId: f, style: u, segmentPage: g } = i, m = r.getSelfOrHeaderFooterModel(f).getBody();
|
|
1142
1145
|
if (m == null)
|
|
1143
1146
|
return !1;
|
|
1144
|
-
const I = Ne(i, m), { startOffset: p, collapsed: h } = I, S = d.findNodeByCharIndex(p,
|
|
1147
|
+
const I = Ne(i, m), { startOffset: p, collapsed: h } = I, S = d.findNodeByCharIndex(p, f, g), _ = _n(S), O = vn(S, m);
|
|
1145
1148
|
let E = p;
|
|
1146
|
-
const v = d.findNodeByCharIndex(p - 1,
|
|
1147
|
-
if (
|
|
1148
|
-
const R =
|
|
1149
|
+
const v = d.findNodeByCharIndex(p - 1, f, g);
|
|
1150
|
+
if (Rn(S) && v !== S && (_ === !0 || O === !0) && h) {
|
|
1151
|
+
const R = xn(S, m);
|
|
1149
1152
|
if (R == null)
|
|
1150
1153
|
return !1;
|
|
1151
|
-
const y = R == null ? void 0 : R.startIndex, D = { startIndex: 0 },
|
|
1154
|
+
const y = R == null ? void 0 : R.startIndex, D = { startIndex: 0 }, L = R.paragraphStyle;
|
|
1152
1155
|
if (_ === !0) {
|
|
1153
1156
|
const X = R.paragraphStyle;
|
|
1154
1157
|
if (X) {
|
|
@@ -1158,7 +1161,7 @@ const qe = {
|
|
|
1158
1161
|
}
|
|
1159
1162
|
} else if (O === !0) {
|
|
1160
1163
|
const X = R.bullet;
|
|
1161
|
-
X && (D.bullet = X),
|
|
1164
|
+
X && (D.bullet = X), L != null && (D.paragraphStyle = { ...L }, delete D.paragraphStyle.hanging, delete D.paragraphStyle.indentStart);
|
|
1162
1165
|
}
|
|
1163
1166
|
const W = [
|
|
1164
1167
|
{
|
|
@@ -1179,7 +1182,7 @@ const qe = {
|
|
|
1179
1182
|
},
|
|
1180
1183
|
textRanges: W,
|
|
1181
1184
|
coverType: Te.REPLACE,
|
|
1182
|
-
segmentId:
|
|
1185
|
+
segmentId: f
|
|
1183
1186
|
});
|
|
1184
1187
|
} else if (h === !0) {
|
|
1185
1188
|
if (v == null)
|
|
@@ -1206,7 +1209,7 @@ const qe = {
|
|
|
1206
1209
|
if (D == null)
|
|
1207
1210
|
return !0;
|
|
1208
1211
|
E -= v.count, E -= D.count;
|
|
1209
|
-
const
|
|
1212
|
+
const L = [
|
|
1210
1213
|
{
|
|
1211
1214
|
startOffset: E,
|
|
1212
1215
|
endOffset: E,
|
|
@@ -1220,24 +1223,24 @@ const qe = {
|
|
|
1220
1223
|
startOffset: i.startOffset - 1,
|
|
1221
1224
|
endOffset: i.endOffset - 1
|
|
1222
1225
|
},
|
|
1223
|
-
segmentId:
|
|
1226
|
+
segmentId: f,
|
|
1224
1227
|
direction: j.LEFT,
|
|
1225
1228
|
len: D.count,
|
|
1226
|
-
textRanges:
|
|
1229
|
+
textRanges: L
|
|
1227
1230
|
});
|
|
1228
1231
|
}
|
|
1229
1232
|
} else
|
|
1230
1233
|
E -= v.count, s = await t.executeCommand(ie.id, {
|
|
1231
1234
|
unitId: r.getUnitId(),
|
|
1232
1235
|
range: I,
|
|
1233
|
-
segmentId:
|
|
1236
|
+
segmentId: f,
|
|
1234
1237
|
direction: j.LEFT,
|
|
1235
1238
|
len: v.count
|
|
1236
1239
|
});
|
|
1237
1240
|
} else {
|
|
1238
1241
|
const R = zt(I, [I]);
|
|
1239
1242
|
s = await t.executeCommand(kt.id, {
|
|
1240
|
-
segmentId:
|
|
1243
|
+
segmentId: f,
|
|
1241
1244
|
textRanges: R,
|
|
1242
1245
|
selections: [I]
|
|
1243
1246
|
});
|
|
@@ -1256,15 +1259,15 @@ const qe = {
|
|
|
1256
1259
|
const s = $t(o, t.getUnitId()), r = o.get(N), a = e.getActiveRange(), c = e.getCurrentSelections(), i = s == null ? void 0 : s.getSkeleton();
|
|
1257
1260
|
if (a == null || i == null || c == null)
|
|
1258
1261
|
return !1;
|
|
1259
|
-
const { segmentId: l, style: d, segmentPage:
|
|
1262
|
+
const { segmentId: l, style: d, segmentPage: f } = a, u = t == null ? void 0 : t.getSelfOrHeaderFooterModel(l).getBody();
|
|
1260
1263
|
if (!t || !u)
|
|
1261
1264
|
return !1;
|
|
1262
|
-
const
|
|
1265
|
+
const g = Ne(a, u, j.RIGHT), { startOffset: m, endOffset: I, collapsed: p } = g;
|
|
1263
1266
|
if (m === u.dataStream.length - 2 && p)
|
|
1264
1267
|
return !0;
|
|
1265
1268
|
let h = !1;
|
|
1266
1269
|
if (p === !0) {
|
|
1267
|
-
const O = i.findNodeByCharIndex(m, l,
|
|
1270
|
+
const O = i.findNodeByCharIndex(m, l, f), E = i.findNodeByCharIndex(m + 1);
|
|
1268
1271
|
if (O.content === "\r")
|
|
1269
1272
|
h = await r.executeCommand(Qe.id, {
|
|
1270
1273
|
direction: j.RIGHT,
|
|
@@ -1315,7 +1318,7 @@ const qe = {
|
|
|
1315
1318
|
];
|
|
1316
1319
|
h = await r.executeCommand(ie.id, {
|
|
1317
1320
|
unitId: t.getUnitId(),
|
|
1318
|
-
range:
|
|
1321
|
+
range: g,
|
|
1319
1322
|
segmentId: l,
|
|
1320
1323
|
direction: j.RIGHT,
|
|
1321
1324
|
textRanges: v,
|
|
@@ -1323,11 +1326,11 @@ const qe = {
|
|
|
1323
1326
|
});
|
|
1324
1327
|
}
|
|
1325
1328
|
} else {
|
|
1326
|
-
const O = zt(
|
|
1329
|
+
const O = zt(g, [g]);
|
|
1327
1330
|
h = await r.executeCommand(kt.id, {
|
|
1328
1331
|
segmentId: l,
|
|
1329
1332
|
textRanges: O,
|
|
1330
|
-
selections: [
|
|
1333
|
+
selections: [g]
|
|
1331
1334
|
});
|
|
1332
1335
|
}
|
|
1333
1336
|
return h;
|
|
@@ -1340,31 +1343,31 @@ function Hn(o, e, n, t, s) {
|
|
|
1340
1343
|
customDecorations: an(n, t, s)
|
|
1341
1344
|
}, d = [];
|
|
1342
1345
|
for (const u of r) {
|
|
1343
|
-
const { st:
|
|
1344
|
-
m <= t ||
|
|
1346
|
+
const { st: g, ed: m } = u;
|
|
1347
|
+
m <= t || g >= s || (g < t ? d.push({
|
|
1345
1348
|
...u,
|
|
1346
1349
|
st: 0,
|
|
1347
1350
|
ed: m - t
|
|
1348
1351
|
}) : m > s ? d.push({
|
|
1349
1352
|
...u,
|
|
1350
|
-
st:
|
|
1353
|
+
st: g - t,
|
|
1351
1354
|
ed: s - t
|
|
1352
1355
|
}) : d.push({
|
|
1353
1356
|
...u,
|
|
1354
|
-
st:
|
|
1357
|
+
st: g - t,
|
|
1355
1358
|
ed: m - t
|
|
1356
1359
|
}));
|
|
1357
1360
|
}
|
|
1358
1361
|
d.length > 0 && (l.textRuns = d);
|
|
1359
|
-
const
|
|
1362
|
+
const f = [];
|
|
1360
1363
|
for (const u of a) {
|
|
1361
|
-
const { startIndex:
|
|
1362
|
-
|
|
1364
|
+
const { startIndex: g } = u;
|
|
1365
|
+
g >= t && g <= s && f.push({
|
|
1363
1366
|
...u,
|
|
1364
|
-
startIndex:
|
|
1367
|
+
startIndex: g - t
|
|
1365
1368
|
});
|
|
1366
1369
|
}
|
|
1367
|
-
return
|
|
1370
|
+
return f.length > 0 && (l.customBlocks = f), l;
|
|
1368
1371
|
}
|
|
1369
1372
|
function zt(o, e) {
|
|
1370
1373
|
let n = o.endOffset;
|
|
@@ -1388,31 +1391,31 @@ const Ht = {
|
|
|
1388
1391
|
const { unitId: n, newText: t, oldTextLen: s, isCompositionEnd: r, isCompositionStart: a } = e, c = o.get(N), i = o.get(Ae), d = o.get(U).getCurrentUniverDocInstance();
|
|
1389
1392
|
if (d == null)
|
|
1390
1393
|
return !1;
|
|
1391
|
-
const
|
|
1392
|
-
if (!
|
|
1394
|
+
const f = i.getActiveRange();
|
|
1395
|
+
if (!f)
|
|
1393
1396
|
return !1;
|
|
1394
|
-
const { startOffset: u, style:
|
|
1397
|
+
const { startOffset: u, style: g, segmentId: m } = f, I = d.getSelfOrHeaderFooterModel(m).getBody();
|
|
1395
1398
|
if (I == null)
|
|
1396
1399
|
return !1;
|
|
1397
|
-
const p = Ye(
|
|
1398
|
-
Object.assign(
|
|
1400
|
+
const p = Ye(f, I);
|
|
1401
|
+
Object.assign(f, p);
|
|
1399
1402
|
const h = t.length, S = [
|
|
1400
1403
|
{
|
|
1401
1404
|
startOffset: u + h,
|
|
1402
1405
|
endOffset: u + h,
|
|
1403
1406
|
collapsed: !0,
|
|
1404
|
-
style:
|
|
1407
|
+
style: g
|
|
1405
1408
|
}
|
|
1406
1409
|
], _ = {
|
|
1407
|
-
id:
|
|
1410
|
+
id: G.id,
|
|
1408
1411
|
params: {
|
|
1409
1412
|
unitId: n,
|
|
1410
1413
|
actions: [],
|
|
1411
1414
|
textRanges: S
|
|
1412
1415
|
}
|
|
1413
|
-
}, O = new
|
|
1414
|
-
if (!
|
|
1415
|
-
const { dos: T, retain: C, cursor: R } = Je(
|
|
1416
|
+
}, O = new $(), E = B.getInstance();
|
|
1417
|
+
if (!f.collapsed && a) {
|
|
1418
|
+
const { dos: T, retain: C, cursor: R } = Je(f, m, 0, I);
|
|
1416
1419
|
O.push(...T), _.params.textRanges = [{
|
|
1417
1420
|
startOffset: u + h + C,
|
|
1418
1421
|
endOffset: u + h + C,
|
|
@@ -1438,7 +1441,7 @@ const Ht = {
|
|
|
1438
1441
|
line: 0,
|
|
1439
1442
|
segmentId: m
|
|
1440
1443
|
});
|
|
1441
|
-
const v =
|
|
1444
|
+
const v = k(d, m);
|
|
1442
1445
|
_.params.actions = E.editOp(O.serialize(), v), _.params.noHistory = !r, _.params.isCompositionEnd = r;
|
|
1443
1446
|
const x = c.syncExecuteCommand(_.id, _.params);
|
|
1444
1447
|
return i.pushUndoRedoMutationParams(x, _.params), !!x;
|
|
@@ -1609,7 +1612,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1609
1612
|
if (l == null)
|
|
1610
1613
|
return !1;
|
|
1611
1614
|
const d = l.getUnitId();
|
|
1612
|
-
let
|
|
1615
|
+
let f;
|
|
1613
1616
|
switch (s) {
|
|
1614
1617
|
case et.id:
|
|
1615
1618
|
case tt.id:
|
|
@@ -1617,7 +1620,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1617
1620
|
case st.id:
|
|
1618
1621
|
case ce.id:
|
|
1619
1622
|
case ot.id: {
|
|
1620
|
-
|
|
1623
|
+
f = Vn(
|
|
1621
1624
|
l.getSelfOrHeaderFooterModel(n).getBody().textRuns,
|
|
1622
1625
|
s,
|
|
1623
1626
|
i
|
|
@@ -1626,18 +1629,18 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1626
1629
|
}
|
|
1627
1630
|
case rt.id:
|
|
1628
1631
|
case at.id: {
|
|
1629
|
-
|
|
1632
|
+
f = t;
|
|
1630
1633
|
break;
|
|
1631
1634
|
}
|
|
1632
1635
|
case it.id:
|
|
1633
1636
|
case ct.id: {
|
|
1634
|
-
|
|
1637
|
+
f = {
|
|
1635
1638
|
rgb: t
|
|
1636
1639
|
};
|
|
1637
1640
|
break;
|
|
1638
1641
|
}
|
|
1639
1642
|
case dt.id: {
|
|
1640
|
-
|
|
1643
|
+
f = {
|
|
1641
1644
|
rgb: null
|
|
1642
1645
|
};
|
|
1643
1646
|
break;
|
|
@@ -1646,13 +1649,13 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1646
1649
|
throw new Error(`Unknown command: ${s} in handleInlineFormat`);
|
|
1647
1650
|
}
|
|
1648
1651
|
const u = {
|
|
1649
|
-
id:
|
|
1652
|
+
id: G.id,
|
|
1650
1653
|
params: {
|
|
1651
1654
|
unitId: d,
|
|
1652
1655
|
actions: [],
|
|
1653
1656
|
textRanges: i.map(se)
|
|
1654
1657
|
}
|
|
1655
|
-
},
|
|
1658
|
+
}, g = new $(), m = B.getInstance(), I = new de();
|
|
1656
1659
|
I.reset();
|
|
1657
1660
|
for (const S of i) {
|
|
1658
1661
|
const { startOffset: _, endOffset: O } = S, E = {
|
|
@@ -1662,24 +1665,24 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1662
1665
|
st: 0,
|
|
1663
1666
|
ed: O - _,
|
|
1664
1667
|
ts: {
|
|
1665
|
-
[Xt[s]]:
|
|
1668
|
+
[Xt[s]]: f
|
|
1666
1669
|
}
|
|
1667
1670
|
}
|
|
1668
1671
|
]
|
|
1669
1672
|
}, v = _ - I.cursor;
|
|
1670
|
-
v !== 0 &&
|
|
1673
|
+
v !== 0 && g.push({
|
|
1671
1674
|
t: M.RETAIN,
|
|
1672
1675
|
len: v,
|
|
1673
1676
|
segmentId: n
|
|
1674
|
-
}),
|
|
1677
|
+
}), g.push({
|
|
1675
1678
|
t: M.RETAIN,
|
|
1676
1679
|
body: E,
|
|
1677
1680
|
len: O - _,
|
|
1678
1681
|
segmentId: n
|
|
1679
1682
|
}), I.reset(), I.moveCursor(O);
|
|
1680
1683
|
}
|
|
1681
|
-
const p =
|
|
1682
|
-
return u.params.actions = m.editOp(
|
|
1684
|
+
const p = k(l, n);
|
|
1685
|
+
return u.params.actions = m.editOp(g.serialize(), p), !!r.syncExecuteCommand(u.id, u.params);
|
|
1683
1686
|
}
|
|
1684
1687
|
};
|
|
1685
1688
|
function Xn(o) {
|
|
@@ -1717,40 +1720,40 @@ const lt = {
|
|
|
1717
1720
|
type: A.COMMAND,
|
|
1718
1721
|
// eslint-disable-next-line max-lines-per-function
|
|
1719
1722
|
handler: (o, e) => {
|
|
1720
|
-
var y, D,
|
|
1723
|
+
var y, D, L, W, X, oe;
|
|
1721
1724
|
const n = o.get(P), t = o.get(U), s = o.get(N), { listType: r } = e, a = t.getCurrentUniverDocInstance(), c = n.getActiveRange();
|
|
1722
1725
|
if (a == null || c == null)
|
|
1723
1726
|
return !1;
|
|
1724
|
-
const { segmentId: i } = c, l = (y = n.getCurrentSelections()) != null ? y : [], d = (D = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : D.paragraphs,
|
|
1727
|
+
const { segmentId: i } = c, l = (y = n.getCurrentSelections()) != null ? y : [], d = (D = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : D.paragraphs, f = l.map(se);
|
|
1725
1728
|
if (d == null)
|
|
1726
1729
|
return !1;
|
|
1727
|
-
const u = (W = (
|
|
1728
|
-
var
|
|
1729
|
-
return ((
|
|
1730
|
+
const u = (W = (L = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : L.sectionBreaks) != null ? W : [], g = Wt(c, d), m = a.getUnitId(), I = g.every((J) => {
|
|
1731
|
+
var z;
|
|
1732
|
+
return ((z = J.bullet) == null ? void 0 : z.listType) === r;
|
|
1730
1733
|
});
|
|
1731
1734
|
let h = ne.generateRandomId(6);
|
|
1732
|
-
if (
|
|
1733
|
-
const J = d.indexOf(
|
|
1734
|
-
|
|
1735
|
+
if (g.length === 1) {
|
|
1736
|
+
const J = d.indexOf(g[0]), z = d[J - 1], Y = d[J + 1];
|
|
1737
|
+
z && z.bullet && z.bullet.listType === r ? h = z.bullet.listId : Y && Y.bullet && Y.bullet.listType === r && (h = Y.bullet.listId);
|
|
1735
1738
|
}
|
|
1736
1739
|
const S = {
|
|
1737
|
-
id:
|
|
1740
|
+
id: G.id,
|
|
1738
1741
|
params: {
|
|
1739
1742
|
unitId: m,
|
|
1740
1743
|
actions: [],
|
|
1741
|
-
textRanges:
|
|
1744
|
+
textRanges: f
|
|
1742
1745
|
}
|
|
1743
1746
|
}, _ = new de();
|
|
1744
1747
|
_.reset();
|
|
1745
|
-
const O = new
|
|
1748
|
+
const O = new $(), E = B.getInstance(), v = (X = a.getSnapshot().lists) != null ? X : {}, x = {
|
|
1746
1749
|
...cn,
|
|
1747
1750
|
...v
|
|
1748
1751
|
}, { defaultTabStop: T = 36 } = a.getSnapshot().documentStyle;
|
|
1749
|
-
for (const J of
|
|
1750
|
-
const { startIndex:
|
|
1752
|
+
for (const J of g) {
|
|
1753
|
+
const { startIndex: z, paragraphStyle: Y = {} } = J, { indentFirstLine: Kt, snapToGrid: Zt, indentStart: be } = Y, { hanging: Pe, indentStart: ut } = x[r].nestingLevel[0], { charSpace: Jt, gridType: qt } = Kn(z, u) || { charSpace: 0, gridType: dn.LINES }, q = On(Jt, T, qt, Zt);
|
|
1751
1754
|
O.push({
|
|
1752
1755
|
t: M.RETAIN,
|
|
1753
|
-
len:
|
|
1756
|
+
len: z - _.cursor,
|
|
1754
1757
|
segmentId: i
|
|
1755
1758
|
}), O.push({
|
|
1756
1759
|
t: M.RETAIN,
|
|
@@ -1788,9 +1791,9 @@ const lt = {
|
|
|
1788
1791
|
},
|
|
1789
1792
|
segmentId: i,
|
|
1790
1793
|
coverType: Te.REPLACE
|
|
1791
|
-
}), _.moveCursorTo(
|
|
1794
|
+
}), _.moveCursorTo(z + 1);
|
|
1792
1795
|
}
|
|
1793
|
-
const C =
|
|
1796
|
+
const C = k(a, i);
|
|
1794
1797
|
return S.params.actions = E.editOp(O.serialize(), C), !!s.syncExecuteCommand(S.id, S.params);
|
|
1795
1798
|
}
|
|
1796
1799
|
}, Wn = {
|
|
@@ -1827,11 +1830,11 @@ const Zn = {
|
|
|
1827
1830
|
id: "doc.command-replace-content",
|
|
1828
1831
|
type: A.COMMAND,
|
|
1829
1832
|
handler: async (o, e) => {
|
|
1830
|
-
const { unitId: n, body: t, textRanges: s, segmentId: r = "", options: a } = e, c = o.get(U), i = o.get(N), l = o.get(P), d = c.getUniverDocInstance(n),
|
|
1831
|
-
if (d == null ||
|
|
1833
|
+
const { unitId: n, body: t, textRanges: s, segmentId: r = "", options: a } = e, c = o.get(U), i = o.get(N), l = o.get(P), d = c.getUniverDocInstance(n), f = d == null ? void 0 : d.getSnapshot().body, u = l.getCurrentSelections();
|
|
1834
|
+
if (d == null || f == null || !Array.isArray(u) || u.length === 0)
|
|
1832
1835
|
return !1;
|
|
1833
|
-
const
|
|
1834
|
-
return
|
|
1836
|
+
const g = Yt(n, r, d, f, t);
|
|
1837
|
+
return g.params.textRanges = s, a && (g.params.options = a), !!i.syncExecuteCommand(g.id, g.params);
|
|
1835
1838
|
}
|
|
1836
1839
|
}, Jn = {
|
|
1837
1840
|
id: "doc.command-cover-content",
|
|
@@ -1849,13 +1852,13 @@ const Zn = {
|
|
|
1849
1852
|
};
|
|
1850
1853
|
function Yt(o, e, n, t, s) {
|
|
1851
1854
|
const r = {
|
|
1852
|
-
id:
|
|
1855
|
+
id: G.id,
|
|
1853
1856
|
params: {
|
|
1854
1857
|
unitId: o,
|
|
1855
1858
|
actions: [],
|
|
1856
1859
|
textRanges: []
|
|
1857
1860
|
}
|
|
1858
|
-
}, a = new
|
|
1861
|
+
}, a = new $(), c = B.getInstance(), i = (t == null ? void 0 : t.dataStream.length) - 2;
|
|
1859
1862
|
i > 0 && a.push({
|
|
1860
1863
|
t: M.DELETE,
|
|
1861
1864
|
len: i,
|
|
@@ -1868,7 +1871,7 @@ function Yt(o, e, n, t, s) {
|
|
|
1868
1871
|
line: 0,
|
|
1869
1872
|
segmentId: e
|
|
1870
1873
|
});
|
|
1871
|
-
const l =
|
|
1874
|
+
const l = k(n, e);
|
|
1872
1875
|
return r.params.actions = c.editOp(a.serialize(), l), r;
|
|
1873
1876
|
}
|
|
1874
1877
|
A.COMMAND;
|
|
@@ -1894,12 +1897,12 @@ const qn = (o, e) => {
|
|
|
1894
1897
|
type: A.COMMAND,
|
|
1895
1898
|
id: "doc.command.set-zoom-ratio",
|
|
1896
1899
|
handler: async (o, e) => {
|
|
1897
|
-
var
|
|
1900
|
+
var f, u, g;
|
|
1898
1901
|
const n = o.get(N), t = o.get(ze), s = o.get(U);
|
|
1899
|
-
let r = (
|
|
1902
|
+
let r = (f = s.getCurrentUniverDocInstance()) == null ? void 0 : f.getUnitId();
|
|
1900
1903
|
if (!r) return !1;
|
|
1901
1904
|
let a = 1;
|
|
1902
|
-
if (e && (r = (u = e.documentId) != null ? u : r, a = (
|
|
1905
|
+
if (e && (r = (u = e.documentId) != null ? u : r, a = (g = e.zoomRatio) != null ? g : a), !s.getUniverDocInstance(r)) return !1;
|
|
1903
1906
|
const i = {
|
|
1904
1907
|
zoomRatio: a,
|
|
1905
1908
|
unitId: r
|
|
@@ -1942,7 +1945,7 @@ var ts = Object.defineProperty, ns = Object.getOwnPropertyDescriptor, ss = (o, e
|
|
|
1942
1945
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
1943
1946
|
return t && s && ts(e, n, s), s;
|
|
1944
1947
|
}, re = (o, e) => (n, t) => e(n, t, o);
|
|
1945
|
-
let Re = class extends
|
|
1948
|
+
let Re = class extends fe {
|
|
1946
1949
|
constructor(e, n, t, s, r) {
|
|
1947
1950
|
super();
|
|
1948
1951
|
w(this, "_previousIMEContent", "");
|
|
@@ -2006,7 +2009,7 @@ Re = ss([
|
|
|
2006
2009
|
re(0, U),
|
|
2007
2010
|
re(1, me),
|
|
2008
2011
|
re(2, Ee),
|
|
2009
|
-
re(3,
|
|
2012
|
+
re(3, te(Ae)),
|
|
2010
2013
|
re(4, N)
|
|
2011
2014
|
], Re);
|
|
2012
2015
|
var os = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, as = (o, e, n, t) => {
|
|
@@ -2014,7 +2017,7 @@ var os = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, as = (o, e
|
|
|
2014
2017
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2015
2018
|
return t && s && os(e, n, s), s;
|
|
2016
2019
|
}, Se = (o, e) => (n, t) => e(n, t, o);
|
|
2017
|
-
let xe = class extends
|
|
2020
|
+
let xe = class extends fe {
|
|
2018
2021
|
constructor(e, n, t, s) {
|
|
2019
2022
|
super();
|
|
2020
2023
|
w(this, "_onInputSubscription");
|
|
@@ -2056,9 +2059,9 @@ let xe = class extends ge {
|
|
|
2056
2059
|
endOffset: i,
|
|
2057
2060
|
style: l,
|
|
2058
2061
|
collapsed: d,
|
|
2059
|
-
direction:
|
|
2062
|
+
direction: f,
|
|
2060
2063
|
segmentId: u,
|
|
2061
|
-
startNodePosition:
|
|
2064
|
+
startNodePosition: g,
|
|
2062
2065
|
endNodePosition: m,
|
|
2063
2066
|
segmentPage: I
|
|
2064
2067
|
} = n;
|
|
@@ -2068,19 +2071,19 @@ let xe = class extends ge {
|
|
|
2068
2071
|
v = Math.min(v, T.startOffset), x = Math.max(x, T.endOffset);
|
|
2069
2072
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2070
2073
|
{
|
|
2071
|
-
startOffset: e ===
|
|
2072
|
-
endOffset: e ===
|
|
2074
|
+
startOffset: e === F.LEFT || e === F.UP ? x : v,
|
|
2075
|
+
endOffset: e === F.LEFT || e === F.UP ? v : x,
|
|
2073
2076
|
style: l
|
|
2074
2077
|
}
|
|
2075
2078
|
], !1);
|
|
2076
2079
|
return;
|
|
2077
2080
|
}
|
|
2078
|
-
const p = d ||
|
|
2079
|
-
let h = d ||
|
|
2081
|
+
const p = d || f === we.FORWARD ? c : i;
|
|
2082
|
+
let h = d || f === we.FORWARD ? i : c;
|
|
2080
2083
|
const S = (O = s.getSelfOrHeaderFooterModel(u).getBody().dataStream.length) != null ? O : Number.POSITIVE_INFINITY;
|
|
2081
|
-
if (e ===
|
|
2084
|
+
if (e === F.LEFT || e === F.RIGHT) {
|
|
2082
2085
|
const v = r.findNodeByCharIndex(h - 1, u, I), x = r.findNodeByCharIndex(h, u, I);
|
|
2083
|
-
h = e ===
|
|
2086
|
+
h = e === F.RIGHT ? h + x.count : h - ((E = v == null ? void 0 : v.count) != null ? E : 0), h = Math.min(S - 2, Math.max(0, h)), this._textSelectionManagerService.replaceTextRanges([
|
|
2084
2087
|
{
|
|
2085
2088
|
startOffset: p,
|
|
2086
2089
|
endOffset: h,
|
|
@@ -2088,9 +2091,9 @@ let xe = class extends ge {
|
|
|
2088
2091
|
}
|
|
2089
2092
|
], !1);
|
|
2090
2093
|
} else {
|
|
2091
|
-
const v = r.findNodeByCharIndex(h, u, I), x = a.document.getOffsetConfig(), T = d ?
|
|
2094
|
+
const v = r.findNodeByCharIndex(h, u, I), x = a.document.getOffsetConfig(), T = d ? g : f === we.FORWARD ? m : g, C = this._getTopOrBottomPosition(r, v, T, e === F.DOWN);
|
|
2092
2095
|
if (C == null) {
|
|
2093
|
-
const y = e ===
|
|
2096
|
+
const y = e === F.UP ? 0 : S - 2;
|
|
2094
2097
|
if (y === h)
|
|
2095
2098
|
return;
|
|
2096
2099
|
this._textSelectionManagerService.replaceTextRanges([
|
|
@@ -2124,27 +2127,27 @@ let xe = class extends ge {
|
|
|
2124
2127
|
const r = (S = this._renderManagerService.getRenderById(s.getUnitId())) == null ? void 0 : S.with(V).getSkeleton(), a = this._getDocObject(), c = s.getBody();
|
|
2125
2128
|
if (n == null || r == null || a == null || t == null || c == null)
|
|
2126
2129
|
return;
|
|
2127
|
-
const { startOffset: i, endOffset: l, style: d, collapsed:
|
|
2128
|
-
if (e ===
|
|
2130
|
+
const { startOffset: i, endOffset: l, style: d, collapsed: f, segmentId: u, startNodePosition: g, endNodePosition: m, segmentPage: I } = n, p = (_ = s.getSelfOrHeaderFooterModel(u).getBody().dataStream.length) != null ? _ : Number.POSITIVE_INFINITY, h = (O = s.getCustomRanges()) != null ? O : [];
|
|
2131
|
+
if (e === F.LEFT || e === F.RIGHT) {
|
|
2129
2132
|
let v;
|
|
2130
2133
|
if (!n.collapsed || t.length > 1) {
|
|
2131
2134
|
let C = Number.POSITIVE_INFINITY, R = Number.NEGATIVE_INFINITY;
|
|
2132
2135
|
for (const y of t)
|
|
2133
2136
|
C = Math.min(C, y.startOffset), R = Math.max(R, y.endOffset);
|
|
2134
|
-
v = e ===
|
|
2137
|
+
v = e === F.LEFT ? C : R;
|
|
2135
2138
|
} else {
|
|
2136
2139
|
const C = r.findNodeByCharIndex(i - 1, u, I), R = r.findNodeByCharIndex(i, u, I);
|
|
2137
|
-
e ===
|
|
2140
|
+
e === F.LEFT ? v = Math.max(0, i - ((E = C == null ? void 0 : C.count) != null ? E : 0)) : v = Math.min(p - 2, l + R.count);
|
|
2138
2141
|
}
|
|
2139
2142
|
const x = [b.CUSTOM_RANGE_START, b.CUSTOM_RANGE_END];
|
|
2140
|
-
if (e ===
|
|
2143
|
+
if (e === F.LEFT)
|
|
2141
2144
|
for (; x.includes(c.dataStream[v]); )
|
|
2142
2145
|
v--;
|
|
2143
2146
|
else
|
|
2144
2147
|
for (; x.includes(c.dataStream[v - 1]); )
|
|
2145
2148
|
v++;
|
|
2146
2149
|
h.filter((C) => C.wholeEntity && C.startIndex < v && C.endIndex >= v).forEach((C) => {
|
|
2147
|
-
e ===
|
|
2150
|
+
e === F.LEFT ? v = Math.min(C.startIndex, v) : v = Math.max(C.endIndex + 1, v);
|
|
2148
2151
|
}), this._textSelectionManagerService.replaceTextRanges([
|
|
2149
2152
|
{
|
|
2150
2153
|
startOffset: v,
|
|
@@ -2155,13 +2158,13 @@ let xe = class extends ge {
|
|
|
2155
2158
|
} else {
|
|
2156
2159
|
const v = r.findNodeByCharIndex(i, u, I), x = r.findNodeByCharIndex(l, u, I), T = a.document.getOffsetConfig(), C = this._getTopOrBottomPosition(
|
|
2157
2160
|
r,
|
|
2158
|
-
e ===
|
|
2159
|
-
e ===
|
|
2160
|
-
e ===
|
|
2161
|
+
e === F.UP || f ? v : x,
|
|
2162
|
+
e === F.UP || f ? g : m,
|
|
2163
|
+
e === F.DOWN
|
|
2161
2164
|
);
|
|
2162
2165
|
if (C == null) {
|
|
2163
2166
|
let y;
|
|
2164
|
-
|
|
2167
|
+
f ? y = e === F.UP ? 0 : p - 2 : y = e === F.UP ? i : l, this._textSelectionManagerService.replaceTextRanges([
|
|
2165
2168
|
{
|
|
2166
2169
|
startOffset: y,
|
|
2167
2170
|
endOffset: y,
|
|
@@ -2206,7 +2209,7 @@ let xe = class extends ge {
|
|
|
2206
2209
|
for (const c of n.divides) {
|
|
2207
2210
|
const i = c.left;
|
|
2208
2211
|
for (const l of c.glyphGroup) {
|
|
2209
|
-
const { left: d } = l,
|
|
2212
|
+
const { left: d } = l, f = i + d, u = Math.abs(t - f);
|
|
2210
2213
|
u < r.distance && (r.glyph = l, r.distance = u);
|
|
2211
2214
|
}
|
|
2212
2215
|
}
|
|
@@ -2250,13 +2253,13 @@ let xe = class extends ge {
|
|
|
2250
2253
|
const d = i.parent;
|
|
2251
2254
|
if (d == null)
|
|
2252
2255
|
return;
|
|
2253
|
-
const
|
|
2254
|
-
if (
|
|
2256
|
+
const f = d.sections.indexOf(i);
|
|
2257
|
+
if (f === -1)
|
|
2255
2258
|
return;
|
|
2256
2259
|
if (n === !0)
|
|
2257
|
-
c = (S = (h = d.sections[
|
|
2260
|
+
c = (S = (h = d.sections[f - 1]) == null ? void 0 : h.columns[0]) == null ? void 0 : S.lines[0];
|
|
2258
2261
|
else {
|
|
2259
|
-
const R = (O = (_ = d.sections) == null ? void 0 : _[
|
|
2262
|
+
const R = (O = (_ = d.sections) == null ? void 0 : _[f - 1]) == null ? void 0 : O.columns, y = R == null ? void 0 : R[R.length - 1], D = y == null ? void 0 : y.lines;
|
|
2260
2263
|
c = D == null ? void 0 : D[D.length - 1];
|
|
2261
2264
|
}
|
|
2262
2265
|
if (c != null)
|
|
@@ -2264,16 +2267,16 @@ let xe = class extends ge {
|
|
|
2264
2267
|
const u = d.parent;
|
|
2265
2268
|
if (u == null)
|
|
2266
2269
|
return;
|
|
2267
|
-
const
|
|
2268
|
-
if (
|
|
2270
|
+
const g = u.pages.indexOf(d);
|
|
2271
|
+
if (g !== -1) {
|
|
2269
2272
|
if (n === !0)
|
|
2270
|
-
c = (x = (v = (E = u.pages[
|
|
2273
|
+
c = (x = (v = (E = u.pages[g + 1]) == null ? void 0 : E.sections[0]) == null ? void 0 : v.columns[0]) == null ? void 0 : x.lines[0];
|
|
2271
2274
|
else {
|
|
2272
|
-
const R = (T = u.pages[
|
|
2275
|
+
const R = (T = u.pages[g - 1]) == null ? void 0 : T.sections;
|
|
2273
2276
|
if (R == null)
|
|
2274
2277
|
return;
|
|
2275
|
-
const y = (C = R[R.length - 1]) == null ? void 0 : C.columns, D = y[y.length - 1],
|
|
2276
|
-
c =
|
|
2278
|
+
const y = (C = R[R.length - 1]) == null ? void 0 : C.columns, D = y[y.length - 1], L = D == null ? void 0 : D.lines;
|
|
2279
|
+
c = L[L.length - 1];
|
|
2277
2280
|
}
|
|
2278
2281
|
if (c != null)
|
|
2279
2282
|
return c;
|
|
@@ -2287,7 +2290,7 @@ xe = as([
|
|
|
2287
2290
|
le(ue.Rendered, xe),
|
|
2288
2291
|
Se(0, U),
|
|
2289
2292
|
Se(1, me),
|
|
2290
|
-
Se(2,
|
|
2293
|
+
Se(2, te(P)),
|
|
2291
2294
|
Se(3, N)
|
|
2292
2295
|
], xe);
|
|
2293
2296
|
var is = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, ds = (o, e, n, t) => {
|
|
@@ -2295,7 +2298,7 @@ var is = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, ds = (o, e
|
|
|
2295
2298
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2296
2299
|
return t && s && is(e, n, s), s;
|
|
2297
2300
|
}, Ie = (o, e) => (n, t) => e(n, t, o);
|
|
2298
|
-
let Oe = class extends
|
|
2301
|
+
let Oe = class extends fe {
|
|
2299
2302
|
constructor(e, n, t, s) {
|
|
2300
2303
|
super();
|
|
2301
2304
|
w(this, "_onInputSubscription");
|
|
@@ -2319,13 +2322,13 @@ let Oe = class extends ge {
|
|
|
2319
2322
|
const t = n.getUnitId(), { event: s, content: r = "", activeRange: a } = e, c = s, i = (I = this._renderManagerService.getRenderById(n.getUnitId())) == null ? void 0 : I.with(V).getSkeleton();
|
|
2320
2323
|
if (c.data == null || i == null || !i || !a)
|
|
2321
2324
|
return;
|
|
2322
|
-
const { startOffset: l, segmentId: d, style:
|
|
2325
|
+
const { startOffset: l, segmentId: d, style: f, segmentPage: u } = a, g = r.length, m = [
|
|
2323
2326
|
{
|
|
2324
|
-
startOffset: l +
|
|
2325
|
-
endOffset: l +
|
|
2327
|
+
startOffset: l + g,
|
|
2328
|
+
endOffset: l + g,
|
|
2326
2329
|
segmentId: d,
|
|
2327
2330
|
segmentPage: u,
|
|
2328
|
-
style:
|
|
2331
|
+
style: f
|
|
2329
2332
|
}
|
|
2330
2333
|
];
|
|
2331
2334
|
await this._commandService.executeCommand(ye.id, {
|
|
@@ -2356,22 +2359,22 @@ const pe = {
|
|
|
2356
2359
|
const n = o.get(P), t = o.get(U), s = o.get(N), { alignType: r } = e, a = t.getCurrentUniverDocInstance(), c = n.getActiveRange();
|
|
2357
2360
|
if (a == null || c == null)
|
|
2358
2361
|
return !1;
|
|
2359
|
-
const { segmentId: i } = c, l = (E = n.getCurrentSelections()) != null ? E : [], d = (v = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : v.paragraphs,
|
|
2362
|
+
const { segmentId: i } = c, l = (E = n.getCurrentSelections()) != null ? E : [], d = (v = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : v.paragraphs, f = l.map(se);
|
|
2360
2363
|
if (d == null)
|
|
2361
2364
|
return !1;
|
|
2362
|
-
const u = Wt(c, d),
|
|
2365
|
+
const u = Wt(c, d), g = a.getUnitId(), m = u.every((x) => {
|
|
2363
2366
|
var T;
|
|
2364
2367
|
return ((T = x.paragraphStyle) == null ? void 0 : T.horizontalAlign) === r;
|
|
2365
2368
|
}), I = {
|
|
2366
|
-
id:
|
|
2369
|
+
id: G.id,
|
|
2367
2370
|
params: {
|
|
2368
|
-
unitId:
|
|
2371
|
+
unitId: g,
|
|
2369
2372
|
actions: [],
|
|
2370
|
-
textRanges:
|
|
2373
|
+
textRanges: f
|
|
2371
2374
|
}
|
|
2372
2375
|
}, p = new de();
|
|
2373
2376
|
p.reset();
|
|
2374
|
-
const h = new
|
|
2377
|
+
const h = new $(), S = B.getInstance();
|
|
2375
2378
|
for (const x of u) {
|
|
2376
2379
|
const { startIndex: T } = x;
|
|
2377
2380
|
h.push({
|
|
@@ -2381,7 +2384,7 @@ const pe = {
|
|
|
2381
2384
|
});
|
|
2382
2385
|
const C = {
|
|
2383
2386
|
...x.paragraphStyle,
|
|
2384
|
-
horizontalAlign: m ?
|
|
2387
|
+
horizontalAlign: m ? ge.UNSPECIFIED : r
|
|
2385
2388
|
};
|
|
2386
2389
|
h.push({
|
|
2387
2390
|
t: M.RETAIN,
|
|
@@ -2400,32 +2403,32 @@ const pe = {
|
|
|
2400
2403
|
coverType: Te.REPLACE
|
|
2401
2404
|
}), p.moveCursorTo(T + 1);
|
|
2402
2405
|
}
|
|
2403
|
-
const _ =
|
|
2406
|
+
const _ = k(a, i);
|
|
2404
2407
|
return I.params.actions = S.editOp(h.serialize(), _), !!s.syncExecuteCommand(I.id, I.params);
|
|
2405
2408
|
}
|
|
2406
2409
|
}, ls = {
|
|
2407
2410
|
id: "doc.command.align-left",
|
|
2408
2411
|
type: A.COMMAND,
|
|
2409
2412
|
handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
|
|
2410
|
-
alignType:
|
|
2413
|
+
alignType: ge.LEFT
|
|
2411
2414
|
})
|
|
2412
2415
|
}, us = {
|
|
2413
2416
|
id: "doc.command.align-center",
|
|
2414
2417
|
type: A.COMMAND,
|
|
2415
2418
|
handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
|
|
2416
|
-
alignType:
|
|
2419
|
+
alignType: ge.CENTER
|
|
2417
2420
|
})
|
|
2418
|
-
},
|
|
2421
|
+
}, fs = {
|
|
2419
2422
|
id: "doc.command.align-right",
|
|
2420
2423
|
type: A.COMMAND,
|
|
2421
2424
|
handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
|
|
2422
|
-
alignType:
|
|
2425
|
+
alignType: ge.RIGHT
|
|
2423
2426
|
})
|
|
2424
|
-
},
|
|
2427
|
+
}, gs = {
|
|
2425
2428
|
id: "doc.command.align-justify",
|
|
2426
2429
|
type: A.COMMAND,
|
|
2427
2430
|
handler: (o) => o.get(N).syncExecuteCommand(pe.id, {
|
|
2428
|
-
alignType:
|
|
2431
|
+
alignType: ge.JUSTIFIED
|
|
2429
2432
|
})
|
|
2430
2433
|
};
|
|
2431
2434
|
var ms = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, ps = (o, e, n, t) => {
|
|
@@ -2433,7 +2436,7 @@ var ms = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, ps = (o, e
|
|
|
2433
2436
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2434
2437
|
return t && s && ms(e, n, s), s;
|
|
2435
2438
|
}, Be = (o, e) => (n, t) => e(n, t, o);
|
|
2436
|
-
let Ce = class extends
|
|
2439
|
+
let Ce = class extends fe {
|
|
2437
2440
|
constructor(o, e, n) {
|
|
2438
2441
|
super(), this._commandService = o, this._textSelectionManagerService = e, this._univerInstanceService = n, this._initSelectionChange();
|
|
2439
2442
|
}
|
|
@@ -2468,7 +2471,7 @@ let Ce = class extends ge {
|
|
|
2468
2471
|
Ce = ps([
|
|
2469
2472
|
le(ue.Ready, Ce),
|
|
2470
2473
|
Be(0, N),
|
|
2471
|
-
Be(1,
|
|
2474
|
+
Be(1, te(P)),
|
|
2472
2475
|
Be(2, U)
|
|
2473
2476
|
], Ce);
|
|
2474
2477
|
var Ss = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, _s = (o, e, n, t) => {
|
|
@@ -2507,7 +2510,7 @@ let Dt = (_e = class extends un {
|
|
|
2507
2510
|
jt,
|
|
2508
2511
|
Ht,
|
|
2509
2512
|
Qe,
|
|
2510
|
-
|
|
2513
|
+
G,
|
|
2511
2514
|
Zn,
|
|
2512
2515
|
Jn,
|
|
2513
2516
|
Qn,
|
|
@@ -2519,9 +2522,9 @@ let Dt = (_e = class extends un {
|
|
|
2519
2522
|
lt,
|
|
2520
2523
|
ls,
|
|
2521
2524
|
us,
|
|
2522
|
-
|
|
2525
|
+
fs,
|
|
2523
2526
|
pe,
|
|
2524
|
-
|
|
2527
|
+
gs
|
|
2525
2528
|
].forEach((o) => {
|
|
2526
2529
|
this._injector.get(N).registerCommand(o);
|
|
2527
2530
|
});
|
|
@@ -2534,7 +2537,7 @@ let Dt = (_e = class extends un {
|
|
|
2534
2537
|
[
|
|
2535
2538
|
Ee,
|
|
2536
2539
|
{
|
|
2537
|
-
useClass:
|
|
2540
|
+
useClass: Cn
|
|
2538
2541
|
}
|
|
2539
2542
|
],
|
|
2540
2543
|
[P],
|
|
@@ -2546,15 +2549,15 @@ let Dt = (_e = class extends un {
|
|
|
2546
2549
|
[Ce]
|
|
2547
2550
|
].forEach((e) => o.add(e));
|
|
2548
2551
|
}
|
|
2549
|
-
}, w(_e, "pluginName", Rs), w(_e, "type",
|
|
2552
|
+
}, w(_e, "pluginName", Rs), w(_e, "type", ee.UNIVER_DOC), _e);
|
|
2550
2553
|
Dt = _s([
|
|
2551
|
-
vs(1,
|
|
2554
|
+
vs(1, te(Mn))
|
|
2552
2555
|
], Dt);
|
|
2553
2556
|
function xs(o, e) {
|
|
2554
2557
|
const { range: n, rangeId: t, rangeType: s, segmentId: r } = o, a = Un(n, e);
|
|
2555
2558
|
if (!a)
|
|
2556
2559
|
return null;
|
|
2557
|
-
const { startOffset: c, endOffset: i } = a, l = new
|
|
2560
|
+
const { startOffset: c, endOffset: i } = a, l = new $();
|
|
2558
2561
|
return c > 0 && l.push({
|
|
2559
2562
|
t: M.RETAIN,
|
|
2560
2563
|
len: c,
|
|
@@ -2590,9 +2593,9 @@ function xs(o, e) {
|
|
|
2590
2593
|
line: 0
|
|
2591
2594
|
}), l;
|
|
2592
2595
|
}
|
|
2593
|
-
function
|
|
2596
|
+
function Vs(o, e) {
|
|
2594
2597
|
const n = {
|
|
2595
|
-
id:
|
|
2598
|
+
id: G.id,
|
|
2596
2599
|
params: {
|
|
2597
2600
|
unitId: o.unitId,
|
|
2598
2601
|
actions: [],
|
|
@@ -2601,28 +2604,28 @@ function Xs(o, e) {
|
|
|
2601
2604
|
}, t = B.getInstance(), s = xs(o, e);
|
|
2602
2605
|
return s ? (n.params.actions = t.editOp(s.serialize()), n) : !1;
|
|
2603
2606
|
}
|
|
2604
|
-
function
|
|
2607
|
+
function Ws(o, e) {
|
|
2605
2608
|
var v;
|
|
2606
2609
|
const { segmentId: n, rangeId: t, rangeType: s, wholeEntity: r } = e, a = o.get(P), c = o.get(U), i = a.getActiveRange();
|
|
2607
2610
|
if (!i)
|
|
2608
2611
|
return !1;
|
|
2609
|
-
const l = c.getCurrentUnitForType(
|
|
2612
|
+
const l = c.getCurrentUnitForType(ee.UNIVER_DOC);
|
|
2610
2613
|
if (!l)
|
|
2611
2614
|
return !1;
|
|
2612
|
-
const d = l.getBody(),
|
|
2615
|
+
const d = l.getBody(), f = l.getUnitId();
|
|
2613
2616
|
if (!d)
|
|
2614
2617
|
return !1;
|
|
2615
|
-
const { startOffset: u, endOffset:
|
|
2618
|
+
const { startOffset: u, endOffset: g } = he(i), m = (v = d.customRanges) != null ? v : [], I = [];
|
|
2616
2619
|
for (let x = 0, T = m.length; x < T; x++) {
|
|
2617
2620
|
const C = m[x];
|
|
2618
|
-
if (C.rangeType === s && Math.max(C.startIndex, u) <= Math.min(C.endIndex,
|
|
2621
|
+
if (C.rangeType === s && Math.max(C.startIndex, u) <= Math.min(C.endIndex, g - 1) && I.push({ ...C }), C.startIndex >= g)
|
|
2619
2622
|
break;
|
|
2620
2623
|
}
|
|
2621
2624
|
const p = I.map((x) => [x.startIndex, x.endIndex]).flat().sort((x, T) => x - T);
|
|
2622
2625
|
let h = 0;
|
|
2623
|
-
const S = new
|
|
2626
|
+
const S = new $(), _ = p.length ? {
|
|
2624
2627
|
startOffset: Math.min(p[0], u),
|
|
2625
|
-
endOffset: Math.max(p[p.length - 1] + 1,
|
|
2628
|
+
endOffset: Math.max(p[p.length - 1] + 1, g)
|
|
2626
2629
|
} : i;
|
|
2627
2630
|
_.startOffset !== h && (S.push({
|
|
2628
2631
|
t: M.RETAIN,
|
|
@@ -2670,9 +2673,9 @@ function Vs(o, e) {
|
|
|
2670
2673
|
segmentId: n
|
|
2671
2674
|
});
|
|
2672
2675
|
const O = B.getInstance(), E = {
|
|
2673
|
-
id:
|
|
2676
|
+
id: G.id,
|
|
2674
2677
|
params: {
|
|
2675
|
-
unitId:
|
|
2678
|
+
unitId: f,
|
|
2676
2679
|
actions: [],
|
|
2677
2680
|
textRanges: void 0
|
|
2678
2681
|
}
|
|
@@ -2680,14 +2683,14 @@ function Vs(o, e) {
|
|
|
2680
2683
|
return E.params.actions = O.editOp(S.serialize()), E;
|
|
2681
2684
|
}
|
|
2682
2685
|
function Os(o, e) {
|
|
2683
|
-
var u,
|
|
2686
|
+
var u, g;
|
|
2684
2687
|
const { unitId: n, rangeId: t, segmentId: s } = e, a = o.get(U).getUnit(n);
|
|
2685
2688
|
if (!a)
|
|
2686
2689
|
return !1;
|
|
2687
|
-
const c = (
|
|
2690
|
+
const c = (g = (u = a.getBody()) == null ? void 0 : u.customRanges) == null ? void 0 : g.find((m) => m.rangeId === t);
|
|
2688
2691
|
if (!c)
|
|
2689
2692
|
return !1;
|
|
2690
|
-
const { startIndex: i, endIndex: l } = c, d = new
|
|
2693
|
+
const { startIndex: i, endIndex: l } = c, d = new $(), f = l - i + 1;
|
|
2691
2694
|
return i > 0 && d.push({
|
|
2692
2695
|
t: M.RETAIN,
|
|
2693
2696
|
len: i,
|
|
@@ -2697,9 +2700,9 @@ function Os(o, e) {
|
|
|
2697
2700
|
len: 1,
|
|
2698
2701
|
segmentId: s,
|
|
2699
2702
|
line: 0
|
|
2700
|
-
}),
|
|
2703
|
+
}), f - 2 > 0 && d.push({
|
|
2701
2704
|
t: M.RETAIN,
|
|
2702
|
-
len:
|
|
2705
|
+
len: f - 2,
|
|
2703
2706
|
segmentId: s
|
|
2704
2707
|
}), d.push({
|
|
2705
2708
|
t: M.DELETE,
|
|
@@ -2708,9 +2711,9 @@ function Os(o, e) {
|
|
|
2708
2711
|
line: 0
|
|
2709
2712
|
}), d;
|
|
2710
2713
|
}
|
|
2711
|
-
function
|
|
2714
|
+
function Ys(o, e) {
|
|
2712
2715
|
const n = {
|
|
2713
|
-
id:
|
|
2716
|
+
id: G.id,
|
|
2714
2717
|
params: {
|
|
2715
2718
|
unitId: e.unitId,
|
|
2716
2719
|
actions: [],
|
|
@@ -2721,13 +2724,13 @@ function Ws(o, e) {
|
|
|
2721
2724
|
}
|
|
2722
2725
|
function Cs(o) {
|
|
2723
2726
|
const { unitId: e, range: n, id: t, type: s, segmentId: r } = o, { startOffset: a, endOffset: c } = n, i = {
|
|
2724
|
-
id:
|
|
2727
|
+
id: G.id,
|
|
2725
2728
|
params: {
|
|
2726
2729
|
unitId: e,
|
|
2727
2730
|
actions: [],
|
|
2728
2731
|
textRanges: void 0
|
|
2729
2732
|
}
|
|
2730
|
-
}, l = new
|
|
2733
|
+
}, l = new $(), d = B.getInstance();
|
|
2731
2734
|
return a > 0 && l.push({
|
|
2732
2735
|
t: M.RETAIN,
|
|
2733
2736
|
len: a,
|
|
@@ -2747,11 +2750,11 @@ function Cs(o) {
|
|
|
2747
2750
|
segmentId: r
|
|
2748
2751
|
}), i.params.actions = d.editOp(l.serialize()), i;
|
|
2749
2752
|
}
|
|
2750
|
-
function
|
|
2753
|
+
function Ks(o, e) {
|
|
2751
2754
|
const { segmentId: n, id: t, type: s } = e, r = o.get(P), a = o.get(U), c = r.getActiveRange();
|
|
2752
2755
|
if (!c)
|
|
2753
2756
|
return !1;
|
|
2754
|
-
const i = a.getCurrentUnitForType(
|
|
2757
|
+
const i = a.getCurrentUnitForType(ee.UNIVER_DOC);
|
|
2755
2758
|
if (!i)
|
|
2756
2759
|
return !1;
|
|
2757
2760
|
const l = i.getBody(), d = i.getUnitId();
|
|
@@ -2769,7 +2772,7 @@ function Ys(o, e) {
|
|
|
2769
2772
|
}
|
|
2770
2773
|
) : !1;
|
|
2771
2774
|
}
|
|
2772
|
-
function
|
|
2775
|
+
function Zs(o, e) {
|
|
2773
2776
|
var I, p;
|
|
2774
2777
|
const { unitId: n, id: t, segmentId: s } = e, a = o.get(U).getUnit(n), c = a == null ? void 0 : a.getBody();
|
|
2775
2778
|
if (!a || !c)
|
|
@@ -2781,14 +2784,14 @@ function Ks(o, e) {
|
|
|
2781
2784
|
var _;
|
|
2782
2785
|
const S = ne.deepClone(h);
|
|
2783
2786
|
return S.customDecorations = (_ = S.customDecorations) == null ? void 0 : _.filter((O) => O.id !== t), S;
|
|
2784
|
-
}),
|
|
2785
|
-
id:
|
|
2787
|
+
}), f = {
|
|
2788
|
+
id: G.id,
|
|
2786
2789
|
params: {
|
|
2787
2790
|
unitId: n,
|
|
2788
2791
|
actions: [],
|
|
2789
2792
|
textRanges: void 0
|
|
2790
2793
|
}
|
|
2791
|
-
}, u = new
|
|
2794
|
+
}, u = new $(), g = B.getInstance();
|
|
2792
2795
|
let m = 0;
|
|
2793
2796
|
return i.forEach((h, S) => {
|
|
2794
2797
|
const _ = d[S], O = l[S];
|
|
@@ -2804,7 +2807,7 @@ function Ks(o, e) {
|
|
|
2804
2807
|
oldBody: O,
|
|
2805
2808
|
coverType: Te.REPLACE
|
|
2806
2809
|
}), m = m + (h.endIndex - h.startIndex + 1);
|
|
2807
|
-
}),
|
|
2810
|
+
}), f.params.actions = g.editOp(u.serialize()), f;
|
|
2808
2811
|
}
|
|
2809
2812
|
const Ms = Lt("CUSTOM_RANGE"), ys = Lt("CUSTOM_DECORATION"), Le = {
|
|
2810
2813
|
CUSTOM_RANGE: Ms,
|
|
@@ -2815,7 +2818,7 @@ var Ts = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, As = (o, e
|
|
|
2815
2818
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2816
2819
|
return t && s && Ts(e, n, s), s;
|
|
2817
2820
|
}, Ns = (o, e) => (n, t) => e(n, t, o);
|
|
2818
|
-
let Fe = class extends
|
|
2821
|
+
let Fe = class extends fe {
|
|
2819
2822
|
constructor(e, n) {
|
|
2820
2823
|
super();
|
|
2821
2824
|
w(this, "_interceptorsByName", /* @__PURE__ */ new Map());
|
|
@@ -2841,14 +2844,14 @@ let Fe = class extends ge {
|
|
|
2841
2844
|
var c, i;
|
|
2842
2845
|
return ((c = a.priority) != null ? c : 0) - ((i = r.priority) != null ? i : 0);
|
|
2843
2846
|
})
|
|
2844
|
-
), this.disposeWithMe(Pt(() =>
|
|
2847
|
+
), this.disposeWithMe(Pt(() => gn(this._interceptorsByName.get(t), n)));
|
|
2845
2848
|
}
|
|
2846
2849
|
fetchThroughInterceptors(e) {
|
|
2847
2850
|
const n = e, t = this._interceptorsByName.get(n);
|
|
2848
|
-
return
|
|
2851
|
+
return mn(t || []);
|
|
2849
2852
|
}
|
|
2850
2853
|
interceptDocumentViewModel(e) {
|
|
2851
|
-
const n = new
|
|
2854
|
+
const n = new hn();
|
|
2852
2855
|
return n.add(e.registerCustomRangeInterceptor({
|
|
2853
2856
|
getCustomRange: (t) => {
|
|
2854
2857
|
var s;
|
|
@@ -2877,23 +2880,23 @@ let Fe = class extends ge {
|
|
|
2877
2880
|
};
|
|
2878
2881
|
Fe = As([
|
|
2879
2882
|
le(ue.Starting, Fe),
|
|
2880
|
-
Ns(1,
|
|
2883
|
+
Ns(1, te(V))
|
|
2881
2884
|
], Fe);
|
|
2882
|
-
const
|
|
2885
|
+
const Js = (o) => o.body ? o.body.dataStream.slice(0, -2).replaceAll(b.CUSTOM_RANGE_START, "").replaceAll(b.CUSTOM_RANGE_END, "") : "";
|
|
2883
2886
|
export {
|
|
2884
2887
|
us as AlignCenterCommand,
|
|
2885
|
-
|
|
2888
|
+
gs as AlignJustifyCommand,
|
|
2886
2889
|
ls as AlignLeftCommand,
|
|
2887
2890
|
pe as AlignOperationCommand,
|
|
2888
|
-
|
|
2891
|
+
fs as AlignRightCommand,
|
|
2889
2892
|
$n as BreakLineCommand,
|
|
2890
2893
|
Wn as BulletListCommand,
|
|
2891
2894
|
Jn as CoverContentCommand,
|
|
2892
2895
|
kt as CutContentCommand,
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2896
|
+
Fs as DOCS_COMPONENT_BACKGROUND_LAYER_INDEX,
|
|
2897
|
+
js as DOCS_COMPONENT_DEFAULT_Z_INDEX,
|
|
2898
|
+
$s as DOCS_COMPONENT_HEADER_LAYER_INDEX,
|
|
2899
|
+
Gs as DOCS_COMPONENT_MAIN_LAYER_INDEX,
|
|
2897
2900
|
De as DOCS_VIEW_KEY,
|
|
2898
2901
|
Le as DOC_INTERCEPTOR_POINT,
|
|
2899
2902
|
ie as DeleteCommand,
|
|
@@ -2907,17 +2910,17 @@ export {
|
|
|
2907
2910
|
Gn as EditorInsertTextCommandId,
|
|
2908
2911
|
Ht as IMEInputCommand,
|
|
2909
2912
|
Ae as IMEInputManagerService,
|
|
2910
|
-
|
|
2913
|
+
Xs as InnerPasteCommand,
|
|
2911
2914
|
ye as InsertCommand,
|
|
2912
2915
|
lt as ListOperationCommand,
|
|
2913
2916
|
Qe as MergeTwoParagraphCommand,
|
|
2914
2917
|
$e as MoveCursorOperation,
|
|
2915
2918
|
je as MoveSelectionOperation,
|
|
2916
|
-
|
|
2919
|
+
ks as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
|
|
2917
2920
|
Yn as OrderListCommand,
|
|
2918
2921
|
Zn as ReplaceContentCommand,
|
|
2919
2922
|
dt as ResetInlineFormatTextBackgroundColorCommand,
|
|
2920
|
-
|
|
2923
|
+
G as RichTextEditingMutation,
|
|
2921
2924
|
es as SelectAllOperation,
|
|
2922
2925
|
Qn as SetDocZoomRatioCommand,
|
|
2923
2926
|
ve as SetDocZoomRatioOperation,
|
|
@@ -2937,22 +2940,22 @@ export {
|
|
|
2937
2940
|
Dt as UniverDocsPlugin,
|
|
2938
2941
|
jt as UpdateCommand,
|
|
2939
2942
|
Ln as VIEWPORT_KEY,
|
|
2940
|
-
|
|
2943
|
+
Ks as addCustomDecorationBySelectionFactory,
|
|
2941
2944
|
Cs as addCustomDecorationFactory,
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2945
|
+
Ws as addCustomRangeBySelectionFactory,
|
|
2946
|
+
Vs as addCustomRangeFactory,
|
|
2947
|
+
Zs as deleteCustomDecorationFactory,
|
|
2948
|
+
Ys as deleteCustomRangeFactory,
|
|
2946
2949
|
Ne as getDeleteSelection,
|
|
2947
2950
|
Fn as getDocObject,
|
|
2948
|
-
|
|
2951
|
+
Hs as getDocObjectById,
|
|
2949
2952
|
Ye as getInsertSelection,
|
|
2950
|
-
|
|
2953
|
+
Js as getPlainTextFormDocument,
|
|
2951
2954
|
Je as getRetainAndDeleteFromReplace,
|
|
2952
|
-
|
|
2953
|
-
|
|
2955
|
+
k as getRichTextEditPath,
|
|
2956
|
+
Bs as getSelectionText,
|
|
2954
2957
|
Gt as isSegmentIntersects,
|
|
2955
|
-
|
|
2956
|
-
|
|
2958
|
+
zs as neoGetDocObject,
|
|
2959
|
+
Ls as replaceSelectionFactory,
|
|
2957
2960
|
se as serializeTextRange
|
|
2958
2961
|
};
|