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