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