@univerjs/docs 0.2.4 → 0.2.5
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 +430 -431
- package/lib/types/basics/custom-decoration-factory.d.ts +1 -2
- package/lib/types/basics/custom-range-factory.d.ts +1 -2
- package/lib/types/basics/replace.d.ts +1 -2
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +7 -8
- 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 +1 -2
- package/lib/types/commands/util.d.ts +1 -2
- package/lib/types/doc-plugin.d.ts +1 -2
- package/lib/types/services/doc-custom-range.service.d.ts +1 -2
- package/lib/types/services/doc-interceptor/doc-interceptor.service.d.ts +1 -1
- package/lib/types/services/ime-input-manager.service.d.ts +1 -2
- package/lib/umd/index.js +1 -1
- package/package.json +6 -8
package/lib/es/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
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, IUndoRedoService as ze, UndoCommandId as
|
|
5
|
-
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as
|
|
4
|
+
import { CommandType as A, RxDisposable as ke, ICommandService as N, Inject as ee, IUndoRedoService as ze, UndoCommandId as gt, RedoCommandId as ft, JSONX as B, IUniverInstanceService as U, LocaleService as tn, UniverInstanceType as te, 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 le, getDocsUpdateBody as on, UpdateDocsAttributeType as Ee, 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 ue, LifecycleStages as ge, Disposable as fe, Direction as F, HorizontalAlign as me, Plugin as un, Injector as gn, createInterceptorKey as Lt, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as fn, remove as mn, composeInterceptors as hn, DisposableCollection as pn } from "@univerjs/core";
|
|
5
|
+
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Sn, ITextSelectionRenderManager as Ae, DocumentSkeleton as In, DocumentViewModel as _n, IRenderManagerService as he, hasListGlyph as vn, isIndentByGlyph as xn, isFirstGlyph as Rn, getParagraphByGlyph as On, getCharSpaceApply as Cn, getNumberUnitValue as Q, RANGE_DIRECTION as Ue, NodePositionConvertToCursor as mt, TextSelectionRenderManager as Mn } 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";
|
|
8
7
|
const He = {
|
|
9
8
|
id: "doc.operation.set-selections",
|
|
10
9
|
type: A.OPERATION,
|
|
@@ -67,16 +66,16 @@ let P = class extends ke {
|
|
|
67
66
|
const e = this._getTextRanges(this._currentSelection);
|
|
68
67
|
if (e == null)
|
|
69
68
|
return;
|
|
70
|
-
const { textRanges: n, segmentId: t, style: s, segmentPage: r } = e, a = n.find((
|
|
69
|
+
const { textRanges: n, segmentId: t, style: s, segmentPage: r } = e, a = n.find((f) => f.isActive());
|
|
71
70
|
if (a == null)
|
|
72
71
|
return null;
|
|
73
|
-
const { startOffset: c, endOffset: i, collapsed: l, startNodePosition: d, endNodePosition:
|
|
72
|
+
const { startOffset: c, endOffset: i, collapsed: l, startNodePosition: d, endNodePosition: g, direction: u } = a;
|
|
74
73
|
return c == null || i == null ? null : {
|
|
75
74
|
startOffset: c,
|
|
76
75
|
endOffset: i,
|
|
77
76
|
collapsed: l,
|
|
78
77
|
startNodePosition: d,
|
|
79
|
-
endNodePosition:
|
|
78
|
+
endNodePosition: g,
|
|
80
79
|
direction: u,
|
|
81
80
|
segmentId: t,
|
|
82
81
|
segmentPage: r,
|
|
@@ -91,7 +90,7 @@ let P = class extends ke {
|
|
|
91
90
|
segmentId: "",
|
|
92
91
|
segmentPage: -1,
|
|
93
92
|
isEditing: n,
|
|
94
|
-
style:
|
|
93
|
+
style: Sn
|
|
95
94
|
// mock style.
|
|
96
95
|
});
|
|
97
96
|
}
|
|
@@ -145,16 +144,16 @@ let P = class extends ke {
|
|
|
145
144
|
}
|
|
146
145
|
};
|
|
147
146
|
P = En([
|
|
148
|
-
ht(0,
|
|
147
|
+
ht(0, Ae),
|
|
149
148
|
ht(1, N)
|
|
150
149
|
], P);
|
|
151
150
|
var An = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, Dn = (o, e, n, t) => {
|
|
152
151
|
for (var s = t > 1 ? void 0 : t ? Nn(e, n) : e, r = o.length - 1, a; r >= 0; r--)
|
|
153
152
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
154
153
|
return t && s && An(e, n, s), s;
|
|
155
|
-
},
|
|
154
|
+
}, Be = (o, e) => (n, t) => e(n, t, o);
|
|
156
155
|
const pt = 300;
|
|
157
|
-
let
|
|
156
|
+
let ye = class extends ke {
|
|
158
157
|
constructor(e, n, t) {
|
|
159
158
|
super();
|
|
160
159
|
w(this, "_docStateChange$", new ae(null));
|
|
@@ -173,7 +172,7 @@ let Me = class extends ke {
|
|
|
173
172
|
_initialize() {
|
|
174
173
|
this.disposeWithMe(
|
|
175
174
|
this._commandService.beforeCommandExecuted((e) => {
|
|
176
|
-
if (e.id ===
|
|
175
|
+
if (e.id === gt || e.id === ft) {
|
|
177
176
|
const n = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
178
177
|
if (n == null)
|
|
179
178
|
return;
|
|
@@ -185,7 +184,7 @@ let Me = class extends ke {
|
|
|
185
184
|
}
|
|
186
185
|
_cacheChangeState(e, n = "history") {
|
|
187
186
|
const { trigger: t, unitId: s, noHistory: r, debounce: a = !1 } = e;
|
|
188
|
-
if (r || t == null || n === "history" && (t ===
|
|
187
|
+
if (r || t == null || n === "history" && (t === ft || t === gt))
|
|
189
188
|
return;
|
|
190
189
|
const c = n === "history" ? this._historyStateCache : this._changeStateCache, i = n === "history" ? this._pushHistory.bind(this) : this._emitChangeState.bind(this);
|
|
191
190
|
if (c.has(s)) {
|
|
@@ -205,12 +204,12 @@ let Me = class extends ke {
|
|
|
205
204
|
return;
|
|
206
205
|
const s = t.length, r = t[0].commandId, a = t[0], c = t[s - 1], i = {
|
|
207
206
|
unitId: e,
|
|
208
|
-
actions: t.reduce((d,
|
|
207
|
+
actions: t.reduce((d, g) => B.compose(d, g.redoState.actions), null),
|
|
209
208
|
textRanges: c.redoState.textRanges
|
|
210
209
|
}, l = {
|
|
211
210
|
unitId: e,
|
|
212
211
|
// Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
|
|
213
|
-
actions: t.reverse().reduce((d,
|
|
212
|
+
actions: t.reverse().reduce((d, g) => B.compose(d, g.undoState.actions), null),
|
|
214
213
|
textRanges: a.undoState.textRanges
|
|
215
214
|
};
|
|
216
215
|
n.pushUndoRedo({
|
|
@@ -223,7 +222,7 @@ let Me = class extends ke {
|
|
|
223
222
|
const n = this._changeStateCache.get(e);
|
|
224
223
|
if (!Array.isArray(n) || n.length === 0)
|
|
225
224
|
return;
|
|
226
|
-
const t = n.length, { commandId: s, trigger: r, segmentId: a, noHistory: c, debounce: i } = n[0], l = n[0], d = n[t - 1],
|
|
225
|
+
const t = n.length, { commandId: s, trigger: r, segmentId: a, noHistory: c, debounce: i } = n[0], l = n[0], d = n[t - 1], g = {
|
|
227
226
|
unitId: e,
|
|
228
227
|
actions: n.reduce((m, I) => B.compose(m, I.redoState.actions), null),
|
|
229
228
|
textRanges: d.redoState.textRanges
|
|
@@ -232,25 +231,25 @@ let Me = class extends ke {
|
|
|
232
231
|
// Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
|
|
233
232
|
actions: n.reverse().reduce((m, I) => B.compose(m, I.undoState.actions), null),
|
|
234
233
|
textRanges: l.undoState.textRanges
|
|
235
|
-
},
|
|
234
|
+
}, f = {
|
|
236
235
|
commandId: s,
|
|
237
236
|
unitId: e,
|
|
238
237
|
trigger: r,
|
|
239
|
-
redoState:
|
|
238
|
+
redoState: g,
|
|
240
239
|
undoState: u,
|
|
241
240
|
segmentId: a,
|
|
242
241
|
noHistory: c,
|
|
243
242
|
debounce: i
|
|
244
243
|
};
|
|
245
|
-
n.length = 0, this._docStateChange$.next(
|
|
244
|
+
n.length = 0, this._docStateChange$.next(f);
|
|
246
245
|
}
|
|
247
246
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
],
|
|
253
|
-
class
|
|
247
|
+
ye = Dn([
|
|
248
|
+
Be(0, ee(ze)),
|
|
249
|
+
Be(1, N),
|
|
250
|
+
Be(2, U)
|
|
251
|
+
], ye);
|
|
252
|
+
class Ne {
|
|
254
253
|
constructor() {
|
|
255
254
|
w(this, "_previousActiveRange", null);
|
|
256
255
|
w(this, "_undoMutationParamsCache", []);
|
|
@@ -314,7 +313,7 @@ let V = class extends ke {
|
|
|
314
313
|
w(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
|
|
315
314
|
w(this, "_currentViewModel$", new ae(null));
|
|
316
315
|
w(this, "currentViewModel$", this._currentViewModel$.asObservable());
|
|
317
|
-
this._context = e, this._localeService = n, this._univerInstanceService = t, this._init(), this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
316
|
+
this._context = e, this._localeService = n, this._univerInstanceService = t, this._init(), this._univerInstanceService.getCurrentTypeOfUnit$(te.UNIVER_DOC).pipe(Ft(this.dispose$)).subscribe((s) => {
|
|
318
317
|
s && s.getUnitId() === this._context.unitId && this._update(s);
|
|
319
318
|
});
|
|
320
319
|
}
|
|
@@ -340,14 +339,14 @@ let V = class extends ke {
|
|
|
340
339
|
t.calculate(), this._currentSkeletonBefore$.next(t), this._currentSkeleton$.next(t), this._currentViewModel$.next(this._docViewModel);
|
|
341
340
|
}
|
|
342
341
|
_buildSkeleton(e) {
|
|
343
|
-
return
|
|
342
|
+
return In.create(e, this._localeService);
|
|
344
343
|
}
|
|
345
344
|
_buildDocViewModel(e) {
|
|
346
|
-
return new
|
|
345
|
+
return new _n(e);
|
|
347
346
|
}
|
|
348
347
|
};
|
|
349
348
|
V = wn([
|
|
350
|
-
St(1,
|
|
349
|
+
St(1, ee(tn)),
|
|
351
350
|
St(2, U)
|
|
352
351
|
], V);
|
|
353
352
|
const It = "doc.mutation.rich-text-editing", G = {
|
|
@@ -366,11 +365,11 @@ const It = "doc.mutation.rich-text-editing", G = {
|
|
|
366
365
|
noHistory: i,
|
|
367
366
|
isCompositionEnd: l,
|
|
368
367
|
noNeedSetTextRange: d,
|
|
369
|
-
debounce:
|
|
370
|
-
} = e, u = o.get(U),
|
|
368
|
+
debounce: g
|
|
369
|
+
} = e, u = o.get(U), f = o.get(he), m = u.getUniverDocInstance(n), I = (T = f.getRenderById(n)) == null ? void 0 : T.with(V).getViewModel();
|
|
371
370
|
if (m == null || I == null)
|
|
372
371
|
throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${n}`);
|
|
373
|
-
const p = o.get(P), S = ((C = p.getCurrentSelections()) != null ? C : []).map(se), _ = o.get(
|
|
372
|
+
const p = o.get(P), S = ((C = p.getCurrentSelections()) != null ? C : []).map(se), _ = o.get(ye), O = o.get(Ne), E = !!m.getSnapshot().disabled;
|
|
374
373
|
if (B.isNoop(s) || s && s.length === 0 || E)
|
|
375
374
|
return {
|
|
376
375
|
unitId: n,
|
|
@@ -381,13 +380,13 @@ const It = "doc.mutation.rich-text-editing", G = {
|
|
|
381
380
|
m.apply(s), I.reset(m), !d && r && c != null && queueMicrotask(() => {
|
|
382
381
|
p.replaceTextRanges(r, !0, e.options);
|
|
383
382
|
});
|
|
384
|
-
const
|
|
383
|
+
const R = {
|
|
385
384
|
commandId: It,
|
|
386
385
|
unitId: n,
|
|
387
386
|
segmentId: t,
|
|
388
387
|
trigger: c,
|
|
389
388
|
noHistory: i,
|
|
390
|
-
debounce:
|
|
389
|
+
debounce: g,
|
|
391
390
|
redoState: {
|
|
392
391
|
actions: s,
|
|
393
392
|
textRanges: r
|
|
@@ -398,20 +397,20 @@ const It = "doc.mutation.rich-text-editing", G = {
|
|
|
398
397
|
}
|
|
399
398
|
};
|
|
400
399
|
if (l) {
|
|
401
|
-
const
|
|
402
|
-
if (
|
|
400
|
+
const x = O.fetchComposedUndoRedoMutationParams();
|
|
401
|
+
if (x == null)
|
|
403
402
|
throw new Error("historyParams is null in RichTextEditingMutation");
|
|
404
|
-
const { undoMutationParams: y, redoMutationParams: D, previousActiveRange: L } =
|
|
405
|
-
|
|
403
|
+
const { undoMutationParams: y, redoMutationParams: D, previousActiveRange: L } = x;
|
|
404
|
+
R.redoState.actions = D.actions, R.undoState.actions = y.actions, R.undoState.textRanges = [L];
|
|
406
405
|
}
|
|
407
|
-
return _.setChangeState(
|
|
406
|
+
return _.setChangeState(R), {
|
|
408
407
|
unitId: n,
|
|
409
408
|
actions: v,
|
|
410
409
|
textRanges: S
|
|
411
410
|
};
|
|
412
411
|
}
|
|
413
412
|
};
|
|
414
|
-
function
|
|
413
|
+
function ie(o) {
|
|
415
414
|
return o === b.CUSTOM_RANGE_END || o === b.CUSTOM_RANGE_START;
|
|
416
415
|
}
|
|
417
416
|
function Xe(o, e, n, t) {
|
|
@@ -426,13 +425,13 @@ function Ve(o, e, n, t) {
|
|
|
426
425
|
const c = s.slice(0, r) + s.slice(r + e);
|
|
427
426
|
for (let i = 0, l = c.length; i < l; i++) {
|
|
428
427
|
const d = c[i];
|
|
429
|
-
if (!
|
|
428
|
+
if (!ie(d))
|
|
430
429
|
return !1;
|
|
431
430
|
}
|
|
432
431
|
return !0;
|
|
433
432
|
}
|
|
434
433
|
var j = /* @__PURE__ */ ((o) => (o[o.LEFT = 0] = "LEFT", o[o.RIGHT = 1] = "RIGHT", o))(j || {});
|
|
435
|
-
function
|
|
434
|
+
function pe(o) {
|
|
436
435
|
const { startOffset: e, endOffset: n, collapsed: t } = o, s = Math.min(e, n), r = Math.max(e, n);
|
|
437
436
|
return {
|
|
438
437
|
startOffset: s,
|
|
@@ -441,7 +440,7 @@ function he(o) {
|
|
|
441
440
|
};
|
|
442
441
|
}
|
|
443
442
|
function We(o, e) {
|
|
444
|
-
let { startOffset: n, endOffset: t } =
|
|
443
|
+
let { startOffset: n, endOffset: t } = pe(o);
|
|
445
444
|
for (; e.dataStream[n - 1] === b.CUSTOM_RANGE_START; )
|
|
446
445
|
n -= 1;
|
|
447
446
|
for (; e.dataStream[t] === b.CUSTOM_RANGE_END; )
|
|
@@ -451,15 +450,15 @@ function We(o, e) {
|
|
|
451
450
|
endOffset: t
|
|
452
451
|
};
|
|
453
452
|
}
|
|
454
|
-
function
|
|
453
|
+
function De(o, e, n = j.LEFT) {
|
|
455
454
|
var c;
|
|
456
|
-
let { startOffset: t, endOffset: s, collapsed: r } =
|
|
455
|
+
let { startOffset: t, endOffset: s, collapsed: r } = pe(o);
|
|
457
456
|
if (r)
|
|
458
457
|
if (n === j.LEFT)
|
|
459
|
-
for (; e.dataStream[t - 1]
|
|
458
|
+
for (; ie(e.dataStream[t - 1]); )
|
|
460
459
|
s -= 1, t -= 1;
|
|
461
460
|
else
|
|
462
|
-
for (; e.dataStream[t]
|
|
461
|
+
for (; ie(e.dataStream[t]); )
|
|
463
462
|
s += 1, t += 1;
|
|
464
463
|
else {
|
|
465
464
|
const i = We(o, e);
|
|
@@ -477,7 +476,7 @@ function Ne(o, e, n = j.LEFT) {
|
|
|
477
476
|
};
|
|
478
477
|
}
|
|
479
478
|
function Ye(o, e) {
|
|
480
|
-
let { startOffset: n, endOffset: t, collapsed: s } =
|
|
479
|
+
let { startOffset: n, endOffset: t, collapsed: s } = pe(o);
|
|
481
480
|
if (s) {
|
|
482
481
|
for (; e.dataStream[t] === b.CUSTOM_RANGE_END; )
|
|
483
482
|
t += 1, n += 1;
|
|
@@ -499,9 +498,9 @@ function Un(o, e) {
|
|
|
499
498
|
return null;
|
|
500
499
|
const n = e.customRanges;
|
|
501
500
|
if (!n)
|
|
502
|
-
return
|
|
501
|
+
return pe(o);
|
|
503
502
|
let { startOffset: t, endOffset: s } = We(o, e);
|
|
504
|
-
for (;
|
|
503
|
+
for (; ie(e.dataStream[t]); ) {
|
|
505
504
|
if (e.dataStream[t] === b.CUSTOM_RANGE_START) {
|
|
506
505
|
const r = n.find((a) => a.startIndex === t);
|
|
507
506
|
if (!r)
|
|
@@ -517,7 +516,7 @@ function Un(o, e) {
|
|
|
517
516
|
}
|
|
518
517
|
t += 1;
|
|
519
518
|
}
|
|
520
|
-
for (;
|
|
519
|
+
for (; ie(e.dataStream[s - 1]); ) {
|
|
521
520
|
if (e.dataStream[t] === b.CUSTOM_RANGE_END) {
|
|
522
521
|
const r = n.find((a) => a.endIndex === s - 1);
|
|
523
522
|
if (!r)
|
|
@@ -571,7 +570,7 @@ const Bn = [
|
|
|
571
570
|
b.CUSTOM_BLOCK
|
|
572
571
|
// 图片 mention 等不参与文档流的场景
|
|
573
572
|
];
|
|
574
|
-
function
|
|
573
|
+
function Us(o, e, n) {
|
|
575
574
|
const t = o.slice(e, n);
|
|
576
575
|
return Bn.reduce((s, r) => s.replaceAll(r, ""), t);
|
|
577
576
|
}
|
|
@@ -580,17 +579,17 @@ function Gt(o, e, n, t) {
|
|
|
580
579
|
}
|
|
581
580
|
function Ke(o, e, n = "", t = 0) {
|
|
582
581
|
var h;
|
|
583
|
-
const { startOffset: s, endOffset: r } =
|
|
582
|
+
const { startOffset: s, endOffset: r } = De(o, e), a = [], { paragraphs: c = [], dataStream: i } = e, l = s - t, d = r - t, g = c == null ? void 0 : c.find(
|
|
584
583
|
(S) => S.startIndex - t >= l && S.startIndex - t < d
|
|
585
|
-
), u = (h = e.customRanges) == null ? void 0 : h.filter((S) => Xe(S.startIndex, S.endIndex, s, r)),
|
|
584
|
+
), u = (h = e.customRanges) == null ? void 0 : h.filter((S) => Xe(S.startIndex, S.endIndex, s, r)), f = new Set(u == null ? void 0 : u.filter((S) => Ve(s, r - s, S, i))), m = /* @__PURE__ */ new Set();
|
|
586
585
|
if (u == null || u.forEach((S) => {
|
|
587
|
-
|
|
586
|
+
f.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));
|
|
588
587
|
}), l > 0 && a.push({
|
|
589
588
|
t: M.RETAIN,
|
|
590
589
|
len: l,
|
|
591
590
|
segmentId: n
|
|
592
|
-
}),
|
|
593
|
-
const S =
|
|
591
|
+
}), g && g.startIndex - t > l) {
|
|
592
|
+
const S = g.startIndex - t;
|
|
594
593
|
m.add(S);
|
|
595
594
|
}
|
|
596
595
|
const I = [...m].sort((S, _) => S - _);
|
|
@@ -614,12 +613,12 @@ function Ke(o, e, n = "", t = 0) {
|
|
|
614
613
|
segmentId: n
|
|
615
614
|
}), a;
|
|
616
615
|
}
|
|
617
|
-
function
|
|
618
|
-
var
|
|
616
|
+
function Bs(o, e) {
|
|
617
|
+
var f, m;
|
|
619
618
|
const { unitId: n, body: t } = e, r = o.get(U).getUnit(n), a = o.get(P);
|
|
620
619
|
if (!r)
|
|
621
620
|
return !1;
|
|
622
|
-
const c = r.getBody(), i = (
|
|
621
|
+
const c = r.getBody(), i = (f = e.selection) != null ? f : a.getActiveRange();
|
|
623
622
|
if (!i || !c)
|
|
624
623
|
return !1;
|
|
625
624
|
const l = (m = e.textRanges) != null ? m : [{
|
|
@@ -634,18 +633,18 @@ function Ls(o, e) {
|
|
|
634
633
|
textRanges: l,
|
|
635
634
|
debounce: !0
|
|
636
635
|
}
|
|
637
|
-
},
|
|
638
|
-
return
|
|
636
|
+
}, g = new $(), u = B.getInstance();
|
|
637
|
+
return g.push(...Ke(i, c)), g.push({
|
|
639
638
|
t: M.INSERT,
|
|
640
639
|
body: t,
|
|
641
640
|
len: t.dataStream.length,
|
|
642
641
|
line: 0
|
|
643
|
-
}), d.params.actions = u.editOp(
|
|
642
|
+
}), d.params.actions = u.editOp(g.serialize()), d;
|
|
644
643
|
}
|
|
645
|
-
var
|
|
646
|
-
const
|
|
647
|
-
function
|
|
648
|
-
const { mainComponent: e, scene: n, engine: t, components: s } = o, r = e, a = s.get(
|
|
644
|
+
var be = /* @__PURE__ */ ((o) => (o.MAIN = "__Document_Render_Main__", o.BACKGROUND = "__Document_Render_Background__", o))(be || {}), Ln = /* @__PURE__ */ ((o) => (o.VIEW_MAIN = "viewMain", o.VIEW_TOP = "viewTop", o.VIEW_LEFT = "viewLeft", o.VIEW_LEFT_TOP = "viewLeftTop", o))(Ln || {});
|
|
645
|
+
const Ls = 0, Fs = 2, Gs = 4, $s = 10, js = "normalTextSelectionPluginName";
|
|
646
|
+
function ks(o) {
|
|
647
|
+
const { mainComponent: e, scene: n, engine: t, components: s } = o, r = e, a = s.get(be.BACKGROUND);
|
|
649
648
|
return {
|
|
650
649
|
document: r,
|
|
651
650
|
docBackground: a,
|
|
@@ -654,13 +653,13 @@ function zs(o) {
|
|
|
654
653
|
};
|
|
655
654
|
}
|
|
656
655
|
function Fn(o, e) {
|
|
657
|
-
const n = o.getCurrentUnitForType(
|
|
656
|
+
const n = o.getCurrentUnitForType(te.UNIVER_DOC);
|
|
658
657
|
if (!n)
|
|
659
658
|
return null;
|
|
660
659
|
const t = n.getUnitId(), s = e.getRenderById(t);
|
|
661
660
|
if (s == null)
|
|
662
661
|
return;
|
|
663
|
-
const { mainComponent: r, scene: a, engine: c, components: i } = s, l = r, d = i.get(
|
|
662
|
+
const { mainComponent: r, scene: a, engine: c, components: i } = s, l = r, d = i.get(be.BACKGROUND);
|
|
664
663
|
return {
|
|
665
664
|
document: l,
|
|
666
665
|
docBackground: d,
|
|
@@ -668,11 +667,11 @@ function Fn(o, e) {
|
|
|
668
667
|
engine: c
|
|
669
668
|
};
|
|
670
669
|
}
|
|
671
|
-
function
|
|
670
|
+
function zs(o, e) {
|
|
672
671
|
const n = e.getRenderById(o);
|
|
673
672
|
if (n == null)
|
|
674
673
|
return;
|
|
675
|
-
const { mainComponent: t, scene: s, engine: r, components: a } = n, c = t, i = a.get(
|
|
674
|
+
const { mainComponent: t, scene: s, engine: r, components: a } = n, c = t, i = a.get(be.BACKGROUND);
|
|
676
675
|
return {
|
|
677
676
|
document: c,
|
|
678
677
|
docBackground: i,
|
|
@@ -699,17 +698,17 @@ class Ze {
|
|
|
699
698
|
}
|
|
700
699
|
function Je(o, e = "", n, t) {
|
|
701
700
|
var I;
|
|
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)),
|
|
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)), g = new Set(d == null ? void 0 : d.filter((p) => Ve(s, r - s, p, l))), u = /* @__PURE__ */ new Set();
|
|
703
702
|
d == null || d.forEach((p) => {
|
|
704
|
-
|
|
703
|
+
g.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));
|
|
705
704
|
}), c > 0 && a.push({
|
|
706
705
|
t: M.RETAIN,
|
|
707
706
|
len: c,
|
|
708
707
|
segmentId: e
|
|
709
708
|
});
|
|
710
|
-
const
|
|
709
|
+
const f = [...u].sort((p, h) => p - h);
|
|
711
710
|
let m = c;
|
|
712
|
-
return
|
|
711
|
+
return f.forEach((p) => {
|
|
713
712
|
const h = p - m;
|
|
714
713
|
h > 0 && a.push({
|
|
715
714
|
t: M.DELETE,
|
|
@@ -734,7 +733,7 @@ function Je(o, e = "", n, t) {
|
|
|
734
733
|
}
|
|
735
734
|
function $t(o, e) {
|
|
736
735
|
var t;
|
|
737
|
-
return (t = o.get(
|
|
736
|
+
return (t = o.get(he).getRenderById(e)) == null ? void 0 : t.with(V);
|
|
738
737
|
}
|
|
739
738
|
function k(o, e = "") {
|
|
740
739
|
if (!e)
|
|
@@ -748,19 +747,19 @@ function k(o, e = "") {
|
|
|
748
747
|
return ["footers", e, "body"];
|
|
749
748
|
throw new Error("Segment id not found in headers or footers");
|
|
750
749
|
}
|
|
751
|
-
const Gn = "doc.command.insert-text",
|
|
750
|
+
const Gn = "doc.command.insert-text", Te = {
|
|
752
751
|
id: Gn,
|
|
753
752
|
type: A.COMMAND,
|
|
754
753
|
// eslint-disable-next-line max-lines-per-function
|
|
755
754
|
handler: async (o, e) => {
|
|
756
755
|
var T;
|
|
757
|
-
const n = o.get(N), { range: t, segmentId: s, body: r, unitId: a, textRanges: c, cursorOffset: i } = e, l = o.get(P),
|
|
758
|
-
if (
|
|
756
|
+
const n = o.get(N), { range: t, segmentId: s, body: r, unitId: a, textRanges: c, cursorOffset: i } = e, l = o.get(P), g = o.get(U).getUnit(a, te.UNIVER_DOC);
|
|
757
|
+
if (g == null)
|
|
759
758
|
return !1;
|
|
760
|
-
const u = l.getActiveRange(),
|
|
761
|
-
if (!
|
|
759
|
+
const u = l.getActiveRange(), f = g.getSelfOrHeaderFooterModel((T = u == null ? void 0 : u.segmentId) != null ? T : "").getBody();
|
|
760
|
+
if (!f)
|
|
762
761
|
return !1;
|
|
763
|
-
const m = Ye(t,
|
|
762
|
+
const m = Ye(t, f), { startOffset: I, collapsed: p } = m, h = i != null ? i : r.dataStream.length, S = [
|
|
764
763
|
{
|
|
765
764
|
startOffset: I + h,
|
|
766
765
|
endOffset: I + h,
|
|
@@ -783,10 +782,10 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
783
782
|
segmentId: s
|
|
784
783
|
});
|
|
785
784
|
else {
|
|
786
|
-
const { dos: C, retain:
|
|
785
|
+
const { dos: C, retain: x } = Je(m, s, 0, f);
|
|
787
786
|
O.push(...C), c || (_.params.textRanges = [{
|
|
788
|
-
startOffset: I + h +
|
|
789
|
-
endOffset: I + h +
|
|
787
|
+
startOffset: I + h + x,
|
|
788
|
+
endOffset: I + h + x,
|
|
790
789
|
collapsed: p
|
|
791
790
|
}]);
|
|
792
791
|
}
|
|
@@ -797,23 +796,23 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
797
796
|
line: 0,
|
|
798
797
|
segmentId: s
|
|
799
798
|
});
|
|
800
|
-
const v = k(
|
|
799
|
+
const v = k(g, s);
|
|
801
800
|
return _.params.actions = E.editOp(O.serialize(), v), !!n.syncExecuteCommand(_.id, _.params);
|
|
802
801
|
}
|
|
803
|
-
},
|
|
802
|
+
}, ce = {
|
|
804
803
|
id: "doc.command.delete-text",
|
|
805
804
|
type: A.COMMAND,
|
|
806
805
|
handler: async (o, e) => {
|
|
807
806
|
var C;
|
|
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,
|
|
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, te.UNIVER_DOC), d = l == null ? void 0 : l.getSelfOrHeaderFooterModel(r).getBody();
|
|
809
808
|
if (l == null || d == null)
|
|
810
809
|
return !1;
|
|
811
|
-
const { startOffset:
|
|
812
|
-
for (let
|
|
813
|
-
h.push(
|
|
814
|
-
p == null || p.forEach((
|
|
815
|
-
h.push(
|
|
816
|
-
}), h.sort((
|
|
810
|
+
const { startOffset: g } = s, u = d.dataStream, f = c === j.LEFT ? g - i : g, m = f + i - 1, I = (C = d.customRanges) == null ? void 0 : C.filter((x) => Xe(x.startIndex, x.endIndex, f, m)), p = I == null ? void 0 : I.filter((x) => Ve(f, i, x, u)), h = [];
|
|
811
|
+
for (let x = 0; x < i; x++)
|
|
812
|
+
h.push(f + x);
|
|
813
|
+
p == null || p.forEach((x) => {
|
|
814
|
+
h.push(x.startIndex, x.endIndex);
|
|
815
|
+
}), h.sort((x, y) => x - y);
|
|
817
816
|
const S = h[0], _ = {
|
|
818
817
|
id: G.id,
|
|
819
818
|
params: {
|
|
@@ -828,8 +827,8 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
828
827
|
}
|
|
829
828
|
}, O = new $(), E = B.getInstance();
|
|
830
829
|
let v = 0;
|
|
831
|
-
for (let
|
|
832
|
-
const y = h[
|
|
830
|
+
for (let x = 0; x < h.length; x++) {
|
|
831
|
+
const y = h[x];
|
|
833
832
|
y - v > 0 && O.push({
|
|
834
833
|
t: M.RETAIN,
|
|
835
834
|
len: y - v,
|
|
@@ -841,8 +840,8 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
841
840
|
line: 0
|
|
842
841
|
}), v = y + 1;
|
|
843
842
|
}
|
|
844
|
-
const
|
|
845
|
-
return _.params.actions = E.editOp(O.serialize(),
|
|
843
|
+
const R = k(l, r);
|
|
844
|
+
return _.params.actions = E.editOp(O.serialize(), R), !!n.syncExecuteCommand(_.id, _.params);
|
|
846
845
|
}
|
|
847
846
|
}, jt = {
|
|
848
847
|
id: "doc.command.update-text",
|
|
@@ -851,14 +850,14 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
851
850
|
const { range: n, segmentId: t, updateBody: s, coverType: r, unitId: a, textRanges: c } = e, i = o.get(N), d = o.get(U).getCurrentUniverDocInstance();
|
|
852
851
|
if (d == null)
|
|
853
852
|
return !1;
|
|
854
|
-
const
|
|
853
|
+
const g = {
|
|
855
854
|
id: G.id,
|
|
856
855
|
params: {
|
|
857
856
|
unitId: a,
|
|
858
857
|
actions: [],
|
|
859
858
|
textRanges: c
|
|
860
859
|
}
|
|
861
|
-
}, u = new $(),
|
|
860
|
+
}, u = new $(), f = B.getInstance(), { startOffset: m, endOffset: I } = n;
|
|
862
861
|
u.push({
|
|
863
862
|
t: M.RETAIN,
|
|
864
863
|
len: m,
|
|
@@ -871,7 +870,7 @@ const Gn = "doc.command.insert-text", ye = {
|
|
|
871
870
|
coverType: r
|
|
872
871
|
});
|
|
873
872
|
const p = k(d, t);
|
|
874
|
-
return
|
|
873
|
+
return g.params.actions = f.editOp(u.serialize(), p), !!i.syncExecuteCommand(g.id, g.params);
|
|
875
874
|
}
|
|
876
875
|
};
|
|
877
876
|
function _t(o, e) {
|
|
@@ -896,24 +895,24 @@ const $n = {
|
|
|
896
895
|
const { segmentId: a } = r, c = n.getCurrentUniverDocInstance(), i = c == null ? void 0 : c.getSelfOrHeaderFooterModel(a).getBody();
|
|
897
896
|
if (!c || !i)
|
|
898
897
|
return !1;
|
|
899
|
-
const l = c.getUnitId(), { startOffset: d, endOffset:
|
|
900
|
-
if (
|
|
901
|
-
const p = nn(wt(i,
|
|
898
|
+
const l = c.getUnitId(), { startOffset: d, endOffset: g } = Ye(r, i), f = ((m = i.paragraphs) != null ? m : []).find((p) => p.startIndex >= d);
|
|
899
|
+
if (f && f.startIndex > g) {
|
|
900
|
+
const p = nn(wt(i, g, f.startIndex));
|
|
902
901
|
p.customRanges = (I = p.customRanges) == null ? void 0 : I.map((_) => s.copyCustomRange(l, _));
|
|
903
902
|
const h = {
|
|
904
903
|
startOffset: d,
|
|
905
|
-
endOffset:
|
|
904
|
+
endOffset: f.startIndex,
|
|
906
905
|
collapsed: !1
|
|
907
906
|
};
|
|
908
907
|
return sn(
|
|
909
908
|
p,
|
|
910
909
|
{
|
|
911
910
|
dataStream: b.PARAGRAPH,
|
|
912
|
-
paragraphs: _t(b.PARAGRAPH,
|
|
911
|
+
paragraphs: _t(b.PARAGRAPH, f)
|
|
913
912
|
},
|
|
914
913
|
1,
|
|
915
914
|
0
|
|
916
|
-
), await t.executeCommand(
|
|
915
|
+
), await t.executeCommand(Te.id, {
|
|
917
916
|
unitId: l,
|
|
918
917
|
body: p,
|
|
919
918
|
range: h,
|
|
@@ -921,17 +920,17 @@ const $n = {
|
|
|
921
920
|
cursorOffset: 1
|
|
922
921
|
});
|
|
923
922
|
} else
|
|
924
|
-
return await t.executeCommand(
|
|
923
|
+
return await t.executeCommand(Te.id, {
|
|
925
924
|
unitId: l,
|
|
926
925
|
body: {
|
|
927
926
|
dataStream: b.PARAGRAPH,
|
|
928
|
-
paragraphs: _t(b.PARAGRAPH,
|
|
927
|
+
paragraphs: _t(b.PARAGRAPH, f)
|
|
929
928
|
},
|
|
930
929
|
range: r,
|
|
931
930
|
segmentId: a
|
|
932
931
|
});
|
|
933
932
|
}
|
|
934
|
-
},
|
|
933
|
+
}, Hs = {
|
|
935
934
|
id: "doc.command.inner-paste",
|
|
936
935
|
type: A.COMMAND,
|
|
937
936
|
handler: async (o, e) => {
|
|
@@ -941,18 +940,18 @@ const $n = {
|
|
|
941
940
|
const l = c.getCurrentUniverDocInstance(), d = l == null ? void 0 : l.getSelfOrHeaderFooterModel(n).getBody();
|
|
942
941
|
if (l == null || d == null)
|
|
943
942
|
return !1;
|
|
944
|
-
const
|
|
943
|
+
const g = l.getUnitId(), u = {
|
|
945
944
|
id: G.id,
|
|
946
945
|
params: {
|
|
947
|
-
unitId:
|
|
946
|
+
unitId: g,
|
|
948
947
|
actions: [],
|
|
949
948
|
textRanges: t
|
|
950
949
|
}
|
|
951
|
-
},
|
|
952
|
-
|
|
950
|
+
}, f = new le();
|
|
951
|
+
f.reset();
|
|
953
952
|
const m = new $(), I = B.getInstance();
|
|
954
953
|
for (const S of i) {
|
|
955
|
-
const { startOffset: _, endOffset: O, collapsed: E } = S, v = _ -
|
|
954
|
+
const { startOffset: _, endOffset: O, collapsed: E } = S, v = _ - f.cursor;
|
|
956
955
|
if (E)
|
|
957
956
|
m.push({
|
|
958
957
|
t: M.RETAIN,
|
|
@@ -960,8 +959,8 @@ const $n = {
|
|
|
960
959
|
segmentId: n
|
|
961
960
|
});
|
|
962
961
|
else {
|
|
963
|
-
const { dos:
|
|
964
|
-
m.push(...
|
|
962
|
+
const { dos: R } = Je(S, n, f.cursor, d);
|
|
963
|
+
m.push(...R);
|
|
965
964
|
}
|
|
966
965
|
m.push({
|
|
967
966
|
t: M.INSERT,
|
|
@@ -969,7 +968,7 @@ const $n = {
|
|
|
969
968
|
len: s.dataStream.length,
|
|
970
969
|
line: 0,
|
|
971
970
|
segmentId: n
|
|
972
|
-
}),
|
|
971
|
+
}), f.reset(), f.moveCursor(O);
|
|
973
972
|
}
|
|
974
973
|
const p = k(l, n);
|
|
975
974
|
return u.params.actions = I.editOp(m.serialize(), p), !!r.syncExecuteCommand(u.id, u.params);
|
|
@@ -979,49 +978,49 @@ const $n = {
|
|
|
979
978
|
type: A.COMMAND,
|
|
980
979
|
// eslint-disable-next-line max-lines-per-function
|
|
981
980
|
handler: async (o, e) => {
|
|
982
|
-
var v,
|
|
981
|
+
var v, R, T, C;
|
|
983
982
|
const { segmentId: n, textRanges: t } = e, s = o.get(N), r = o.get(P), a = o.get(U), c = (v = e.selections) != null ? v : r.getCurrentSelections();
|
|
984
983
|
if (!Array.isArray(c) || c.length === 0)
|
|
985
984
|
return !1;
|
|
986
|
-
const i = (
|
|
985
|
+
const i = (R = a.getCurrentUniverDocInstance()) == null ? void 0 : R.getUnitId();
|
|
987
986
|
if (!i)
|
|
988
987
|
return !1;
|
|
989
988
|
const l = a.getUniverDocInstance(i), d = on(l.getSnapshot(), n);
|
|
990
989
|
if (l == null || d == null)
|
|
991
990
|
return !1;
|
|
992
|
-
const
|
|
991
|
+
const g = {
|
|
993
992
|
id: G.id,
|
|
994
993
|
params: {
|
|
995
994
|
unitId: i,
|
|
996
995
|
actions: [],
|
|
997
996
|
textRanges: t
|
|
998
997
|
}
|
|
999
|
-
}, u = new
|
|
998
|
+
}, u = new le();
|
|
1000
999
|
u.reset();
|
|
1001
|
-
const
|
|
1002
|
-
for (const
|
|
1003
|
-
const { startOffset: y, endOffset: D, collapsed: L } =
|
|
1000
|
+
const f = new $(), m = B.getInstance(), I = [];
|
|
1001
|
+
for (const x of c) {
|
|
1002
|
+
const { startOffset: y, endOffset: D, collapsed: L } = x;
|
|
1004
1003
|
if (y == null || D == null)
|
|
1005
1004
|
continue;
|
|
1006
1005
|
const W = y - u.cursor;
|
|
1007
|
-
L ?
|
|
1006
|
+
L ? f.push({
|
|
1008
1007
|
t: M.RETAIN,
|
|
1009
1008
|
len: W,
|
|
1010
1009
|
segmentId: n
|
|
1011
|
-
}) :
|
|
1010
|
+
}) : f.push(...Ke(x, d, n, u.cursor)), u.reset(), u.moveCursor(D);
|
|
1012
1011
|
}
|
|
1013
1012
|
const p = k(l, n);
|
|
1014
|
-
I.push(m.editOp(
|
|
1015
|
-
const h = jn(d, c), S = (T = l.getDrawings()) != null ? T : {}, _ = (C = l.getDrawingsOrder()) != null ? C : [], O = h.sort((
|
|
1013
|
+
I.push(m.editOp(f.serialize(), p));
|
|
1014
|
+
const h = jn(d, c), S = (T = l.getDrawings()) != null ? T : {}, _ = (C = l.getDrawingsOrder()) != null ? C : [], O = h.sort((x, y) => _.indexOf(x) > _.indexOf(y) ? -1 : _.indexOf(x) < _.indexOf(y) ? 1 : 0);
|
|
1016
1015
|
if (O.length > 0)
|
|
1017
|
-
for (const
|
|
1018
|
-
const y = S[
|
|
1016
|
+
for (const x of O) {
|
|
1017
|
+
const y = S[x], D = _.indexOf(x);
|
|
1019
1018
|
if (y == null || D < 0)
|
|
1020
1019
|
continue;
|
|
1021
|
-
const L = m.removeOp(["drawings",
|
|
1020
|
+
const L = m.removeOp(["drawings", x], y), W = m.removeOp(["drawingsOrder", D], x);
|
|
1022
1021
|
I.push(L), I.push(W);
|
|
1023
1022
|
}
|
|
1024
|
-
return
|
|
1023
|
+
return g.params.actions = I.reduce((x, y) => B.compose(x, y), null), !!s.syncExecuteCommand(g.id, g.params);
|
|
1025
1024
|
}
|
|
1026
1025
|
};
|
|
1027
1026
|
function jn(o, e) {
|
|
@@ -1044,11 +1043,11 @@ const qe = {
|
|
|
1044
1043
|
const n = o.get(P), t = o.get(U), s = o.get(N), r = n.getActiveRange(), a = t.getCurrentUniverDocInstance();
|
|
1045
1044
|
if (r == null || a == null)
|
|
1046
1045
|
return !1;
|
|
1047
|
-
const { direction: c, range: i, unitId: l, drawingId: d } = e, { startOffset:
|
|
1046
|
+
const { direction: c, range: i, unitId: l, drawingId: d } = e, { startOffset: g, segmentId: u, style: f } = r, m = c === j.LEFT ? g - 1 : g, I = [
|
|
1048
1047
|
{
|
|
1049
1048
|
startOffset: m,
|
|
1050
1049
|
endOffset: m,
|
|
1051
|
-
style:
|
|
1050
|
+
style: f
|
|
1052
1051
|
}
|
|
1053
1052
|
], p = {
|
|
1054
1053
|
id: G.id,
|
|
@@ -1059,9 +1058,9 @@ const qe = {
|
|
|
1059
1058
|
prevTextRanges: [i]
|
|
1060
1059
|
}
|
|
1061
1060
|
}, h = new $(), S = B.getInstance(), _ = [];
|
|
1062
|
-
|
|
1061
|
+
g > 0 && h.push({
|
|
1063
1062
|
t: M.RETAIN,
|
|
1064
|
-
len: c === j.LEFT ?
|
|
1063
|
+
len: c === j.LEFT ? g - 1 : g,
|
|
1065
1064
|
segmentId: u
|
|
1066
1065
|
}), h.push({
|
|
1067
1066
|
t: M.DELETE,
|
|
@@ -1071,7 +1070,7 @@ const qe = {
|
|
|
1071
1070
|
});
|
|
1072
1071
|
const O = k(a, u);
|
|
1073
1072
|
_.push(S.editOp(h.serialize(), O));
|
|
1074
|
-
const E = ((y = a.getDrawings()) != null ? y : {})[d],
|
|
1073
|
+
const E = ((y = a.getDrawings()) != null ? y : {})[d], R = a.getDrawingsOrder().indexOf(d), T = S.removeOp(["drawings", d], E), C = S.removeOp(["drawingsOrder", R], d);
|
|
1075
1074
|
return _.push(T), _.push(C), p.params.actions = _.reduce((D, L) => B.compose(D, L), null), !!s.syncExecuteCommand(p.id, p.params);
|
|
1076
1075
|
}
|
|
1077
1076
|
}, Qe = {
|
|
@@ -1083,10 +1082,10 @@ const qe = {
|
|
|
1083
1082
|
const n = o.get(P), t = o.get(U), s = o.get(N), { direction: r, range: a } = e, c = n.getActiveRange(), i = n.getCurrentSelections();
|
|
1084
1083
|
if (c == null || i == null)
|
|
1085
1084
|
return !1;
|
|
1086
|
-
const { segmentId: l, style: d } = c,
|
|
1087
|
-
if (!
|
|
1085
|
+
const { segmentId: l, style: d } = c, g = t.getCurrentUniverDocInstance(), u = g == null ? void 0 : g.getSelfOrHeaderFooterModel(l).getBody();
|
|
1086
|
+
if (!g || !u)
|
|
1088
1087
|
return !1;
|
|
1089
|
-
const
|
|
1088
|
+
const f = De(c, u), m = g.getUnitId(), { startOffset: I, collapsed: p } = f;
|
|
1090
1089
|
if (!p)
|
|
1091
1090
|
return !1;
|
|
1092
1091
|
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 = [
|
|
@@ -1103,29 +1102,29 @@ const qe = {
|
|
|
1103
1102
|
textRanges: E,
|
|
1104
1103
|
prevTextRanges: [a]
|
|
1105
1104
|
}
|
|
1106
|
-
},
|
|
1107
|
-
|
|
1105
|
+
}, R = new $(), T = B.getInstance();
|
|
1106
|
+
R.push({
|
|
1108
1107
|
t: M.RETAIN,
|
|
1109
1108
|
len: r === j.LEFT ? I - 1 : I,
|
|
1110
1109
|
segmentId: l
|
|
1111
|
-
}), _.dataStream.length &&
|
|
1110
|
+
}), _.dataStream.length && R.push({
|
|
1112
1111
|
t: M.INSERT,
|
|
1113
1112
|
body: _,
|
|
1114
1113
|
len: _.dataStream.length,
|
|
1115
1114
|
line: 0,
|
|
1116
1115
|
segmentId: l
|
|
1117
|
-
}),
|
|
1116
|
+
}), R.push({
|
|
1118
1117
|
t: M.RETAIN,
|
|
1119
1118
|
len: 1,
|
|
1120
1119
|
segmentId: l
|
|
1121
|
-
}),
|
|
1120
|
+
}), R.push({
|
|
1122
1121
|
t: M.DELETE,
|
|
1123
1122
|
len: S + 1 - h,
|
|
1124
1123
|
line: 0,
|
|
1125
1124
|
segmentId: l
|
|
1126
1125
|
});
|
|
1127
|
-
const C = k(
|
|
1128
|
-
return v.params.actions = T.editOp(
|
|
1126
|
+
const C = k(g, l);
|
|
1127
|
+
return v.params.actions = T.editOp(R.serialize(), C), !!s.syncExecuteCommand(v.id, v.params);
|
|
1129
1128
|
}
|
|
1130
1129
|
}, kn = {
|
|
1131
1130
|
id: "doc.command.delete-left",
|
|
@@ -1141,26 +1140,26 @@ const qe = {
|
|
|
1141
1140
|
const a = r.getUnitId(), c = $t(o, a), i = e.getActiveRange(), l = e.getCurrentSelections(), d = c == null ? void 0 : c.getSkeleton();
|
|
1142
1141
|
if (i == null || d == null || l == null)
|
|
1143
1142
|
return !1;
|
|
1144
|
-
const { segmentId:
|
|
1143
|
+
const { segmentId: g, style: u, segmentPage: f } = i, m = r.getSelfOrHeaderFooterModel(g).getBody();
|
|
1145
1144
|
if (m == null)
|
|
1146
1145
|
return !1;
|
|
1147
|
-
const I =
|
|
1146
|
+
const I = De(i, m), { startOffset: p, collapsed: h } = I, S = d.findNodeByCharIndex(p, g, f), _ = vn(S), O = xn(S, m);
|
|
1148
1147
|
let E = p;
|
|
1149
|
-
const v = d.findNodeByCharIndex(p - 1,
|
|
1148
|
+
const v = d.findNodeByCharIndex(p - 1, g, f);
|
|
1150
1149
|
if (Rn(S) && v !== S && (_ === !0 || O === !0) && h) {
|
|
1151
|
-
const
|
|
1152
|
-
if (
|
|
1150
|
+
const x = On(S, m);
|
|
1151
|
+
if (x == null)
|
|
1153
1152
|
return !1;
|
|
1154
|
-
const y =
|
|
1153
|
+
const y = x == null ? void 0 : x.startIndex, D = { startIndex: 0 }, L = x.paragraphStyle;
|
|
1155
1154
|
if (_ === !0) {
|
|
1156
|
-
const X =
|
|
1155
|
+
const X = x.paragraphStyle;
|
|
1157
1156
|
if (X) {
|
|
1158
1157
|
D.paragraphStyle = X;
|
|
1159
1158
|
const { hanging: oe } = X;
|
|
1160
1159
|
oe && (D.paragraphStyle.indentStart = oe, D.paragraphStyle.hanging = void 0);
|
|
1161
1160
|
}
|
|
1162
1161
|
} else if (O === !0) {
|
|
1163
|
-
const X =
|
|
1162
|
+
const X = x.bullet;
|
|
1164
1163
|
X && (D.bullet = X), L != null && (D.paragraphStyle = { ...L }, delete D.paragraphStyle.hanging, delete D.paragraphStyle.indentStart);
|
|
1165
1164
|
}
|
|
1166
1165
|
const W = [
|
|
@@ -1181,8 +1180,8 @@ const qe = {
|
|
|
1181
1180
|
endOffset: y + 1
|
|
1182
1181
|
},
|
|
1183
1182
|
textRanges: W,
|
|
1184
|
-
coverType:
|
|
1185
|
-
segmentId:
|
|
1183
|
+
coverType: Ee.REPLACE,
|
|
1184
|
+
segmentId: g
|
|
1186
1185
|
});
|
|
1187
1186
|
} else if (h === !0) {
|
|
1188
1187
|
if (v == null)
|
|
@@ -1193,10 +1192,10 @@ const qe = {
|
|
|
1193
1192
|
range: I
|
|
1194
1193
|
});
|
|
1195
1194
|
else if (v.streamType === "\b") {
|
|
1196
|
-
const
|
|
1197
|
-
if (
|
|
1195
|
+
const x = (C = r.getSnapshot().drawings) == null ? void 0 : C[(T = v.drawingId) != null ? T : ""];
|
|
1196
|
+
if (x == null)
|
|
1198
1197
|
return !0;
|
|
1199
|
-
if (
|
|
1198
|
+
if (x.layoutType === Ut.INLINE) {
|
|
1200
1199
|
const D = r.getUnitId();
|
|
1201
1200
|
s = await t.executeCommand(qe.id, {
|
|
1202
1201
|
direction: j.LEFT,
|
|
@@ -1216,32 +1215,32 @@ const qe = {
|
|
|
1216
1215
|
style: u
|
|
1217
1216
|
}
|
|
1218
1217
|
];
|
|
1219
|
-
s = await t.executeCommand(
|
|
1218
|
+
s = await t.executeCommand(ce.id, {
|
|
1220
1219
|
unitId: r.getUnitId(),
|
|
1221
1220
|
range: {
|
|
1222
1221
|
...i,
|
|
1223
1222
|
startOffset: i.startOffset - 1,
|
|
1224
1223
|
endOffset: i.endOffset - 1
|
|
1225
1224
|
},
|
|
1226
|
-
segmentId:
|
|
1225
|
+
segmentId: g,
|
|
1227
1226
|
direction: j.LEFT,
|
|
1228
1227
|
len: D.count,
|
|
1229
1228
|
textRanges: L
|
|
1230
1229
|
});
|
|
1231
1230
|
}
|
|
1232
1231
|
} else
|
|
1233
|
-
E -= v.count, s = await t.executeCommand(
|
|
1232
|
+
E -= v.count, s = await t.executeCommand(ce.id, {
|
|
1234
1233
|
unitId: r.getUnitId(),
|
|
1235
1234
|
range: I,
|
|
1236
|
-
segmentId:
|
|
1235
|
+
segmentId: g,
|
|
1237
1236
|
direction: j.LEFT,
|
|
1238
1237
|
len: v.count
|
|
1239
1238
|
});
|
|
1240
1239
|
} else {
|
|
1241
|
-
const
|
|
1240
|
+
const x = zt(I, [I]);
|
|
1242
1241
|
s = await t.executeCommand(kt.id, {
|
|
1243
|
-
segmentId:
|
|
1244
|
-
textRanges:
|
|
1242
|
+
segmentId: g,
|
|
1243
|
+
textRanges: x,
|
|
1245
1244
|
selections: [I]
|
|
1246
1245
|
});
|
|
1247
1246
|
}
|
|
@@ -1259,15 +1258,15 @@ const qe = {
|
|
|
1259
1258
|
const s = $t(o, t.getUnitId()), r = o.get(N), a = e.getActiveRange(), c = e.getCurrentSelections(), i = s == null ? void 0 : s.getSkeleton();
|
|
1260
1259
|
if (a == null || i == null || c == null)
|
|
1261
1260
|
return !1;
|
|
1262
|
-
const { segmentId: l, style: d, segmentPage:
|
|
1261
|
+
const { segmentId: l, style: d, segmentPage: g } = a, u = t == null ? void 0 : t.getSelfOrHeaderFooterModel(l).getBody();
|
|
1263
1262
|
if (!t || !u)
|
|
1264
1263
|
return !1;
|
|
1265
|
-
const
|
|
1264
|
+
const f = De(a, u, j.RIGHT), { startOffset: m, endOffset: I, collapsed: p } = f;
|
|
1266
1265
|
if (m === u.dataStream.length - 2 && p)
|
|
1267
1266
|
return !0;
|
|
1268
1267
|
let h = !1;
|
|
1269
1268
|
if (p === !0) {
|
|
1270
|
-
const O = i.findNodeByCharIndex(m, l,
|
|
1269
|
+
const O = i.findNodeByCharIndex(m, l, g), E = i.findNodeByCharIndex(m + 1);
|
|
1271
1270
|
if (O.content === "\r")
|
|
1272
1271
|
h = await r.executeCommand(Qe.id, {
|
|
1273
1272
|
direction: j.RIGHT,
|
|
@@ -1295,7 +1294,7 @@ const qe = {
|
|
|
1295
1294
|
style: d
|
|
1296
1295
|
}
|
|
1297
1296
|
];
|
|
1298
|
-
h = await r.executeCommand(
|
|
1297
|
+
h = await r.executeCommand(ce.id, {
|
|
1299
1298
|
unitId: t.getUnitId(),
|
|
1300
1299
|
range: {
|
|
1301
1300
|
...a,
|
|
@@ -1316,9 +1315,9 @@ const qe = {
|
|
|
1316
1315
|
style: d
|
|
1317
1316
|
}
|
|
1318
1317
|
];
|
|
1319
|
-
h = await r.executeCommand(
|
|
1318
|
+
h = await r.executeCommand(ce.id, {
|
|
1320
1319
|
unitId: t.getUnitId(),
|
|
1321
|
-
range:
|
|
1320
|
+
range: f,
|
|
1322
1321
|
segmentId: l,
|
|
1323
1322
|
direction: j.RIGHT,
|
|
1324
1323
|
textRanges: v,
|
|
@@ -1326,11 +1325,11 @@ const qe = {
|
|
|
1326
1325
|
});
|
|
1327
1326
|
}
|
|
1328
1327
|
} else {
|
|
1329
|
-
const O = zt(
|
|
1328
|
+
const O = zt(f, [f]);
|
|
1330
1329
|
h = await r.executeCommand(kt.id, {
|
|
1331
1330
|
segmentId: l,
|
|
1332
1331
|
textRanges: O,
|
|
1333
|
-
selections: [
|
|
1332
|
+
selections: [f]
|
|
1334
1333
|
});
|
|
1335
1334
|
}
|
|
1336
1335
|
return h;
|
|
@@ -1343,31 +1342,31 @@ function Hn(o, e, n, t, s) {
|
|
|
1343
1342
|
customDecorations: an(n, t, s)
|
|
1344
1343
|
}, d = [];
|
|
1345
1344
|
for (const u of r) {
|
|
1346
|
-
const { st:
|
|
1347
|
-
m <= t ||
|
|
1345
|
+
const { st: f, ed: m } = u;
|
|
1346
|
+
m <= t || f >= s || (f < t ? d.push({
|
|
1348
1347
|
...u,
|
|
1349
1348
|
st: 0,
|
|
1350
1349
|
ed: m - t
|
|
1351
1350
|
}) : m > s ? d.push({
|
|
1352
1351
|
...u,
|
|
1353
|
-
st:
|
|
1352
|
+
st: f - t,
|
|
1354
1353
|
ed: s - t
|
|
1355
1354
|
}) : d.push({
|
|
1356
1355
|
...u,
|
|
1357
|
-
st:
|
|
1356
|
+
st: f - t,
|
|
1358
1357
|
ed: m - t
|
|
1359
1358
|
}));
|
|
1360
1359
|
}
|
|
1361
1360
|
d.length > 0 && (l.textRuns = d);
|
|
1362
|
-
const
|
|
1361
|
+
const g = [];
|
|
1363
1362
|
for (const u of a) {
|
|
1364
|
-
const { startIndex:
|
|
1365
|
-
|
|
1363
|
+
const { startIndex: f } = u;
|
|
1364
|
+
f >= t && f <= s && g.push({
|
|
1366
1365
|
...u,
|
|
1367
|
-
startIndex:
|
|
1366
|
+
startIndex: f - t
|
|
1368
1367
|
});
|
|
1369
1368
|
}
|
|
1370
|
-
return
|
|
1369
|
+
return g.length > 0 && (l.customBlocks = g), l;
|
|
1371
1370
|
}
|
|
1372
1371
|
function zt(o, e) {
|
|
1373
1372
|
let n = o.endOffset;
|
|
@@ -1388,23 +1387,23 @@ const Ht = {
|
|
|
1388
1387
|
type: A.COMMAND,
|
|
1389
1388
|
// eslint-disable-next-line max-lines-per-function
|
|
1390
1389
|
handler: async (o, e) => {
|
|
1391
|
-
const { unitId: n, newText: t, oldTextLen: s, isCompositionEnd: r, isCompositionStart: a } = e, c = o.get(N), i = o.get(
|
|
1390
|
+
const { unitId: n, newText: t, oldTextLen: s, isCompositionEnd: r, isCompositionStart: a } = e, c = o.get(N), i = o.get(Ne), d = o.get(U).getCurrentUniverDocInstance();
|
|
1392
1391
|
if (d == null)
|
|
1393
1392
|
return !1;
|
|
1394
|
-
const
|
|
1395
|
-
if (!
|
|
1393
|
+
const g = i.getActiveRange();
|
|
1394
|
+
if (!g)
|
|
1396
1395
|
return !1;
|
|
1397
|
-
const { startOffset: u, style:
|
|
1396
|
+
const { startOffset: u, style: f, segmentId: m } = g, I = d.getSelfOrHeaderFooterModel(m).getBody();
|
|
1398
1397
|
if (I == null)
|
|
1399
1398
|
return !1;
|
|
1400
|
-
const p = Ye(
|
|
1401
|
-
Object.assign(
|
|
1399
|
+
const p = Ye(g, I);
|
|
1400
|
+
Object.assign(g, p);
|
|
1402
1401
|
const h = t.length, S = [
|
|
1403
1402
|
{
|
|
1404
1403
|
startOffset: u + h,
|
|
1405
1404
|
endOffset: u + h,
|
|
1406
1405
|
collapsed: !0,
|
|
1407
|
-
style:
|
|
1406
|
+
style: f
|
|
1408
1407
|
}
|
|
1409
1408
|
], _ = {
|
|
1410
1409
|
id: G.id,
|
|
@@ -1414,8 +1413,8 @@ const Ht = {
|
|
|
1414
1413
|
textRanges: S
|
|
1415
1414
|
}
|
|
1416
1415
|
}, O = new $(), E = B.getInstance();
|
|
1417
|
-
if (!
|
|
1418
|
-
const { dos: T, retain: C, cursor:
|
|
1416
|
+
if (!g.collapsed && a) {
|
|
1417
|
+
const { dos: T, retain: C, cursor: x } = Je(g, m, 0, I);
|
|
1419
1418
|
O.push(...T), _.params.textRanges = [{
|
|
1420
1419
|
startOffset: u + h + C,
|
|
1421
1420
|
endOffset: u + h + C,
|
|
@@ -1443,8 +1442,8 @@ const Ht = {
|
|
|
1443
1442
|
});
|
|
1444
1443
|
const v = k(d, m);
|
|
1445
1444
|
_.params.actions = E.editOp(O.serialize(), v), _.params.noHistory = !r, _.params.isCompositionEnd = r;
|
|
1446
|
-
const
|
|
1447
|
-
return i.pushUndoRedoMutationParams(
|
|
1445
|
+
const R = c.syncExecuteCommand(_.id, _.params);
|
|
1446
|
+
return i.pushUndoRedoMutationParams(R, _.params), !!R;
|
|
1448
1447
|
}
|
|
1449
1448
|
};
|
|
1450
1449
|
function H(o, e, n, t) {
|
|
@@ -1468,25 +1467,25 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1468
1467
|
n
|
|
1469
1468
|
);
|
|
1470
1469
|
}
|
|
1471
|
-
},
|
|
1472
|
-
id:
|
|
1470
|
+
}, xt = "doc.command.set-inline-format-italic", tt = {
|
|
1471
|
+
id: xt,
|
|
1473
1472
|
type: A.COMMAND,
|
|
1474
1473
|
handler: async (o, e) => {
|
|
1475
1474
|
const n = o.get(N), t = o.get(P);
|
|
1476
1475
|
return H(
|
|
1477
|
-
|
|
1476
|
+
xt,
|
|
1478
1477
|
e,
|
|
1479
1478
|
t,
|
|
1480
1479
|
n
|
|
1481
1480
|
);
|
|
1482
1481
|
}
|
|
1483
|
-
},
|
|
1484
|
-
id:
|
|
1482
|
+
}, Rt = "doc.command.set-inline-format-underline", nt = {
|
|
1483
|
+
id: Rt,
|
|
1485
1484
|
type: A.COMMAND,
|
|
1486
1485
|
handler: async (o, e) => {
|
|
1487
1486
|
const n = o.get(N), t = o.get(P);
|
|
1488
1487
|
return H(
|
|
1489
|
-
|
|
1488
|
+
Rt,
|
|
1490
1489
|
e,
|
|
1491
1490
|
t,
|
|
1492
1491
|
n
|
|
@@ -1504,7 +1503,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1504
1503
|
n
|
|
1505
1504
|
);
|
|
1506
1505
|
}
|
|
1507
|
-
}, Ct = "doc.command.set-inline-format-subscript",
|
|
1506
|
+
}, Ct = "doc.command.set-inline-format-subscript", de = {
|
|
1508
1507
|
id: Ct,
|
|
1509
1508
|
type: A.COMMAND,
|
|
1510
1509
|
handler: async (o, e) => {
|
|
@@ -1598,7 +1597,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1598
1597
|
[it.id]: "cl",
|
|
1599
1598
|
[ct.id]: "bg",
|
|
1600
1599
|
[dt.id]: "bg",
|
|
1601
|
-
[
|
|
1600
|
+
[de.id]: "va",
|
|
1602
1601
|
[ot.id]: "va"
|
|
1603
1602
|
}, Vt = {
|
|
1604
1603
|
id: "doc.command.set-inline-format",
|
|
@@ -1612,15 +1611,15 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1612
1611
|
if (l == null)
|
|
1613
1612
|
return !1;
|
|
1614
1613
|
const d = l.getUnitId();
|
|
1615
|
-
let
|
|
1614
|
+
let g;
|
|
1616
1615
|
switch (s) {
|
|
1617
1616
|
case et.id:
|
|
1618
1617
|
case tt.id:
|
|
1619
1618
|
case nt.id:
|
|
1620
1619
|
case st.id:
|
|
1621
|
-
case
|
|
1620
|
+
case de.id:
|
|
1622
1621
|
case ot.id: {
|
|
1623
|
-
|
|
1622
|
+
g = Vn(
|
|
1624
1623
|
l.getSelfOrHeaderFooterModel(n).getBody().textRuns,
|
|
1625
1624
|
s,
|
|
1626
1625
|
i
|
|
@@ -1629,18 +1628,18 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1629
1628
|
}
|
|
1630
1629
|
case rt.id:
|
|
1631
1630
|
case at.id: {
|
|
1632
|
-
|
|
1631
|
+
g = t;
|
|
1633
1632
|
break;
|
|
1634
1633
|
}
|
|
1635
1634
|
case it.id:
|
|
1636
1635
|
case ct.id: {
|
|
1637
|
-
|
|
1636
|
+
g = {
|
|
1638
1637
|
rgb: t
|
|
1639
1638
|
};
|
|
1640
1639
|
break;
|
|
1641
1640
|
}
|
|
1642
1641
|
case dt.id: {
|
|
1643
|
-
|
|
1642
|
+
g = {
|
|
1644
1643
|
rgb: null
|
|
1645
1644
|
};
|
|
1646
1645
|
break;
|
|
@@ -1655,7 +1654,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1655
1654
|
actions: [],
|
|
1656
1655
|
textRanges: i.map(se)
|
|
1657
1656
|
}
|
|
1658
|
-
},
|
|
1657
|
+
}, f = new $(), m = B.getInstance(), I = new le();
|
|
1659
1658
|
I.reset();
|
|
1660
1659
|
for (const S of i) {
|
|
1661
1660
|
const { startOffset: _, endOffset: O } = S, E = {
|
|
@@ -1665,16 +1664,16 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1665
1664
|
st: 0,
|
|
1666
1665
|
ed: O - _,
|
|
1667
1666
|
ts: {
|
|
1668
|
-
[Xt[s]]:
|
|
1667
|
+
[Xt[s]]: g
|
|
1669
1668
|
}
|
|
1670
1669
|
}
|
|
1671
1670
|
]
|
|
1672
1671
|
}, v = _ - I.cursor;
|
|
1673
|
-
v !== 0 &&
|
|
1672
|
+
v !== 0 && f.push({
|
|
1674
1673
|
t: M.RETAIN,
|
|
1675
1674
|
len: v,
|
|
1676
1675
|
segmentId: n
|
|
1677
|
-
}),
|
|
1676
|
+
}), f.push({
|
|
1678
1677
|
t: M.RETAIN,
|
|
1679
1678
|
body: E,
|
|
1680
1679
|
len: O - _,
|
|
@@ -1682,7 +1681,7 @@ const vt = "doc.command.set-inline-format-bold", et = {
|
|
|
1682
1681
|
}), I.reset(), I.moveCursor(O);
|
|
1683
1682
|
}
|
|
1684
1683
|
const p = k(l, n);
|
|
1685
|
-
return u.params.actions = m.editOp(
|
|
1684
|
+
return u.params.actions = m.editOp(f.serialize(), p), !!r.syncExecuteCommand(u.id, u.params);
|
|
1686
1685
|
}
|
|
1687
1686
|
};
|
|
1688
1687
|
function Xn(o) {
|
|
@@ -1707,13 +1706,13 @@ function Vn(o, e, n) {
|
|
|
1707
1706
|
s: K.TRUE
|
|
1708
1707
|
};
|
|
1709
1708
|
if (/va/.test(r))
|
|
1710
|
-
return e ===
|
|
1709
|
+
return e === de.id ? (d == null ? void 0 : d[r]) === Z.SUBSCRIPT ? Z.NORMAL : Z.SUBSCRIPT : (d == null ? void 0 : d[r]) === Z.SUPERSCRIPT ? Z.NORMAL : Z.SUPERSCRIPT;
|
|
1711
1710
|
t++;
|
|
1712
1711
|
}
|
|
1713
1712
|
}
|
|
1714
1713
|
return /bl|it/.test(r) ? K.TRUE : /ul|st/.test(r) ? {
|
|
1715
1714
|
s: K.TRUE
|
|
1716
|
-
} : e ===
|
|
1715
|
+
} : e === de.id ? Z.SUBSCRIPT : Z.SUPERSCRIPT;
|
|
1717
1716
|
}
|
|
1718
1717
|
const lt = {
|
|
1719
1718
|
id: "doc.command.list-operation",
|
|
@@ -1724,16 +1723,16 @@ const lt = {
|
|
|
1724
1723
|
const n = o.get(P), t = o.get(U), s = o.get(N), { listType: r } = e, a = t.getCurrentUniverDocInstance(), c = n.getActiveRange();
|
|
1725
1724
|
if (a == null || c == null)
|
|
1726
1725
|
return !1;
|
|
1727
|
-
const { segmentId: i } = c, l = (y = n.getCurrentSelections()) != null ? y : [], d = (D = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : D.paragraphs,
|
|
1726
|
+
const { segmentId: i } = c, l = (y = n.getCurrentSelections()) != null ? y : [], d = (D = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : D.paragraphs, g = l.map(se);
|
|
1728
1727
|
if (d == null)
|
|
1729
1728
|
return !1;
|
|
1730
|
-
const u = (W = (L = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : L.sectionBreaks) != null ? W : [],
|
|
1729
|
+
const u = (W = (L = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : L.sectionBreaks) != null ? W : [], f = Wt(c, d), m = a.getUnitId(), I = f.every((J) => {
|
|
1731
1730
|
var z;
|
|
1732
1731
|
return ((z = J.bullet) == null ? void 0 : z.listType) === r;
|
|
1733
1732
|
});
|
|
1734
1733
|
let h = ne.generateRandomId(6);
|
|
1735
|
-
if (
|
|
1736
|
-
const J = d.indexOf(
|
|
1734
|
+
if (f.length === 1) {
|
|
1735
|
+
const J = d.indexOf(f[0]), z = d[J - 1], Y = d[J + 1];
|
|
1737
1736
|
z && z.bullet && z.bullet.listType === r ? h = z.bullet.listId : Y && Y.bullet && Y.bullet.listType === r && (h = Y.bullet.listId);
|
|
1738
1737
|
}
|
|
1739
1738
|
const S = {
|
|
@@ -1741,16 +1740,16 @@ const lt = {
|
|
|
1741
1740
|
params: {
|
|
1742
1741
|
unitId: m,
|
|
1743
1742
|
actions: [],
|
|
1744
|
-
textRanges:
|
|
1743
|
+
textRanges: g
|
|
1745
1744
|
}
|
|
1746
|
-
}, _ = new
|
|
1745
|
+
}, _ = new le();
|
|
1747
1746
|
_.reset();
|
|
1748
|
-
const O = new $(), E = B.getInstance(), v = (X = a.getSnapshot().lists) != null ? X : {},
|
|
1747
|
+
const O = new $(), E = B.getInstance(), v = (X = a.getSnapshot().lists) != null ? X : {}, R = {
|
|
1749
1748
|
...cn,
|
|
1750
1749
|
...v
|
|
1751
1750
|
}, { defaultTabStop: T = 36 } = a.getSnapshot().documentStyle;
|
|
1752
|
-
for (const J of
|
|
1753
|
-
const { startIndex: z, paragraphStyle: Y = {} } = J, { indentFirstLine: Kt, snapToGrid: Zt, indentStart:
|
|
1751
|
+
for (const J of f) {
|
|
1752
|
+
const { startIndex: z, paragraphStyle: Y = {} } = J, { indentFirstLine: Kt, snapToGrid: Zt, indentStart: Pe } = Y, { hanging: we, indentStart: ut } = R[r].nestingLevel[0], { charSpace: Jt, gridType: qt } = Kn(z, u) || { charSpace: 0, gridType: dn.LINES }, q = Cn(Jt, T, qt, Zt);
|
|
1754
1753
|
O.push({
|
|
1755
1754
|
t: M.RETAIN,
|
|
1756
1755
|
len: z - _.cursor,
|
|
@@ -1765,7 +1764,7 @@ const lt = {
|
|
|
1765
1764
|
paragraphStyle: {
|
|
1766
1765
|
...Y,
|
|
1767
1766
|
hanging: void 0,
|
|
1768
|
-
indentStart:
|
|
1767
|
+
indentStart: Pe ? { v: Math.max(0, Q(Pe, q) + Q(we, q) - Q(ut, q)) } : void 0
|
|
1769
1768
|
},
|
|
1770
1769
|
startIndex: 0
|
|
1771
1770
|
} : {
|
|
@@ -1773,8 +1772,8 @@ const lt = {
|
|
|
1773
1772
|
paragraphStyle: {
|
|
1774
1773
|
...Y,
|
|
1775
1774
|
indentFirstLine: void 0,
|
|
1776
|
-
hanging:
|
|
1777
|
-
indentStart: { v: Q(ut, q) - Q(
|
|
1775
|
+
hanging: we,
|
|
1776
|
+
indentStart: { v: Q(ut, q) - Q(we, q) + Q(Kt, q) + Q(Pe, q) }
|
|
1778
1777
|
},
|
|
1779
1778
|
bullet: {
|
|
1780
1779
|
...(oe = J.bullet) != null ? oe : {
|
|
@@ -1790,7 +1789,7 @@ const lt = {
|
|
|
1790
1789
|
]
|
|
1791
1790
|
},
|
|
1792
1791
|
segmentId: i,
|
|
1793
|
-
coverType:
|
|
1792
|
+
coverType: Ee.REPLACE
|
|
1794
1793
|
}), _.moveCursorTo(z + 1);
|
|
1795
1794
|
}
|
|
1796
1795
|
const C = k(a, i);
|
|
@@ -1830,11 +1829,11 @@ const Zn = {
|
|
|
1830
1829
|
id: "doc.command-replace-content",
|
|
1831
1830
|
type: A.COMMAND,
|
|
1832
1831
|
handler: async (o, e) => {
|
|
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),
|
|
1834
|
-
if (d == null ||
|
|
1832
|
+
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), g = d == null ? void 0 : d.getSnapshot().body, u = l.getCurrentSelections();
|
|
1833
|
+
if (d == null || g == null || !Array.isArray(u) || u.length === 0)
|
|
1835
1834
|
return !1;
|
|
1836
|
-
const
|
|
1837
|
-
return
|
|
1835
|
+
const f = Yt(n, r, d, g, t);
|
|
1836
|
+
return f.params.textRanges = s, a && (f.params.options = a), !!i.syncExecuteCommand(f.id, f.params);
|
|
1838
1837
|
}
|
|
1839
1838
|
}, Jn = {
|
|
1840
1839
|
id: "doc.command-cover-content",
|
|
@@ -1881,7 +1880,7 @@ const qn = (o, e) => {
|
|
|
1881
1880
|
...ne.deepClone(e),
|
|
1882
1881
|
zoomRatio: t
|
|
1883
1882
|
};
|
|
1884
|
-
},
|
|
1883
|
+
}, xe = {
|
|
1885
1884
|
id: "doc.operation.set-zoom-ratio",
|
|
1886
1885
|
type: A.OPERATION,
|
|
1887
1886
|
handler: (o, e) => {
|
|
@@ -1897,20 +1896,20 @@ const qn = (o, e) => {
|
|
|
1897
1896
|
type: A.COMMAND,
|
|
1898
1897
|
id: "doc.command.set-zoom-ratio",
|
|
1899
1898
|
handler: async (o, e) => {
|
|
1900
|
-
var
|
|
1899
|
+
var g, u, f;
|
|
1901
1900
|
const n = o.get(N), t = o.get(ze), s = o.get(U);
|
|
1902
|
-
let r = (
|
|
1901
|
+
let r = (g = s.getCurrentUniverDocInstance()) == null ? void 0 : g.getUnitId();
|
|
1903
1902
|
if (!r) return !1;
|
|
1904
1903
|
let a = 1;
|
|
1905
|
-
if (e && (r = (u = e.documentId) != null ? u : r, a = (
|
|
1904
|
+
if (e && (r = (u = e.documentId) != null ? u : r, a = (f = e.zoomRatio) != null ? f : a), !s.getUniverDocInstance(r)) return !1;
|
|
1906
1905
|
const i = {
|
|
1907
1906
|
zoomRatio: a,
|
|
1908
1907
|
unitId: r
|
|
1909
1908
|
}, l = qn(o, i);
|
|
1910
|
-
return n.syncExecuteCommand(
|
|
1909
|
+
return n.syncExecuteCommand(xe.id, i) ? (t.pushUndoRedo({
|
|
1911
1910
|
unitID: r,
|
|
1912
|
-
undoMutations: [{ id:
|
|
1913
|
-
redoMutations: [{ id:
|
|
1911
|
+
undoMutations: [{ id: xe.id, params: l }],
|
|
1912
|
+
redoMutations: [{ id: xe.id, params: i }]
|
|
1914
1913
|
}), !0) : !1;
|
|
1915
1914
|
}
|
|
1916
1915
|
}, $e = {
|
|
@@ -2005,19 +2004,19 @@ let Re = class extends fe {
|
|
|
2005
2004
|
}
|
|
2006
2005
|
};
|
|
2007
2006
|
Re = ss([
|
|
2008
|
-
|
|
2007
|
+
ue(ge.Rendered, Re),
|
|
2009
2008
|
re(0, U),
|
|
2010
|
-
re(1,
|
|
2011
|
-
re(2,
|
|
2012
|
-
re(3,
|
|
2009
|
+
re(1, he),
|
|
2010
|
+
re(2, Ae),
|
|
2011
|
+
re(3, ee(Ne)),
|
|
2013
2012
|
re(4, N)
|
|
2014
2013
|
], Re);
|
|
2015
2014
|
var os = Object.defineProperty, rs = Object.getOwnPropertyDescriptor, as = (o, e, n, t) => {
|
|
2016
2015
|
for (var s = t > 1 ? void 0 : t ? rs(e, n) : e, r = o.length - 1, a; r >= 0; r--)
|
|
2017
2016
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2018
2017
|
return t && s && os(e, n, s), s;
|
|
2019
|
-
},
|
|
2020
|
-
let
|
|
2018
|
+
}, Ie = (o, e) => (n, t) => e(n, t, o);
|
|
2019
|
+
let Oe = class extends fe {
|
|
2021
2020
|
constructor(e, n, t, s) {
|
|
2022
2021
|
super();
|
|
2023
2022
|
w(this, "_onInputSubscription");
|
|
@@ -2059,31 +2058,31 @@ let xe = class extends fe {
|
|
|
2059
2058
|
endOffset: i,
|
|
2060
2059
|
style: l,
|
|
2061
2060
|
collapsed: d,
|
|
2062
|
-
direction:
|
|
2061
|
+
direction: g,
|
|
2063
2062
|
segmentId: u,
|
|
2064
|
-
startNodePosition:
|
|
2063
|
+
startNodePosition: f,
|
|
2065
2064
|
endNodePosition: m,
|
|
2066
2065
|
segmentPage: I
|
|
2067
2066
|
} = n;
|
|
2068
2067
|
if (t.length > 1) {
|
|
2069
|
-
let v = Number.POSITIVE_INFINITY,
|
|
2068
|
+
let v = Number.POSITIVE_INFINITY, R = Number.NEGATIVE_INFINITY;
|
|
2070
2069
|
for (const T of t)
|
|
2071
|
-
v = Math.min(v, T.startOffset),
|
|
2070
|
+
v = Math.min(v, T.startOffset), R = Math.max(R, T.endOffset);
|
|
2072
2071
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2073
2072
|
{
|
|
2074
|
-
startOffset: e === F.LEFT || e === F.UP ?
|
|
2075
|
-
endOffset: e === F.LEFT || e === F.UP ? v :
|
|
2073
|
+
startOffset: e === F.LEFT || e === F.UP ? R : v,
|
|
2074
|
+
endOffset: e === F.LEFT || e === F.UP ? v : R,
|
|
2076
2075
|
style: l
|
|
2077
2076
|
}
|
|
2078
2077
|
], !1);
|
|
2079
2078
|
return;
|
|
2080
2079
|
}
|
|
2081
|
-
const p = d ||
|
|
2082
|
-
let h = d ||
|
|
2080
|
+
const p = d || g === Ue.FORWARD ? c : i;
|
|
2081
|
+
let h = d || g === Ue.FORWARD ? i : c;
|
|
2083
2082
|
const S = (O = s.getSelfOrHeaderFooterModel(u).getBody().dataStream.length) != null ? O : Number.POSITIVE_INFINITY;
|
|
2084
2083
|
if (e === F.LEFT || e === F.RIGHT) {
|
|
2085
|
-
const v = r.findNodeByCharIndex(h - 1, u, I),
|
|
2086
|
-
h = e === F.RIGHT ? h +
|
|
2084
|
+
const v = r.findNodeByCharIndex(h - 1, u, I), R = r.findNodeByCharIndex(h, u, I);
|
|
2085
|
+
h = e === F.RIGHT ? h + R.count : h - ((E = v == null ? void 0 : v.count) != null ? E : 0), h = Math.min(S - 2, Math.max(0, h)), this._textSelectionManagerService.replaceTextRanges([
|
|
2087
2086
|
{
|
|
2088
2087
|
startOffset: p,
|
|
2089
2088
|
endOffset: h,
|
|
@@ -2091,7 +2090,7 @@ let xe = class extends fe {
|
|
|
2091
2090
|
}
|
|
2092
2091
|
], !1);
|
|
2093
2092
|
} else {
|
|
2094
|
-
const v = r.findNodeByCharIndex(h, u, I),
|
|
2093
|
+
const v = r.findNodeByCharIndex(h, u, I), R = a.document.getOffsetConfig(), T = d ? f : g === Ue.FORWARD ? m : f, C = this._getTopOrBottomPosition(r, v, T, e === F.DOWN);
|
|
2095
2094
|
if (C == null) {
|
|
2096
2095
|
const y = e === F.UP ? 0 : S - 2;
|
|
2097
2096
|
if (y === h)
|
|
@@ -2105,14 +2104,14 @@ let xe = class extends fe {
|
|
|
2105
2104
|
], !1);
|
|
2106
2105
|
return;
|
|
2107
2106
|
}
|
|
2108
|
-
const
|
|
2107
|
+
const x = new mt(R, r).getRangePointData(
|
|
2109
2108
|
C,
|
|
2110
2109
|
C
|
|
2111
2110
|
).cursorList[0];
|
|
2112
2111
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2113
2112
|
{
|
|
2114
2113
|
startOffset: p,
|
|
2115
|
-
endOffset:
|
|
2114
|
+
endOffset: x.endOffset,
|
|
2116
2115
|
style: l
|
|
2117
2116
|
}
|
|
2118
2117
|
], !1);
|
|
@@ -2127,24 +2126,24 @@ let xe = class extends fe {
|
|
|
2127
2126
|
const r = (S = this._renderManagerService.getRenderById(s.getUnitId())) == null ? void 0 : S.with(V).getSkeleton(), a = this._getDocObject(), c = s.getBody();
|
|
2128
2127
|
if (n == null || r == null || a == null || t == null || c == null)
|
|
2129
2128
|
return;
|
|
2130
|
-
const { startOffset: i, endOffset: l, style: d, collapsed:
|
|
2129
|
+
const { startOffset: i, endOffset: l, style: d, collapsed: g, segmentId: u, startNodePosition: f, endNodePosition: m, segmentPage: I } = n, p = (_ = s.getSelfOrHeaderFooterModel(u).getBody().dataStream.length) != null ? _ : Number.POSITIVE_INFINITY, h = (O = s.getCustomRanges()) != null ? O : [];
|
|
2131
2130
|
if (e === F.LEFT || e === F.RIGHT) {
|
|
2132
2131
|
let v;
|
|
2133
2132
|
if (!n.collapsed || t.length > 1) {
|
|
2134
|
-
let C = Number.POSITIVE_INFINITY,
|
|
2133
|
+
let C = Number.POSITIVE_INFINITY, x = Number.NEGATIVE_INFINITY;
|
|
2135
2134
|
for (const y of t)
|
|
2136
|
-
C = Math.min(C, y.startOffset),
|
|
2137
|
-
v = e === F.LEFT ? C :
|
|
2135
|
+
C = Math.min(C, y.startOffset), x = Math.max(x, y.endOffset);
|
|
2136
|
+
v = e === F.LEFT ? C : x;
|
|
2138
2137
|
} else {
|
|
2139
|
-
const C = r.findNodeByCharIndex(i - 1, u, I),
|
|
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 +
|
|
2138
|
+
const C = r.findNodeByCharIndex(i - 1, u, I), x = r.findNodeByCharIndex(i, u, I);
|
|
2139
|
+
e === F.LEFT ? v = Math.max(0, i - ((E = C == null ? void 0 : C.count) != null ? E : 0)) : v = Math.min(p - 2, l + x.count);
|
|
2141
2140
|
}
|
|
2142
|
-
const
|
|
2141
|
+
const R = [b.CUSTOM_RANGE_START, b.CUSTOM_RANGE_END];
|
|
2143
2142
|
if (e === F.LEFT)
|
|
2144
|
-
for (;
|
|
2143
|
+
for (; R.includes(c.dataStream[v]); )
|
|
2145
2144
|
v--;
|
|
2146
2145
|
else
|
|
2147
|
-
for (;
|
|
2146
|
+
for (; R.includes(c.dataStream[v - 1]); )
|
|
2148
2147
|
v++;
|
|
2149
2148
|
h.filter((C) => C.wholeEntity && C.startIndex < v && C.endIndex >= v).forEach((C) => {
|
|
2150
2149
|
e === F.LEFT ? v = Math.min(C.startIndex, v) : v = Math.max(C.endIndex + 1, v);
|
|
@@ -2156,15 +2155,15 @@ let xe = class extends fe {
|
|
|
2156
2155
|
}
|
|
2157
2156
|
], !1);
|
|
2158
2157
|
} else {
|
|
2159
|
-
const v = r.findNodeByCharIndex(i, u, I),
|
|
2158
|
+
const v = r.findNodeByCharIndex(i, u, I), R = r.findNodeByCharIndex(l, u, I), T = a.document.getOffsetConfig(), C = this._getTopOrBottomPosition(
|
|
2160
2159
|
r,
|
|
2161
|
-
e === F.UP ||
|
|
2162
|
-
e === F.UP ||
|
|
2160
|
+
e === F.UP || g ? v : R,
|
|
2161
|
+
e === F.UP || g ? f : m,
|
|
2163
2162
|
e === F.DOWN
|
|
2164
2163
|
);
|
|
2165
2164
|
if (C == null) {
|
|
2166
2165
|
let y;
|
|
2167
|
-
|
|
2166
|
+
g ? y = e === F.UP ? 0 : p - 2 : y = e === F.UP ? i : l, this._textSelectionManagerService.replaceTextRanges([
|
|
2168
2167
|
{
|
|
2169
2168
|
startOffset: y,
|
|
2170
2169
|
endOffset: y,
|
|
@@ -2173,13 +2172,13 @@ let xe = class extends fe {
|
|
|
2173
2172
|
], !1);
|
|
2174
2173
|
return;
|
|
2175
2174
|
}
|
|
2176
|
-
const
|
|
2175
|
+
const x = new mt(T, r).getRangePointData(
|
|
2177
2176
|
C,
|
|
2178
2177
|
C
|
|
2179
2178
|
).cursorList[0];
|
|
2180
2179
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2181
2180
|
{
|
|
2182
|
-
...
|
|
2181
|
+
...x,
|
|
2183
2182
|
style: d
|
|
2184
2183
|
}
|
|
2185
2184
|
], !1);
|
|
@@ -2209,7 +2208,7 @@ let xe = class extends fe {
|
|
|
2209
2208
|
for (const c of n.divides) {
|
|
2210
2209
|
const i = c.left;
|
|
2211
2210
|
for (const l of c.glyphGroup) {
|
|
2212
|
-
const { left: d } = l,
|
|
2211
|
+
const { left: d } = l, g = i + d, u = Math.abs(t - g);
|
|
2213
2212
|
u < r.distance && (r.glyph = l, r.distance = u);
|
|
2214
2213
|
}
|
|
2215
2214
|
}
|
|
@@ -2220,7 +2219,7 @@ let xe = class extends fe {
|
|
|
2220
2219
|
}
|
|
2221
2220
|
// eslint-disable-next-line max-lines-per-function
|
|
2222
2221
|
_getNextOrPrevLine(e, n) {
|
|
2223
|
-
var m, I, p, h, S, _, O, E, v,
|
|
2222
|
+
var m, I, p, h, S, _, O, E, v, R, T, C;
|
|
2224
2223
|
const t = e.parent;
|
|
2225
2224
|
if (t == null)
|
|
2226
2225
|
return;
|
|
@@ -2245,21 +2244,21 @@ let xe = class extends fe {
|
|
|
2245
2244
|
if (n === !0)
|
|
2246
2245
|
c = (m = i.columns[l + 1]) == null ? void 0 : m.lines[0];
|
|
2247
2246
|
else {
|
|
2248
|
-
const
|
|
2249
|
-
c =
|
|
2247
|
+
const x = (p = (I = i.columns) == null ? void 0 : I[l - 1]) == null ? void 0 : p.lines;
|
|
2248
|
+
c = x == null ? void 0 : x[x.length - 1];
|
|
2250
2249
|
}
|
|
2251
2250
|
if (c != null)
|
|
2252
2251
|
return c;
|
|
2253
2252
|
const d = i.parent;
|
|
2254
2253
|
if (d == null)
|
|
2255
2254
|
return;
|
|
2256
|
-
const
|
|
2257
|
-
if (
|
|
2255
|
+
const g = d.sections.indexOf(i);
|
|
2256
|
+
if (g === -1)
|
|
2258
2257
|
return;
|
|
2259
2258
|
if (n === !0)
|
|
2260
|
-
c = (S = (h = d.sections[
|
|
2259
|
+
c = (S = (h = d.sections[g - 1]) == null ? void 0 : h.columns[0]) == null ? void 0 : S.lines[0];
|
|
2261
2260
|
else {
|
|
2262
|
-
const
|
|
2261
|
+
const x = (O = (_ = d.sections) == null ? void 0 : _[g - 1]) == null ? void 0 : O.columns, y = x == null ? void 0 : x[x.length - 1], D = y == null ? void 0 : y.lines;
|
|
2263
2262
|
c = D == null ? void 0 : D[D.length - 1];
|
|
2264
2263
|
}
|
|
2265
2264
|
if (c != null)
|
|
@@ -2267,15 +2266,15 @@ let xe = class extends fe {
|
|
|
2267
2266
|
const u = d.parent;
|
|
2268
2267
|
if (u == null)
|
|
2269
2268
|
return;
|
|
2270
|
-
const
|
|
2271
|
-
if (
|
|
2269
|
+
const f = u.pages.indexOf(d);
|
|
2270
|
+
if (f !== -1) {
|
|
2272
2271
|
if (n === !0)
|
|
2273
|
-
c = (
|
|
2272
|
+
c = (R = (v = (E = u.pages[f + 1]) == null ? void 0 : E.sections[0]) == null ? void 0 : v.columns[0]) == null ? void 0 : R.lines[0];
|
|
2274
2273
|
else {
|
|
2275
|
-
const
|
|
2276
|
-
if (
|
|
2274
|
+
const x = (T = u.pages[f - 1]) == null ? void 0 : T.sections;
|
|
2275
|
+
if (x == null)
|
|
2277
2276
|
return;
|
|
2278
|
-
const y = (C =
|
|
2277
|
+
const y = (C = x[x.length - 1]) == null ? void 0 : C.columns, D = y[y.length - 1], L = D == null ? void 0 : D.lines;
|
|
2279
2278
|
c = L[L.length - 1];
|
|
2280
2279
|
}
|
|
2281
2280
|
if (c != null)
|
|
@@ -2286,19 +2285,19 @@ let xe = class extends fe {
|
|
|
2286
2285
|
return Fn(this._univerInstanceService, this._renderManagerService);
|
|
2287
2286
|
}
|
|
2288
2287
|
};
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
],
|
|
2288
|
+
Oe = as([
|
|
2289
|
+
ue(ge.Rendered, Oe),
|
|
2290
|
+
Ie(0, U),
|
|
2291
|
+
Ie(1, he),
|
|
2292
|
+
Ie(2, ee(P)),
|
|
2293
|
+
Ie(3, N)
|
|
2294
|
+
], Oe);
|
|
2296
2295
|
var is = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, ds = (o, e, n, t) => {
|
|
2297
2296
|
for (var s = t > 1 ? void 0 : t ? cs(e, n) : e, r = o.length - 1, a; r >= 0; r--)
|
|
2298
2297
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2299
2298
|
return t && s && is(e, n, s), s;
|
|
2300
|
-
},
|
|
2301
|
-
let
|
|
2299
|
+
}, _e = (o, e) => (n, t) => e(n, t, o);
|
|
2300
|
+
let Ce = class extends fe {
|
|
2302
2301
|
constructor(e, n, t, s) {
|
|
2303
2302
|
super();
|
|
2304
2303
|
w(this, "_onInputSubscription");
|
|
@@ -2322,16 +2321,16 @@ let Oe = class extends fe {
|
|
|
2322
2321
|
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();
|
|
2323
2322
|
if (c.data == null || i == null || !i || !a)
|
|
2324
2323
|
return;
|
|
2325
|
-
const { startOffset: l, segmentId: d, style:
|
|
2324
|
+
const { startOffset: l, segmentId: d, style: g, segmentPage: u } = a, f = r.length, m = [
|
|
2326
2325
|
{
|
|
2327
|
-
startOffset: l +
|
|
2328
|
-
endOffset: l +
|
|
2326
|
+
startOffset: l + f,
|
|
2327
|
+
endOffset: l + f,
|
|
2329
2328
|
segmentId: d,
|
|
2330
2329
|
segmentPage: u,
|
|
2331
|
-
style:
|
|
2330
|
+
style: g
|
|
2332
2331
|
}
|
|
2333
2332
|
];
|
|
2334
|
-
await this._commandService.executeCommand(
|
|
2333
|
+
await this._commandService.executeCommand(Te.id, {
|
|
2335
2334
|
unitId: t,
|
|
2336
2335
|
body: {
|
|
2337
2336
|
dataStream: r
|
|
@@ -2343,14 +2342,14 @@ let Oe = class extends fe {
|
|
|
2343
2342
|
});
|
|
2344
2343
|
}
|
|
2345
2344
|
};
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
],
|
|
2353
|
-
const
|
|
2345
|
+
Ce = ds([
|
|
2346
|
+
ue(ge.Rendered, Ce),
|
|
2347
|
+
_e(0, U),
|
|
2348
|
+
_e(1, he),
|
|
2349
|
+
_e(2, Ae),
|
|
2350
|
+
_e(3, N)
|
|
2351
|
+
], Ce);
|
|
2352
|
+
const Se = {
|
|
2354
2353
|
id: "doc.command.align-operation",
|
|
2355
2354
|
type: A.COMMAND,
|
|
2356
2355
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -2359,32 +2358,32 @@ const pe = {
|
|
|
2359
2358
|
const n = o.get(P), t = o.get(U), s = o.get(N), { alignType: r } = e, a = t.getCurrentUniverDocInstance(), c = n.getActiveRange();
|
|
2360
2359
|
if (a == null || c == null)
|
|
2361
2360
|
return !1;
|
|
2362
|
-
const { segmentId: i } = c, l = (E = n.getCurrentSelections()) != null ? E : [], d = (v = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : v.paragraphs,
|
|
2361
|
+
const { segmentId: i } = c, l = (E = n.getCurrentSelections()) != null ? E : [], d = (v = a.getSelfOrHeaderFooterModel(i).getBody()) == null ? void 0 : v.paragraphs, g = l.map(se);
|
|
2363
2362
|
if (d == null)
|
|
2364
2363
|
return !1;
|
|
2365
|
-
const u = Wt(c, d),
|
|
2364
|
+
const u = Wt(c, d), f = a.getUnitId(), m = u.every((R) => {
|
|
2366
2365
|
var T;
|
|
2367
|
-
return ((T =
|
|
2366
|
+
return ((T = R.paragraphStyle) == null ? void 0 : T.horizontalAlign) === r;
|
|
2368
2367
|
}), I = {
|
|
2369
2368
|
id: G.id,
|
|
2370
2369
|
params: {
|
|
2371
|
-
unitId:
|
|
2370
|
+
unitId: f,
|
|
2372
2371
|
actions: [],
|
|
2373
|
-
textRanges:
|
|
2372
|
+
textRanges: g
|
|
2374
2373
|
}
|
|
2375
|
-
}, p = new
|
|
2374
|
+
}, p = new le();
|
|
2376
2375
|
p.reset();
|
|
2377
2376
|
const h = new $(), S = B.getInstance();
|
|
2378
|
-
for (const
|
|
2379
|
-
const { startIndex: T } =
|
|
2377
|
+
for (const R of u) {
|
|
2378
|
+
const { startIndex: T } = R;
|
|
2380
2379
|
h.push({
|
|
2381
2380
|
t: M.RETAIN,
|
|
2382
2381
|
len: T - p.cursor,
|
|
2383
2382
|
segmentId: i
|
|
2384
2383
|
});
|
|
2385
2384
|
const C = {
|
|
2386
|
-
...
|
|
2387
|
-
horizontalAlign: m ?
|
|
2385
|
+
...R.paragraphStyle,
|
|
2386
|
+
horizontalAlign: m ? me.UNSPECIFIED : r
|
|
2388
2387
|
};
|
|
2389
2388
|
h.push({
|
|
2390
2389
|
t: M.RETAIN,
|
|
@@ -2393,14 +2392,14 @@ const pe = {
|
|
|
2393
2392
|
dataStream: "",
|
|
2394
2393
|
paragraphs: [
|
|
2395
2394
|
{
|
|
2396
|
-
...
|
|
2395
|
+
...R,
|
|
2397
2396
|
paragraphStyle: C,
|
|
2398
2397
|
startIndex: 0
|
|
2399
2398
|
}
|
|
2400
2399
|
]
|
|
2401
2400
|
},
|
|
2402
2401
|
segmentId: i,
|
|
2403
|
-
coverType:
|
|
2402
|
+
coverType: Ee.REPLACE
|
|
2404
2403
|
}), p.moveCursorTo(T + 1);
|
|
2405
2404
|
}
|
|
2406
2405
|
const _ = k(a, i);
|
|
@@ -2409,34 +2408,34 @@ const pe = {
|
|
|
2409
2408
|
}, ls = {
|
|
2410
2409
|
id: "doc.command.align-left",
|
|
2411
2410
|
type: A.COMMAND,
|
|
2412
|
-
handler: (o) => o.get(N).syncExecuteCommand(
|
|
2413
|
-
alignType:
|
|
2411
|
+
handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
|
|
2412
|
+
alignType: me.LEFT
|
|
2414
2413
|
})
|
|
2415
2414
|
}, us = {
|
|
2416
2415
|
id: "doc.command.align-center",
|
|
2417
2416
|
type: A.COMMAND,
|
|
2418
|
-
handler: (o) => o.get(N).syncExecuteCommand(
|
|
2419
|
-
alignType:
|
|
2417
|
+
handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
|
|
2418
|
+
alignType: me.CENTER
|
|
2420
2419
|
})
|
|
2421
|
-
},
|
|
2420
|
+
}, gs = {
|
|
2422
2421
|
id: "doc.command.align-right",
|
|
2423
2422
|
type: A.COMMAND,
|
|
2424
|
-
handler: (o) => o.get(N).syncExecuteCommand(
|
|
2425
|
-
alignType:
|
|
2423
|
+
handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
|
|
2424
|
+
alignType: me.RIGHT
|
|
2426
2425
|
})
|
|
2427
|
-
},
|
|
2426
|
+
}, fs = {
|
|
2428
2427
|
id: "doc.command.align-justify",
|
|
2429
2428
|
type: A.COMMAND,
|
|
2430
|
-
handler: (o) => o.get(N).syncExecuteCommand(
|
|
2431
|
-
alignType:
|
|
2429
|
+
handler: (o) => o.get(N).syncExecuteCommand(Se.id, {
|
|
2430
|
+
alignType: me.JUSTIFIED
|
|
2432
2431
|
})
|
|
2433
2432
|
};
|
|
2434
2433
|
var ms = Object.defineProperty, hs = Object.getOwnPropertyDescriptor, ps = (o, e, n, t) => {
|
|
2435
2434
|
for (var s = t > 1 ? void 0 : t ? hs(e, n) : e, r = o.length - 1, a; r >= 0; r--)
|
|
2436
2435
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2437
2436
|
return t && s && ms(e, n, s), s;
|
|
2438
|
-
},
|
|
2439
|
-
let
|
|
2437
|
+
}, Le = (o, e) => (n, t) => e(n, t, o);
|
|
2438
|
+
let Me = class extends fe {
|
|
2440
2439
|
constructor(o, e, n) {
|
|
2441
2440
|
super(), this._commandService = o, this._textSelectionManagerService = e, this._univerInstanceService = n, this._initSelectionChange();
|
|
2442
2441
|
}
|
|
@@ -2468,20 +2467,20 @@ let Ce = class extends fe {
|
|
|
2468
2467
|
}));
|
|
2469
2468
|
}
|
|
2470
2469
|
};
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
],
|
|
2470
|
+
Me = ps([
|
|
2471
|
+
ue(ge.Ready, Me),
|
|
2472
|
+
Le(0, N),
|
|
2473
|
+
Le(1, ee(P)),
|
|
2474
|
+
Le(2, U)
|
|
2475
|
+
], Me);
|
|
2477
2476
|
var Ss = Object.defineProperty, Is = Object.getOwnPropertyDescriptor, _s = (o, e, n, t) => {
|
|
2478
2477
|
for (var s = t > 1 ? void 0 : t ? Is(e, n) : e, r = o.length - 1, a; r >= 0; r--)
|
|
2479
2478
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2480
2479
|
return t && s && Ss(e, n, s), s;
|
|
2481
2480
|
}, vs = (o, e) => (n, t) => e(n, t, o);
|
|
2482
|
-
const
|
|
2483
|
-
var
|
|
2484
|
-
let Dt = (
|
|
2481
|
+
const xs = "docs";
|
|
2482
|
+
var ve;
|
|
2483
|
+
let Dt = (ve = class extends un {
|
|
2485
2484
|
constructor(o = {}, e) {
|
|
2486
2485
|
super(), this._injector = e, this._initializeDependencies(e), this._initializeCommands();
|
|
2487
2486
|
}
|
|
@@ -2495,7 +2494,7 @@ let Dt = (_e = class extends un {
|
|
|
2495
2494
|
tt,
|
|
2496
2495
|
nt,
|
|
2497
2496
|
st,
|
|
2498
|
-
|
|
2497
|
+
de,
|
|
2499
2498
|
ot,
|
|
2500
2499
|
rt,
|
|
2501
2500
|
at,
|
|
@@ -2504,8 +2503,8 @@ let Dt = (_e = class extends un {
|
|
|
2504
2503
|
ct,
|
|
2505
2504
|
Vt,
|
|
2506
2505
|
$n,
|
|
2507
|
-
|
|
2508
|
-
|
|
2506
|
+
Te,
|
|
2507
|
+
ce,
|
|
2509
2508
|
qe,
|
|
2510
2509
|
jt,
|
|
2511
2510
|
Ht,
|
|
@@ -2514,7 +2513,7 @@ let Dt = (_e = class extends un {
|
|
|
2514
2513
|
Zn,
|
|
2515
2514
|
Jn,
|
|
2516
2515
|
Qn,
|
|
2517
|
-
|
|
2516
|
+
xe,
|
|
2518
2517
|
He,
|
|
2519
2518
|
es,
|
|
2520
2519
|
Yn,
|
|
@@ -2522,9 +2521,9 @@ let Dt = (_e = class extends un {
|
|
|
2522
2521
|
lt,
|
|
2523
2522
|
ls,
|
|
2524
2523
|
us,
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2524
|
+
gs,
|
|
2525
|
+
Se,
|
|
2526
|
+
fs
|
|
2528
2527
|
].forEach((o) => {
|
|
2529
2528
|
this._injector.get(N).registerCommand(o);
|
|
2530
2529
|
});
|
|
@@ -2532,28 +2531,28 @@ let Dt = (_e = class extends un {
|
|
|
2532
2531
|
_initializeDependencies(o) {
|
|
2533
2532
|
[
|
|
2534
2533
|
// services
|
|
2535
|
-
[
|
|
2536
|
-
[
|
|
2534
|
+
[ye],
|
|
2535
|
+
[Ne],
|
|
2537
2536
|
[
|
|
2538
|
-
|
|
2537
|
+
Ae,
|
|
2539
2538
|
{
|
|
2540
|
-
useClass:
|
|
2539
|
+
useClass: Mn
|
|
2541
2540
|
}
|
|
2542
2541
|
],
|
|
2543
2542
|
[P],
|
|
2544
2543
|
[Ze],
|
|
2545
2544
|
// controllers
|
|
2546
|
-
[
|
|
2545
|
+
[Ce],
|
|
2547
2546
|
[Re],
|
|
2548
|
-
[
|
|
2549
|
-
[
|
|
2547
|
+
[Oe],
|
|
2548
|
+
[Me]
|
|
2550
2549
|
].forEach((e) => o.add(e));
|
|
2551
2550
|
}
|
|
2552
|
-
}, w(
|
|
2551
|
+
}, w(ve, "pluginName", xs), w(ve, "type", te.UNIVER_DOC), ve);
|
|
2553
2552
|
Dt = _s([
|
|
2554
|
-
vs(1,
|
|
2553
|
+
vs(1, ee(gn))
|
|
2555
2554
|
], Dt);
|
|
2556
|
-
function
|
|
2555
|
+
function Rs(o, e) {
|
|
2557
2556
|
const { range: n, rangeId: t, rangeType: s, segmentId: r } = o, a = Un(n, e);
|
|
2558
2557
|
if (!a)
|
|
2559
2558
|
return null;
|
|
@@ -2593,7 +2592,7 @@ function xs(o, e) {
|
|
|
2593
2592
|
line: 0
|
|
2594
2593
|
}), l;
|
|
2595
2594
|
}
|
|
2596
|
-
function
|
|
2595
|
+
function Xs(o, e) {
|
|
2597
2596
|
const n = {
|
|
2598
2597
|
id: G.id,
|
|
2599
2598
|
params: {
|
|
@@ -2601,31 +2600,31 @@ function Vs(o, e) {
|
|
|
2601
2600
|
actions: [],
|
|
2602
2601
|
textRanges: void 0
|
|
2603
2602
|
}
|
|
2604
|
-
}, t = B.getInstance(), s =
|
|
2603
|
+
}, t = B.getInstance(), s = Rs(o, e);
|
|
2605
2604
|
return s ? (n.params.actions = t.editOp(s.serialize()), n) : !1;
|
|
2606
2605
|
}
|
|
2607
|
-
function
|
|
2606
|
+
function Vs(o, e) {
|
|
2608
2607
|
var v;
|
|
2609
2608
|
const { segmentId: n, rangeId: t, rangeType: s, wholeEntity: r } = e, a = o.get(P), c = o.get(U), i = a.getActiveRange();
|
|
2610
2609
|
if (!i)
|
|
2611
2610
|
return !1;
|
|
2612
|
-
const l = c.getCurrentUnitForType(
|
|
2611
|
+
const l = c.getCurrentUnitForType(te.UNIVER_DOC);
|
|
2613
2612
|
if (!l)
|
|
2614
2613
|
return !1;
|
|
2615
|
-
const d = l.getBody(),
|
|
2614
|
+
const d = l.getBody(), g = l.getUnitId();
|
|
2616
2615
|
if (!d)
|
|
2617
2616
|
return !1;
|
|
2618
|
-
const { startOffset: u, endOffset:
|
|
2619
|
-
for (let
|
|
2620
|
-
const C = m[
|
|
2621
|
-
if (C.rangeType === s && Math.max(C.startIndex, u) <= Math.min(C.endIndex,
|
|
2617
|
+
const { startOffset: u, endOffset: f } = pe(i), m = (v = d.customRanges) != null ? v : [], I = [];
|
|
2618
|
+
for (let R = 0, T = m.length; R < T; R++) {
|
|
2619
|
+
const C = m[R];
|
|
2620
|
+
if (C.rangeType === s && Math.max(C.startIndex, u) <= Math.min(C.endIndex, f - 1) && I.push({ ...C }), C.startIndex >= f)
|
|
2622
2621
|
break;
|
|
2623
2622
|
}
|
|
2624
|
-
const p = I.map((
|
|
2623
|
+
const p = I.map((R) => [R.startIndex, R.endIndex]).flat().sort((R, T) => R - T);
|
|
2625
2624
|
let h = 0;
|
|
2626
2625
|
const S = new $(), _ = p.length ? {
|
|
2627
2626
|
startOffset: Math.min(p[0], u),
|
|
2628
|
-
endOffset: Math.max(p[p.length - 1] + 1,
|
|
2627
|
+
endOffset: Math.max(p[p.length - 1] + 1, f)
|
|
2629
2628
|
} : i;
|
|
2630
2629
|
_.startOffset !== h && (S.push({
|
|
2631
2630
|
t: M.RETAIN,
|
|
@@ -2639,12 +2638,12 @@ function Ws(o, e) {
|
|
|
2639
2638
|
len: 1,
|
|
2640
2639
|
line: 0,
|
|
2641
2640
|
segmentId: n
|
|
2642
|
-
}), p.forEach((
|
|
2643
|
-
|
|
2641
|
+
}), p.forEach((R, T) => {
|
|
2642
|
+
R !== h && (S.push({
|
|
2644
2643
|
t: M.RETAIN,
|
|
2645
|
-
len:
|
|
2644
|
+
len: R - h,
|
|
2646
2645
|
segmentId: n
|
|
2647
|
-
}), h =
|
|
2646
|
+
}), h = R), S.push({
|
|
2648
2647
|
t: M.DELETE,
|
|
2649
2648
|
len: 1,
|
|
2650
2649
|
line: 0,
|
|
@@ -2675,7 +2674,7 @@ function Ws(o, e) {
|
|
|
2675
2674
|
const O = B.getInstance(), E = {
|
|
2676
2675
|
id: G.id,
|
|
2677
2676
|
params: {
|
|
2678
|
-
unitId:
|
|
2677
|
+
unitId: g,
|
|
2679
2678
|
actions: [],
|
|
2680
2679
|
textRanges: void 0
|
|
2681
2680
|
}
|
|
@@ -2683,14 +2682,14 @@ function Ws(o, e) {
|
|
|
2683
2682
|
return E.params.actions = O.editOp(S.serialize()), E;
|
|
2684
2683
|
}
|
|
2685
2684
|
function Os(o, e) {
|
|
2686
|
-
var u,
|
|
2685
|
+
var u, f;
|
|
2687
2686
|
const { unitId: n, rangeId: t, segmentId: s } = e, a = o.get(U).getUnit(n);
|
|
2688
2687
|
if (!a)
|
|
2689
2688
|
return !1;
|
|
2690
|
-
const c = (
|
|
2689
|
+
const c = (f = (u = a.getBody()) == null ? void 0 : u.customRanges) == null ? void 0 : f.find((m) => m.rangeId === t);
|
|
2691
2690
|
if (!c)
|
|
2692
2691
|
return !1;
|
|
2693
|
-
const { startIndex: i, endIndex: l } = c, d = new $(),
|
|
2692
|
+
const { startIndex: i, endIndex: l } = c, d = new $(), g = l - i + 1;
|
|
2694
2693
|
return i > 0 && d.push({
|
|
2695
2694
|
t: M.RETAIN,
|
|
2696
2695
|
len: i,
|
|
@@ -2700,9 +2699,9 @@ function Os(o, e) {
|
|
|
2700
2699
|
len: 1,
|
|
2701
2700
|
segmentId: s,
|
|
2702
2701
|
line: 0
|
|
2703
|
-
}),
|
|
2702
|
+
}), g - 2 > 0 && d.push({
|
|
2704
2703
|
t: M.RETAIN,
|
|
2705
|
-
len:
|
|
2704
|
+
len: g - 2,
|
|
2706
2705
|
segmentId: s
|
|
2707
2706
|
}), d.push({
|
|
2708
2707
|
t: M.DELETE,
|
|
@@ -2711,7 +2710,7 @@ function Os(o, e) {
|
|
|
2711
2710
|
line: 0
|
|
2712
2711
|
}), d;
|
|
2713
2712
|
}
|
|
2714
|
-
function
|
|
2713
|
+
function Ws(o, e) {
|
|
2715
2714
|
const n = {
|
|
2716
2715
|
id: G.id,
|
|
2717
2716
|
params: {
|
|
@@ -2750,11 +2749,11 @@ function Cs(o) {
|
|
|
2750
2749
|
segmentId: r
|
|
2751
2750
|
}), i.params.actions = d.editOp(l.serialize()), i;
|
|
2752
2751
|
}
|
|
2753
|
-
function
|
|
2752
|
+
function Ys(o, e) {
|
|
2754
2753
|
const { segmentId: n, id: t, type: s } = e, r = o.get(P), a = o.get(U), c = r.getActiveRange();
|
|
2755
2754
|
if (!c)
|
|
2756
2755
|
return !1;
|
|
2757
|
-
const i = a.getCurrentUnitForType(
|
|
2756
|
+
const i = a.getCurrentUnitForType(te.UNIVER_DOC);
|
|
2758
2757
|
if (!i)
|
|
2759
2758
|
return !1;
|
|
2760
2759
|
const l = i.getBody(), d = i.getUnitId();
|
|
@@ -2772,7 +2771,7 @@ function Ks(o, e) {
|
|
|
2772
2771
|
}
|
|
2773
2772
|
) : !1;
|
|
2774
2773
|
}
|
|
2775
|
-
function
|
|
2774
|
+
function Ks(o, e) {
|
|
2776
2775
|
var I, p;
|
|
2777
2776
|
const { unitId: n, id: t, segmentId: s } = e, a = o.get(U).getUnit(n), c = a == null ? void 0 : a.getBody();
|
|
2778
2777
|
if (!a || !c)
|
|
@@ -2784,14 +2783,14 @@ function Zs(o, e) {
|
|
|
2784
2783
|
var _;
|
|
2785
2784
|
const S = ne.deepClone(h);
|
|
2786
2785
|
return S.customDecorations = (_ = S.customDecorations) == null ? void 0 : _.filter((O) => O.id !== t), S;
|
|
2787
|
-
}),
|
|
2786
|
+
}), g = {
|
|
2788
2787
|
id: G.id,
|
|
2789
2788
|
params: {
|
|
2790
2789
|
unitId: n,
|
|
2791
2790
|
actions: [],
|
|
2792
2791
|
textRanges: void 0
|
|
2793
2792
|
}
|
|
2794
|
-
}, u = new $(),
|
|
2793
|
+
}, u = new $(), f = B.getInstance();
|
|
2795
2794
|
let m = 0;
|
|
2796
2795
|
return i.forEach((h, S) => {
|
|
2797
2796
|
const _ = d[S], O = l[S];
|
|
@@ -2805,11 +2804,11 @@ function Zs(o, e) {
|
|
|
2805
2804
|
segmentId: s,
|
|
2806
2805
|
body: _,
|
|
2807
2806
|
oldBody: O,
|
|
2808
|
-
coverType:
|
|
2807
|
+
coverType: Ee.REPLACE
|
|
2809
2808
|
}), m = m + (h.endIndex - h.startIndex + 1);
|
|
2810
|
-
}),
|
|
2809
|
+
}), g.params.actions = f.editOp(u.serialize()), g;
|
|
2811
2810
|
}
|
|
2812
|
-
const Ms = Lt("CUSTOM_RANGE"), ys = Lt("CUSTOM_DECORATION"),
|
|
2811
|
+
const Ms = Lt("CUSTOM_RANGE"), ys = Lt("CUSTOM_DECORATION"), Fe = {
|
|
2813
2812
|
CUSTOM_RANGE: Ms,
|
|
2814
2813
|
CUSTOM_DECORATION: ys
|
|
2815
2814
|
};
|
|
@@ -2818,7 +2817,7 @@ var Ts = Object.defineProperty, Es = Object.getOwnPropertyDescriptor, As = (o, e
|
|
|
2818
2817
|
(a = o[r]) && (s = (t ? a(e, n, s) : a(s)) || s);
|
|
2819
2818
|
return t && s && Ts(e, n, s), s;
|
|
2820
2819
|
}, Ns = (o, e) => (n, t) => e(n, t, o);
|
|
2821
|
-
let
|
|
2820
|
+
let Ge = class extends fe {
|
|
2822
2821
|
constructor(e, n) {
|
|
2823
2822
|
super();
|
|
2824
2823
|
w(this, "_interceptorsByName", /* @__PURE__ */ new Map());
|
|
@@ -2829,7 +2828,7 @@ let Fe = class extends fe {
|
|
|
2829
2828
|
return;
|
|
2830
2829
|
this.interceptDocumentViewModel(t);
|
|
2831
2830
|
}
|
|
2832
|
-
})), this.disposeWithMe(this.intercept(
|
|
2831
|
+
})), this.disposeWithMe(this.intercept(Fe.CUSTOM_RANGE, {
|
|
2833
2832
|
priority: -1,
|
|
2834
2833
|
handler: (t, s, r) => r(t)
|
|
2835
2834
|
}));
|
|
@@ -2844,18 +2843,18 @@ let Fe = class extends fe {
|
|
|
2844
2843
|
var c, i;
|
|
2845
2844
|
return ((c = a.priority) != null ? c : 0) - ((i = r.priority) != null ? i : 0);
|
|
2846
2845
|
})
|
|
2847
|
-
), this.disposeWithMe(Pt(() =>
|
|
2846
|
+
), this.disposeWithMe(Pt(() => mn(this._interceptorsByName.get(t), n)));
|
|
2848
2847
|
}
|
|
2849
2848
|
fetchThroughInterceptors(e) {
|
|
2850
2849
|
const n = e, t = this._interceptorsByName.get(n);
|
|
2851
|
-
return
|
|
2850
|
+
return hn(t || []);
|
|
2852
2851
|
}
|
|
2853
2852
|
interceptDocumentViewModel(e) {
|
|
2854
|
-
const n = new
|
|
2853
|
+
const n = new pn();
|
|
2855
2854
|
return n.add(e.registerCustomRangeInterceptor({
|
|
2856
2855
|
getCustomRange: (t) => {
|
|
2857
2856
|
var s;
|
|
2858
|
-
return this.fetchThroughInterceptors(
|
|
2857
|
+
return this.fetchThroughInterceptors(Fe.CUSTOM_RANGE)(
|
|
2859
2858
|
e.getCustomRangeRaw(t),
|
|
2860
2859
|
{
|
|
2861
2860
|
index: t,
|
|
@@ -2866,7 +2865,7 @@ let Fe = class extends fe {
|
|
|
2866
2865
|
},
|
|
2867
2866
|
getCustomDecoration: (t) => {
|
|
2868
2867
|
var s;
|
|
2869
|
-
return this.fetchThroughInterceptors(
|
|
2868
|
+
return this.fetchThroughInterceptors(Fe.CUSTOM_DECORATION)(
|
|
2870
2869
|
e.getCustomDecorationRaw(t),
|
|
2871
2870
|
{
|
|
2872
2871
|
index: t,
|
|
@@ -2878,59 +2877,59 @@ let Fe = class extends fe {
|
|
|
2878
2877
|
})), n;
|
|
2879
2878
|
}
|
|
2880
2879
|
};
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
Ns(1,
|
|
2884
|
-
],
|
|
2885
|
-
const
|
|
2880
|
+
Ge = As([
|
|
2881
|
+
ue(ge.Starting, Ge),
|
|
2882
|
+
Ns(1, ee(V))
|
|
2883
|
+
], Ge);
|
|
2884
|
+
const Zs = (o) => o.body ? o.body.dataStream.slice(0, -2).replaceAll(b.CUSTOM_RANGE_START, "").replaceAll(b.CUSTOM_RANGE_END, "") : "";
|
|
2886
2885
|
export {
|
|
2887
2886
|
us as AlignCenterCommand,
|
|
2888
|
-
|
|
2887
|
+
fs as AlignJustifyCommand,
|
|
2889
2888
|
ls as AlignLeftCommand,
|
|
2890
|
-
|
|
2891
|
-
|
|
2889
|
+
Se as AlignOperationCommand,
|
|
2890
|
+
gs as AlignRightCommand,
|
|
2892
2891
|
$n as BreakLineCommand,
|
|
2893
2892
|
Wn as BulletListCommand,
|
|
2894
2893
|
Jn as CoverContentCommand,
|
|
2895
2894
|
kt as CutContentCommand,
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2895
|
+
Ls as DOCS_COMPONENT_BACKGROUND_LAYER_INDEX,
|
|
2896
|
+
$s as DOCS_COMPONENT_DEFAULT_Z_INDEX,
|
|
2897
|
+
Gs as DOCS_COMPONENT_HEADER_LAYER_INDEX,
|
|
2898
|
+
Fs as DOCS_COMPONENT_MAIN_LAYER_INDEX,
|
|
2899
|
+
be as DOCS_VIEW_KEY,
|
|
2900
|
+
Fe as DOC_INTERCEPTOR_POINT,
|
|
2901
|
+
ce as DeleteCommand,
|
|
2903
2902
|
qe as DeleteCustomBlockCommand,
|
|
2904
2903
|
kn as DeleteLeftCommand,
|
|
2905
2904
|
zn as DeleteRightCommand,
|
|
2906
2905
|
Ze as DocCustomRangeService,
|
|
2907
|
-
|
|
2906
|
+
Ge as DocInterceptorService,
|
|
2908
2907
|
V as DocSkeletonManagerService,
|
|
2909
|
-
|
|
2908
|
+
ye as DocStateChangeManagerService,
|
|
2910
2909
|
Gn as EditorInsertTextCommandId,
|
|
2911
2910
|
Ht as IMEInputCommand,
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2911
|
+
Ne as IMEInputManagerService,
|
|
2912
|
+
Hs as InnerPasteCommand,
|
|
2913
|
+
Te as InsertCommand,
|
|
2915
2914
|
lt as ListOperationCommand,
|
|
2916
2915
|
Qe as MergeTwoParagraphCommand,
|
|
2917
2916
|
$e as MoveCursorOperation,
|
|
2918
2917
|
je as MoveSelectionOperation,
|
|
2919
|
-
|
|
2918
|
+
js as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
|
|
2920
2919
|
Yn as OrderListCommand,
|
|
2921
2920
|
Zn as ReplaceContentCommand,
|
|
2922
2921
|
dt as ResetInlineFormatTextBackgroundColorCommand,
|
|
2923
2922
|
G as RichTextEditingMutation,
|
|
2924
2923
|
es as SelectAllOperation,
|
|
2925
2924
|
Qn as SetDocZoomRatioCommand,
|
|
2926
|
-
|
|
2925
|
+
xe as SetDocZoomRatioOperation,
|
|
2927
2926
|
et as SetInlineFormatBoldCommand,
|
|
2928
2927
|
Vt as SetInlineFormatCommand,
|
|
2929
2928
|
at as SetInlineFormatFontFamilyCommand,
|
|
2930
2929
|
rt as SetInlineFormatFontSizeCommand,
|
|
2931
2930
|
tt as SetInlineFormatItalicCommand,
|
|
2932
2931
|
st as SetInlineFormatStrikethroughCommand,
|
|
2933
|
-
|
|
2932
|
+
de as SetInlineFormatSubscriptCommand,
|
|
2934
2933
|
ot as SetInlineFormatSuperscriptCommand,
|
|
2935
2934
|
ct as SetInlineFormatTextBackgroundColorCommand,
|
|
2936
2935
|
it as SetInlineFormatTextColorCommand,
|
|
@@ -2940,22 +2939,22 @@ export {
|
|
|
2940
2939
|
Dt as UniverDocsPlugin,
|
|
2941
2940
|
jt as UpdateCommand,
|
|
2942
2941
|
Ln as VIEWPORT_KEY,
|
|
2943
|
-
|
|
2942
|
+
Ys as addCustomDecorationBySelectionFactory,
|
|
2944
2943
|
Cs as addCustomDecorationFactory,
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2944
|
+
Vs as addCustomRangeBySelectionFactory,
|
|
2945
|
+
Xs as addCustomRangeFactory,
|
|
2946
|
+
Ks as deleteCustomDecorationFactory,
|
|
2947
|
+
Ws as deleteCustomRangeFactory,
|
|
2948
|
+
De as getDeleteSelection,
|
|
2950
2949
|
Fn as getDocObject,
|
|
2951
|
-
|
|
2950
|
+
zs as getDocObjectById,
|
|
2952
2951
|
Ye as getInsertSelection,
|
|
2953
|
-
|
|
2952
|
+
Zs as getPlainTextFormDocument,
|
|
2954
2953
|
Je as getRetainAndDeleteFromReplace,
|
|
2955
2954
|
k as getRichTextEditPath,
|
|
2956
|
-
|
|
2955
|
+
Us as getSelectionText,
|
|
2957
2956
|
Gt as isSegmentIntersects,
|
|
2958
|
-
|
|
2959
|
-
|
|
2957
|
+
ks as neoGetDocObject,
|
|
2958
|
+
Bs as replaceSelectionFactory,
|
|
2960
2959
|
se as serializeTextRange
|
|
2961
2960
|
};
|