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