@univerjs/docs 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +694 -803
- package/lib/types/index.d.ts +2 -2
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
- package/lib/types/controllers/text-selection.controller.d.ts +0 -36
package/lib/es/index.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var M = (
|
|
4
|
-
import { CommandType as v, RxDisposable as
|
|
5
|
-
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as
|
|
6
|
-
import { BehaviorSubject as
|
|
7
|
-
import { Inject as w, Injector as
|
|
8
|
-
function
|
|
9
|
-
const n =
|
|
1
|
+
var tt = Object.defineProperty;
|
|
2
|
+
var nt = (r, e, t) => e in r ? tt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var M = (r, e, t) => (nt(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { CommandType as v, RxDisposable as oe, ICommandService as y, TextXActionType as R, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Ve, IUniverInstanceService as T, IUndoRedoService as ie, UndoCommandId as Ue, RedoCommandId as Ne, TextX as U, DataStreamTreeTokenType as ye, Tools as Y, LocaleService as ke, MemoryCursor as ae, getDocsUpdateBody as st, UpdateDocsAttributeType as je, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as rt, BooleanNumber as F, BaselineOffset as z, PresetListType as He, OnLifecycle as ce, LifecycleStages as le, Disposable as de, Direction as b, Plugin as ot, PluginType as it, IConfigService as at } from "@univerjs/core";
|
|
5
|
+
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as ct, ITextSelectionRenderManager as ue, DocumentViewModel as lt, DocumentSkeleton as dt, hasListSpan as ut, isIndentBySpan as mt, isFirstSpan as gt, getParagraphBySpan as ft, RANGE_DIRECTION as we, NodePositionConvertToCursor as Le, IRenderManagerService as Ge, TextSelectionRenderManager as ht } from "@univerjs/engine-render";
|
|
6
|
+
import { BehaviorSubject as W, takeUntil as Z } from "rxjs";
|
|
7
|
+
import { Inject as w, Injector as pt } from "@wendellhu/redi";
|
|
8
|
+
function Xe(r, e) {
|
|
9
|
+
const n = r.getCurrentUniverDocInstance().getUnitId(), s = e.getRenderById(n);
|
|
10
10
|
if (s == null)
|
|
11
11
|
return;
|
|
12
|
-
const { mainComponent:
|
|
12
|
+
const { mainComponent: o, scene: i, engine: a } = s;
|
|
13
13
|
return {
|
|
14
|
-
document:
|
|
15
|
-
scene:
|
|
14
|
+
document: o,
|
|
15
|
+
scene: i,
|
|
16
16
|
engine: a
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const t = e.getRenderById(
|
|
19
|
+
function _n(r, e) {
|
|
20
|
+
const t = e.getRenderById(r);
|
|
21
21
|
if (t == null)
|
|
22
22
|
return;
|
|
23
|
-
const { mainComponent: n, scene: s, engine:
|
|
23
|
+
const { mainComponent: n, scene: s, engine: o } = t;
|
|
24
24
|
return {
|
|
25
25
|
document: n,
|
|
26
26
|
scene: s,
|
|
27
|
-
engine:
|
|
27
|
+
engine: o
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
var
|
|
31
|
-
const
|
|
30
|
+
var St = /* @__PURE__ */ ((r) => (r.MAIN = "__Document_Render_Main__", r))(St || {}), _t = /* @__PURE__ */ ((r) => (r.VIEW_MAIN = "viewMain", r.VIEW_TOP = "viewTop", r.VIEW_LEFT = "viewLeft", r.VIEW_LEFT_TOP = "viewLeftTop", r))(_t || {});
|
|
31
|
+
const vn = 0, In = 2, Mn = 10, Cn = "normalTextSelectionPluginName", Ye = {
|
|
32
32
|
id: "doc.operation.set-selections",
|
|
33
33
|
type: v.OPERATION,
|
|
34
|
-
handler: (
|
|
34
|
+
handler: (r, e) => !0
|
|
35
35
|
};
|
|
36
|
-
var
|
|
37
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
38
|
-
(
|
|
39
|
-
return n && s &&
|
|
40
|
-
},
|
|
41
|
-
function
|
|
42
|
-
const { startOffset: e, endOffset: t, collapsed: n } =
|
|
36
|
+
var vt = Object.defineProperty, It = Object.getOwnPropertyDescriptor, Mt = (r, e, t, n) => {
|
|
37
|
+
for (var s = n > 1 ? void 0 : n ? It(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
38
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
39
|
+
return n && s && vt(e, t, s), s;
|
|
40
|
+
}, Be = (r, e) => (t, n) => e(t, n, r);
|
|
41
|
+
function q(r) {
|
|
42
|
+
const { startOffset: e, endOffset: t, collapsed: n } = r, s = {
|
|
43
43
|
startOffset: e,
|
|
44
44
|
endOffset: t,
|
|
45
45
|
collapsed: n
|
|
46
46
|
};
|
|
47
|
-
return typeof
|
|
47
|
+
return typeof r.isActive == "function" && (s.isActive = r.isActive()), s;
|
|
48
48
|
}
|
|
49
|
-
let
|
|
49
|
+
let A = class extends oe {
|
|
50
50
|
constructor(e, t) {
|
|
51
51
|
super();
|
|
52
52
|
M(this, "_currentSelection", null);
|
|
53
53
|
M(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
|
|
54
|
-
M(this, "_textSelection$", new
|
|
54
|
+
M(this, "_textSelection$", new W(null));
|
|
55
55
|
M(this, "textSelection$", this._textSelection$.asObservable());
|
|
56
56
|
this._textSelectionRenderManager = e, this._commandService = t, this._syncSelectionFromRenderService();
|
|
57
57
|
}
|
|
@@ -83,12 +83,12 @@ let U = class extends he {
|
|
|
83
83
|
const e = this._getTextRanges(this._currentSelection);
|
|
84
84
|
if (e == null)
|
|
85
85
|
return;
|
|
86
|
-
const { textRanges: t, segmentId: n, style: s } = e,
|
|
87
|
-
if (
|
|
86
|
+
const { textRanges: t, segmentId: n, style: s } = e, o = t.find((m) => m.isActive());
|
|
87
|
+
if (o == null)
|
|
88
88
|
return null;
|
|
89
|
-
const { startOffset:
|
|
90
|
-
return
|
|
91
|
-
startOffset:
|
|
89
|
+
const { startOffset: i, endOffset: a, collapsed: c, startNodePosition: d, endNodePosition: l, direction: u } = o;
|
|
90
|
+
return i == null || a == null ? null : {
|
|
91
|
+
startOffset: i,
|
|
92
92
|
endOffset: a,
|
|
93
93
|
collapsed: c,
|
|
94
94
|
startNodePosition: d,
|
|
@@ -105,7 +105,7 @@ let U = class extends he {
|
|
|
105
105
|
textRanges: e,
|
|
106
106
|
segmentId: "",
|
|
107
107
|
isEditing: t,
|
|
108
|
-
style:
|
|
108
|
+
style: ct
|
|
109
109
|
// mock style.
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -114,7 +114,7 @@ let U = class extends he {
|
|
|
114
114
|
}
|
|
115
115
|
// All textRanges should be synchronized from the render layer.
|
|
116
116
|
_syncSelectionFromRenderService() {
|
|
117
|
-
this._textSelectionRenderManager.textSelectionInner$.pipe(
|
|
117
|
+
this._textSelectionRenderManager.textSelectionInner$.pipe(Z(this.dispose$)).subscribe((e) => {
|
|
118
118
|
e != null && this._replaceTextRangesWithNoRefresh(e);
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -126,14 +126,14 @@ let U = class extends he {
|
|
|
126
126
|
...e
|
|
127
127
|
};
|
|
128
128
|
this._replaceByParam(t), this._textSelection$.next(t);
|
|
129
|
-
const { unitId: n, subUnitId: s, segmentId:
|
|
130
|
-
this._commandService.executeCommand(
|
|
129
|
+
const { unitId: n, subUnitId: s, segmentId: o, style: i, textRanges: a, isEditing: c } = t;
|
|
130
|
+
this._commandService.executeCommand(Ye.id, {
|
|
131
131
|
unitId: n,
|
|
132
132
|
subUnitId: s,
|
|
133
|
-
segmentId:
|
|
134
|
-
style:
|
|
133
|
+
segmentId: o,
|
|
134
|
+
style: i,
|
|
135
135
|
isEditing: c,
|
|
136
|
-
ranges: a.map(
|
|
136
|
+
ranges: a.map(q)
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
_getTextRanges(e) {
|
|
@@ -145,46 +145,46 @@ let U = class extends he {
|
|
|
145
145
|
}
|
|
146
146
|
_refresh(e) {
|
|
147
147
|
const t = this._getTextRanges(e);
|
|
148
|
-
this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(
|
|
148
|
+
this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(q));
|
|
149
149
|
}
|
|
150
150
|
_replaceByParam(e) {
|
|
151
|
-
const { unitId: t, subUnitId: n, style: s, segmentId:
|
|
152
|
-
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges:
|
|
151
|
+
const { unitId: t, subUnitId: n, style: s, segmentId: o, textRanges: i, isEditing: a } = e;
|
|
152
|
+
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: i, style: s, segmentId: o, isEditing: a });
|
|
153
153
|
}
|
|
154
154
|
_addByParam(e) {
|
|
155
|
-
const { unitId: t, subUnitId: n, textRanges: s, style:
|
|
155
|
+
const { unitId: t, subUnitId: n, textRanges: s, style: o, segmentId: i, isEditing: a } = e;
|
|
156
156
|
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map());
|
|
157
157
|
const c = this._textSelectionInfo.get(t);
|
|
158
|
-
c.has(n) ? c.get(n).textRanges.push(...s) : c.set(n, { textRanges: s, style:
|
|
158
|
+
c.has(n) ? c.get(n).textRanges.push(...s) : c.set(n, { textRanges: s, style: o, segmentId: i, isEditing: a });
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
],
|
|
165
|
-
function
|
|
166
|
-
const { startOffset: n, endOffset: s } =
|
|
167
|
-
return
|
|
161
|
+
A = Mt([
|
|
162
|
+
Be(0, ue),
|
|
163
|
+
Be(1, y)
|
|
164
|
+
], A);
|
|
165
|
+
function De(r, e = "", t = 0) {
|
|
166
|
+
const { startOffset: n, endOffset: s } = r, o = [], i = n - t, a = s - t;
|
|
167
|
+
return i > 0 && o.push({
|
|
168
168
|
t: R.RETAIN,
|
|
169
|
-
len:
|
|
169
|
+
len: i,
|
|
170
170
|
segmentId: e
|
|
171
|
-
}),
|
|
171
|
+
}), o.push({
|
|
172
172
|
t: R.DELETE,
|
|
173
|
-
len: a -
|
|
173
|
+
len: a - i,
|
|
174
174
|
line: 0,
|
|
175
175
|
segmentId: e
|
|
176
|
-
}),
|
|
176
|
+
}), o;
|
|
177
177
|
}
|
|
178
|
-
var
|
|
179
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
180
|
-
(
|
|
181
|
-
return n && s &&
|
|
182
|
-
},
|
|
183
|
-
let
|
|
178
|
+
var Ct = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, xt = (r, e, t, n) => {
|
|
179
|
+
for (var s = n > 1 ? void 0 : n ? Rt(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
180
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
181
|
+
return n && s && Ct(e, t, s), s;
|
|
182
|
+
}, Ot = (r, e) => (t, n) => e(t, n, r);
|
|
183
|
+
let J = class extends oe {
|
|
184
184
|
constructor(e) {
|
|
185
185
|
super();
|
|
186
186
|
M(this, "_docViewModelMap", /* @__PURE__ */ new Map());
|
|
187
|
-
M(this, "_currentDocViewModel$", new
|
|
187
|
+
M(this, "_currentDocViewModel$", new W(null));
|
|
188
188
|
M(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
|
|
189
189
|
this._currentUniverService = e, this._initialize();
|
|
190
190
|
}
|
|
@@ -195,11 +195,11 @@ let Q = class extends he {
|
|
|
195
195
|
this._currentDocViewModel$.complete(), this._docViewModelMap.clear();
|
|
196
196
|
}
|
|
197
197
|
_init() {
|
|
198
|
-
this._currentUniverService.currentDoc$.pipe(
|
|
198
|
+
this._currentUniverService.currentDoc$.pipe(Z(this.dispose$)).subscribe((e) => {
|
|
199
199
|
this._create(e);
|
|
200
200
|
}), this._currentUniverService.getAllUniverDocsInstance().forEach((e) => {
|
|
201
201
|
this._create(e);
|
|
202
|
-
}), this._currentUniverService.docDisposed$.pipe(
|
|
202
|
+
}), this._currentUniverService.docDisposed$.pipe(Z(this.dispose$)).subscribe((e) => {
|
|
203
203
|
this._docViewModelMap.delete(e.getUnitId());
|
|
204
204
|
});
|
|
205
205
|
}
|
|
@@ -229,7 +229,7 @@ let Q = class extends he {
|
|
|
229
229
|
docViewModel: s
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
|
-
if (e ===
|
|
232
|
+
if (e === Ve) {
|
|
233
233
|
const s = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
|
|
234
234
|
if (s == null)
|
|
235
235
|
return;
|
|
@@ -239,22 +239,22 @@ let Q = class extends he {
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
_buildDocViewModel(e) {
|
|
242
|
-
return new
|
|
242
|
+
return new lt(e);
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
],
|
|
248
|
-
var
|
|
249
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
250
|
-
(
|
|
251
|
-
return n && s &&
|
|
252
|
-
},
|
|
253
|
-
const
|
|
254
|
-
let
|
|
245
|
+
J = xt([
|
|
246
|
+
Ot(0, T)
|
|
247
|
+
], J);
|
|
248
|
+
var yt = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, Et = (r, e, t, n) => {
|
|
249
|
+
for (var s = n > 1 ? void 0 : n ? Tt(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
250
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
251
|
+
return n && s && yt(e, t, s), s;
|
|
252
|
+
}, Re = (r, e) => (t, n) => e(t, n, r);
|
|
253
|
+
const Dt = 300;
|
|
254
|
+
let re = class extends oe {
|
|
255
255
|
constructor(e, t, n) {
|
|
256
256
|
super();
|
|
257
|
-
M(this, "_docStateChange$", new
|
|
257
|
+
M(this, "_docStateChange$", new W(null));
|
|
258
258
|
M(this, "docStateChange$", this._docStateChange$.asObservable());
|
|
259
259
|
M(this, "_stateCache", /* @__PURE__ */ new Map());
|
|
260
260
|
M(this, "_timer", null);
|
|
@@ -267,7 +267,7 @@ let ue = class extends he {
|
|
|
267
267
|
_initialize() {
|
|
268
268
|
this.disposeWithMe(
|
|
269
269
|
this._commandService.beforeCommandExecuted((e) => {
|
|
270
|
-
if (e.id ===
|
|
270
|
+
if (e.id === Ue || e.id === Ne) {
|
|
271
271
|
const t = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
272
272
|
if (t == null)
|
|
273
273
|
return;
|
|
@@ -279,44 +279,44 @@ let ue = class extends he {
|
|
|
279
279
|
}
|
|
280
280
|
_cacheChangeState(e) {
|
|
281
281
|
const { trigger: t, unitId: n, noHistory: s } = e;
|
|
282
|
-
if (!(t ===
|
|
282
|
+
if (!(t === Ne || t === Ue || s)) {
|
|
283
283
|
if (this._stateCache.has(n)) {
|
|
284
|
-
const
|
|
285
|
-
|
|
284
|
+
const o = this._stateCache.get(n);
|
|
285
|
+
o == null || o.push(e);
|
|
286
286
|
} else
|
|
287
287
|
this._stateCache.set(n, [e]);
|
|
288
|
-
t ===
|
|
288
|
+
t === ge.id || t === fe.id ? (this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
|
|
289
289
|
this._pushHistory(n);
|
|
290
|
-
},
|
|
290
|
+
}, Dt)) : this._pushHistory(n);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
_pushHistory(e) {
|
|
294
294
|
const t = this._undoRedoService, n = this._stateCache.get(e);
|
|
295
295
|
if (!Array.isArray(n) || n.length === 0)
|
|
296
296
|
return;
|
|
297
|
-
const s = n.length,
|
|
297
|
+
const s = n.length, o = n[0].commandId, i = n[0], a = n[s - 1], c = {
|
|
298
298
|
unitId: e,
|
|
299
|
-
actions: n.reduce((l, u) =>
|
|
299
|
+
actions: n.reduce((l, u) => U.compose(l, u.redoState.actions), []),
|
|
300
300
|
textRanges: a.redoState.textRanges
|
|
301
301
|
}, d = {
|
|
302
302
|
unitId: e,
|
|
303
303
|
// Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
|
|
304
|
-
actions: n.reverse().reduce((l, u) =>
|
|
305
|
-
textRanges:
|
|
304
|
+
actions: n.reverse().reduce((l, u) => U.compose(l, u.undoState.actions), []),
|
|
305
|
+
textRanges: i.undoState.textRanges
|
|
306
306
|
};
|
|
307
307
|
t.pushUndoRedo({
|
|
308
308
|
unitID: e,
|
|
309
|
-
undoMutations: [{ id:
|
|
310
|
-
redoMutations: [{ id:
|
|
309
|
+
undoMutations: [{ id: o, params: d }],
|
|
310
|
+
redoMutations: [{ id: o, params: c }]
|
|
311
311
|
}), n.length = 0;
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
],
|
|
319
|
-
class
|
|
314
|
+
re = Et([
|
|
315
|
+
Re(0, w(ie)),
|
|
316
|
+
Re(1, y),
|
|
317
|
+
Re(2, T)
|
|
318
|
+
], re);
|
|
319
|
+
class me {
|
|
320
320
|
constructor() {
|
|
321
321
|
M(this, "_previousActiveRange", null);
|
|
322
322
|
M(this, "_undoMutationParamsCache", []);
|
|
@@ -348,13 +348,13 @@ class fe {
|
|
|
348
348
|
return null;
|
|
349
349
|
const { unitId: e } = this._undoMutationParamsCache[0], t = {
|
|
350
350
|
unitId: e,
|
|
351
|
-
actions: this._undoMutationParamsCache.reverse().reduce((s,
|
|
351
|
+
actions: this._undoMutationParamsCache.reverse().reduce((s, o) => U.compose(s, o.actions), []),
|
|
352
352
|
textRanges: []
|
|
353
353
|
// Add empty array, will never use, just fix type error
|
|
354
354
|
};
|
|
355
355
|
return { redoMutationParams: {
|
|
356
356
|
unitId: e,
|
|
357
|
-
actions: this._redoMutationParamsCache.reduce((s,
|
|
357
|
+
actions: this._redoMutationParamsCache.reduce((s, o) => U.compose(s, o.actions), []),
|
|
358
358
|
textRanges: []
|
|
359
359
|
// Add empty array, will never use, just fix type error
|
|
360
360
|
}, undoMutationParams: t, previousActiveRange: this._previousActiveRange };
|
|
@@ -363,37 +363,37 @@ class fe {
|
|
|
363
363
|
this._undoMutationParamsCache = [], this._redoMutationParamsCache = [], this._previousActiveRange = null;
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
|
-
const
|
|
367
|
-
id:
|
|
366
|
+
const $e = "doc.mutation.rich-text-editing", L = {
|
|
367
|
+
id: $e,
|
|
368
368
|
type: v.MUTATION,
|
|
369
|
-
handler: (
|
|
369
|
+
handler: (r, e) => {
|
|
370
370
|
var E;
|
|
371
371
|
const {
|
|
372
372
|
unitId: t,
|
|
373
373
|
actions: n,
|
|
374
374
|
textRanges: s,
|
|
375
|
-
prevTextRanges:
|
|
376
|
-
trigger:
|
|
375
|
+
prevTextRanges: o,
|
|
376
|
+
trigger: i,
|
|
377
377
|
noHistory: a,
|
|
378
378
|
isCompositionEnd: c,
|
|
379
379
|
noNeedSetTextRange: d
|
|
380
|
-
} = e, u =
|
|
380
|
+
} = e, u = r.get(T).getUniverDocInstance(t), g = r.get(J).getViewModel(t), S = r.get(A), f = ((E = S.getSelections()) != null ? E : []).map(q), _ = r.get(re), p = r.get(me);
|
|
381
381
|
if (u == null || g == null)
|
|
382
382
|
throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${t}`);
|
|
383
383
|
if (n.length === 0)
|
|
384
384
|
return {
|
|
385
385
|
unitId: t,
|
|
386
386
|
actions: [],
|
|
387
|
-
textRanges:
|
|
387
|
+
textRanges: f
|
|
388
388
|
};
|
|
389
389
|
const C = u.apply(n), { segmentId: x } = n[0], O = u.getSelfOrHeaderFooterModel(x);
|
|
390
|
-
g.getSelfOrHeaderFooterViewModel(x).reset(O), !d && s &&
|
|
391
|
-
|
|
390
|
+
g.getSelfOrHeaderFooterViewModel(x).reset(O), !d && s && i != null && queueMicrotask(() => {
|
|
391
|
+
S.replaceTextRanges(s);
|
|
392
392
|
});
|
|
393
|
-
const
|
|
394
|
-
commandId:
|
|
393
|
+
const P = {
|
|
394
|
+
commandId: $e,
|
|
395
395
|
unitId: t,
|
|
396
|
-
trigger:
|
|
396
|
+
trigger: i,
|
|
397
397
|
noHistory: a,
|
|
398
398
|
redoState: {
|
|
399
399
|
actions: n,
|
|
@@ -401,63 +401,63 @@ const ke = "doc.mutation.rich-text-editing", L = {
|
|
|
401
401
|
},
|
|
402
402
|
undoState: {
|
|
403
403
|
actions: C,
|
|
404
|
-
textRanges:
|
|
404
|
+
textRanges: o != null ? o : f
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
407
|
if (c) {
|
|
408
408
|
const D = p.fetchComposedUndoRedoMutationParams();
|
|
409
409
|
if (D == null)
|
|
410
410
|
throw new Error("historyParams is null in RichTextEditingMutation");
|
|
411
|
-
const { undoMutationParams: I, redoMutationParams:
|
|
412
|
-
|
|
411
|
+
const { undoMutationParams: I, redoMutationParams: $, previousActiveRange: B } = D;
|
|
412
|
+
P.redoState.actions = $.actions, P.undoState.actions = I.actions, P.undoState.textRanges = [B];
|
|
413
413
|
}
|
|
414
|
-
return
|
|
414
|
+
return _.setChangeState(P), {
|
|
415
415
|
unitId: t,
|
|
416
416
|
actions: C,
|
|
417
|
-
textRanges:
|
|
417
|
+
textRanges: f
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
|
-
},
|
|
420
|
+
}, ge = {
|
|
421
421
|
id: "doc.command.insert-text",
|
|
422
422
|
type: v.COMMAND,
|
|
423
|
-
handler: async (
|
|
424
|
-
const t =
|
|
423
|
+
handler: async (r, e) => {
|
|
424
|
+
const t = r.get(y), { range: n, segmentId: s, body: o, unitId: i, textRanges: a } = e, { startOffset: c, collapsed: d } = n, l = {
|
|
425
425
|
id: L.id,
|
|
426
426
|
params: {
|
|
427
|
-
unitId:
|
|
427
|
+
unitId: i,
|
|
428
428
|
actions: [],
|
|
429
429
|
textRanges: a
|
|
430
430
|
}
|
|
431
|
-
}, u = new
|
|
431
|
+
}, u = new U();
|
|
432
432
|
return d ? c > 0 && u.push({
|
|
433
433
|
t: R.RETAIN,
|
|
434
434
|
len: c,
|
|
435
435
|
segmentId: s
|
|
436
|
-
}) : u.push(...
|
|
436
|
+
}) : u.push(...De(n, s)), u.push({
|
|
437
437
|
t: R.INSERT,
|
|
438
|
-
body:
|
|
439
|
-
len:
|
|
438
|
+
body: o,
|
|
439
|
+
len: o.dataStream.length,
|
|
440
440
|
line: 0,
|
|
441
441
|
segmentId: s
|
|
442
442
|
}), l.params.actions = u.serialize(), !!t.syncExecuteCommand(l.id, l.params);
|
|
443
443
|
}
|
|
444
444
|
};
|
|
445
|
-
var
|
|
446
|
-
const
|
|
445
|
+
var V = /* @__PURE__ */ ((r) => (r[r.LEFT = 0] = "LEFT", r[r.RIGHT = 1] = "RIGHT", r))(V || {});
|
|
446
|
+
const fe = {
|
|
447
447
|
id: "doc.command.delete-text",
|
|
448
448
|
type: v.COMMAND,
|
|
449
|
-
handler: async (
|
|
450
|
-
const t =
|
|
449
|
+
handler: async (r, e) => {
|
|
450
|
+
const t = r.get(y), { range: n, segmentId: s, unitId: o, direction: i, textRanges: a, len: c = 1 } = e, { startOffset: d } = n, l = {
|
|
451
451
|
id: L.id,
|
|
452
452
|
params: {
|
|
453
|
-
unitId:
|
|
453
|
+
unitId: o,
|
|
454
454
|
actions: [],
|
|
455
455
|
textRanges: a
|
|
456
456
|
}
|
|
457
|
-
}, u = new
|
|
457
|
+
}, u = new U();
|
|
458
458
|
return d > 0 && u.push({
|
|
459
459
|
t: R.RETAIN,
|
|
460
|
-
len:
|
|
460
|
+
len: i === 0 ? d - c : d,
|
|
461
461
|
segmentId: s
|
|
462
462
|
}), u.push({
|
|
463
463
|
t: R.DELETE,
|
|
@@ -466,18 +466,18 @@ const _e = {
|
|
|
466
466
|
segmentId: s
|
|
467
467
|
}), l.params.actions = u.serialize(), !!t.syncExecuteCommand(l.id, l.params);
|
|
468
468
|
}
|
|
469
|
-
},
|
|
469
|
+
}, We = {
|
|
470
470
|
id: "doc.command.update-text",
|
|
471
471
|
type: v.COMMAND,
|
|
472
|
-
handler: async (
|
|
473
|
-
const { range: t, segmentId: n, updateBody: s, coverType:
|
|
472
|
+
handler: async (r, e) => {
|
|
473
|
+
const { range: t, segmentId: n, updateBody: s, coverType: o, unitId: i, textRanges: a } = e, c = r.get(y), d = {
|
|
474
474
|
id: L.id,
|
|
475
475
|
params: {
|
|
476
|
-
unitId:
|
|
476
|
+
unitId: i,
|
|
477
477
|
actions: [],
|
|
478
478
|
textRanges: a
|
|
479
479
|
}
|
|
480
|
-
}, l = new
|
|
480
|
+
}, l = new U(), { startOffset: u, endOffset: m } = t;
|
|
481
481
|
return l.push({
|
|
482
482
|
t: R.RETAIN,
|
|
483
483
|
len: u,
|
|
@@ -485,43 +485,43 @@ const _e = {
|
|
|
485
485
|
}), l.push({
|
|
486
486
|
t: R.RETAIN,
|
|
487
487
|
body: s,
|
|
488
|
-
len:
|
|
488
|
+
len: m - u,
|
|
489
489
|
segmentId: n,
|
|
490
|
-
coverType:
|
|
490
|
+
coverType: o
|
|
491
491
|
}), d.params.actions = l.serialize(), !!c.syncExecuteCommand(d.id, d.params);
|
|
492
492
|
}
|
|
493
493
|
};
|
|
494
|
-
function
|
|
494
|
+
function Pt(r, e) {
|
|
495
495
|
const t = [];
|
|
496
|
-
for (let n = 0, s =
|
|
497
|
-
|
|
496
|
+
for (let n = 0, s = r.length; n < s; n++)
|
|
497
|
+
r[n] === ye.PARAGRAPH && t.push({
|
|
498
498
|
startIndex: n
|
|
499
499
|
});
|
|
500
500
|
if (e)
|
|
501
501
|
for (const n of t)
|
|
502
|
-
e.bullet && (n.bullet =
|
|
502
|
+
e.bullet && (n.bullet = Y.deepClone(e.bullet)), e.paragraphStyle && (n.paragraphStyle = Y.deepClone(e.paragraphStyle));
|
|
503
503
|
return t;
|
|
504
504
|
}
|
|
505
|
-
const
|
|
505
|
+
const bt = {
|
|
506
506
|
id: "doc.command.break-line",
|
|
507
507
|
type: v.COMMAND,
|
|
508
|
-
handler: async (
|
|
509
|
-
var
|
|
510
|
-
const e =
|
|
508
|
+
handler: async (r) => {
|
|
509
|
+
var S, h;
|
|
510
|
+
const e = r.get(A), t = r.get(T), n = r.get(y), s = e.getActiveRange();
|
|
511
511
|
if (s == null)
|
|
512
512
|
return !1;
|
|
513
|
-
const
|
|
513
|
+
const o = t.getCurrentUniverDocInstance(), i = o.getUnitId(), { startOffset: a, segmentId: c, style: d } = s, l = [
|
|
514
514
|
{
|
|
515
515
|
startOffset: a + 1,
|
|
516
516
|
endOffset: a + 1,
|
|
517
517
|
style: d
|
|
518
518
|
}
|
|
519
|
-
],
|
|
520
|
-
return await n.executeCommand(
|
|
521
|
-
unitId:
|
|
519
|
+
], m = ((h = (S = o.getBody()) == null ? void 0 : S.paragraphs) != null ? h : []).find((f) => f.startIndex >= a);
|
|
520
|
+
return await n.executeCommand(ge.id, {
|
|
521
|
+
unitId: i,
|
|
522
522
|
body: {
|
|
523
|
-
dataStream:
|
|
524
|
-
paragraphs:
|
|
523
|
+
dataStream: ye.PARAGRAPH,
|
|
524
|
+
paragraphs: Pt(ye.PARAGRAPH, m)
|
|
525
525
|
},
|
|
526
526
|
range: s,
|
|
527
527
|
textRanges: l,
|
|
@@ -529,20 +529,20 @@ const Lt = {
|
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
531
|
};
|
|
532
|
-
var
|
|
533
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
534
|
-
(
|
|
535
|
-
return n && s &&
|
|
536
|
-
},
|
|
537
|
-
let
|
|
532
|
+
var At = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Nt = (r, e, t, n) => {
|
|
533
|
+
for (var s = n > 1 ? void 0 : n ? Ut(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
534
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
535
|
+
return n && s && At(e, t, s), s;
|
|
536
|
+
}, xe = (r, e) => (t, n) => e(t, n, r);
|
|
537
|
+
let k = class extends oe {
|
|
538
538
|
constructor(e, t, n) {
|
|
539
539
|
super();
|
|
540
540
|
M(this, "_currentSkeletonUnitId", "");
|
|
541
541
|
M(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
|
|
542
|
-
M(this, "_currentSkeleton$", new
|
|
542
|
+
M(this, "_currentSkeleton$", new W(null));
|
|
543
543
|
M(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
|
|
544
544
|
// CurrentSkeletonBefore for pre-triggered logic during registration
|
|
545
|
-
M(this, "_currentSkeletonBefore$", new
|
|
545
|
+
M(this, "_currentSkeletonBefore$", new W(null));
|
|
546
546
|
M(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
|
|
547
547
|
this._localeService = e, this._docViewModelManagerService = t, this._currentUniverService = n, this._initialize();
|
|
548
548
|
}
|
|
@@ -553,11 +553,11 @@ let B = class extends he {
|
|
|
553
553
|
this._currentSkeletonBefore$.complete(), this._currentSkeleton$.complete(), this._docSkeletonMap.clear();
|
|
554
554
|
}
|
|
555
555
|
_init() {
|
|
556
|
-
this._docViewModelManagerService.currentDocViewModel$.pipe(
|
|
556
|
+
this._docViewModelManagerService.currentDocViewModel$.pipe(Z(this.dispose$)).subscribe((e) => {
|
|
557
557
|
e != null && this._setCurrent(e);
|
|
558
558
|
}), this._docViewModelManagerService.getAllModel().forEach((e) => {
|
|
559
559
|
e != null && this._setCurrent(e);
|
|
560
|
-
}), this._currentUniverService.docDisposed$.pipe(
|
|
560
|
+
}), this._currentUniverService.docDisposed$.pipe(Z(this.dispose$)).subscribe((e) => {
|
|
561
561
|
this._docSkeletonMap.delete(e.getUnitId()), this._currentSkeletonUnitId = this._currentUniverService.getCurrentUniverDocInstance().getUnitId();
|
|
562
562
|
});
|
|
563
563
|
}
|
|
@@ -593,19 +593,19 @@ let B = class extends he {
|
|
|
593
593
|
return this._currentSkeletonUnitId = t, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
|
|
594
594
|
}
|
|
595
595
|
_buildSkeleton(e) {
|
|
596
|
-
return
|
|
596
|
+
return dt.create(e, this._localeService);
|
|
597
597
|
}
|
|
598
598
|
};
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
],
|
|
604
|
-
const
|
|
599
|
+
k = Nt([
|
|
600
|
+
xe(0, w(ke)),
|
|
601
|
+
xe(1, w(J)),
|
|
602
|
+
xe(2, T)
|
|
603
|
+
], k);
|
|
604
|
+
const Rn = {
|
|
605
605
|
id: "doc.command.inner-paste",
|
|
606
606
|
type: v.COMMAND,
|
|
607
|
-
handler: async (
|
|
608
|
-
const { segmentId: t, body: n, textRanges: s } = e,
|
|
607
|
+
handler: async (r, e) => {
|
|
608
|
+
const { segmentId: t, body: n, textRanges: s } = e, o = r.get(y), i = r.get(A), a = r.get(T), c = i.getSelections();
|
|
609
609
|
if (!Array.isArray(c) || c.length === 0)
|
|
610
610
|
return !1;
|
|
611
611
|
const l = a.getCurrentUniverDocInstance().getUnitId(), u = {
|
|
@@ -615,33 +615,33 @@ const bn = {
|
|
|
615
615
|
actions: [],
|
|
616
616
|
textRanges: s
|
|
617
617
|
}
|
|
618
|
-
},
|
|
619
|
-
|
|
620
|
-
const g = new
|
|
621
|
-
for (const
|
|
622
|
-
const { startOffset:
|
|
618
|
+
}, m = new ae();
|
|
619
|
+
m.reset();
|
|
620
|
+
const g = new U();
|
|
621
|
+
for (const h of c) {
|
|
622
|
+
const { startOffset: f, endOffset: _, collapsed: p } = h, C = f - m.cursor;
|
|
623
623
|
p ? g.push({
|
|
624
624
|
t: R.RETAIN,
|
|
625
625
|
len: C,
|
|
626
626
|
segmentId: t
|
|
627
|
-
}) : g.push(...
|
|
627
|
+
}) : g.push(...De(h, t, m.cursor)), g.push({
|
|
628
628
|
t: R.INSERT,
|
|
629
629
|
body: n,
|
|
630
630
|
len: n.dataStream.length,
|
|
631
631
|
line: 0,
|
|
632
632
|
segmentId: t
|
|
633
|
-
}),
|
|
633
|
+
}), m.reset(), m.moveCursor(_);
|
|
634
634
|
}
|
|
635
|
-
return u.params.actions = g.serialize(), !!
|
|
635
|
+
return u.params.actions = g.serialize(), !!o.syncExecuteCommand(u.id, u.params);
|
|
636
636
|
}
|
|
637
|
-
},
|
|
637
|
+
}, Ze = {
|
|
638
638
|
id: "doc.command.inner-cut",
|
|
639
639
|
type: v.COMMAND,
|
|
640
|
-
handler: async (
|
|
641
|
-
const { segmentId: t, textRanges: n } = e, s =
|
|
640
|
+
handler: async (r, e) => {
|
|
641
|
+
const { segmentId: t, textRanges: n } = e, s = r.get(y), o = r.get(A), i = r.get(T), a = o.getSelections();
|
|
642
642
|
if (!Array.isArray(a) || a.length === 0)
|
|
643
643
|
return !1;
|
|
644
|
-
const c =
|
|
644
|
+
const c = i.getCurrentUniverDocInstance().getUnitId(), d = i.getUniverDocInstance(c), l = st(d.snapshot, t);
|
|
645
645
|
if (l == null)
|
|
646
646
|
return !1;
|
|
647
647
|
const u = {
|
|
@@ -651,196 +651,196 @@ const bn = {
|
|
|
651
651
|
actions: [],
|
|
652
652
|
textRanges: n
|
|
653
653
|
}
|
|
654
|
-
},
|
|
655
|
-
|
|
656
|
-
const g = new
|
|
657
|
-
for (const
|
|
658
|
-
const { startOffset:
|
|
654
|
+
}, m = new ae();
|
|
655
|
+
m.reset();
|
|
656
|
+
const g = new U();
|
|
657
|
+
for (const h of a) {
|
|
658
|
+
const { startOffset: f, endOffset: _, collapsed: p } = h, C = f - m.cursor;
|
|
659
659
|
p ? g.push({
|
|
660
660
|
t: R.RETAIN,
|
|
661
661
|
len: C,
|
|
662
662
|
segmentId: t
|
|
663
|
-
}) : g.push(...
|
|
663
|
+
}) : g.push(...wt(h, l, t, m.cursor)), m.reset(), m.moveCursor(_);
|
|
664
664
|
}
|
|
665
665
|
return u.params.actions = g.serialize(), !!s.syncExecuteCommand(u.id, u.params);
|
|
666
666
|
}
|
|
667
667
|
};
|
|
668
|
-
function
|
|
669
|
-
const { startOffset: s, endOffset:
|
|
668
|
+
function wt(r, e, t = "", n = 0) {
|
|
669
|
+
const { startOffset: s, endOffset: o } = r, i = [], { paragraphs: a = [] } = e, c = s - n, d = o - n, l = a == null ? void 0 : a.find(
|
|
670
670
|
(u) => u.startIndex - n >= c && u.startIndex - n <= d
|
|
671
671
|
);
|
|
672
|
-
if (c > 0 &&
|
|
672
|
+
if (c > 0 && i.push({
|
|
673
673
|
t: R.RETAIN,
|
|
674
674
|
len: c,
|
|
675
675
|
segmentId: t
|
|
676
676
|
}), l && l.startIndex - n > c) {
|
|
677
677
|
const u = l.startIndex - n;
|
|
678
|
-
|
|
678
|
+
i.push({
|
|
679
679
|
t: R.DELETE,
|
|
680
680
|
len: u - c,
|
|
681
681
|
line: 0,
|
|
682
682
|
segmentId: t
|
|
683
|
-
}),
|
|
683
|
+
}), i.push({
|
|
684
684
|
t: R.RETAIN,
|
|
685
685
|
len: 1,
|
|
686
686
|
segmentId: t
|
|
687
|
-
}), d > u + 1 &&
|
|
687
|
+
}), d > u + 1 && i.push({
|
|
688
688
|
t: R.DELETE,
|
|
689
689
|
len: d - u - 1,
|
|
690
690
|
line: 0,
|
|
691
691
|
segmentId: t
|
|
692
692
|
});
|
|
693
693
|
} else
|
|
694
|
-
|
|
694
|
+
i.push({
|
|
695
695
|
t: R.DELETE,
|
|
696
696
|
len: d - c,
|
|
697
697
|
line: 0,
|
|
698
698
|
segmentId: t
|
|
699
699
|
});
|
|
700
|
-
return
|
|
700
|
+
return i;
|
|
701
701
|
}
|
|
702
|
-
const
|
|
702
|
+
const Lt = {
|
|
703
703
|
id: "doc.command.delete-left",
|
|
704
704
|
type: v.COMMAND,
|
|
705
|
-
handler: async (
|
|
705
|
+
handler: async (r) => {
|
|
706
706
|
var x;
|
|
707
|
-
const e =
|
|
707
|
+
const e = r.get(A), t = r.get(k), n = r.get(T), s = r.get(y), o = e.getActiveRange(), i = e.getSelections(), a = (x = t.getCurrent()) == null ? void 0 : x.skeleton;
|
|
708
708
|
let c = !0;
|
|
709
|
-
if (
|
|
709
|
+
if (o == null || a == null || i == null)
|
|
710
710
|
return !1;
|
|
711
|
-
const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId:
|
|
712
|
-
let
|
|
711
|
+
const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId: m, style: g } = o, S = a.findNodeByCharIndex(l), h = ut(S), f = mt(S, d.getBody());
|
|
712
|
+
let _ = l;
|
|
713
713
|
const p = a.findNodeByCharIndex(l - 1);
|
|
714
|
-
if (
|
|
715
|
-
const O =
|
|
714
|
+
if (gt(S) && p !== S && (h === !0 || f === !0)) {
|
|
715
|
+
const O = ft(S, d.getBody());
|
|
716
716
|
if (O == null)
|
|
717
717
|
return !1;
|
|
718
|
-
const N = O == null ? void 0 : O.startIndex,
|
|
719
|
-
if (
|
|
718
|
+
const N = O == null ? void 0 : O.startIndex, P = { startIndex: 0 }, E = O.paragraphStyle;
|
|
719
|
+
if (h === !0) {
|
|
720
720
|
const I = O.paragraphStyle;
|
|
721
|
-
I && (
|
|
722
|
-
} else if (
|
|
721
|
+
I && (P.paragraphStyle = I);
|
|
722
|
+
} else if (f === !0) {
|
|
723
723
|
const I = O.bullet;
|
|
724
|
-
I && (
|
|
724
|
+
I && (P.bullet = I), E != null && (P.paragraphStyle = { ...E }, delete P.paragraphStyle.hanging, delete P.paragraphStyle.indentStart);
|
|
725
725
|
}
|
|
726
726
|
const D = [
|
|
727
727
|
{
|
|
728
|
-
startOffset:
|
|
729
|
-
endOffset:
|
|
728
|
+
startOffset: _,
|
|
729
|
+
endOffset: _,
|
|
730
730
|
style: g
|
|
731
731
|
}
|
|
732
732
|
];
|
|
733
|
-
c = await s.executeCommand(
|
|
733
|
+
c = await s.executeCommand(We.id, {
|
|
734
734
|
unitId: d.getUnitId(),
|
|
735
735
|
updateBody: {
|
|
736
736
|
dataStream: "",
|
|
737
|
-
paragraphs: [{ ...
|
|
737
|
+
paragraphs: [{ ...P }]
|
|
738
738
|
},
|
|
739
739
|
range: {
|
|
740
740
|
startOffset: N,
|
|
741
741
|
endOffset: N + 1
|
|
742
742
|
},
|
|
743
743
|
textRanges: D,
|
|
744
|
-
coverType:
|
|
745
|
-
segmentId:
|
|
744
|
+
coverType: je.REPLACE,
|
|
745
|
+
segmentId: m
|
|
746
746
|
});
|
|
747
747
|
} else if (u === !0) {
|
|
748
748
|
if (p == null)
|
|
749
749
|
return !0;
|
|
750
750
|
if (p.content === "\r")
|
|
751
|
-
c = await s.executeCommand(
|
|
752
|
-
direction:
|
|
753
|
-
range:
|
|
751
|
+
c = await s.executeCommand(Pe.id, {
|
|
752
|
+
direction: V.LEFT,
|
|
753
|
+
range: o
|
|
754
754
|
});
|
|
755
755
|
else {
|
|
756
|
-
|
|
756
|
+
_ -= p.count;
|
|
757
757
|
const O = [
|
|
758
758
|
{
|
|
759
|
-
startOffset:
|
|
760
|
-
endOffset:
|
|
759
|
+
startOffset: _,
|
|
760
|
+
endOffset: _,
|
|
761
761
|
style: g
|
|
762
762
|
}
|
|
763
763
|
];
|
|
764
|
-
c = await s.executeCommand(
|
|
764
|
+
c = await s.executeCommand(fe.id, {
|
|
765
765
|
unitId: d.getUnitId(),
|
|
766
|
-
range:
|
|
767
|
-
segmentId:
|
|
768
|
-
direction:
|
|
766
|
+
range: o,
|
|
767
|
+
segmentId: m,
|
|
768
|
+
direction: V.LEFT,
|
|
769
769
|
len: p.count,
|
|
770
770
|
textRanges: O
|
|
771
771
|
});
|
|
772
772
|
}
|
|
773
773
|
} else {
|
|
774
|
-
const O =
|
|
775
|
-
c = await s.executeCommand(
|
|
776
|
-
segmentId:
|
|
774
|
+
const O = qe(o, i);
|
|
775
|
+
c = await s.executeCommand(Ze.id, {
|
|
776
|
+
segmentId: m,
|
|
777
777
|
textRanges: O
|
|
778
778
|
});
|
|
779
779
|
}
|
|
780
780
|
return c;
|
|
781
781
|
}
|
|
782
|
-
},
|
|
782
|
+
}, Bt = {
|
|
783
783
|
id: "doc.command.delete-right",
|
|
784
784
|
type: v.COMMAND,
|
|
785
|
-
handler: async (
|
|
786
|
-
var
|
|
787
|
-
const e =
|
|
785
|
+
handler: async (r) => {
|
|
786
|
+
var S;
|
|
787
|
+
const e = r.get(A), t = r.get(k), n = r.get(T), s = r.get(y), o = e.getActiveRange(), i = e.getSelections(), a = (S = t.getCurrent()) == null ? void 0 : S.skeleton;
|
|
788
788
|
let c;
|
|
789
|
-
if (
|
|
789
|
+
if (o == null || a == null || i == null)
|
|
790
790
|
return !1;
|
|
791
|
-
const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId:
|
|
791
|
+
const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId: m, style: g } = o;
|
|
792
792
|
if (l === d.getBody().dataStream.length - 2 && u)
|
|
793
793
|
return !0;
|
|
794
794
|
if (u === !0) {
|
|
795
|
-
const
|
|
796
|
-
if (
|
|
797
|
-
c = await s.executeCommand(
|
|
798
|
-
direction:
|
|
799
|
-
range:
|
|
795
|
+
const h = a.findNodeByCharIndex(l);
|
|
796
|
+
if (h.content === "\r")
|
|
797
|
+
c = await s.executeCommand(Pe.id, {
|
|
798
|
+
direction: V.RIGHT,
|
|
799
|
+
range: o
|
|
800
800
|
});
|
|
801
801
|
else {
|
|
802
|
-
const
|
|
802
|
+
const f = [
|
|
803
803
|
{
|
|
804
804
|
startOffset: l,
|
|
805
805
|
endOffset: l,
|
|
806
806
|
style: g
|
|
807
807
|
}
|
|
808
808
|
];
|
|
809
|
-
c = await s.executeCommand(
|
|
809
|
+
c = await s.executeCommand(fe.id, {
|
|
810
810
|
unitId: d.getUnitId(),
|
|
811
|
-
range:
|
|
812
|
-
segmentId:
|
|
813
|
-
direction:
|
|
814
|
-
textRanges:
|
|
815
|
-
len:
|
|
811
|
+
range: o,
|
|
812
|
+
segmentId: m,
|
|
813
|
+
direction: V.RIGHT,
|
|
814
|
+
textRanges: f,
|
|
815
|
+
len: h.count
|
|
816
816
|
});
|
|
817
817
|
}
|
|
818
818
|
} else {
|
|
819
|
-
const
|
|
820
|
-
c = await s.executeCommand(
|
|
821
|
-
segmentId:
|
|
822
|
-
textRanges:
|
|
819
|
+
const h = qe(o, i);
|
|
820
|
+
c = await s.executeCommand(Ze.id, {
|
|
821
|
+
segmentId: m,
|
|
822
|
+
textRanges: h
|
|
823
823
|
});
|
|
824
824
|
}
|
|
825
825
|
return c;
|
|
826
826
|
}
|
|
827
|
-
},
|
|
827
|
+
}, Pe = {
|
|
828
828
|
id: "doc.command.merge-two-paragraph",
|
|
829
829
|
type: v.COMMAND,
|
|
830
|
-
handler: async (
|
|
831
|
-
var
|
|
832
|
-
const t =
|
|
833
|
-
|
|
834
|
-
const { direction:
|
|
830
|
+
handler: async (r, e) => {
|
|
831
|
+
var P, E, D;
|
|
832
|
+
const t = r.get(A), n = r.get(T), s = r.get(y);
|
|
833
|
+
r.get(ie);
|
|
834
|
+
const { direction: o, range: i } = e, a = t.getActiveRange(), c = t.getSelections();
|
|
835
835
|
if (a == null || c == null)
|
|
836
836
|
return !1;
|
|
837
|
-
const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId:
|
|
837
|
+
const d = n.getCurrentUniverDocInstance(), { startOffset: l, collapsed: u, segmentId: m, style: g } = a;
|
|
838
838
|
if (!u)
|
|
839
839
|
return !1;
|
|
840
|
-
const
|
|
840
|
+
const S = o === V.LEFT ? l : l + 1, h = (D = (E = (P = d.getBody()) == null ? void 0 : P.paragraphs) == null ? void 0 : E.find((I) => I.startIndex >= S)) == null ? void 0 : D.startIndex, f = $t(d.getBody(), S, h), _ = o === V.LEFT ? l - 1 : l, p = d.getUnitId(), C = [
|
|
841
841
|
{
|
|
842
|
-
startOffset:
|
|
843
|
-
endOffset:
|
|
842
|
+
startOffset: _,
|
|
843
|
+
endOffset: _,
|
|
844
844
|
style: g
|
|
845
845
|
}
|
|
846
846
|
], x = {
|
|
@@ -849,192 +849,192 @@ const Vt = {
|
|
|
849
849
|
unitId: p,
|
|
850
850
|
actions: [],
|
|
851
851
|
textRanges: C,
|
|
852
|
-
prevTextRanges: [
|
|
852
|
+
prevTextRanges: [i]
|
|
853
853
|
}
|
|
854
|
-
}, O = new
|
|
854
|
+
}, O = new U();
|
|
855
855
|
return O.push({
|
|
856
856
|
t: R.RETAIN,
|
|
857
|
-
len:
|
|
858
|
-
segmentId:
|
|
859
|
-
}),
|
|
857
|
+
len: o === V.LEFT ? l - 1 : l,
|
|
858
|
+
segmentId: m
|
|
859
|
+
}), f.dataStream.length && O.push({
|
|
860
860
|
t: R.INSERT,
|
|
861
|
-
body:
|
|
862
|
-
len:
|
|
861
|
+
body: f,
|
|
862
|
+
len: f.dataStream.length,
|
|
863
863
|
line: 0,
|
|
864
|
-
segmentId:
|
|
864
|
+
segmentId: m
|
|
865
865
|
}), O.push({
|
|
866
866
|
t: R.RETAIN,
|
|
867
867
|
len: 1,
|
|
868
|
-
segmentId:
|
|
868
|
+
segmentId: m
|
|
869
869
|
}), O.push({
|
|
870
870
|
t: R.DELETE,
|
|
871
|
-
len:
|
|
871
|
+
len: h + 1 - S,
|
|
872
872
|
line: 0,
|
|
873
|
-
segmentId:
|
|
873
|
+
segmentId: m
|
|
874
874
|
}), x.params.actions = O.serialize(), !!s.syncExecuteCommand(x.id, x.params);
|
|
875
875
|
}
|
|
876
876
|
};
|
|
877
|
-
function
|
|
878
|
-
const { textRuns: n } =
|
|
877
|
+
function $t(r, e, t) {
|
|
878
|
+
const { textRuns: n } = r, s = r.dataStream.substring(e, t);
|
|
879
879
|
if (n == null)
|
|
880
880
|
return {
|
|
881
881
|
dataStream: s
|
|
882
882
|
};
|
|
883
|
-
const
|
|
884
|
-
for (const
|
|
885
|
-
const { st: a, ed: c } =
|
|
886
|
-
c <= e || a >= t || (a < e ?
|
|
887
|
-
...
|
|
883
|
+
const o = [];
|
|
884
|
+
for (const i of n) {
|
|
885
|
+
const { st: a, ed: c } = i;
|
|
886
|
+
c <= e || a >= t || (a < e ? o.push({
|
|
887
|
+
...i,
|
|
888
888
|
st: 0,
|
|
889
889
|
ed: c - e
|
|
890
|
-
}) : c > t ?
|
|
891
|
-
...
|
|
890
|
+
}) : c > t ? o.push({
|
|
891
|
+
...i,
|
|
892
892
|
st: a - e,
|
|
893
893
|
ed: t - e
|
|
894
|
-
}) :
|
|
895
|
-
...
|
|
894
|
+
}) : o.push({
|
|
895
|
+
...i,
|
|
896
896
|
st: a - e,
|
|
897
897
|
ed: c - e
|
|
898
898
|
}));
|
|
899
899
|
}
|
|
900
900
|
return {
|
|
901
901
|
dataStream: s,
|
|
902
|
-
textRuns:
|
|
902
|
+
textRuns: o
|
|
903
903
|
};
|
|
904
904
|
}
|
|
905
|
-
function
|
|
906
|
-
let t =
|
|
905
|
+
function qe(r, e) {
|
|
906
|
+
let t = r.endOffset;
|
|
907
907
|
for (const s of e) {
|
|
908
|
-
const { startOffset:
|
|
909
|
-
|
|
908
|
+
const { startOffset: o, endOffset: i } = s;
|
|
909
|
+
o == null || i == null || i <= r.endOffset && (t -= i - o);
|
|
910
910
|
}
|
|
911
911
|
return [
|
|
912
912
|
{
|
|
913
913
|
startOffset: t,
|
|
914
914
|
endOffset: t,
|
|
915
|
-
style:
|
|
915
|
+
style: r.style
|
|
916
916
|
}
|
|
917
917
|
];
|
|
918
918
|
}
|
|
919
|
-
const
|
|
919
|
+
const Je = {
|
|
920
920
|
id: "doc.command.ime-input",
|
|
921
921
|
type: v.COMMAND,
|
|
922
|
-
handler: async (
|
|
923
|
-
const { unitId: t, newText: n, oldTextLen: s, isCompositionEnd:
|
|
922
|
+
handler: async (r, e) => {
|
|
923
|
+
const { unitId: t, newText: n, oldTextLen: s, isCompositionEnd: o, isCompositionStart: i } = e, a = r.get(y), c = r.get(me), d = c.getActiveRange();
|
|
924
924
|
if (d == null)
|
|
925
925
|
return !1;
|
|
926
|
-
const { startOffset: l, style: u, segmentId:
|
|
926
|
+
const { startOffset: l, style: u, segmentId: m } = d, g = n.length, S = [
|
|
927
927
|
{
|
|
928
928
|
startOffset: l + g,
|
|
929
929
|
endOffset: l + g,
|
|
930
930
|
collapsed: !0,
|
|
931
931
|
style: u
|
|
932
932
|
}
|
|
933
|
-
],
|
|
933
|
+
], h = {
|
|
934
934
|
id: L.id,
|
|
935
935
|
params: {
|
|
936
936
|
unitId: t,
|
|
937
937
|
actions: [],
|
|
938
|
-
textRanges:
|
|
938
|
+
textRanges: S
|
|
939
939
|
}
|
|
940
|
-
},
|
|
941
|
-
!d.collapsed &&
|
|
940
|
+
}, f = new U();
|
|
941
|
+
!d.collapsed && i ? f.push(...De(d, m)) : f.push({
|
|
942
942
|
t: R.RETAIN,
|
|
943
943
|
len: l,
|
|
944
|
-
segmentId:
|
|
945
|
-
}), s > 0 &&
|
|
944
|
+
segmentId: m
|
|
945
|
+
}), s > 0 && f.push({
|
|
946
946
|
t: R.DELETE,
|
|
947
947
|
len: s,
|
|
948
948
|
line: 0,
|
|
949
|
-
segmentId:
|
|
950
|
-
}),
|
|
949
|
+
segmentId: m
|
|
950
|
+
}), f.push({
|
|
951
951
|
t: R.INSERT,
|
|
952
952
|
body: {
|
|
953
953
|
dataStream: n
|
|
954
954
|
},
|
|
955
955
|
len: n.length,
|
|
956
956
|
line: 0,
|
|
957
|
-
segmentId:
|
|
958
|
-
}),
|
|
959
|
-
const
|
|
960
|
-
return c.pushUndoRedoMutationParams(
|
|
957
|
+
segmentId: m
|
|
958
|
+
}), h.params.actions = f.serialize(), h.params.noHistory = !o, h.params.isCompositionEnd = o;
|
|
959
|
+
const _ = a.syncExecuteCommand(h.id, h.params);
|
|
960
|
+
return c.pushUndoRedoMutationParams(_, h.params), !!_;
|
|
961
961
|
}
|
|
962
|
-
},
|
|
962
|
+
}, he = {
|
|
963
963
|
id: "doc.command.set-inline-format-bold",
|
|
964
964
|
type: v.COMMAND,
|
|
965
965
|
handler: async () => !0
|
|
966
|
-
},
|
|
966
|
+
}, pe = {
|
|
967
967
|
id: "doc.command.set-inline-format-italic",
|
|
968
968
|
type: v.COMMAND,
|
|
969
969
|
handler: async () => !0
|
|
970
|
-
},
|
|
970
|
+
}, Se = {
|
|
971
971
|
id: "doc.command.set-inline-format-underline",
|
|
972
972
|
type: v.COMMAND,
|
|
973
973
|
handler: async () => !0
|
|
974
|
-
},
|
|
974
|
+
}, _e = {
|
|
975
975
|
id: "doc.command.set-inline-format-strikethrough",
|
|
976
976
|
type: v.COMMAND,
|
|
977
977
|
handler: async () => !0
|
|
978
|
-
},
|
|
978
|
+
}, j = {
|
|
979
979
|
id: "doc.command.set-inline-format-subscript",
|
|
980
980
|
type: v.COMMAND,
|
|
981
981
|
handler: async () => !0
|
|
982
|
-
},
|
|
982
|
+
}, ve = {
|
|
983
983
|
id: "doc.command.set-inline-format-superscript",
|
|
984
984
|
type: v.COMMAND,
|
|
985
985
|
handler: async () => !0
|
|
986
|
-
},
|
|
986
|
+
}, Ie = {
|
|
987
987
|
id: "doc.command.set-inline-format-fontsize",
|
|
988
988
|
type: v.COMMAND,
|
|
989
989
|
handler: async () => !0
|
|
990
|
-
},
|
|
990
|
+
}, Me = {
|
|
991
991
|
id: "doc.command.set-inline-format-font-family",
|
|
992
992
|
type: v.COMMAND,
|
|
993
993
|
handler: async () => !0
|
|
994
|
-
},
|
|
994
|
+
}, Ce = {
|
|
995
995
|
id: "doc.command.set-inline-format-text-color",
|
|
996
996
|
type: v.COMMAND,
|
|
997
997
|
handler: async () => !0
|
|
998
|
-
},
|
|
999
|
-
[
|
|
1000
|
-
[
|
|
1001
|
-
[
|
|
1002
|
-
[
|
|
1003
|
-
[
|
|
1004
|
-
[
|
|
1005
|
-
[
|
|
1006
|
-
[
|
|
1007
|
-
[
|
|
1008
|
-
},
|
|
998
|
+
}, Ke = {
|
|
999
|
+
[he.id]: "bl",
|
|
1000
|
+
[pe.id]: "it",
|
|
1001
|
+
[Se.id]: "ul",
|
|
1002
|
+
[_e.id]: "st",
|
|
1003
|
+
[Ie.id]: "fs",
|
|
1004
|
+
[Me.id]: "ff",
|
|
1005
|
+
[Ce.id]: "cl",
|
|
1006
|
+
[j.id]: "va",
|
|
1007
|
+
[ve.id]: "va"
|
|
1008
|
+
}, Qe = {
|
|
1009
1009
|
id: "doc.command.set-inline-format",
|
|
1010
1010
|
type: v.COMMAND,
|
|
1011
|
-
handler: async (
|
|
1012
|
-
const { segmentId: t, value: n, preCommandId: s } = e,
|
|
1011
|
+
handler: async (r, e) => {
|
|
1012
|
+
const { segmentId: t, value: n, preCommandId: s } = e, o = r.get(y), i = r.get(A), a = r.get(T), c = i.getSelections();
|
|
1013
1013
|
if (!Array.isArray(c) || c.length === 0)
|
|
1014
1014
|
return !1;
|
|
1015
1015
|
let d = a.getCurrentUniverDocInstance(), l = d.getUnitId();
|
|
1016
|
-
l ===
|
|
1016
|
+
l === rt && (d = a.getUniverDocInstance(Ve), l = d.getUnitId());
|
|
1017
1017
|
let u;
|
|
1018
1018
|
switch (s) {
|
|
1019
|
+
case he.id:
|
|
1020
|
+
case pe.id:
|
|
1019
1021
|
case Se.id:
|
|
1020
|
-
case
|
|
1021
|
-
case
|
|
1022
|
-
case
|
|
1023
|
-
|
|
1024
|
-
case Ce.id: {
|
|
1025
|
-
u = Gt(
|
|
1022
|
+
case _e.id:
|
|
1023
|
+
case j.id:
|
|
1024
|
+
case ve.id: {
|
|
1025
|
+
u = zt(
|
|
1026
1026
|
d.getBody().textRuns,
|
|
1027
1027
|
s,
|
|
1028
1028
|
c
|
|
1029
1029
|
);
|
|
1030
1030
|
break;
|
|
1031
1031
|
}
|
|
1032
|
-
case
|
|
1033
|
-
case
|
|
1032
|
+
case Ie.id:
|
|
1033
|
+
case Me.id: {
|
|
1034
1034
|
u = n;
|
|
1035
1035
|
break;
|
|
1036
1036
|
}
|
|
1037
|
-
case
|
|
1037
|
+
case Ce.id: {
|
|
1038
1038
|
u = {
|
|
1039
1039
|
rgb: n
|
|
1040
1040
|
};
|
|
@@ -1043,28 +1043,28 @@ const tt = {
|
|
|
1043
1043
|
default:
|
|
1044
1044
|
throw new Error(`Unknown command: ${s} in handleInlineFormat`);
|
|
1045
1045
|
}
|
|
1046
|
-
const
|
|
1046
|
+
const m = {
|
|
1047
1047
|
id: L.id,
|
|
1048
1048
|
params: {
|
|
1049
1049
|
unitId: l,
|
|
1050
1050
|
actions: [],
|
|
1051
|
-
textRanges: c
|
|
1051
|
+
textRanges: c.map(q)
|
|
1052
1052
|
}
|
|
1053
|
-
}, g = new
|
|
1054
|
-
|
|
1055
|
-
for (const
|
|
1056
|
-
const { startOffset:
|
|
1053
|
+
}, g = new U(), S = new ae();
|
|
1054
|
+
S.reset();
|
|
1055
|
+
for (const f of c) {
|
|
1056
|
+
const { startOffset: _, endOffset: p } = f, C = {
|
|
1057
1057
|
dataStream: "",
|
|
1058
1058
|
textRuns: [
|
|
1059
1059
|
{
|
|
1060
1060
|
st: 0,
|
|
1061
|
-
ed: p -
|
|
1061
|
+
ed: p - _,
|
|
1062
1062
|
ts: {
|
|
1063
|
-
[
|
|
1063
|
+
[Ke[s]]: u
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
1066
|
]
|
|
1067
|
-
}, x =
|
|
1067
|
+
}, x = _ - S.cursor;
|
|
1068
1068
|
x !== 0 && g.push({
|
|
1069
1069
|
t: R.RETAIN,
|
|
1070
1070
|
len: x,
|
|
@@ -1072,76 +1072,76 @@ const tt = {
|
|
|
1072
1072
|
}), g.push({
|
|
1073
1073
|
t: R.RETAIN,
|
|
1074
1074
|
body: C,
|
|
1075
|
-
len: p -
|
|
1075
|
+
len: p - _,
|
|
1076
1076
|
segmentId: t
|
|
1077
|
-
}),
|
|
1077
|
+
}), S.reset(), S.moveCursor(p);
|
|
1078
1078
|
}
|
|
1079
|
-
return
|
|
1079
|
+
return m.params.actions = g.serialize(), !!o.syncExecuteCommand(m.id, m.params);
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
1082
|
-
function
|
|
1083
|
-
return
|
|
1082
|
+
function Ft(r) {
|
|
1083
|
+
return r !== null && typeof r == "object";
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function zt(r, e, t) {
|
|
1086
1086
|
let n = 0, s = 0;
|
|
1087
|
-
const
|
|
1088
|
-
for (; n !==
|
|
1089
|
-
const { startOffset:
|
|
1087
|
+
const o = Ke[e];
|
|
1088
|
+
for (; n !== r.length && s !== t.length; ) {
|
|
1089
|
+
const { startOffset: i, endOffset: a } = t[s], { st: c, ed: d, ts: l } = r[n];
|
|
1090
1090
|
if (a <= c)
|
|
1091
1091
|
s++;
|
|
1092
|
-
else if (d <=
|
|
1092
|
+
else if (d <= i)
|
|
1093
1093
|
n++;
|
|
1094
1094
|
else {
|
|
1095
|
-
if (/bl|it/.test(
|
|
1096
|
-
return (l == null ? void 0 : l[
|
|
1097
|
-
if (/ul|st/.test(
|
|
1098
|
-
return
|
|
1099
|
-
s:
|
|
1095
|
+
if (/bl|it/.test(o))
|
|
1096
|
+
return (l == null ? void 0 : l[o]) === F.TRUE ? F.FALSE : F.TRUE;
|
|
1097
|
+
if (/ul|st/.test(o))
|
|
1098
|
+
return Ft(l == null ? void 0 : l[o]) && (l == null ? void 0 : l[o]).s === F.TRUE ? {
|
|
1099
|
+
s: F.FALSE
|
|
1100
1100
|
} : {
|
|
1101
|
-
s:
|
|
1101
|
+
s: F.TRUE
|
|
1102
1102
|
};
|
|
1103
|
-
if (/va/.test(
|
|
1104
|
-
return e ===
|
|
1103
|
+
if (/va/.test(o))
|
|
1104
|
+
return e === j.id ? (l == null ? void 0 : l[o]) === z.SUBSCRIPT ? z.NORMAL : z.SUBSCRIPT : (l == null ? void 0 : l[o]) === z.SUPERSCRIPT ? z.NORMAL : z.SUPERSCRIPT;
|
|
1105
1105
|
n++;
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
return /bl|it/.test(
|
|
1109
|
-
s:
|
|
1110
|
-
} : e ===
|
|
1108
|
+
return /bl|it/.test(o) ? F.TRUE : /ul|st/.test(o) ? {
|
|
1109
|
+
s: F.TRUE
|
|
1110
|
+
} : e === j.id ? z.SUBSCRIPT : z.SUPERSCRIPT;
|
|
1111
1111
|
}
|
|
1112
|
-
const
|
|
1112
|
+
const be = {
|
|
1113
1113
|
id: "doc.command.list-operation",
|
|
1114
1114
|
type: v.COMMAND,
|
|
1115
|
-
handler: (
|
|
1116
|
-
var O, N,
|
|
1117
|
-
const t =
|
|
1115
|
+
handler: (r, e) => {
|
|
1116
|
+
var O, N, P;
|
|
1117
|
+
const t = r.get(A), n = r.get(T), s = r.get(y), { listType: o } = e, i = n.getCurrentUniverDocInstance(), a = t.getActiveRange(), c = (O = t.getSelections()) != null ? O : [], d = (N = i.getBody()) == null ? void 0 : N.paragraphs, l = c.map(q);
|
|
1118
1118
|
if (a == null || d == null)
|
|
1119
1119
|
return !1;
|
|
1120
|
-
const u =
|
|
1120
|
+
const u = jt(a, d), { segmentId: m } = a, g = i.getUnitId(), S = u.every((E) => {
|
|
1121
1121
|
var D;
|
|
1122
|
-
return ((D = E.bullet) == null ? void 0 : D.listType) ===
|
|
1122
|
+
return ((D = E.bullet) == null ? void 0 : D.listType) === o;
|
|
1123
1123
|
});
|
|
1124
|
-
let
|
|
1124
|
+
let f = Y.generateRandomId(6);
|
|
1125
1125
|
if (u.length === 1) {
|
|
1126
1126
|
const E = d.indexOf(u[0]), D = d[E - 1], I = d[E + 1];
|
|
1127
|
-
D && D.bullet && D.bullet.listType ===
|
|
1127
|
+
D && D.bullet && D.bullet.listType === o ? f = D.bullet.listId : I && I.bullet && I.bullet.listType === o && (f = I.bullet.listId);
|
|
1128
1128
|
}
|
|
1129
|
-
const
|
|
1129
|
+
const _ = {
|
|
1130
1130
|
id: L.id,
|
|
1131
1131
|
params: {
|
|
1132
1132
|
unitId: g,
|
|
1133
1133
|
actions: [],
|
|
1134
1134
|
textRanges: l
|
|
1135
1135
|
}
|
|
1136
|
-
}, p = new
|
|
1136
|
+
}, p = new ae();
|
|
1137
1137
|
p.reset();
|
|
1138
|
-
const C = new
|
|
1138
|
+
const C = new U();
|
|
1139
1139
|
for (const E of u) {
|
|
1140
1140
|
const { startIndex: D } = E;
|
|
1141
1141
|
C.push({
|
|
1142
1142
|
t: R.RETAIN,
|
|
1143
1143
|
len: D - p.cursor,
|
|
1144
|
-
segmentId:
|
|
1144
|
+
segmentId: m
|
|
1145
1145
|
});
|
|
1146
1146
|
const I = {
|
|
1147
1147
|
...E.paragraphStyle,
|
|
@@ -1154,120 +1154,120 @@ const we = {
|
|
|
1154
1154
|
body: {
|
|
1155
1155
|
dataStream: "",
|
|
1156
1156
|
paragraphs: [
|
|
1157
|
-
|
|
1157
|
+
S ? {
|
|
1158
1158
|
paragraphStyle: I,
|
|
1159
1159
|
startIndex: 0
|
|
1160
1160
|
} : {
|
|
1161
1161
|
...E,
|
|
1162
1162
|
startIndex: 0,
|
|
1163
1163
|
bullet: {
|
|
1164
|
-
...(
|
|
1164
|
+
...(P = E.bullet) != null ? P : {
|
|
1165
1165
|
nestingLevel: 0,
|
|
1166
1166
|
textStyle: {
|
|
1167
1167
|
fs: 20
|
|
1168
1168
|
}
|
|
1169
1169
|
},
|
|
1170
|
-
listType:
|
|
1171
|
-
listId:
|
|
1170
|
+
listType: o,
|
|
1171
|
+
listId: f
|
|
1172
1172
|
}
|
|
1173
1173
|
}
|
|
1174
1174
|
]
|
|
1175
1175
|
},
|
|
1176
|
-
segmentId:
|
|
1177
|
-
coverType:
|
|
1176
|
+
segmentId: m,
|
|
1177
|
+
coverType: je.REPLACE
|
|
1178
1178
|
}), p.moveCursorTo(D + 1);
|
|
1179
1179
|
}
|
|
1180
|
-
return
|
|
1180
|
+
return _.params.actions = C.serialize(), !!s.syncExecuteCommand(_.id, _.params);
|
|
1181
1181
|
}
|
|
1182
|
-
},
|
|
1182
|
+
}, Vt = {
|
|
1183
1183
|
id: "doc.command.bullet-list",
|
|
1184
1184
|
type: v.COMMAND,
|
|
1185
|
-
handler: (
|
|
1186
|
-
listType:
|
|
1185
|
+
handler: (r) => r.get(y).syncExecuteCommand(be.id, {
|
|
1186
|
+
listType: He.BULLET_LIST
|
|
1187
1187
|
})
|
|
1188
|
-
},
|
|
1188
|
+
}, kt = {
|
|
1189
1189
|
id: "doc.command.order-list",
|
|
1190
1190
|
type: v.COMMAND,
|
|
1191
|
-
handler: (
|
|
1192
|
-
listType:
|
|
1191
|
+
handler: (r) => r.get(y).syncExecuteCommand(be.id, {
|
|
1192
|
+
listType: He.ORDER_LIST
|
|
1193
1193
|
})
|
|
1194
1194
|
};
|
|
1195
|
-
function
|
|
1196
|
-
const { startOffset: t, endOffset: n } =
|
|
1197
|
-
let
|
|
1198
|
-
for (const
|
|
1199
|
-
const { startIndex: a } =
|
|
1200
|
-
(t >
|
|
1195
|
+
function jt(r, e) {
|
|
1196
|
+
const { startOffset: t, endOffset: n } = r, s = [];
|
|
1197
|
+
let o = -1;
|
|
1198
|
+
for (const i of e) {
|
|
1199
|
+
const { startIndex: a } = i;
|
|
1200
|
+
(t > o && t <= a || n > o && n <= a || a >= t && a <= n) && s.push(i), o = a;
|
|
1201
1201
|
}
|
|
1202
1202
|
return s;
|
|
1203
1203
|
}
|
|
1204
|
-
const
|
|
1204
|
+
const Ht = {
|
|
1205
1205
|
id: "doc.command-replace-content",
|
|
1206
1206
|
type: v.COMMAND,
|
|
1207
|
-
handler: async (
|
|
1207
|
+
handler: async (r, e) => {
|
|
1208
1208
|
var g;
|
|
1209
|
-
const { unitId: t, body: n, textRanges: s, segmentId:
|
|
1209
|
+
const { unitId: t, body: n, textRanges: s, segmentId: o = "" } = e, i = r.get(T), a = r.get(y), c = r.get(A), d = (g = i.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, l = c.getSelections();
|
|
1210
1210
|
if (d == null || !Array.isArray(l) || l.length === 0)
|
|
1211
1211
|
return !1;
|
|
1212
|
-
const u =
|
|
1212
|
+
const u = et(t, o, d, n);
|
|
1213
1213
|
return u.params.textRanges = s, !!a.syncExecuteCommand(u.id, u.params);
|
|
1214
1214
|
}
|
|
1215
|
-
},
|
|
1215
|
+
}, Gt = {
|
|
1216
1216
|
id: "doc.command-cover-content",
|
|
1217
1217
|
type: v.COMMAND,
|
|
1218
|
-
handler: async (
|
|
1218
|
+
handler: async (r, e) => {
|
|
1219
1219
|
var l;
|
|
1220
|
-
const { unitId: t, body: n, segmentId: s = "" } = e,
|
|
1220
|
+
const { unitId: t, body: n, segmentId: s = "" } = e, o = r.get(T), i = r.get(y), a = r.get(ie), c = (l = o.getUniverDocInstance(t)) == null ? void 0 : l.getSnapshot().body;
|
|
1221
1221
|
if (c == null)
|
|
1222
1222
|
return !1;
|
|
1223
|
-
const d =
|
|
1224
|
-
return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0,
|
|
1223
|
+
const d = et(t, s, c, n);
|
|
1224
|
+
return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0, i.syncExecuteCommand(
|
|
1225
1225
|
d.id,
|
|
1226
1226
|
d.params
|
|
1227
1227
|
), a.clearUndoRedo(t), !0;
|
|
1228
1228
|
}
|
|
1229
1229
|
};
|
|
1230
|
-
function
|
|
1230
|
+
function et(r, e, t, n) {
|
|
1231
1231
|
const s = {
|
|
1232
1232
|
id: L.id,
|
|
1233
1233
|
params: {
|
|
1234
|
-
unitId:
|
|
1234
|
+
unitId: r,
|
|
1235
1235
|
actions: [],
|
|
1236
1236
|
textRanges: []
|
|
1237
1237
|
}
|
|
1238
|
-
},
|
|
1239
|
-
return
|
|
1238
|
+
}, o = new U(), i = (t == null ? void 0 : t.dataStream.length) - 2;
|
|
1239
|
+
return i > 0 && o.push({
|
|
1240
1240
|
t: R.DELETE,
|
|
1241
|
-
len:
|
|
1241
|
+
len: i,
|
|
1242
1242
|
line: 0,
|
|
1243
1243
|
segmentId: e
|
|
1244
|
-
}), n.dataStream.length > 0 &&
|
|
1244
|
+
}), n.dataStream.length > 0 && o.push({
|
|
1245
1245
|
t: R.INSERT,
|
|
1246
1246
|
body: n,
|
|
1247
1247
|
len: n.dataStream.length,
|
|
1248
1248
|
line: 0,
|
|
1249
1249
|
segmentId: e
|
|
1250
|
-
}), s.params.actions =
|
|
1250
|
+
}), s.params.actions = o.serialize(), s;
|
|
1251
1251
|
}
|
|
1252
|
-
const
|
|
1252
|
+
const Te = {
|
|
1253
1253
|
id: "doc.operation.move-cursor",
|
|
1254
1254
|
type: v.OPERATION,
|
|
1255
|
-
handler: (
|
|
1256
|
-
},
|
|
1255
|
+
handler: (r, e) => !!e
|
|
1256
|
+
}, Ee = {
|
|
1257
1257
|
id: "doc.operation.move-selection",
|
|
1258
1258
|
type: v.OPERATION,
|
|
1259
|
-
handler: (
|
|
1260
|
-
},
|
|
1261
|
-
const t =
|
|
1259
|
+
handler: (r, e) => !!e
|
|
1260
|
+
}, Xt = (r, e) => {
|
|
1261
|
+
const t = r.get(T).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
|
|
1262
1262
|
return {
|
|
1263
|
-
...
|
|
1263
|
+
...Y.deepClone(e),
|
|
1264
1264
|
zoomRatio: n
|
|
1265
1265
|
};
|
|
1266
|
-
},
|
|
1266
|
+
}, Q = {
|
|
1267
1267
|
id: "doc.operation.set-zoom-ratio",
|
|
1268
1268
|
type: v.OPERATION,
|
|
1269
|
-
handler: (
|
|
1270
|
-
const t =
|
|
1269
|
+
handler: (r, e) => {
|
|
1270
|
+
const t = r.get(T).getUniverDocInstance(e.unitId);
|
|
1271
1271
|
if (!t)
|
|
1272
1272
|
return !1;
|
|
1273
1273
|
const n = t.getSnapshot();
|
|
@@ -1275,30 +1275,30 @@ const be = {
|
|
|
1275
1275
|
zoomRatio: e.zoomRatio
|
|
1276
1276
|
} : n.settings.zoomRatio = e.zoomRatio, !0;
|
|
1277
1277
|
}
|
|
1278
|
-
},
|
|
1278
|
+
}, Yt = {
|
|
1279
1279
|
type: v.COMMAND,
|
|
1280
1280
|
id: "doc.command.set-zoom-ratio",
|
|
1281
|
-
handler: async (
|
|
1282
|
-
var u,
|
|
1283
|
-
const t =
|
|
1284
|
-
let
|
|
1285
|
-
if (e && (
|
|
1281
|
+
handler: async (r, e) => {
|
|
1282
|
+
var u, m;
|
|
1283
|
+
const t = r.get(y), n = r.get(ie), s = r.get(T);
|
|
1284
|
+
let o = s.getCurrentUniverDocInstance().getUnitId(), i = 1;
|
|
1285
|
+
if (e && (o = (u = e.documentId) != null ? u : o, i = (m = e.zoomRatio) != null ? m : i), !s.getUniverDocInstance(o))
|
|
1286
1286
|
return !1;
|
|
1287
1287
|
const c = {
|
|
1288
|
-
zoomRatio:
|
|
1289
|
-
unitId:
|
|
1290
|
-
}, d =
|
|
1291
|
-
return t.syncExecuteCommand(
|
|
1292
|
-
unitID:
|
|
1293
|
-
undoMutations: [{ id:
|
|
1294
|
-
redoMutations: [{ id:
|
|
1288
|
+
zoomRatio: i,
|
|
1289
|
+
unitId: o
|
|
1290
|
+
}, d = Xt(r, c);
|
|
1291
|
+
return t.syncExecuteCommand(Q.id, c) ? (n.pushUndoRedo({
|
|
1292
|
+
unitID: o,
|
|
1293
|
+
undoMutations: [{ id: Q.id, params: d }],
|
|
1294
|
+
redoMutations: [{ id: Q.id, params: c }]
|
|
1295
1295
|
}), !0) : !1;
|
|
1296
1296
|
}
|
|
1297
|
-
},
|
|
1297
|
+
}, Wt = {
|
|
1298
1298
|
id: "doc.operation.select-all",
|
|
1299
1299
|
type: v.COMMAND,
|
|
1300
|
-
handler: async (
|
|
1301
|
-
const e =
|
|
1300
|
+
handler: async (r) => {
|
|
1301
|
+
const e = r.get(T), t = r.get(A), n = e.getCurrentUniverDocInstance().getSnapshot().body;
|
|
1302
1302
|
if (n == null)
|
|
1303
1303
|
return !1;
|
|
1304
1304
|
const s = [
|
|
@@ -1310,20 +1310,20 @@ const be = {
|
|
|
1310
1310
|
return t.replaceTextRanges(s, !1), !0;
|
|
1311
1311
|
}
|
|
1312
1312
|
};
|
|
1313
|
-
var
|
|
1314
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1315
|
-
(
|
|
1316
|
-
return n && s &&
|
|
1317
|
-
},
|
|
1318
|
-
let
|
|
1319
|
-
constructor(e, t, n, s,
|
|
1313
|
+
var Zt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Jt = (r, e, t, n) => {
|
|
1314
|
+
for (var s = n > 1 ? void 0 : n ? qt(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
1315
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1316
|
+
return n && s && Zt(e, t, s), s;
|
|
1317
|
+
}, H = (r, e) => (t, n) => e(t, n, r);
|
|
1318
|
+
let ee = class extends de {
|
|
1319
|
+
constructor(e, t, n, s, o) {
|
|
1320
1320
|
super();
|
|
1321
1321
|
M(this, "_previousIMEContent", "");
|
|
1322
1322
|
M(this, "_isCompositionStart", !0);
|
|
1323
1323
|
M(this, "_onStartSubscription");
|
|
1324
1324
|
M(this, "_onUpdateSubscription");
|
|
1325
1325
|
M(this, "_onEndSubscription");
|
|
1326
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = s, this._commandService =
|
|
1326
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = s, this._commandService = o, this._initialize();
|
|
1327
1327
|
}
|
|
1328
1328
|
dispose() {
|
|
1329
1329
|
var e, t, n;
|
|
@@ -1337,7 +1337,7 @@ let ie = class extends ne {
|
|
|
1337
1337
|
if (e == null)
|
|
1338
1338
|
return;
|
|
1339
1339
|
const { activeRange: t } = e;
|
|
1340
|
-
t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(
|
|
1340
|
+
t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(Y.deepClone(t)), this._isCompositionStart = !0);
|
|
1341
1341
|
});
|
|
1342
1342
|
}
|
|
1343
1343
|
_initialOnCompositionUpdate() {
|
|
@@ -1355,11 +1355,11 @@ let ie = class extends ne {
|
|
|
1355
1355
|
const n = (d = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : d.skeleton;
|
|
1356
1356
|
if (e == null || n == null)
|
|
1357
1357
|
return;
|
|
1358
|
-
const s = this._currentUniverService.getCurrentUniverDocInstance(), { event:
|
|
1359
|
-
if (n == null ||
|
|
1358
|
+
const s = this._currentUniverService.getCurrentUniverDocInstance(), { event: o, activeRange: i } = e;
|
|
1359
|
+
if (n == null || i == null)
|
|
1360
1360
|
return;
|
|
1361
|
-
const c =
|
|
1362
|
-
c === this._previousIMEContent && t || (await this._commandService.executeCommand(
|
|
1361
|
+
const c = o.data;
|
|
1362
|
+
c === this._previousIMEContent && t || (await this._commandService.executeCommand(Je.id, {
|
|
1363
1363
|
unitId: s.getUnitId(),
|
|
1364
1364
|
newText: c,
|
|
1365
1365
|
oldTextLen: this._previousIMEContent.length,
|
|
@@ -1371,66 +1371,66 @@ let ie = class extends ne {
|
|
|
1371
1371
|
this._previousIMEContent = "", this._isCompositionStart = !0, this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(null);
|
|
1372
1372
|
}
|
|
1373
1373
|
};
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
],
|
|
1382
|
-
var
|
|
1383
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1384
|
-
(
|
|
1385
|
-
return n && s &&
|
|
1386
|
-
},
|
|
1387
|
-
let
|
|
1388
|
-
constructor(
|
|
1389
|
-
super(), this._textSelectionManagerService =
|
|
1374
|
+
ee = Jt([
|
|
1375
|
+
ce(le.Rendered, ee),
|
|
1376
|
+
H(0, w(k)),
|
|
1377
|
+
H(1, T),
|
|
1378
|
+
H(2, ue),
|
|
1379
|
+
H(3, w(me)),
|
|
1380
|
+
H(4, y)
|
|
1381
|
+
], ee);
|
|
1382
|
+
var Kt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, en = (r, e, t, n) => {
|
|
1383
|
+
for (var s = n > 1 ? void 0 : n ? Qt(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
1384
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1385
|
+
return n && s && Kt(e, t, s), s;
|
|
1386
|
+
}, Fe = (r, e) => (t, n) => e(t, n, r);
|
|
1387
|
+
let te = class extends de {
|
|
1388
|
+
constructor(r, e) {
|
|
1389
|
+
super(), this._textSelectionManagerService = r, this._commandService = e, this._commandExecutedListener();
|
|
1390
1390
|
}
|
|
1391
1391
|
_commandExecutedListener() {
|
|
1392
|
-
const
|
|
1392
|
+
const r = [
|
|
1393
|
+
he.id,
|
|
1394
|
+
pe.id,
|
|
1393
1395
|
Se.id,
|
|
1396
|
+
_e.id,
|
|
1397
|
+
j.id,
|
|
1394
1398
|
ve.id,
|
|
1395
|
-
Me.id,
|
|
1396
1399
|
Ie.id,
|
|
1397
|
-
|
|
1398
|
-
Ce.id
|
|
1399
|
-
Re.id,
|
|
1400
|
-
xe.id,
|
|
1401
|
-
Oe.id
|
|
1400
|
+
Me.id,
|
|
1401
|
+
Ce.id
|
|
1402
1402
|
];
|
|
1403
1403
|
this.disposeWithMe(
|
|
1404
1404
|
this._commandService.onCommandExecuted((e) => {
|
|
1405
|
-
|
|
1405
|
+
r.includes(e.id) && this._handleInlineFormat(e);
|
|
1406
1406
|
})
|
|
1407
1407
|
);
|
|
1408
1408
|
}
|
|
1409
|
-
_handleInlineFormat(
|
|
1409
|
+
_handleInlineFormat(r) {
|
|
1410
1410
|
var t, n;
|
|
1411
1411
|
const { segmentId: e } = (t = this._textSelectionManagerService.getActiveRange()) != null ? t : {};
|
|
1412
|
-
e != null && this._commandService.executeCommand(
|
|
1412
|
+
e != null && this._commandService.executeCommand(Qe.id, {
|
|
1413
1413
|
segmentId: e,
|
|
1414
|
-
preCommandId:
|
|
1415
|
-
...(n =
|
|
1414
|
+
preCommandId: r.id,
|
|
1415
|
+
...(n = r.params) != null ? n : {}
|
|
1416
1416
|
});
|
|
1417
1417
|
}
|
|
1418
1418
|
};
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
],
|
|
1424
|
-
var
|
|
1425
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1426
|
-
(
|
|
1427
|
-
return n && s &&
|
|
1428
|
-
},
|
|
1429
|
-
let
|
|
1430
|
-
constructor(e, t, n, s,
|
|
1419
|
+
te = en([
|
|
1420
|
+
ce(le.Rendered, te),
|
|
1421
|
+
Fe(0, w(A)),
|
|
1422
|
+
Fe(1, y)
|
|
1423
|
+
], te);
|
|
1424
|
+
var tn = Object.defineProperty, nn = Object.getOwnPropertyDescriptor, sn = (r, e, t, n) => {
|
|
1425
|
+
for (var s = n > 1 ? void 0 : n ? nn(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
1426
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1427
|
+
return n && s && tn(e, t, s), s;
|
|
1428
|
+
}, G = (r, e) => (t, n) => e(t, n, r);
|
|
1429
|
+
let ne = class extends de {
|
|
1430
|
+
constructor(e, t, n, s, o) {
|
|
1431
1431
|
super();
|
|
1432
1432
|
M(this, "_onInputSubscription");
|
|
1433
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = s, this._commandService =
|
|
1433
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = s, this._commandService = o, this._initialize(), this._commandExecutedListener();
|
|
1434
1434
|
}
|
|
1435
1435
|
dispose() {
|
|
1436
1436
|
var e;
|
|
@@ -1439,16 +1439,16 @@ let ae = class extends ne {
|
|
|
1439
1439
|
_initialize() {
|
|
1440
1440
|
}
|
|
1441
1441
|
_commandExecutedListener() {
|
|
1442
|
-
const e = [
|
|
1442
|
+
const e = [Te.id, Ee.id];
|
|
1443
1443
|
this.disposeWithMe(
|
|
1444
1444
|
this._commandService.onCommandExecuted((t) => {
|
|
1445
1445
|
if (!e.includes(t.id))
|
|
1446
1446
|
return;
|
|
1447
1447
|
const n = t.params;
|
|
1448
1448
|
switch (t.id) {
|
|
1449
|
-
case
|
|
1449
|
+
case Te.id:
|
|
1450
1450
|
return this._handleMoveCursor(n.direction);
|
|
1451
|
-
case
|
|
1451
|
+
case Ee.id:
|
|
1452
1452
|
return this._handleShiftMoveSelection(n.direction);
|
|
1453
1453
|
default:
|
|
1454
1454
|
throw new Error("Unknown command");
|
|
@@ -1457,9 +1457,9 @@ let ae = class extends ne {
|
|
|
1457
1457
|
);
|
|
1458
1458
|
}
|
|
1459
1459
|
_handleShiftMoveSelection(e) {
|
|
1460
|
-
var
|
|
1461
|
-
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(),
|
|
1462
|
-
if (t == null ||
|
|
1460
|
+
var h, f, _;
|
|
1461
|
+
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(), o = (h = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, i = this._getDocObject();
|
|
1462
|
+
if (t == null || o == null || i == null)
|
|
1463
1463
|
return;
|
|
1464
1464
|
const { startOffset: a, endOffset: c, style: d, collapsed: l, direction: u } = t;
|
|
1465
1465
|
if (n.length > 1) {
|
|
@@ -1468,47 +1468,47 @@ let ae = class extends ne {
|
|
|
1468
1468
|
p = Math.min(p, x.startOffset), C = Math.max(C, x.endOffset);
|
|
1469
1469
|
this._textSelectionManagerService.replaceTextRanges([
|
|
1470
1470
|
{
|
|
1471
|
-
startOffset: e ===
|
|
1472
|
-
endOffset: e ===
|
|
1471
|
+
startOffset: e === b.LEFT || e === b.UP ? C : p,
|
|
1472
|
+
endOffset: e === b.LEFT || e === b.UP ? p : C,
|
|
1473
1473
|
style: d
|
|
1474
1474
|
}
|
|
1475
1475
|
], !1);
|
|
1476
1476
|
return;
|
|
1477
1477
|
}
|
|
1478
|
-
const
|
|
1479
|
-
let g = l || u ===
|
|
1480
|
-
const
|
|
1481
|
-
if (e ===
|
|
1482
|
-
const p =
|
|
1483
|
-
g = e ===
|
|
1478
|
+
const m = l || u === we.FORWARD ? a : c;
|
|
1479
|
+
let g = l || u === we.FORWARD ? c : a;
|
|
1480
|
+
const S = (f = s.getBody().dataStream.length) != null ? f : Number.POSITIVE_INFINITY;
|
|
1481
|
+
if (e === b.LEFT || e === b.RIGHT) {
|
|
1482
|
+
const p = o.findNodeByCharIndex(g - 1), C = o.findNodeByCharIndex(g);
|
|
1483
|
+
g = e === b.RIGHT ? g + C.count : g - ((_ = p == null ? void 0 : p.count) != null ? _ : 0), g = Math.min(S - 2, Math.max(0, g)), this._textSelectionManagerService.replaceTextRanges([
|
|
1484
1484
|
{
|
|
1485
|
-
startOffset:
|
|
1485
|
+
startOffset: m,
|
|
1486
1486
|
endOffset: g,
|
|
1487
1487
|
style: d
|
|
1488
1488
|
}
|
|
1489
1489
|
], !1);
|
|
1490
1490
|
} else {
|
|
1491
|
-
const p =
|
|
1491
|
+
const p = o.findNodeByCharIndex(g), C = i.document.getOffsetConfig(), x = this._getTopOrBottomPosition(o, p, e === b.DOWN);
|
|
1492
1492
|
if (x == null) {
|
|
1493
|
-
const N = e ===
|
|
1493
|
+
const N = e === b.UP ? 0 : S - 2;
|
|
1494
1494
|
if (N === g)
|
|
1495
1495
|
return;
|
|
1496
1496
|
this._textSelectionManagerService.replaceTextRanges([
|
|
1497
1497
|
{
|
|
1498
|
-
startOffset:
|
|
1498
|
+
startOffset: m,
|
|
1499
1499
|
endOffset: N,
|
|
1500
1500
|
style: d
|
|
1501
1501
|
}
|
|
1502
1502
|
], !1);
|
|
1503
1503
|
return;
|
|
1504
1504
|
}
|
|
1505
|
-
const O = new
|
|
1505
|
+
const O = new Le(C, o).getRangePointData(
|
|
1506
1506
|
x,
|
|
1507
1507
|
x
|
|
1508
1508
|
).cursorList[0];
|
|
1509
1509
|
this._textSelectionManagerService.replaceTextRanges([
|
|
1510
1510
|
{
|
|
1511
|
-
startOffset:
|
|
1511
|
+
startOffset: m,
|
|
1512
1512
|
endOffset: O.endOffset,
|
|
1513
1513
|
style: d
|
|
1514
1514
|
}
|
|
@@ -1516,38 +1516,38 @@ let ae = class extends ne {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
1518
1518
|
_handleMoveCursor(e) {
|
|
1519
|
-
var
|
|
1520
|
-
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(),
|
|
1521
|
-
if (t == null ||
|
|
1519
|
+
var m, g, S;
|
|
1520
|
+
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), s = this._currentUniverService.getCurrentUniverDocInstance(), o = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, i = this._getDocObject();
|
|
1521
|
+
if (t == null || o == null || i == null || n == null)
|
|
1522
1522
|
return;
|
|
1523
1523
|
const { startOffset: a, endOffset: c, style: d, collapsed: l } = t, u = (g = s.getBody().dataStream.length) != null ? g : Number.POSITIVE_INFINITY;
|
|
1524
|
-
if (e ===
|
|
1525
|
-
let
|
|
1524
|
+
if (e === b.LEFT || e === b.RIGHT) {
|
|
1525
|
+
let h;
|
|
1526
1526
|
if (!t.collapsed || n.length > 1) {
|
|
1527
|
-
let
|
|
1527
|
+
let f = Number.POSITIVE_INFINITY, _ = Number.NEGATIVE_INFINITY;
|
|
1528
1528
|
for (const p of n)
|
|
1529
|
-
|
|
1530
|
-
|
|
1529
|
+
f = Math.min(f, p.startOffset), _ = Math.max(_, p.endOffset);
|
|
1530
|
+
h = e === b.LEFT ? f : _;
|
|
1531
1531
|
} else {
|
|
1532
|
-
const
|
|
1533
|
-
e ===
|
|
1532
|
+
const f = o.findNodeByCharIndex(a - 1), _ = o.findNodeByCharIndex(a);
|
|
1533
|
+
e === b.LEFT ? h = Math.max(0, a - ((S = f == null ? void 0 : f.count) != null ? S : 0)) : h = Math.min(u - 2, c + _.count);
|
|
1534
1534
|
}
|
|
1535
1535
|
this._textSelectionManagerService.replaceTextRanges([
|
|
1536
1536
|
{
|
|
1537
|
-
startOffset:
|
|
1538
|
-
endOffset:
|
|
1537
|
+
startOffset: h,
|
|
1538
|
+
endOffset: h,
|
|
1539
1539
|
style: d
|
|
1540
1540
|
}
|
|
1541
1541
|
], !1);
|
|
1542
1542
|
} else {
|
|
1543
|
-
const
|
|
1544
|
-
|
|
1545
|
-
e ===
|
|
1546
|
-
e ===
|
|
1543
|
+
const h = o.findNodeByCharIndex(a), f = o.findNodeByCharIndex(c), _ = i.document.getOffsetConfig(), p = this._getTopOrBottomPosition(
|
|
1544
|
+
o,
|
|
1545
|
+
e === b.UP ? h : f,
|
|
1546
|
+
e === b.DOWN
|
|
1547
1547
|
);
|
|
1548
1548
|
if (p == null) {
|
|
1549
1549
|
let x;
|
|
1550
|
-
l ? x = e ===
|
|
1550
|
+
l ? x = e === b.UP ? 0 : u - 2 : x = e === b.UP ? a : c, this._textSelectionManagerService.replaceTextRanges([
|
|
1551
1551
|
{
|
|
1552
1552
|
startOffset: x,
|
|
1553
1553
|
endOffset: x,
|
|
@@ -1556,7 +1556,7 @@ let ae = class extends ne {
|
|
|
1556
1556
|
], !1);
|
|
1557
1557
|
return;
|
|
1558
1558
|
}
|
|
1559
|
-
const C = new
|
|
1559
|
+
const C = new Le(_, o).getRangePointData(
|
|
1560
1560
|
p,
|
|
1561
1561
|
p
|
|
1562
1562
|
).cursorList[0];
|
|
@@ -1571,12 +1571,12 @@ let ae = class extends ne {
|
|
|
1571
1571
|
_getTopOrBottomPosition(e, t, n) {
|
|
1572
1572
|
if (t == null)
|
|
1573
1573
|
return;
|
|
1574
|
-
const s = this._getSpanLeftOffsetInLine(t),
|
|
1575
|
-
if (
|
|
1574
|
+
const s = this._getSpanLeftOffsetInLine(t), o = this._getNextOrPrevLine(t, n);
|
|
1575
|
+
if (o == null)
|
|
1576
1576
|
return;
|
|
1577
|
-
const
|
|
1578
|
-
if (
|
|
1579
|
-
return { ...
|
|
1577
|
+
const i = this._matchPositionByLeftOffset(e, o, s);
|
|
1578
|
+
if (i != null)
|
|
1579
|
+
return { ...i, isBack: !0 };
|
|
1580
1580
|
}
|
|
1581
1581
|
_getSpanLeftOffsetInLine(e) {
|
|
1582
1582
|
const t = e.parent;
|
|
@@ -1589,10 +1589,10 @@ let ae = class extends ne {
|
|
|
1589
1589
|
const s = {
|
|
1590
1590
|
distance: Number.POSITIVE_INFINITY
|
|
1591
1591
|
};
|
|
1592
|
-
for (const
|
|
1593
|
-
const
|
|
1594
|
-
for (const a of
|
|
1595
|
-
const { left: c } = a, d =
|
|
1592
|
+
for (const o of t.divides) {
|
|
1593
|
+
const i = o.left;
|
|
1594
|
+
for (const a of o.spanGroup) {
|
|
1595
|
+
const { left: c } = a, d = i + c, l = Math.abs(n - d);
|
|
1596
1596
|
l < s.distance && (s.span = a, s.distance = l);
|
|
1597
1597
|
}
|
|
1598
1598
|
}
|
|
@@ -1600,32 +1600,32 @@ let ae = class extends ne {
|
|
|
1600
1600
|
return e.findPositionBySpan(s.span);
|
|
1601
1601
|
}
|
|
1602
1602
|
_getNextOrPrevLine(e, t) {
|
|
1603
|
-
var
|
|
1603
|
+
var S, h, f, _, p, C, x, O, N, P, E, D;
|
|
1604
1604
|
const n = e.parent;
|
|
1605
1605
|
if (n == null)
|
|
1606
1606
|
return;
|
|
1607
1607
|
const s = n.parent;
|
|
1608
1608
|
if (s == null)
|
|
1609
1609
|
return;
|
|
1610
|
-
const
|
|
1611
|
-
if (
|
|
1610
|
+
const o = s.parent;
|
|
1611
|
+
if (o == null)
|
|
1612
1612
|
return;
|
|
1613
|
-
const
|
|
1614
|
-
if (
|
|
1613
|
+
const i = o.lines.indexOf(s);
|
|
1614
|
+
if (i === -1)
|
|
1615
1615
|
return;
|
|
1616
1616
|
let a;
|
|
1617
|
-
if (t === !0 ? a =
|
|
1617
|
+
if (t === !0 ? a = o.lines[i + 1] : a = o.lines[i - 1], a != null)
|
|
1618
1618
|
return a;
|
|
1619
|
-
const c =
|
|
1619
|
+
const c = o.parent;
|
|
1620
1620
|
if (c == null)
|
|
1621
1621
|
return;
|
|
1622
|
-
const d = c.columns.indexOf(
|
|
1622
|
+
const d = c.columns.indexOf(o);
|
|
1623
1623
|
if (d === -1)
|
|
1624
1624
|
return;
|
|
1625
1625
|
if (t === !0)
|
|
1626
|
-
a = (
|
|
1626
|
+
a = (S = c.columns[d + 1]) == null ? void 0 : S.lines[0];
|
|
1627
1627
|
else {
|
|
1628
|
-
const I = (
|
|
1628
|
+
const I = (f = (h = c.columns) == null ? void 0 : h[d - 1]) == null ? void 0 : f.lines;
|
|
1629
1629
|
a = I == null ? void 0 : I[I.length - 1];
|
|
1630
1630
|
}
|
|
1631
1631
|
if (a != null)
|
|
@@ -1637,53 +1637,53 @@ let ae = class extends ne {
|
|
|
1637
1637
|
if (u === -1)
|
|
1638
1638
|
return;
|
|
1639
1639
|
if (t === !0)
|
|
1640
|
-
a = (p = (
|
|
1640
|
+
a = (p = (_ = l.sections[u - 1]) == null ? void 0 : _.columns[0]) == null ? void 0 : p.lines[0];
|
|
1641
1641
|
else {
|
|
1642
|
-
const I = (x = (C = l.sections) == null ? void 0 : C[u - 1]) == null ? void 0 : x.columns,
|
|
1643
|
-
a =
|
|
1642
|
+
const I = (x = (C = l.sections) == null ? void 0 : C[u - 1]) == null ? void 0 : x.columns, $ = I == null ? void 0 : I[I.length - 1], B = $ == null ? void 0 : $.lines;
|
|
1643
|
+
a = B == null ? void 0 : B[B.length - 1];
|
|
1644
1644
|
}
|
|
1645
1645
|
if (a != null)
|
|
1646
1646
|
return a;
|
|
1647
|
-
const
|
|
1648
|
-
if (
|
|
1647
|
+
const m = l.parent;
|
|
1648
|
+
if (m == null)
|
|
1649
1649
|
return;
|
|
1650
|
-
const g =
|
|
1650
|
+
const g = m.pages.indexOf(l);
|
|
1651
1651
|
if (g !== -1) {
|
|
1652
1652
|
if (t === !0)
|
|
1653
|
-
a = (
|
|
1653
|
+
a = (P = (N = (O = m.pages[g + 1]) == null ? void 0 : O.sections[0]) == null ? void 0 : N.columns[0]) == null ? void 0 : P.lines[0];
|
|
1654
1654
|
else {
|
|
1655
|
-
const I = (E =
|
|
1655
|
+
const I = (E = m.pages[g - 1]) == null ? void 0 : E.sections;
|
|
1656
1656
|
if (I == null)
|
|
1657
1657
|
return;
|
|
1658
|
-
const
|
|
1659
|
-
a =
|
|
1658
|
+
const $ = (D = I[I.length - 1]) == null ? void 0 : D.columns, B = $[$.length - 1], Ae = B == null ? void 0 : B.lines;
|
|
1659
|
+
a = Ae[Ae.length - 1];
|
|
1660
1660
|
}
|
|
1661
1661
|
if (a != null)
|
|
1662
1662
|
return a;
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
1665
1665
|
_getDocObject() {
|
|
1666
|
-
return
|
|
1666
|
+
return Xe(this._currentUniverService, this._renderManagerService);
|
|
1667
1667
|
}
|
|
1668
1668
|
};
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
],
|
|
1677
|
-
var
|
|
1678
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1679
|
-
(
|
|
1680
|
-
return n && s &&
|
|
1681
|
-
},
|
|
1682
|
-
let
|
|
1683
|
-
constructor(e, t, n, s,
|
|
1669
|
+
ne = sn([
|
|
1670
|
+
ce(le.Rendered, ne),
|
|
1671
|
+
G(0, w(k)),
|
|
1672
|
+
G(1, T),
|
|
1673
|
+
G(2, Ge),
|
|
1674
|
+
G(3, w(A)),
|
|
1675
|
+
G(4, y)
|
|
1676
|
+
], ne);
|
|
1677
|
+
var rn = Object.defineProperty, on = Object.getOwnPropertyDescriptor, an = (r, e, t, n) => {
|
|
1678
|
+
for (var s = n > 1 ? void 0 : n ? on(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
1679
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1680
|
+
return n && s && rn(e, t, s), s;
|
|
1681
|
+
}, X = (r, e) => (t, n) => e(t, n, r);
|
|
1682
|
+
let se = class extends de {
|
|
1683
|
+
constructor(e, t, n, s, o) {
|
|
1684
1684
|
super();
|
|
1685
1685
|
M(this, "_onInputSubscription");
|
|
1686
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = s, this._commandService =
|
|
1686
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = s, this._commandService = o, this._initialize(), this._commandExecutedListener();
|
|
1687
1687
|
}
|
|
1688
1688
|
dispose() {
|
|
1689
1689
|
var e;
|
|
@@ -1694,25 +1694,25 @@ let ce = class extends ne {
|
|
|
1694
1694
|
}
|
|
1695
1695
|
_initialNormalInput() {
|
|
1696
1696
|
this._onInputSubscription = this._textSelectionRenderManager.onInput$.subscribe(async (e) => {
|
|
1697
|
-
var
|
|
1697
|
+
var S;
|
|
1698
1698
|
if (e == null)
|
|
1699
1699
|
return;
|
|
1700
|
-
const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: s, content:
|
|
1701
|
-
if (a.data == null || c == null || !c || !
|
|
1700
|
+
const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: s, content: o = "", activeRange: i } = e, a = s, c = (S = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : S.skeleton;
|
|
1701
|
+
if (a.data == null || c == null || !c || !i)
|
|
1702
1702
|
return;
|
|
1703
|
-
const { startOffset: d, segmentId: l, style: u } =
|
|
1703
|
+
const { startOffset: d, segmentId: l, style: u } = i, m = o.length, g = [
|
|
1704
1704
|
{
|
|
1705
|
-
startOffset: d +
|
|
1706
|
-
endOffset: d +
|
|
1705
|
+
startOffset: d + m,
|
|
1706
|
+
endOffset: d + m,
|
|
1707
1707
|
style: u
|
|
1708
1708
|
}
|
|
1709
1709
|
];
|
|
1710
|
-
await this._commandService.executeCommand(
|
|
1710
|
+
await this._commandService.executeCommand(ge.id, {
|
|
1711
1711
|
unitId: n,
|
|
1712
1712
|
body: {
|
|
1713
|
-
dataStream:
|
|
1713
|
+
dataStream: o
|
|
1714
1714
|
},
|
|
1715
|
-
range:
|
|
1715
|
+
range: i,
|
|
1716
1716
|
textRanges: g,
|
|
1717
1717
|
segmentId: l
|
|
1718
1718
|
});
|
|
@@ -1721,175 +1721,66 @@ let ce = class extends ne {
|
|
|
1721
1721
|
_commandExecutedListener() {
|
|
1722
1722
|
}
|
|
1723
1723
|
_getDocObject() {
|
|
1724
|
-
return
|
|
1724
|
+
return Xe(this._currentUniverService, this._renderManagerService);
|
|
1725
1725
|
}
|
|
1726
1726
|
};
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
],
|
|
1735
|
-
var
|
|
1736
|
-
for (var s = n > 1 ? void 0 : n ?
|
|
1737
|
-
(
|
|
1738
|
-
return n && s &&
|
|
1739
|
-
},
|
|
1740
|
-
|
|
1741
|
-
constructor(e, t, n, s, r, o) {
|
|
1742
|
-
super();
|
|
1743
|
-
M(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
1744
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = s, this._textSelectionRenderManager = r, this._textSelectionManagerService = o, this._initialize();
|
|
1745
|
-
}
|
|
1746
|
-
_initialize() {
|
|
1747
|
-
this._init(), this._skeletonListener(), this._commandExecutedListener();
|
|
1748
|
-
}
|
|
1749
|
-
_init() {
|
|
1750
|
-
this.disposeWithMe(
|
|
1751
|
-
this._renderManagerService.currentRender$.subscribe((e) => {
|
|
1752
|
-
this._create(e);
|
|
1753
|
-
})
|
|
1754
|
-
), this._renderManagerService.getRenderAll().forEach((e, t) => {
|
|
1755
|
-
this._create(t);
|
|
1756
|
-
});
|
|
1757
|
-
}
|
|
1758
|
-
_create(e) {
|
|
1759
|
-
if (e == null || this._currentUniverService.getUniverDocInstance(e) == null)
|
|
1760
|
-
return;
|
|
1761
|
-
const t = this._getDocObjectById(e);
|
|
1762
|
-
t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
|
|
1763
|
-
}
|
|
1764
|
-
_initialMain(e) {
|
|
1765
|
-
const t = this._getDocObjectById(e);
|
|
1766
|
-
if (t == null)
|
|
1767
|
-
return;
|
|
1768
|
-
const { document: n, scene: s } = t;
|
|
1769
|
-
this.disposeWithMe(
|
|
1770
|
-
G(
|
|
1771
|
-
n.onPointerEnterObserver.add(() => {
|
|
1772
|
-
n.cursor = Ve.TEXT;
|
|
1773
|
-
})
|
|
1774
|
-
)
|
|
1775
|
-
), this.disposeWithMe(
|
|
1776
|
-
G(
|
|
1777
|
-
n.onPointerLeaveObserver.add(() => {
|
|
1778
|
-
n.cursor = Ve.DEFAULT, s.resetCursor();
|
|
1779
|
-
})
|
|
1780
|
-
)
|
|
1781
|
-
), this.disposeWithMe(
|
|
1782
|
-
G(
|
|
1783
|
-
n == null ? void 0 : n.onPointerDownObserver.add((r, o) => {
|
|
1784
|
-
this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(r), r.button !== 2 && o.stopPropagation();
|
|
1785
|
-
})
|
|
1786
|
-
)
|
|
1787
|
-
), this.disposeWithMe(
|
|
1788
|
-
G(
|
|
1789
|
-
n == null ? void 0 : n.onDblclickObserver.add((r) => {
|
|
1790
|
-
this._textSelectionRenderManager.handleDblClick(r);
|
|
1791
|
-
})
|
|
1792
|
-
)
|
|
1793
|
-
), this.disposeWithMe(
|
|
1794
|
-
G(
|
|
1795
|
-
n == null ? void 0 : n.onTripleClickObserver.add((r) => {
|
|
1796
|
-
this._textSelectionRenderManager.handleTripleClick(r);
|
|
1797
|
-
})
|
|
1798
|
-
)
|
|
1799
|
-
);
|
|
1800
|
-
}
|
|
1801
|
-
_commandExecutedListener() {
|
|
1802
|
-
const e = [Z.id];
|
|
1803
|
-
this.disposeWithMe(
|
|
1804
|
-
this._commandService.onCommandExecuted((t) => {
|
|
1805
|
-
var n;
|
|
1806
|
-
if (e.includes(t.id)) {
|
|
1807
|
-
const s = t.params, { unitId: r } = s, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
|
|
1808
|
-
if (r !== o)
|
|
1809
|
-
return;
|
|
1810
|
-
this._textSelectionManagerService.refreshSelection();
|
|
1811
|
-
}
|
|
1812
|
-
})
|
|
1813
|
-
);
|
|
1814
|
-
}
|
|
1815
|
-
_skeletonListener() {
|
|
1816
|
-
this.disposeWithMe(
|
|
1817
|
-
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1818
|
-
if (e == null)
|
|
1819
|
-
return;
|
|
1820
|
-
const { unitId: t, skeleton: n } = e, s = this._renderManagerService.getRenderById(t);
|
|
1821
|
-
if (s == null)
|
|
1822
|
-
return;
|
|
1823
|
-
const { scene: r, mainComponent: o } = s;
|
|
1824
|
-
this._textSelectionRenderManager.changeRuntime(n, r, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
1825
|
-
unitId: t,
|
|
1826
|
-
subUnitId: ""
|
|
1827
|
-
});
|
|
1828
|
-
})
|
|
1829
|
-
);
|
|
1830
|
-
}
|
|
1831
|
-
_getDocObjectById(e) {
|
|
1832
|
-
return It(e, this._renderManagerService);
|
|
1833
|
-
}
|
|
1834
|
-
};
|
|
1835
|
-
le = fn([
|
|
1836
|
-
ee(te.Rendered, le),
|
|
1837
|
-
k(0, w(B)),
|
|
1838
|
-
k(1, T),
|
|
1839
|
-
k(2, y),
|
|
1840
|
-
k(3, Ue),
|
|
1841
|
-
k(4, se),
|
|
1842
|
-
k(5, w(U))
|
|
1843
|
-
], le);
|
|
1844
|
-
var pn = Object.defineProperty, _n = Object.getOwnPropertyDescriptor, Sn = (i, e, t, n) => {
|
|
1845
|
-
for (var s = n > 1 ? void 0 : n ? _n(e, t) : e, r = i.length - 1, o; r >= 0; r--)
|
|
1846
|
-
(o = i[r]) && (s = (n ? o(e, t, s) : o(s)) || s);
|
|
1847
|
-
return n && s && pn(e, t, s), s;
|
|
1848
|
-
}, re = (i, e) => (t, n) => e(t, n, i);
|
|
1849
|
-
const vn = {
|
|
1727
|
+
se = an([
|
|
1728
|
+
ce(le.Rendered, se),
|
|
1729
|
+
X(0, w(k)),
|
|
1730
|
+
X(1, T),
|
|
1731
|
+
X(2, Ge),
|
|
1732
|
+
X(3, ue),
|
|
1733
|
+
X(4, y)
|
|
1734
|
+
], se);
|
|
1735
|
+
var cn = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, dn = (r, e, t, n) => {
|
|
1736
|
+
for (var s = n > 1 ? void 0 : n ? ln(e, t) : e, o = r.length - 1, i; o >= 0; o--)
|
|
1737
|
+
(i = r[o]) && (s = (n ? i(e, t, s) : i(s)) || s);
|
|
1738
|
+
return n && s && cn(e, t, s), s;
|
|
1739
|
+
}, K = (r, e) => (t, n) => e(t, n, r);
|
|
1740
|
+
const un = {
|
|
1850
1741
|
hasScroll: !0
|
|
1851
|
-
},
|
|
1852
|
-
var
|
|
1853
|
-
let
|
|
1854
|
-
constructor(e = {}, t, n, s,
|
|
1855
|
-
super(
|
|
1742
|
+
}, mn = "docs";
|
|
1743
|
+
var Oe;
|
|
1744
|
+
let ze = (Oe = class extends ot {
|
|
1745
|
+
constructor(e = {}, t, n, s, o) {
|
|
1746
|
+
super(mn);
|
|
1856
1747
|
M(this, "_config");
|
|
1857
|
-
this._injector = t, this._localeService = n, this._configService = s, this._currentUniverService =
|
|
1748
|
+
this._injector = t, this._localeService = n, this._configService = s, this._currentUniverService = o, this._config = Object.assign(un, e), this._initializeDependencies(t), this._initializeCommands();
|
|
1858
1749
|
}
|
|
1859
1750
|
initialize() {
|
|
1860
1751
|
}
|
|
1861
1752
|
_initializeCommands() {
|
|
1862
1753
|
[
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1754
|
+
Te,
|
|
1755
|
+
Ee,
|
|
1756
|
+
Lt,
|
|
1757
|
+
Bt,
|
|
1758
|
+
he,
|
|
1759
|
+
pe,
|
|
1867
1760
|
Se,
|
|
1761
|
+
_e,
|
|
1762
|
+
j,
|
|
1868
1763
|
ve,
|
|
1869
|
-
Me,
|
|
1870
1764
|
Ie,
|
|
1871
|
-
|
|
1765
|
+
Me,
|
|
1872
1766
|
Ce,
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
pe,
|
|
1879
|
-
_e,
|
|
1880
|
-
Ke,
|
|
1881
|
-
tt,
|
|
1882
|
-
Ne,
|
|
1883
|
-
L,
|
|
1884
|
-
Zt,
|
|
1885
|
-
qt,
|
|
1886
|
-
Kt,
|
|
1887
|
-
Z,
|
|
1767
|
+
Qe,
|
|
1768
|
+
bt,
|
|
1769
|
+
ge,
|
|
1770
|
+
fe,
|
|
1771
|
+
We,
|
|
1888
1772
|
Je,
|
|
1889
|
-
|
|
1890
|
-
|
|
1773
|
+
Pe,
|
|
1774
|
+
L,
|
|
1775
|
+
Ht,
|
|
1776
|
+
Gt,
|
|
1777
|
+
Yt,
|
|
1778
|
+
Q,
|
|
1779
|
+
Ye,
|
|
1891
1780
|
Wt,
|
|
1892
|
-
|
|
1781
|
+
kt,
|
|
1782
|
+
Vt,
|
|
1783
|
+
be
|
|
1893
1784
|
].forEach((e) => {
|
|
1894
1785
|
this._injector.get(y).registerCommand(e);
|
|
1895
1786
|
});
|
|
@@ -1900,75 +1791,75 @@ let Ge = (Ee = class extends lt {
|
|
|
1900
1791
|
_initializeDependencies(e) {
|
|
1901
1792
|
[
|
|
1902
1793
|
// services
|
|
1903
|
-
[
|
|
1904
|
-
[
|
|
1905
|
-
[
|
|
1906
|
-
[
|
|
1794
|
+
[k],
|
|
1795
|
+
[J],
|
|
1796
|
+
[re],
|
|
1797
|
+
[me],
|
|
1907
1798
|
[
|
|
1908
|
-
|
|
1799
|
+
ue,
|
|
1909
1800
|
{
|
|
1910
|
-
useClass:
|
|
1801
|
+
useClass: ht
|
|
1911
1802
|
}
|
|
1912
1803
|
],
|
|
1913
|
-
[
|
|
1804
|
+
[A],
|
|
1914
1805
|
// controllers
|
|
1915
|
-
[
|
|
1916
|
-
[
|
|
1917
|
-
[
|
|
1918
|
-
[
|
|
1919
|
-
[ae]
|
|
1806
|
+
[se],
|
|
1807
|
+
[ee],
|
|
1808
|
+
[te],
|
|
1809
|
+
[ne]
|
|
1920
1810
|
].forEach((t) => e.add(t));
|
|
1921
1811
|
}
|
|
1922
|
-
}, M(
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
],
|
|
1812
|
+
}, M(Oe, "type", it.Doc), Oe);
|
|
1813
|
+
ze = dn([
|
|
1814
|
+
K(1, w(pt)),
|
|
1815
|
+
K(2, w(ke)),
|
|
1816
|
+
K(3, at),
|
|
1817
|
+
K(4, T)
|
|
1818
|
+
], ze);
|
|
1929
1819
|
export {
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1820
|
+
bt as BreakLineCommand,
|
|
1821
|
+
Vt as BulletListCommand,
|
|
1822
|
+
Gt as CoverContentCommand,
|
|
1823
|
+
Ze as CutContentCommand,
|
|
1824
|
+
Mn as DOCS_COMPONENT_DEFAULT_Z_INDEX,
|
|
1825
|
+
In as DOCS_COMPONENT_HEADER_LAYER_INDEX,
|
|
1826
|
+
vn as DOCS_COMPONENT_MAIN_LAYER_INDEX,
|
|
1827
|
+
St as DOCS_VIEW_KEY,
|
|
1828
|
+
fe as DeleteCommand,
|
|
1829
|
+
Lt as DeleteLeftCommand,
|
|
1830
|
+
Bt as DeleteRightCommand,
|
|
1831
|
+
k as DocSkeletonManagerService,
|
|
1832
|
+
re as DocStateChangeManagerService,
|
|
1833
|
+
J as DocViewModelManagerService,
|
|
1834
|
+
Je as IMEInputCommand,
|
|
1835
|
+
me as IMEInputManagerService,
|
|
1836
|
+
Rn as InnerPasteCommand,
|
|
1837
|
+
ge as InsertCommand,
|
|
1838
|
+
Te as MoveCursorOperation,
|
|
1839
|
+
Ee as MoveSelectionOperation,
|
|
1840
|
+
Cn as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
|
|
1841
|
+
kt as OrderListCommand,
|
|
1842
|
+
Ht as ReplaceContentCommand,
|
|
1953
1843
|
L as RichTextEditingMutation,
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1844
|
+
Wt as SelectAllOperation,
|
|
1845
|
+
Yt as SetDocZoomRatioCommand,
|
|
1846
|
+
Q as SetDocZoomRatioOperation,
|
|
1847
|
+
he as SetInlineFormatBoldCommand,
|
|
1848
|
+
Qe as SetInlineFormatCommand,
|
|
1849
|
+
Me as SetInlineFormatFontFamilyCommand,
|
|
1850
|
+
Ie as SetInlineFormatFontSizeCommand,
|
|
1851
|
+
pe as SetInlineFormatItalicCommand,
|
|
1852
|
+
_e as SetInlineFormatStrikethroughCommand,
|
|
1853
|
+
j as SetInlineFormatSubscriptCommand,
|
|
1854
|
+
ve as SetInlineFormatSuperscriptCommand,
|
|
1855
|
+
Ce as SetInlineFormatTextColorCommand,
|
|
1856
|
+
Se as SetInlineFormatUnderlineCommand,
|
|
1857
|
+
Ye as SetTextSelectionsOperation,
|
|
1858
|
+
A as TextSelectionManagerService,
|
|
1859
|
+
ze as UniverDocsPlugin,
|
|
1860
|
+
We as UpdateCommand,
|
|
1861
|
+
_t as VIEWPORT_KEY,
|
|
1862
|
+
Xe as getDocObject,
|
|
1863
|
+
_n as getDocObjectById,
|
|
1864
|
+
q as serializeTextRange
|
|
1974
1865
|
};
|