@univerjs/docs 0.1.0-beta.3 → 0.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -2
- package/lib/es/index.js +1287 -1901
- package/lib/types/basics/retain-delete-params.d.ts +1 -1
- package/lib/types/commands/commands/ime-input.command.d.ts +2 -5
- package/lib/types/commands/commands/list.command.d.ts +4 -4
- package/lib/types/commands/mutations/core-editing.mutation.d.ts +10 -4
- package/lib/types/controllers/ime-input.controller.d.ts +3 -5
- package/lib/types/controllers/text-selection.controller.d.ts +1 -3
- package/lib/types/index.d.ts +5 -2
- package/lib/types/services/doc-skeleton-manager.service.d.ts +1 -1
- package/lib/types/services/doc-state-change-manager.service.d.ts +45 -0
- package/lib/types/services/ime-input-manager.service.d.ts +12 -1
- package/lib/types/services/text-selection-manager.service.d.ts +2 -1
- package/lib/umd/index.js +1 -2
- package/package.json +24 -15
- package/lib/types/commands/commands/clipboard.command.d.ts +0 -19
- package/lib/types/controllers/clipboard.controller.d.ts +0 -33
- package/lib/types/services/clipboard/__test__/html-and-udm-convert.spec.d.ts +0 -16
- package/lib/types/services/clipboard/clipboard.service.d.ts +0 -42
- package/lib/types/services/clipboard/copy-content-cache.d.ts +0 -25
- package/lib/types/services/clipboard/html-to-udm/converter.d.ts +0 -30
- package/lib/types/services/clipboard/html-to-udm/parse-node-style.d.ts +0 -17
- package/lib/types/services/clipboard/html-to-udm/parse-to-dom.d.ts +0 -16
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-lark.d.ts +0 -18
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/plugin-word.d.ts +0 -18
- package/lib/types/services/clipboard/html-to-udm/paste-plugins/type.d.ts +0 -30
- package/lib/types/services/clipboard/html-to-udm/utils.d.ts +0 -18
- package/lib/types/services/clipboard/udm-to-html/convertor.d.ts +0 -19
- package/lib/types/shortcuts/core-editing.shortcut.d.ts +0 -19
- package/lib/types/shortcuts/cursor.shortcut.d.ts +0 -25
package/lib/es/index.js
CHANGED
|
@@ -1,59 +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 {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const n = i.getCurrentUniverDocInstance().getUnitId(), r = e.getRenderById(n);
|
|
1
|
+
var Rt = Object.defineProperty;
|
|
2
|
+
var Ot = (s, e, t) => e in s ? Rt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var v = (s, e, t) => (Ot(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { CommandType as C, RxDisposable as ee, ICommandService as b, TextXActionType as x, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as Y, IUniverInstanceService as y, IUndoRedoService as Re, UndoCommandId as qe, RedoCommandId as Ze, TextX as A, DataStreamTreeTokenType as Fe, Tools as oe, LocaleService as dt, MemoryCursor as Oe, getDocsUpdateBody as xt, UpdateDocsAttributeType as ut, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY as q, BooleanNumber as V, BaselineOffset as k, PresetListType as ht, OnLifecycle as j, LifecycleStages as z, Disposable as W, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as bt, IFloatingObjectManagerService as yt, Direction as U, toDisposable as Ke, IConfigService as gt, Plugin as Tt, PluginType as Dt } from "@univerjs/core";
|
|
5
|
+
import { NORMAL_TEXT_SELECTION_PLUGIN_STYLE as Pt, ITextSelectionRenderManager as ae, DocumentViewModel as Et, DocumentSkeleton as wt, hasListSpan as Ut, isIndentBySpan as Nt, isFirstSpan as At, getParagraphBySpan as Lt, PageLayoutType as Je, IRenderManagerService as X, Liquid as $t, RANGE_DIRECTION as Qe, NodePositionConvertToCursor as et, Rect as Bt, CURSOR_TYPE as tt, Viewport as Ft, EVENT_TYPE as jt, ScrollBar as zt, Layer as nt, Documents as Vt, TextSelectionRenderManager as kt } from "@univerjs/engine-render";
|
|
6
|
+
import { BehaviorSubject as K, takeUntil as ce } from "rxjs";
|
|
7
|
+
import { Inject as E, Injector as Ht } from "@wendellhu/redi";
|
|
8
|
+
function ke(s, e) {
|
|
9
|
+
const n = s.getCurrentUniverDocInstance().getUnitId(), r = e.getRenderById(n);
|
|
11
10
|
if (r == null)
|
|
12
11
|
return;
|
|
13
|
-
const { mainComponent:
|
|
12
|
+
const { mainComponent: i, scene: o, engine: a } = r;
|
|
14
13
|
return {
|
|
15
|
-
document:
|
|
14
|
+
document: i,
|
|
16
15
|
scene: o,
|
|
17
16
|
engine: a
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
function
|
|
21
|
-
const t = e.getRenderById(
|
|
19
|
+
function Wt(s, e) {
|
|
20
|
+
const t = e.getRenderById(s);
|
|
22
21
|
if (t == null)
|
|
23
22
|
return;
|
|
24
|
-
const { mainComponent: n, scene: r, engine:
|
|
23
|
+
const { mainComponent: n, scene: r, engine: i } = t;
|
|
25
24
|
return {
|
|
26
25
|
document: n,
|
|
27
26
|
scene: r,
|
|
28
|
-
engine:
|
|
27
|
+
engine: i
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
|
-
var
|
|
32
|
-
const
|
|
30
|
+
var je = /* @__PURE__ */ ((s) => (s.MAIN = "__Document_Render_Main__", s))(je || {}), He = /* @__PURE__ */ ((s) => (s.VIEW_MAIN = "viewMain", s.VIEW_TOP = "viewTop", s.VIEW_LEFT = "viewLeft", s.VIEW_LEFT_TOP = "viewLeftTop", s))(He || {});
|
|
31
|
+
const rt = 0, Xt = 2, Gt = 10, hr = "normalTextSelectionPluginName", mt = {
|
|
33
32
|
id: "doc.operation.set-selections",
|
|
34
|
-
type:
|
|
35
|
-
handler: (
|
|
33
|
+
type: C.OPERATION,
|
|
34
|
+
handler: (s, e) => !0
|
|
36
35
|
};
|
|
37
|
-
var
|
|
38
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
39
|
-
(o = i
|
|
40
|
-
return n && r &&
|
|
41
|
-
},
|
|
42
|
-
function
|
|
43
|
-
const { startOffset: e, endOffset: t, collapsed: n } =
|
|
36
|
+
var Yt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Zt = (s, e, t, n) => {
|
|
37
|
+
for (var r = n > 1 ? void 0 : n ? qt(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
38
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
39
|
+
return n && r && Yt(e, t, r), r;
|
|
40
|
+
}, it = (s, e) => (t, n) => e(t, n, s);
|
|
41
|
+
function Ie(s) {
|
|
42
|
+
const { startOffset: e, endOffset: t, collapsed: n } = s;
|
|
44
43
|
return {
|
|
45
44
|
startOffset: e,
|
|
46
45
|
endOffset: t,
|
|
47
46
|
collapsed: n
|
|
48
47
|
};
|
|
49
48
|
}
|
|
50
|
-
let
|
|
49
|
+
let w = class extends ee {
|
|
51
50
|
constructor(e, t) {
|
|
52
51
|
super();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
v(this, "_currentSelection", null);
|
|
53
|
+
v(this, "_textSelectionInfo", /* @__PURE__ */ new Map());
|
|
54
|
+
v(this, "_textSelection$", new K(null));
|
|
55
|
+
v(this, "textSelection$", this._textSelection$.asObservable());
|
|
57
56
|
this._textSelectionRenderManager = e, this._commandService = t, this._syncSelectionFromRenderService();
|
|
58
57
|
}
|
|
59
58
|
getCurrentSelection() {
|
|
@@ -84,17 +83,17 @@ let U = class extends me {
|
|
|
84
83
|
const e = this._getTextRanges(this._currentSelection);
|
|
85
84
|
if (e == null)
|
|
86
85
|
return;
|
|
87
|
-
const { textRanges: t, segmentId: n, style: r } = e,
|
|
88
|
-
if (
|
|
86
|
+
const { textRanges: t, segmentId: n, style: r } = e, i = t.find((h) => h.isActive());
|
|
87
|
+
if (i == null)
|
|
89
88
|
return null;
|
|
90
|
-
const { startOffset: o, endOffset: a, collapsed:
|
|
89
|
+
const { startOffset: o, endOffset: a, collapsed: l, startNodePosition: d, endNodePosition: c, direction: u } = i;
|
|
91
90
|
return o == null || a == null ? null : {
|
|
92
91
|
startOffset: o,
|
|
93
92
|
endOffset: a,
|
|
94
|
-
collapsed:
|
|
93
|
+
collapsed: l,
|
|
95
94
|
startNodePosition: d,
|
|
96
|
-
endNodePosition:
|
|
97
|
-
direction:
|
|
95
|
+
endNodePosition: c,
|
|
96
|
+
direction: u,
|
|
98
97
|
segmentId: n,
|
|
99
98
|
style: r
|
|
100
99
|
};
|
|
@@ -105,7 +104,7 @@ let U = class extends me {
|
|
|
105
104
|
...this._currentSelection,
|
|
106
105
|
textRanges: e,
|
|
107
106
|
segmentId: "",
|
|
108
|
-
style:
|
|
107
|
+
style: Pt
|
|
109
108
|
// mock style.
|
|
110
109
|
});
|
|
111
110
|
}
|
|
@@ -114,7 +113,7 @@ let U = class extends me {
|
|
|
114
113
|
}
|
|
115
114
|
// All textRanges should be synchronized from the render layer.
|
|
116
115
|
_syncSelectionFromRenderService() {
|
|
117
|
-
this._textSelectionRenderManager.textSelectionInner$.pipe(
|
|
116
|
+
this._textSelectionRenderManager.textSelectionInner$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
118
117
|
e != null && this._replaceTextRangesWithNoRefresh(e);
|
|
119
118
|
});
|
|
120
119
|
}
|
|
@@ -126,13 +125,13 @@ let U = class extends me {
|
|
|
126
125
|
...e
|
|
127
126
|
};
|
|
128
127
|
this._replaceByParam(t), this._textSelection$.next(t);
|
|
129
|
-
const { unitId: n, subUnitId: r, segmentId:
|
|
130
|
-
this._commandService.executeCommand(
|
|
128
|
+
const { unitId: n, subUnitId: r, segmentId: i, style: o, textRanges: a } = t;
|
|
129
|
+
this._commandService.executeCommand(mt.id, {
|
|
131
130
|
unitId: n,
|
|
132
131
|
subUnitId: r,
|
|
133
|
-
segmentId:
|
|
132
|
+
segmentId: i,
|
|
134
133
|
style: o,
|
|
135
|
-
ranges: a.map(
|
|
134
|
+
ranges: a.map(Ie)
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
137
|
_getTextRanges(e) {
|
|
@@ -144,52 +143,52 @@ let U = class extends me {
|
|
|
144
143
|
}
|
|
145
144
|
_refresh(e) {
|
|
146
145
|
const t = this._getTextRanges(e);
|
|
147
|
-
this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(
|
|
146
|
+
this._textSelectionRenderManager.removeAllTextRanges(), t && Array.isArray(t.textRanges) && t.textRanges.length && this._textSelectionRenderManager.addTextRanges(t.textRanges.map(Ie));
|
|
148
147
|
}
|
|
149
148
|
_replaceByParam(e) {
|
|
150
|
-
const { unitId: t, subUnitId: n, style: r, segmentId:
|
|
151
|
-
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: o, style: r, segmentId:
|
|
149
|
+
const { unitId: t, subUnitId: n, style: r, segmentId: i, textRanges: o } = e;
|
|
150
|
+
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map()), this._textSelectionInfo.get(t).set(n, { textRanges: o, style: r, segmentId: i });
|
|
152
151
|
}
|
|
153
152
|
_addByParam(e) {
|
|
154
|
-
const { unitId: t, subUnitId: n, textRanges: r, style:
|
|
153
|
+
const { unitId: t, subUnitId: n, textRanges: r, style: i, segmentId: o } = e;
|
|
155
154
|
this._textSelectionInfo.has(t) || this._textSelectionInfo.set(t, /* @__PURE__ */ new Map());
|
|
156
155
|
const a = this._textSelectionInfo.get(t);
|
|
157
|
-
a.has(n) ? a.get(n).textRanges.push(...r) : a.set(n, { textRanges: r, style:
|
|
156
|
+
a.has(n) ? a.get(n).textRanges.push(...r) : a.set(n, { textRanges: r, style: i, segmentId: o });
|
|
158
157
|
}
|
|
159
158
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
],
|
|
164
|
-
function
|
|
165
|
-
const { startOffset: n, endOffset: r } =
|
|
166
|
-
return o > 0 &&
|
|
167
|
-
t:
|
|
159
|
+
w = Zt([
|
|
160
|
+
it(0, ae),
|
|
161
|
+
it(1, b)
|
|
162
|
+
], w);
|
|
163
|
+
function We(s, e = "", t = 0) {
|
|
164
|
+
const { startOffset: n, endOffset: r } = s, i = [], o = n - t, a = r - t;
|
|
165
|
+
return o > 0 && i.push({
|
|
166
|
+
t: x.RETAIN,
|
|
168
167
|
len: o,
|
|
169
168
|
segmentId: e
|
|
170
|
-
}),
|
|
171
|
-
t:
|
|
169
|
+
}), i.push({
|
|
170
|
+
t: x.DELETE,
|
|
172
171
|
len: a - o,
|
|
173
172
|
line: 0,
|
|
174
173
|
segmentId: e
|
|
175
|
-
}),
|
|
174
|
+
}), i;
|
|
176
175
|
}
|
|
177
|
-
var
|
|
178
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
179
|
-
(o = i
|
|
180
|
-
return n && r &&
|
|
181
|
-
},
|
|
182
|
-
let
|
|
176
|
+
var Kt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, Qt = (s, e, t, n) => {
|
|
177
|
+
for (var r = n > 1 ? void 0 : n ? Jt(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
178
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
179
|
+
return n && r && Kt(e, t, r), r;
|
|
180
|
+
}, en = (s, e) => (t, n) => e(t, n, s);
|
|
181
|
+
let J = class extends ee {
|
|
183
182
|
constructor(e) {
|
|
184
183
|
super();
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
v(this, "_currentViewModelUnitId", "");
|
|
185
|
+
v(this, "_docViewModelMap", /* @__PURE__ */ new Map());
|
|
186
|
+
v(this, "_currentDocViewModel$", new K(null));
|
|
187
|
+
v(this, "currentDocViewModel$", this._currentDocViewModel$.asObservable());
|
|
189
188
|
this._currentUniverService = e, this._initialize();
|
|
190
189
|
}
|
|
191
190
|
_initialize() {
|
|
192
|
-
this._currentUniverService.currentDoc$.pipe(
|
|
191
|
+
this._currentUniverService.currentDoc$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
193
192
|
if (e == null)
|
|
194
193
|
return;
|
|
195
194
|
const t = e.getUnitId();
|
|
@@ -219,7 +218,7 @@ let se = class extends me {
|
|
|
219
218
|
docViewModel: r
|
|
220
219
|
});
|
|
221
220
|
}
|
|
222
|
-
if (e ===
|
|
221
|
+
if (e === Y) {
|
|
223
222
|
const r = (n = this._docViewModelMap.get(e)) == null ? void 0 : n.docViewModel;
|
|
224
223
|
if (r == null)
|
|
225
224
|
return;
|
|
@@ -229,215 +228,311 @@ let se = class extends me {
|
|
|
229
228
|
}
|
|
230
229
|
}
|
|
231
230
|
_buildDocViewModel(e) {
|
|
232
|
-
return new
|
|
231
|
+
return new Et(e);
|
|
233
232
|
}
|
|
234
233
|
};
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
],
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
234
|
+
J = Qt([
|
|
235
|
+
en(0, y)
|
|
236
|
+
], J);
|
|
237
|
+
var tn = Object.defineProperty, nn = Object.getOwnPropertyDescriptor, rn = (s, e, t, n) => {
|
|
238
|
+
for (var r = n > 1 ? void 0 : n ? nn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
239
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
240
|
+
return n && r && tn(e, t, r), r;
|
|
241
|
+
}, Le = (s, e) => (t, n) => e(t, n, s);
|
|
242
|
+
const sn = 300;
|
|
243
|
+
let Ce = class extends ee {
|
|
244
|
+
constructor(e, t, n) {
|
|
245
|
+
super();
|
|
246
|
+
v(this, "_docStateChange$", new K(null));
|
|
247
|
+
v(this, "docStateChange$", this._docStateChange$.asObservable());
|
|
248
|
+
v(this, "_stateCache", /* @__PURE__ */ new Map());
|
|
249
|
+
v(this, "_timer", null);
|
|
250
|
+
this._undoRedoService = e, this._commandService = t, this._univerInstanceService = n, this._initialize();
|
|
251
|
+
}
|
|
252
|
+
setChangeState(e) {
|
|
253
|
+
const { trigger: t, noHistory: n } = e;
|
|
254
|
+
t != null && (this._cacheChangeState(e), n || this._docStateChange$.next(e));
|
|
255
|
+
}
|
|
256
|
+
_initialize() {
|
|
257
|
+
this.disposeWithMe(
|
|
258
|
+
this._commandService.beforeCommandExecuted((e) => {
|
|
259
|
+
if (e.id === qe || e.id === Ze) {
|
|
260
|
+
const t = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
261
|
+
if (t == null)
|
|
262
|
+
return;
|
|
263
|
+
const n = t.getUnitId();
|
|
264
|
+
this._pushHistory(n);
|
|
265
|
+
}
|
|
266
|
+
})
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
_cacheChangeState(e) {
|
|
270
|
+
const { trigger: t, unitId: n, noHistory: r } = e;
|
|
271
|
+
if (!(t === Ze || t === qe || r)) {
|
|
272
|
+
if (this._stateCache.has(n)) {
|
|
273
|
+
const i = this._stateCache.get(n);
|
|
274
|
+
i == null || i.push(e);
|
|
275
|
+
} else
|
|
276
|
+
this._stateCache.set(n, [e]);
|
|
277
|
+
t === be.id || t === ye.id ? (this._timer && clearTimeout(this._timer), this._timer = setTimeout(() => {
|
|
278
|
+
this._pushHistory(n);
|
|
279
|
+
}, sn)) : this._pushHistory(n);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
_pushHistory(e) {
|
|
283
|
+
const t = this._undoRedoService, n = this._stateCache.get(e);
|
|
284
|
+
if (!Array.isArray(n) || n.length === 0)
|
|
285
|
+
return;
|
|
286
|
+
const r = n.length, i = n[0].commandId, o = n[0], a = n[r - 1], l = {
|
|
287
|
+
unitId: e,
|
|
288
|
+
actions: n.reduce((c, u) => A.compose(c, u.redoState.actions), []),
|
|
289
|
+
textRanges: a.redoState.textRanges
|
|
290
|
+
}, d = {
|
|
291
|
+
unitId: e,
|
|
292
|
+
// Always need to put undoParams after redoParams, because `reverse` will change the `cacheStates` order.
|
|
293
|
+
actions: n.reverse().reduce((c, u) => A.compose(c, u.undoState.actions), []),
|
|
294
|
+
textRanges: o.undoState.textRanges
|
|
295
|
+
};
|
|
296
|
+
t.pushUndoRedo({
|
|
297
|
+
unitID: e,
|
|
298
|
+
undoMutations: [{ id: i, params: d }],
|
|
299
|
+
redoMutations: [{ id: i, params: l }]
|
|
300
|
+
}), n.length = 0;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
Ce = rn([
|
|
304
|
+
Le(0, E(Re)),
|
|
305
|
+
Le(1, b),
|
|
306
|
+
Le(2, y)
|
|
307
|
+
], Ce);
|
|
308
|
+
class xe {
|
|
309
|
+
constructor() {
|
|
310
|
+
v(this, "_previousActiveRange", null);
|
|
311
|
+
v(this, "_undoMutationParamsCache", []);
|
|
312
|
+
v(this, "_redoMutationParamsCache", []);
|
|
313
|
+
}
|
|
314
|
+
clearUndoRedoMutationParamsCache() {
|
|
315
|
+
this._undoMutationParamsCache = [], this._redoMutationParamsCache = [];
|
|
316
|
+
}
|
|
317
|
+
getUndoRedoMutationParamsCache() {
|
|
318
|
+
return {
|
|
319
|
+
undoCache: this._undoMutationParamsCache,
|
|
320
|
+
redoCache: this._redoMutationParamsCache
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
setUndoRedoMutationParamsCache({ undoCache: e = [], redoCache: t = [] }) {
|
|
324
|
+
this._undoMutationParamsCache = e, this._redoMutationParamsCache = t;
|
|
325
|
+
}
|
|
326
|
+
getActiveRange() {
|
|
327
|
+
return this._previousActiveRange;
|
|
328
|
+
}
|
|
329
|
+
setActiveRange(e) {
|
|
330
|
+
this._previousActiveRange = e;
|
|
331
|
+
}
|
|
332
|
+
pushUndoRedoMutationParams(e, t) {
|
|
333
|
+
this._undoMutationParamsCache.push(e), this._redoMutationParamsCache.push(t);
|
|
334
|
+
}
|
|
335
|
+
fetchComposedUndoRedoMutationParams() {
|
|
336
|
+
if (this._undoMutationParamsCache.length === 0 || this._previousActiveRange == null || this._redoMutationParamsCache.length === 0)
|
|
337
|
+
return null;
|
|
338
|
+
const { unitId: e } = this._undoMutationParamsCache[0], t = {
|
|
339
|
+
unitId: e,
|
|
340
|
+
actions: this._undoMutationParamsCache.reverse().reduce((r, i) => A.compose(r, i.actions), []),
|
|
341
|
+
textRanges: []
|
|
342
|
+
// Add empty array, will never use, just fix type error
|
|
343
|
+
};
|
|
344
|
+
return { redoMutationParams: {
|
|
345
|
+
unitId: e,
|
|
346
|
+
actions: this._redoMutationParamsCache.reduce((r, i) => A.compose(r, i.actions), []),
|
|
347
|
+
textRanges: []
|
|
348
|
+
// Add empty array, will never use, just fix type error
|
|
349
|
+
}, undoMutationParams: t, previousActiveRange: this._previousActiveRange };
|
|
350
|
+
}
|
|
351
|
+
dispose() {
|
|
352
|
+
this._undoMutationParamsCache = [], this._redoMutationParamsCache = [], this._previousActiveRange = null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
const st = "doc.mutation.rich-text-editing", L = {
|
|
356
|
+
id: st,
|
|
357
|
+
type: C.MUTATION,
|
|
358
|
+
handler: (s, e) => {
|
|
359
|
+
var T;
|
|
360
|
+
const {
|
|
361
|
+
unitId: t,
|
|
362
|
+
actions: n,
|
|
363
|
+
textRanges: r,
|
|
364
|
+
prevTextRanges: i,
|
|
365
|
+
trigger: o,
|
|
366
|
+
noHistory: a,
|
|
367
|
+
isCompositionEnd: l,
|
|
368
|
+
noNeedSetTextRange: d
|
|
369
|
+
} = e, u = s.get(y).getUniverDocInstance(t), g = s.get(J).getViewModel(t), f = s.get(w), p = ((T = f.getSelections()) != null ? T : []).map(Ie), _ = s.get(Ce), S = s.get(xe);
|
|
370
|
+
if (u == null || g == null)
|
|
244
371
|
throw new Error(`DocumentDataModel or documentViewModel not found for unitId: ${t}`);
|
|
245
372
|
if (n.length === 0)
|
|
246
373
|
throw new Error("Mutation's length should great than 0 when call RichTextEditingMutation");
|
|
247
|
-
const
|
|
248
|
-
|
|
374
|
+
const I = u.apply(n), { segmentId: R } = n[0], O = u.getSelfOrHeaderFooterModel(R);
|
|
375
|
+
g.getSelfOrHeaderFooterViewModel(R).reset(O), !d && r && queueMicrotask(() => {
|
|
376
|
+
f.replaceTextRanges(r);
|
|
377
|
+
});
|
|
378
|
+
const P = {
|
|
379
|
+
commandId: st,
|
|
380
|
+
unitId: t,
|
|
381
|
+
trigger: o,
|
|
382
|
+
noHistory: a,
|
|
383
|
+
redoState: {
|
|
384
|
+
actions: n,
|
|
385
|
+
textRanges: r
|
|
386
|
+
},
|
|
387
|
+
undoState: {
|
|
388
|
+
actions: I,
|
|
389
|
+
textRanges: i != null ? i : p
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
if (l) {
|
|
393
|
+
const D = S.fetchComposedUndoRedoMutationParams();
|
|
394
|
+
if (D == null)
|
|
395
|
+
throw new Error("historyParams is null in RichTextEditingMutation");
|
|
396
|
+
const { undoMutationParams: M, redoMutationParams: F, previousActiveRange: $ } = D;
|
|
397
|
+
P.redoState.actions = F.actions, P.undoState.actions = M.actions, P.undoState.textRanges = [$];
|
|
398
|
+
}
|
|
399
|
+
return _.setChangeState(P), {
|
|
249
400
|
unitId: t,
|
|
250
|
-
|
|
401
|
+
actions: I,
|
|
402
|
+
textRanges: p
|
|
251
403
|
};
|
|
252
404
|
}
|
|
253
|
-
},
|
|
405
|
+
}, be = {
|
|
254
406
|
id: "doc.command.insert-text",
|
|
255
|
-
type:
|
|
256
|
-
handler: async (
|
|
257
|
-
const t =
|
|
258
|
-
id:
|
|
407
|
+
type: C.COMMAND,
|
|
408
|
+
handler: async (s, e) => {
|
|
409
|
+
const t = s.get(b), { range: n, segmentId: r, body: i, unitId: o, textRanges: a } = e, { startOffset: l, collapsed: d } = n, c = {
|
|
410
|
+
id: L.id,
|
|
259
411
|
params: {
|
|
260
|
-
unitId:
|
|
261
|
-
|
|
412
|
+
unitId: o,
|
|
413
|
+
actions: [],
|
|
414
|
+
textRanges: a
|
|
262
415
|
}
|
|
263
|
-
}, u = new
|
|
264
|
-
|
|
265
|
-
t:
|
|
416
|
+
}, u = new A();
|
|
417
|
+
return d ? l > 0 && u.push({
|
|
418
|
+
t: x.RETAIN,
|
|
266
419
|
len: l,
|
|
267
|
-
segmentId:
|
|
268
|
-
}) : u.push(...
|
|
269
|
-
t:
|
|
270
|
-
body:
|
|
271
|
-
len:
|
|
420
|
+
segmentId: r
|
|
421
|
+
}) : u.push(...We(n, r)), u.push({
|
|
422
|
+
t: x.INSERT,
|
|
423
|
+
body: i,
|
|
424
|
+
len: i.dataStream.length,
|
|
272
425
|
line: 0,
|
|
273
|
-
segmentId:
|
|
274
|
-
}),
|
|
275
|
-
const p = n.syncExecuteCommand(g.id, g.params);
|
|
276
|
-
return r.replaceTextRanges(d), p ? (t.pushUndoRedo({
|
|
277
|
-
unitID: c,
|
|
278
|
-
undoMutations: [{ id: _.id, params: p }],
|
|
279
|
-
redoMutations: [{ id: _.id, params: g.params }],
|
|
280
|
-
undo() {
|
|
281
|
-
return n.syncExecuteCommand(_.id, p), r.replaceTextRanges([s]), !0;
|
|
282
|
-
},
|
|
283
|
-
redo() {
|
|
284
|
-
return n.syncExecuteCommand(_.id, g.params), r.replaceTextRanges(d), !0;
|
|
285
|
-
}
|
|
286
|
-
}), !0) : !1;
|
|
426
|
+
segmentId: r
|
|
427
|
+
}), c.params.actions = u.serialize(), !!t.syncExecuteCommand(c.id, c.params);
|
|
287
428
|
}
|
|
288
429
|
};
|
|
289
|
-
var
|
|
290
|
-
const
|
|
430
|
+
var H = /* @__PURE__ */ ((s) => (s[s.LEFT = 0] = "LEFT", s[s.RIGHT = 1] = "RIGHT", s))(H || {});
|
|
431
|
+
const ye = {
|
|
291
432
|
id: "doc.command.delete-text",
|
|
292
|
-
type:
|
|
293
|
-
handler: async (
|
|
294
|
-
const t =
|
|
295
|
-
id:
|
|
433
|
+
type: C.COMMAND,
|
|
434
|
+
handler: async (s, e) => {
|
|
435
|
+
const t = s.get(b), { range: n, segmentId: r, unitId: i, direction: o, textRanges: a, len: l = 1 } = e, { startOffset: d } = n, c = {
|
|
436
|
+
id: L.id,
|
|
296
437
|
params: {
|
|
297
|
-
unitId:
|
|
298
|
-
|
|
438
|
+
unitId: i,
|
|
439
|
+
actions: [],
|
|
440
|
+
textRanges: a
|
|
299
441
|
}
|
|
300
|
-
}, u = new
|
|
301
|
-
|
|
302
|
-
t:
|
|
303
|
-
len:
|
|
304
|
-
segmentId:
|
|
442
|
+
}, u = new A();
|
|
443
|
+
return d > 0 && u.push({
|
|
444
|
+
t: x.RETAIN,
|
|
445
|
+
len: o === 0 ? d - l : d,
|
|
446
|
+
segmentId: r
|
|
305
447
|
}), u.push({
|
|
306
|
-
t:
|
|
448
|
+
t: x.DELETE,
|
|
307
449
|
len: l,
|
|
308
450
|
line: 0,
|
|
309
|
-
segmentId:
|
|
310
|
-
}),
|
|
311
|
-
const p = t.syncExecuteCommand(g.id, g.params);
|
|
312
|
-
return r.replaceTextRanges(d), p && n.pushUndoRedo({
|
|
313
|
-
unitID: a,
|
|
314
|
-
undoMutations: [{ id: _.id, params: p }],
|
|
315
|
-
redoMutations: [{ id: _.id, params: g.params }],
|
|
316
|
-
undo() {
|
|
317
|
-
return t.syncExecuteCommand(_.id, p), r.replaceTextRanges([s]), !0;
|
|
318
|
-
},
|
|
319
|
-
redo() {
|
|
320
|
-
return t.syncExecuteCommand(_.id, g.params), r.replaceTextRanges(d), !0;
|
|
321
|
-
}
|
|
322
|
-
}), !1;
|
|
451
|
+
segmentId: r
|
|
452
|
+
}), c.params.actions = u.serialize(), !!t.syncExecuteCommand(c.id, c.params);
|
|
323
453
|
}
|
|
324
|
-
},
|
|
454
|
+
}, ft = {
|
|
325
455
|
id: "doc.command.update-text",
|
|
326
|
-
type:
|
|
327
|
-
handler: async (
|
|
328
|
-
const { range: t, segmentId: n, updateBody: r, coverType:
|
|
329
|
-
id:
|
|
456
|
+
type: C.COMMAND,
|
|
457
|
+
handler: async (s, e) => {
|
|
458
|
+
const { range: t, segmentId: n, updateBody: r, coverType: i, unitId: o, textRanges: a } = e, l = s.get(b), d = {
|
|
459
|
+
id: L.id,
|
|
330
460
|
params: {
|
|
331
461
|
unitId: o,
|
|
332
|
-
|
|
462
|
+
actions: [],
|
|
463
|
+
textRanges: a
|
|
333
464
|
}
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
t:
|
|
465
|
+
}, c = new A(), { startOffset: u, endOffset: h } = t;
|
|
466
|
+
return c.push({
|
|
467
|
+
t: x.RETAIN,
|
|
337
468
|
len: u,
|
|
338
469
|
segmentId: n
|
|
339
|
-
}),
|
|
340
|
-
t:
|
|
470
|
+
}), c.push({
|
|
471
|
+
t: x.RETAIN,
|
|
341
472
|
body: r,
|
|
342
|
-
len:
|
|
473
|
+
len: h - u,
|
|
343
474
|
segmentId: n,
|
|
344
|
-
coverType:
|
|
345
|
-
}),
|
|
346
|
-
const f = c.syncExecuteCommand(h.id, h.params);
|
|
347
|
-
return l.replaceTextRanges(a), f ? (d.pushUndoRedo({
|
|
348
|
-
unitID: o,
|
|
349
|
-
undoMutations: [{ id: _.id, params: f }],
|
|
350
|
-
redoMutations: [{ id: _.id, params: h.params }],
|
|
351
|
-
undo() {
|
|
352
|
-
return c.syncExecuteCommand(_.id, f), l.replaceTextRanges(a), !0;
|
|
353
|
-
},
|
|
354
|
-
redo() {
|
|
355
|
-
return c.syncExecuteCommand(_.id, h.params), l.replaceTextRanges(a), !0;
|
|
356
|
-
}
|
|
357
|
-
}), !0) : !1;
|
|
475
|
+
coverType: i
|
|
476
|
+
}), d.params.actions = c.serialize(), !!l.syncExecuteCommand(d.id, d.params);
|
|
358
477
|
}
|
|
359
478
|
};
|
|
360
|
-
function
|
|
479
|
+
function on(s, e) {
|
|
361
480
|
const t = [];
|
|
362
|
-
for (let n = 0, r =
|
|
363
|
-
|
|
481
|
+
for (let n = 0, r = s.length; n < r; n++)
|
|
482
|
+
s[n] === Fe.PARAGRAPH && t.push({
|
|
364
483
|
startIndex: n
|
|
365
484
|
});
|
|
366
485
|
if (e)
|
|
367
486
|
for (const n of t)
|
|
368
|
-
e.bullet && (n.bullet =
|
|
487
|
+
e.bullet && (n.bullet = oe.deepClone(e.bullet)), e.paragraphStyle && (n.paragraphStyle = oe.deepClone(e.paragraphStyle));
|
|
369
488
|
return t;
|
|
370
489
|
}
|
|
371
|
-
const
|
|
490
|
+
const an = {
|
|
372
491
|
id: "doc.command.break-line",
|
|
373
|
-
type:
|
|
374
|
-
handler: async (
|
|
375
|
-
var
|
|
376
|
-
const e =
|
|
492
|
+
type: C.COMMAND,
|
|
493
|
+
handler: async (s) => {
|
|
494
|
+
var f, m;
|
|
495
|
+
const e = s.get(w), t = s.get(y), n = s.get(b), r = e.getActiveRange();
|
|
377
496
|
if (r == null)
|
|
378
497
|
return !1;
|
|
379
|
-
const
|
|
498
|
+
const i = t.getCurrentUniverDocInstance(), o = i.getUnitId(), { startOffset: a, segmentId: l, style: d } = r, c = [
|
|
380
499
|
{
|
|
381
500
|
startOffset: a + 1,
|
|
382
501
|
endOffset: a + 1,
|
|
383
502
|
style: d
|
|
384
503
|
}
|
|
385
|
-
],
|
|
386
|
-
return await n.executeCommand(
|
|
504
|
+
], h = ((m = (f = i.getBody()) == null ? void 0 : f.paragraphs) != null ? m : []).find((p) => p.startIndex >= a);
|
|
505
|
+
return await n.executeCommand(be.id, {
|
|
387
506
|
unitId: o,
|
|
388
507
|
body: {
|
|
389
|
-
dataStream:
|
|
390
|
-
paragraphs:
|
|
508
|
+
dataStream: Fe.PARAGRAPH,
|
|
509
|
+
paragraphs: on(Fe.PARAGRAPH, h)
|
|
391
510
|
},
|
|
392
511
|
range: r,
|
|
393
|
-
textRanges:
|
|
394
|
-
segmentId:
|
|
512
|
+
textRanges: c,
|
|
513
|
+
segmentId: l
|
|
395
514
|
});
|
|
396
515
|
}
|
|
397
|
-
}, ze = {
|
|
398
|
-
id: gn.id,
|
|
399
|
-
name: "doc.command.copy",
|
|
400
|
-
type: I.COMMAND,
|
|
401
|
-
multi: !0,
|
|
402
|
-
priority: 999,
|
|
403
|
-
preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e),
|
|
404
|
-
handler: async () => !0
|
|
405
|
-
}, We = {
|
|
406
|
-
id: pn.id,
|
|
407
|
-
name: "doc.command.cut",
|
|
408
|
-
type: I.COMMAND,
|
|
409
|
-
multi: !0,
|
|
410
|
-
priority: 999,
|
|
411
|
-
preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e),
|
|
412
|
-
handler: async () => !0
|
|
413
|
-
}, He = {
|
|
414
|
-
id: fn.id,
|
|
415
|
-
name: "doc.command.paste",
|
|
416
|
-
type: I.COMMAND,
|
|
417
|
-
multi: !0,
|
|
418
|
-
priority: 999,
|
|
419
|
-
preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e),
|
|
420
|
-
handler: async () => !0
|
|
421
516
|
};
|
|
422
|
-
var
|
|
423
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
424
|
-
(o = i
|
|
425
|
-
return n && r &&
|
|
426
|
-
},
|
|
427
|
-
let
|
|
517
|
+
var cn = Object.defineProperty, ln = Object.getOwnPropertyDescriptor, dn = (s, e, t, n) => {
|
|
518
|
+
for (var r = n > 1 ? void 0 : n ? ln(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
519
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
520
|
+
return n && r && cn(e, t, r), r;
|
|
521
|
+
}, ot = (s, e) => (t, n) => e(t, n, s);
|
|
522
|
+
let B = class extends ee {
|
|
428
523
|
constructor(e, t) {
|
|
429
524
|
super();
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
525
|
+
v(this, "_currentSkeletonUnitId", "");
|
|
526
|
+
v(this, "_docSkeletonMap", /* @__PURE__ */ new Map());
|
|
527
|
+
v(this, "_currentSkeleton$", new K(null));
|
|
528
|
+
v(this, "currentSkeleton$", this._currentSkeleton$.asObservable());
|
|
434
529
|
// CurrentSkeletonBefore for pre-triggered logic during registration
|
|
435
|
-
|
|
436
|
-
|
|
530
|
+
v(this, "_currentSkeletonBefore$", new K(null));
|
|
531
|
+
v(this, "currentSkeletonBefore$", this._currentSkeletonBefore$.asObservable());
|
|
437
532
|
this._localeService = e, this._docViewModelManagerService = t, this._initialize();
|
|
438
533
|
}
|
|
439
534
|
_initialize() {
|
|
440
|
-
this._docViewModelManagerService.currentDocViewModel$.pipe(
|
|
535
|
+
this._docViewModelManagerService.currentDocViewModel$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
441
536
|
e != null && this._setCurrent(e);
|
|
442
537
|
});
|
|
443
538
|
}
|
|
@@ -473,543 +568,448 @@ let L = class extends me {
|
|
|
473
568
|
return this._currentSkeletonUnitId = t, this._currentSkeletonBefore$.next(this.getCurrent()), this._currentSkeleton$.next(this.getCurrent()), this.getCurrent();
|
|
474
569
|
}
|
|
475
570
|
_buildSkeleton(e) {
|
|
476
|
-
return
|
|
571
|
+
return wt.create(e, this._localeService);
|
|
477
572
|
}
|
|
478
573
|
};
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
],
|
|
483
|
-
const
|
|
574
|
+
B = dn([
|
|
575
|
+
ot(0, E(dt)),
|
|
576
|
+
ot(1, E(J))
|
|
577
|
+
], B);
|
|
578
|
+
const gr = {
|
|
484
579
|
id: "doc.command.inner-paste",
|
|
485
|
-
type:
|
|
486
|
-
handler: async (
|
|
487
|
-
const { segmentId: t, body: n, textRanges: r } = e,
|
|
488
|
-
if (!Array.isArray(
|
|
580
|
+
type: C.COMMAND,
|
|
581
|
+
handler: async (s, e) => {
|
|
582
|
+
const { segmentId: t, body: n, textRanges: r } = e, i = s.get(b), o = s.get(w), a = s.get(y), l = o.getSelections();
|
|
583
|
+
if (!Array.isArray(l) || l.length === 0)
|
|
489
584
|
return !1;
|
|
490
|
-
const
|
|
491
|
-
id:
|
|
585
|
+
const c = a.getCurrentUniverDocInstance().getUnitId(), u = {
|
|
586
|
+
id: L.id,
|
|
492
587
|
params: {
|
|
493
|
-
unitId:
|
|
494
|
-
|
|
588
|
+
unitId: c,
|
|
589
|
+
actions: [],
|
|
590
|
+
textRanges: r
|
|
495
591
|
}
|
|
496
|
-
},
|
|
497
|
-
|
|
498
|
-
const
|
|
499
|
-
for (const m of
|
|
500
|
-
const { startOffset:
|
|
501
|
-
|
|
502
|
-
t:
|
|
503
|
-
len:
|
|
592
|
+
}, h = new Oe();
|
|
593
|
+
h.reset();
|
|
594
|
+
const g = new A();
|
|
595
|
+
for (const m of l) {
|
|
596
|
+
const { startOffset: p, endOffset: _, collapsed: S } = m, I = p - h.cursor;
|
|
597
|
+
S ? g.push({
|
|
598
|
+
t: x.RETAIN,
|
|
599
|
+
len: I,
|
|
504
600
|
segmentId: t
|
|
505
|
-
}) :
|
|
506
|
-
t:
|
|
601
|
+
}) : g.push(...We(m, t, h.cursor)), g.push({
|
|
602
|
+
t: x.INSERT,
|
|
507
603
|
body: n,
|
|
508
604
|
len: n.dataStream.length,
|
|
509
605
|
line: 0,
|
|
510
606
|
segmentId: t
|
|
511
|
-
}),
|
|
607
|
+
}), h.reset(), h.moveCursor(_);
|
|
512
608
|
}
|
|
513
|
-
|
|
514
|
-
const f = o.syncExecuteCommand(g.id, g.params);
|
|
515
|
-
return a.replaceTextRanges(r), f ? (s.pushUndoRedo({
|
|
516
|
-
unitID: h,
|
|
517
|
-
undoMutations: [{ id: _.id, params: f }],
|
|
518
|
-
redoMutations: [{ id: _.id, params: g.params }],
|
|
519
|
-
undo() {
|
|
520
|
-
return o.syncExecuteCommand(_.id, f), a.replaceTextRanges(d), !0;
|
|
521
|
-
},
|
|
522
|
-
redo() {
|
|
523
|
-
return o.syncExecuteCommand(_.id, g.params), a.replaceTextRanges(r), !0;
|
|
524
|
-
}
|
|
525
|
-
}), !0) : !1;
|
|
609
|
+
return u.params.actions = g.serialize(), !!i.syncExecuteCommand(u.id, u.params);
|
|
526
610
|
}
|
|
527
|
-
},
|
|
611
|
+
}, pt = {
|
|
528
612
|
id: "doc.command.inner-cut",
|
|
529
|
-
type:
|
|
530
|
-
handler: async (
|
|
531
|
-
const { segmentId: t, textRanges: n } = e, r =
|
|
532
|
-
if (!Array.isArray(
|
|
613
|
+
type: C.COMMAND,
|
|
614
|
+
handler: async (s, e) => {
|
|
615
|
+
const { segmentId: t, textRanges: n } = e, r = s.get(b), i = s.get(w), o = s.get(y), a = i.getSelections();
|
|
616
|
+
if (!Array.isArray(a) || a.length === 0)
|
|
533
617
|
return !1;
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
618
|
+
const l = o.getCurrentUniverDocInstance().getUnitId(), d = o.getUniverDocInstance(l), c = xt(d.snapshot, t);
|
|
619
|
+
if (c == null)
|
|
536
620
|
return !1;
|
|
537
|
-
const
|
|
538
|
-
id:
|
|
621
|
+
const u = {
|
|
622
|
+
id: L.id,
|
|
539
623
|
params: {
|
|
540
|
-
unitId:
|
|
541
|
-
|
|
624
|
+
unitId: l,
|
|
625
|
+
actions: [],
|
|
626
|
+
textRanges: n
|
|
542
627
|
}
|
|
543
|
-
},
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
for (const m of
|
|
547
|
-
const { startOffset:
|
|
548
|
-
|
|
549
|
-
t:
|
|
550
|
-
len:
|
|
628
|
+
}, h = new Oe();
|
|
629
|
+
h.reset();
|
|
630
|
+
const g = new A();
|
|
631
|
+
for (const m of a) {
|
|
632
|
+
const { startOffset: p, endOffset: _, collapsed: S } = m, I = p - h.cursor;
|
|
633
|
+
S ? g.push({
|
|
634
|
+
t: x.RETAIN,
|
|
635
|
+
len: I,
|
|
551
636
|
segmentId: t
|
|
552
|
-
}) :
|
|
637
|
+
}) : g.push(...un(m, c, t, h.cursor)), h.reset(), h.moveCursor(_);
|
|
553
638
|
}
|
|
554
|
-
|
|
555
|
-
const f = s.syncExecuteCommand(g.id, g.params);
|
|
556
|
-
return o.replaceTextRanges(n), f ? (r.pushUndoRedo({
|
|
557
|
-
unitID: d,
|
|
558
|
-
undoMutations: [{ id: _.id, params: f }],
|
|
559
|
-
redoMutations: [{ id: _.id, params: g.params }],
|
|
560
|
-
undo() {
|
|
561
|
-
return s.syncExecuteCommand(_.id, f), o.replaceTextRanges(c), !0;
|
|
562
|
-
},
|
|
563
|
-
redo() {
|
|
564
|
-
return s.syncExecuteCommand(_.id, g.params), o.replaceTextRanges(n), !0;
|
|
565
|
-
}
|
|
566
|
-
}), !0) : !1;
|
|
639
|
+
return u.params.actions = g.serialize(), !!r.syncExecuteCommand(u.id, u.params);
|
|
567
640
|
}
|
|
568
641
|
};
|
|
569
|
-
function
|
|
570
|
-
const { startOffset: r, endOffset:
|
|
571
|
-
(
|
|
642
|
+
function un(s, e, t = "", n = 0) {
|
|
643
|
+
const { startOffset: r, endOffset: i } = s, o = [], { paragraphs: a = [] } = e, l = r - n, d = i - n, c = a == null ? void 0 : a.find(
|
|
644
|
+
(u) => u.startIndex - n >= l && u.startIndex - n <= d
|
|
572
645
|
);
|
|
573
|
-
if (
|
|
574
|
-
t:
|
|
575
|
-
len:
|
|
646
|
+
if (l > 0 && o.push({
|
|
647
|
+
t: x.RETAIN,
|
|
648
|
+
len: l,
|
|
576
649
|
segmentId: t
|
|
577
|
-
}),
|
|
578
|
-
const
|
|
650
|
+
}), c && c.startIndex - n > l) {
|
|
651
|
+
const u = c.startIndex - n;
|
|
579
652
|
o.push({
|
|
580
|
-
t:
|
|
581
|
-
len:
|
|
653
|
+
t: x.DELETE,
|
|
654
|
+
len: u - l,
|
|
582
655
|
line: 0,
|
|
583
656
|
segmentId: t
|
|
584
657
|
}), o.push({
|
|
585
|
-
t:
|
|
658
|
+
t: x.RETAIN,
|
|
586
659
|
len: 1,
|
|
587
660
|
segmentId: t
|
|
588
|
-
}), d >
|
|
589
|
-
t:
|
|
590
|
-
len: d -
|
|
661
|
+
}), d > u + 1 && o.push({
|
|
662
|
+
t: x.DELETE,
|
|
663
|
+
len: d - u - 1,
|
|
591
664
|
line: 0,
|
|
592
665
|
segmentId: t
|
|
593
666
|
});
|
|
594
667
|
} else
|
|
595
668
|
o.push({
|
|
596
|
-
t:
|
|
597
|
-
len: d -
|
|
669
|
+
t: x.DELETE,
|
|
670
|
+
len: d - l,
|
|
598
671
|
line: 0,
|
|
599
672
|
segmentId: t
|
|
600
673
|
});
|
|
601
674
|
return o;
|
|
602
675
|
}
|
|
603
|
-
const
|
|
676
|
+
const hn = {
|
|
604
677
|
id: "doc.command.delete-left",
|
|
605
|
-
type:
|
|
606
|
-
handler: async (
|
|
607
|
-
var
|
|
608
|
-
const e =
|
|
609
|
-
let
|
|
610
|
-
if (
|
|
678
|
+
type: C.COMMAND,
|
|
679
|
+
handler: async (s) => {
|
|
680
|
+
var R;
|
|
681
|
+
const e = s.get(w), t = s.get(B), n = s.get(y), r = s.get(b), i = e.getActiveRange(), o = e.getSelections(), a = (R = t.getCurrent()) == null ? void 0 : R.skeleton;
|
|
682
|
+
let l = !0;
|
|
683
|
+
if (i == null || a == null || o == null)
|
|
611
684
|
return !1;
|
|
612
|
-
const d = n.getCurrentUniverDocInstance(), { startOffset:
|
|
613
|
-
let
|
|
614
|
-
const
|
|
615
|
-
if (
|
|
616
|
-
const
|
|
617
|
-
if (
|
|
685
|
+
const d = n.getCurrentUniverDocInstance(), { startOffset: c, collapsed: u, segmentId: h, style: g } = i, f = a.findNodeByCharIndex(c), m = Ut(f), p = Nt(f, d.getBody());
|
|
686
|
+
let _ = c;
|
|
687
|
+
const S = a.findNodeByCharIndex(c - 1);
|
|
688
|
+
if (At(f) && S !== f && (m === !0 || p === !0)) {
|
|
689
|
+
const O = Lt(f, d.getBody());
|
|
690
|
+
if (O == null)
|
|
618
691
|
return !1;
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
} else if (
|
|
624
|
-
const
|
|
625
|
-
|
|
692
|
+
const N = O == null ? void 0 : O.startIndex, P = { startIndex: 0 }, T = O.paragraphStyle;
|
|
693
|
+
if (m === !0) {
|
|
694
|
+
const M = O.paragraphStyle;
|
|
695
|
+
M && (P.paragraphStyle = M);
|
|
696
|
+
} else if (p === !0) {
|
|
697
|
+
const M = O.bullet;
|
|
698
|
+
M && (P.bullet = M), T != null && (P.paragraphStyle = { ...T }, delete P.paragraphStyle.hanging, delete P.paragraphStyle.indentStart);
|
|
626
699
|
}
|
|
627
|
-
const
|
|
700
|
+
const D = [
|
|
628
701
|
{
|
|
629
|
-
startOffset:
|
|
630
|
-
endOffset:
|
|
631
|
-
style:
|
|
702
|
+
startOffset: _,
|
|
703
|
+
endOffset: _,
|
|
704
|
+
style: g
|
|
632
705
|
}
|
|
633
706
|
];
|
|
634
|
-
|
|
707
|
+
l = await r.executeCommand(ft.id, {
|
|
635
708
|
unitId: d.getUnitId(),
|
|
636
709
|
updateBody: {
|
|
637
710
|
dataStream: "",
|
|
638
711
|
paragraphs: [{ ...P }]
|
|
639
712
|
},
|
|
640
713
|
range: {
|
|
641
|
-
startOffset:
|
|
642
|
-
endOffset:
|
|
714
|
+
startOffset: N,
|
|
715
|
+
endOffset: N + 1
|
|
643
716
|
},
|
|
644
|
-
textRanges:
|
|
645
|
-
coverType:
|
|
646
|
-
segmentId:
|
|
717
|
+
textRanges: D,
|
|
718
|
+
coverType: ut.REPLACE,
|
|
719
|
+
segmentId: h
|
|
647
720
|
});
|
|
648
|
-
} else if (
|
|
649
|
-
if (
|
|
721
|
+
} else if (u === !0) {
|
|
722
|
+
if (S == null)
|
|
650
723
|
return !0;
|
|
651
|
-
if (
|
|
652
|
-
|
|
653
|
-
direction:
|
|
654
|
-
range:
|
|
724
|
+
if (S.content === "\r")
|
|
725
|
+
l = await r.executeCommand(Xe.id, {
|
|
726
|
+
direction: H.LEFT,
|
|
727
|
+
range: i
|
|
655
728
|
});
|
|
656
729
|
else {
|
|
657
|
-
|
|
658
|
-
const
|
|
730
|
+
_ -= S.count;
|
|
731
|
+
const O = [
|
|
659
732
|
{
|
|
660
|
-
startOffset:
|
|
661
|
-
endOffset:
|
|
662
|
-
style:
|
|
733
|
+
startOffset: _,
|
|
734
|
+
endOffset: _,
|
|
735
|
+
style: g
|
|
663
736
|
}
|
|
664
737
|
];
|
|
665
|
-
|
|
738
|
+
l = await r.executeCommand(ye.id, {
|
|
666
739
|
unitId: d.getUnitId(),
|
|
667
|
-
range:
|
|
668
|
-
segmentId:
|
|
669
|
-
direction:
|
|
670
|
-
len:
|
|
671
|
-
textRanges:
|
|
740
|
+
range: i,
|
|
741
|
+
segmentId: h,
|
|
742
|
+
direction: H.LEFT,
|
|
743
|
+
len: S.count,
|
|
744
|
+
textRanges: O
|
|
672
745
|
});
|
|
673
746
|
}
|
|
674
747
|
} else {
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
segmentId:
|
|
678
|
-
textRanges:
|
|
748
|
+
const O = _t(i, o);
|
|
749
|
+
l = await r.executeCommand(pt.id, {
|
|
750
|
+
segmentId: h,
|
|
751
|
+
textRanges: O
|
|
679
752
|
});
|
|
680
753
|
}
|
|
681
|
-
return
|
|
754
|
+
return l;
|
|
682
755
|
}
|
|
683
|
-
},
|
|
756
|
+
}, gn = {
|
|
684
757
|
id: "doc.command.delete-right",
|
|
685
|
-
type:
|
|
686
|
-
handler: async (
|
|
687
|
-
var
|
|
688
|
-
const e =
|
|
689
|
-
let
|
|
690
|
-
if (
|
|
758
|
+
type: C.COMMAND,
|
|
759
|
+
handler: async (s) => {
|
|
760
|
+
var f;
|
|
761
|
+
const e = s.get(w), t = s.get(B), n = s.get(y), r = s.get(b), i = e.getActiveRange(), o = e.getSelections(), a = (f = t.getCurrent()) == null ? void 0 : f.skeleton;
|
|
762
|
+
let l;
|
|
763
|
+
if (i == null || a == null || o == null)
|
|
691
764
|
return !1;
|
|
692
|
-
const d = n.getCurrentUniverDocInstance(), { startOffset:
|
|
693
|
-
if (
|
|
765
|
+
const d = n.getCurrentUniverDocInstance(), { startOffset: c, collapsed: u, segmentId: h, style: g } = i;
|
|
766
|
+
if (c === d.getBody().dataStream.length - 2 && u)
|
|
694
767
|
return !0;
|
|
695
|
-
if (
|
|
696
|
-
const
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
direction:
|
|
700
|
-
range:
|
|
768
|
+
if (u === !0) {
|
|
769
|
+
const m = a.findNodeByCharIndex(c);
|
|
770
|
+
if (m.content === "\r")
|
|
771
|
+
l = await r.executeCommand(Xe.id, {
|
|
772
|
+
direction: H.RIGHT,
|
|
773
|
+
range: i
|
|
701
774
|
});
|
|
702
775
|
else {
|
|
703
|
-
const
|
|
776
|
+
const p = [
|
|
704
777
|
{
|
|
705
|
-
startOffset:
|
|
706
|
-
endOffset:
|
|
707
|
-
style:
|
|
778
|
+
startOffset: c,
|
|
779
|
+
endOffset: c,
|
|
780
|
+
style: g
|
|
708
781
|
}
|
|
709
782
|
];
|
|
710
|
-
|
|
783
|
+
l = await r.executeCommand(ye.id, {
|
|
711
784
|
unitId: d.getUnitId(),
|
|
712
|
-
range:
|
|
713
|
-
segmentId:
|
|
714
|
-
direction:
|
|
715
|
-
textRanges:
|
|
716
|
-
len:
|
|
785
|
+
range: i,
|
|
786
|
+
segmentId: h,
|
|
787
|
+
direction: H.RIGHT,
|
|
788
|
+
textRanges: p,
|
|
789
|
+
len: m.count
|
|
717
790
|
});
|
|
718
791
|
}
|
|
719
792
|
} else {
|
|
720
|
-
const
|
|
721
|
-
|
|
722
|
-
segmentId:
|
|
723
|
-
textRanges:
|
|
793
|
+
const m = _t(i, o);
|
|
794
|
+
l = await r.executeCommand(pt.id, {
|
|
795
|
+
segmentId: h,
|
|
796
|
+
textRanges: m
|
|
724
797
|
});
|
|
725
798
|
}
|
|
726
|
-
return
|
|
799
|
+
return l;
|
|
727
800
|
}
|
|
728
|
-
},
|
|
801
|
+
}, Xe = {
|
|
729
802
|
id: "doc.command.merge-two-paragraph",
|
|
730
|
-
type:
|
|
731
|
-
handler: async (
|
|
732
|
-
var
|
|
733
|
-
const t =
|
|
734
|
-
|
|
803
|
+
type: C.COMMAND,
|
|
804
|
+
handler: async (s, e) => {
|
|
805
|
+
var P, T, D;
|
|
806
|
+
const t = s.get(w), n = s.get(y), r = s.get(b);
|
|
807
|
+
s.get(Re);
|
|
808
|
+
const { direction: i, range: o } = e, a = t.getActiveRange(), l = t.getSelections();
|
|
809
|
+
if (a == null || l == null)
|
|
735
810
|
return !1;
|
|
736
|
-
const
|
|
737
|
-
if (!
|
|
811
|
+
const d = n.getCurrentUniverDocInstance(), { startOffset: c, collapsed: u, segmentId: h, style: g } = a;
|
|
812
|
+
if (!u)
|
|
738
813
|
return !1;
|
|
739
|
-
const f =
|
|
814
|
+
const f = i === H.LEFT ? c : c + 1, m = (D = (T = (P = d.getBody()) == null ? void 0 : P.paragraphs) == null ? void 0 : T.find((M) => M.startIndex >= f)) == null ? void 0 : D.startIndex, p = mn(d.getBody(), f, m), _ = i === H.LEFT ? c - 1 : c, S = d.getUnitId(), I = [
|
|
740
815
|
{
|
|
741
|
-
startOffset:
|
|
742
|
-
endOffset:
|
|
743
|
-
style:
|
|
816
|
+
startOffset: _,
|
|
817
|
+
endOffset: _,
|
|
818
|
+
style: g
|
|
744
819
|
}
|
|
745
|
-
],
|
|
746
|
-
id:
|
|
820
|
+
], R = {
|
|
821
|
+
id: L.id,
|
|
747
822
|
params: {
|
|
748
|
-
unitId:
|
|
749
|
-
|
|
823
|
+
unitId: S,
|
|
824
|
+
actions: [],
|
|
825
|
+
textRanges: I,
|
|
826
|
+
prevTextRanges: [o]
|
|
750
827
|
}
|
|
751
|
-
},
|
|
752
|
-
|
|
753
|
-
t:
|
|
754
|
-
len:
|
|
755
|
-
segmentId:
|
|
756
|
-
}),
|
|
757
|
-
t:
|
|
758
|
-
body:
|
|
759
|
-
len:
|
|
828
|
+
}, O = new A();
|
|
829
|
+
return O.push({
|
|
830
|
+
t: x.RETAIN,
|
|
831
|
+
len: i === H.LEFT ? c - 1 : c,
|
|
832
|
+
segmentId: h
|
|
833
|
+
}), p.dataStream.length && O.push({
|
|
834
|
+
t: x.INSERT,
|
|
835
|
+
body: p,
|
|
836
|
+
len: p.dataStream.length,
|
|
760
837
|
line: 0,
|
|
761
|
-
segmentId:
|
|
762
|
-
}),
|
|
763
|
-
t:
|
|
838
|
+
segmentId: h
|
|
839
|
+
}), O.push({
|
|
840
|
+
t: x.RETAIN,
|
|
764
841
|
len: 1,
|
|
765
|
-
segmentId:
|
|
766
|
-
}),
|
|
767
|
-
t:
|
|
842
|
+
segmentId: h
|
|
843
|
+
}), O.push({
|
|
844
|
+
t: x.DELETE,
|
|
768
845
|
len: m + 1 - f,
|
|
769
846
|
line: 0,
|
|
770
|
-
segmentId:
|
|
771
|
-
}),
|
|
772
|
-
const P = r.syncExecuteCommand(C.id, C.params);
|
|
773
|
-
return t.replaceTextRanges(T), P ? (s.pushUndoRedo({
|
|
774
|
-
unitID: b,
|
|
775
|
-
undoMutations: [{ id: _.id, params: P }],
|
|
776
|
-
redoMutations: [{ id: _.id, params: C.params }],
|
|
777
|
-
undo() {
|
|
778
|
-
return r.syncExecuteCommand(_.id, P), t.replaceTextRanges([a]), !0;
|
|
779
|
-
},
|
|
780
|
-
redo() {
|
|
781
|
-
return r.syncExecuteCommand(_.id, C.params), t.replaceTextRanges(T), !0;
|
|
782
|
-
}
|
|
783
|
-
}), !0) : !1;
|
|
847
|
+
segmentId: h
|
|
848
|
+
}), R.params.actions = O.serialize(), !!r.syncExecuteCommand(R.id, R.params);
|
|
784
849
|
}
|
|
785
850
|
};
|
|
786
|
-
function
|
|
787
|
-
const { textRuns: n } =
|
|
851
|
+
function mn(s, e, t) {
|
|
852
|
+
const { textRuns: n } = s, r = s.dataStream.substring(e, t);
|
|
788
853
|
if (n == null)
|
|
789
854
|
return {
|
|
790
855
|
dataStream: r
|
|
791
856
|
};
|
|
792
|
-
const
|
|
857
|
+
const i = [];
|
|
793
858
|
for (const o of n) {
|
|
794
|
-
const { st: a, ed:
|
|
795
|
-
|
|
859
|
+
const { st: a, ed: l } = o;
|
|
860
|
+
l <= e || a >= t || (a < e ? i.push({
|
|
796
861
|
...o,
|
|
797
862
|
st: 0,
|
|
798
|
-
ed:
|
|
799
|
-
}) :
|
|
863
|
+
ed: l - e
|
|
864
|
+
}) : l > t ? i.push({
|
|
800
865
|
...o,
|
|
801
866
|
st: a - e,
|
|
802
867
|
ed: t - e
|
|
803
|
-
}) :
|
|
868
|
+
}) : i.push({
|
|
804
869
|
...o,
|
|
805
870
|
st: a - e,
|
|
806
|
-
ed:
|
|
871
|
+
ed: l - e
|
|
807
872
|
}));
|
|
808
873
|
}
|
|
809
874
|
return {
|
|
810
875
|
dataStream: r,
|
|
811
|
-
textRuns:
|
|
876
|
+
textRuns: i
|
|
812
877
|
};
|
|
813
878
|
}
|
|
814
|
-
function
|
|
815
|
-
let t =
|
|
879
|
+
function _t(s, e) {
|
|
880
|
+
let t = s.endOffset;
|
|
816
881
|
for (const r of e) {
|
|
817
|
-
const { startOffset:
|
|
818
|
-
|
|
882
|
+
const { startOffset: i, endOffset: o } = r;
|
|
883
|
+
i == null || o == null || o <= s.endOffset && (t -= o - i);
|
|
819
884
|
}
|
|
820
885
|
return [
|
|
821
886
|
{
|
|
822
887
|
startOffset: t,
|
|
823
888
|
endOffset: t,
|
|
824
|
-
style:
|
|
889
|
+
style: s.style
|
|
825
890
|
}
|
|
826
891
|
];
|
|
827
892
|
}
|
|
828
|
-
|
|
829
|
-
constructor() {
|
|
830
|
-
S(this, "_previousActiveRange", null);
|
|
831
|
-
S(this, "_undoMutationParamsCache", []);
|
|
832
|
-
S(this, "_redoMutationParamsCache", []);
|
|
833
|
-
}
|
|
834
|
-
clearUndoRedoMutationParamsCache() {
|
|
835
|
-
this._undoMutationParamsCache = [], this._redoMutationParamsCache = [];
|
|
836
|
-
}
|
|
837
|
-
setActiveRange(e) {
|
|
838
|
-
this._previousActiveRange = e;
|
|
839
|
-
}
|
|
840
|
-
pushUndoRedoMutationParams(e, t) {
|
|
841
|
-
this._undoMutationParamsCache.push(e), this._redoMutationParamsCache.push(t);
|
|
842
|
-
}
|
|
843
|
-
fetchComposedUndoRedoMutationParams(e) {
|
|
844
|
-
if (this._undoMutationParamsCache.length === 0 || this._previousActiveRange == null)
|
|
845
|
-
return null;
|
|
846
|
-
const { unitId: t } = this._undoMutationParamsCache[0], { segmentId: n, startOffset: r, collapsed: s } = this._previousActiveRange, o = {
|
|
847
|
-
unitId: t,
|
|
848
|
-
mutations: []
|
|
849
|
-
}, a = {
|
|
850
|
-
unitId: t,
|
|
851
|
-
mutations: []
|
|
852
|
-
};
|
|
853
|
-
return s ? (o.mutations.push({
|
|
854
|
-
t: "r",
|
|
855
|
-
len: r,
|
|
856
|
-
segmentId: n
|
|
857
|
-
}), a.mutations.push({
|
|
858
|
-
t: "r",
|
|
859
|
-
len: r,
|
|
860
|
-
segmentId: n
|
|
861
|
-
})) : (r > 0 && o.mutations.push({
|
|
862
|
-
t: "r",
|
|
863
|
-
len: r,
|
|
864
|
-
segmentId: n
|
|
865
|
-
}), o.mutations.push(this._undoMutationParamsCache[0].mutations.find((c) => c.t === "i")), a.mutations.push(...Be(this._previousActiveRange, n))), e.length && (o.mutations.push({
|
|
866
|
-
t: "d",
|
|
867
|
-
len: e.length,
|
|
868
|
-
line: 0,
|
|
869
|
-
segmentId: n
|
|
870
|
-
}), a.mutations.push({
|
|
871
|
-
t: "i",
|
|
872
|
-
body: {
|
|
873
|
-
dataStream: e
|
|
874
|
-
},
|
|
875
|
-
len: e.length,
|
|
876
|
-
line: 0,
|
|
877
|
-
segmentId: n
|
|
878
|
-
})), { redoMutationParams: a, undoMutationParams: o, previousActiveRange: this._previousActiveRange };
|
|
879
|
-
}
|
|
880
|
-
dispose() {
|
|
881
|
-
this._undoMutationParamsCache = [], this._redoMutationParamsCache = [], this._previousActiveRange = null;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
const Lt = {
|
|
893
|
+
const St = {
|
|
885
894
|
id: "doc.command.ime-input",
|
|
886
|
-
type:
|
|
887
|
-
handler: async (
|
|
888
|
-
const { unitId: t, newText: n, oldTextLen: r,
|
|
889
|
-
|
|
895
|
+
type: C.COMMAND,
|
|
896
|
+
handler: async (s, e) => {
|
|
897
|
+
const { unitId: t, newText: n, oldTextLen: r, isCompositionEnd: i, isCompositionStart: o } = e, a = s.get(b), l = s.get(xe), d = l.getActiveRange();
|
|
898
|
+
if (d == null)
|
|
899
|
+
return !1;
|
|
900
|
+
const { startOffset: c, style: u, segmentId: h } = d, g = n.length, f = [
|
|
901
|
+
{
|
|
902
|
+
startOffset: c + g,
|
|
903
|
+
endOffset: c + g,
|
|
904
|
+
collapsed: !0,
|
|
905
|
+
style: u
|
|
906
|
+
}
|
|
907
|
+
], m = {
|
|
908
|
+
id: L.id,
|
|
890
909
|
params: {
|
|
891
910
|
unitId: t,
|
|
892
|
-
|
|
911
|
+
actions: [],
|
|
912
|
+
textRanges: f
|
|
893
913
|
}
|
|
894
|
-
}, p = new
|
|
895
|
-
|
|
896
|
-
t:
|
|
897
|
-
len:
|
|
898
|
-
segmentId:
|
|
899
|
-
})
|
|
900
|
-
t:
|
|
914
|
+
}, p = new A();
|
|
915
|
+
!d.collapsed && o ? p.push(...We(d, h)) : p.push({
|
|
916
|
+
t: x.RETAIN,
|
|
917
|
+
len: c,
|
|
918
|
+
segmentId: h
|
|
919
|
+
}), r > 0 && p.push({
|
|
920
|
+
t: x.DELETE,
|
|
901
921
|
len: r,
|
|
902
922
|
line: 0,
|
|
903
|
-
segmentId:
|
|
923
|
+
segmentId: h
|
|
904
924
|
}), p.push({
|
|
905
|
-
t:
|
|
925
|
+
t: x.INSERT,
|
|
906
926
|
body: {
|
|
907
927
|
dataStream: n
|
|
908
928
|
},
|
|
909
929
|
len: n.length,
|
|
910
930
|
line: 0,
|
|
911
|
-
segmentId:
|
|
912
|
-
}),
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
if (f) {
|
|
916
|
-
const m = g.fetchComposedUndoRedoMutationParams(n);
|
|
917
|
-
if (m == null)
|
|
918
|
-
return !1;
|
|
919
|
-
const { undoMutationParams: v, redoMutationParams: M, previousActiveRange: b } = m;
|
|
920
|
-
return l.pushUndoRedo({
|
|
921
|
-
unitID: t,
|
|
922
|
-
undoMutations: [{ id: _.id, params: v }],
|
|
923
|
-
redoMutations: [{ id: _.id, params: M }],
|
|
924
|
-
undo() {
|
|
925
|
-
return d.syncExecuteCommand(_.id, v), h.replaceTextRanges([b]), !0;
|
|
926
|
-
},
|
|
927
|
-
redo() {
|
|
928
|
-
return d.syncExecuteCommand(_.id, M), h.replaceTextRanges(a), !0;
|
|
929
|
-
}
|
|
930
|
-
}), !0;
|
|
931
|
-
}
|
|
932
|
-
} else
|
|
933
|
-
return !!f;
|
|
934
|
-
return !1;
|
|
931
|
+
segmentId: h
|
|
932
|
+
}), m.params.actions = p.serialize(), m.params.noHistory = !i, m.params.isCompositionEnd = i;
|
|
933
|
+
const _ = a.syncExecuteCommand(m.id, m.params);
|
|
934
|
+
return l.pushUndoRedoMutationParams(_, m.params), !!_;
|
|
935
935
|
}
|
|
936
|
-
},
|
|
936
|
+
}, Te = {
|
|
937
937
|
id: "doc.command.set-inline-format-bold",
|
|
938
|
-
type:
|
|
938
|
+
type: C.COMMAND,
|
|
939
939
|
handler: async () => !0
|
|
940
|
-
},
|
|
940
|
+
}, De = {
|
|
941
941
|
id: "doc.command.set-inline-format-italic",
|
|
942
|
-
type:
|
|
942
|
+
type: C.COMMAND,
|
|
943
943
|
handler: async () => !0
|
|
944
|
-
},
|
|
944
|
+
}, Pe = {
|
|
945
945
|
id: "doc.command.set-inline-format-underline",
|
|
946
|
-
type:
|
|
946
|
+
type: C.COMMAND,
|
|
947
947
|
handler: async () => !0
|
|
948
|
-
},
|
|
948
|
+
}, Ee = {
|
|
949
949
|
id: "doc.command.set-inline-format-strikethrough",
|
|
950
|
-
type:
|
|
950
|
+
type: C.COMMAND,
|
|
951
951
|
handler: async () => !0
|
|
952
952
|
}, Q = {
|
|
953
953
|
id: "doc.command.set-inline-format-subscript",
|
|
954
|
-
type:
|
|
954
|
+
type: C.COMMAND,
|
|
955
955
|
handler: async () => !0
|
|
956
|
-
},
|
|
956
|
+
}, we = {
|
|
957
957
|
id: "doc.command.set-inline-format-superscript",
|
|
958
|
-
type:
|
|
958
|
+
type: C.COMMAND,
|
|
959
959
|
handler: async () => !0
|
|
960
|
-
},
|
|
960
|
+
}, Ue = {
|
|
961
961
|
id: "doc.command.set-inline-format-fontsize",
|
|
962
|
-
type:
|
|
962
|
+
type: C.COMMAND,
|
|
963
963
|
handler: async () => !0
|
|
964
|
-
},
|
|
964
|
+
}, Ne = {
|
|
965
965
|
id: "doc.command.set-inline-format-font-family",
|
|
966
|
-
type:
|
|
966
|
+
type: C.COMMAND,
|
|
967
967
|
handler: async () => !0
|
|
968
|
-
},
|
|
968
|
+
}, Ae = {
|
|
969
969
|
id: "doc.command.set-inline-format-text-color",
|
|
970
|
-
type:
|
|
970
|
+
type: C.COMMAND,
|
|
971
971
|
handler: async () => !0
|
|
972
|
-
},
|
|
973
|
-
[
|
|
974
|
-
[
|
|
975
|
-
[
|
|
976
|
-
[
|
|
977
|
-
[
|
|
978
|
-
[
|
|
979
|
-
[
|
|
972
|
+
}, vt = {
|
|
973
|
+
[Te.id]: "bl",
|
|
974
|
+
[De.id]: "it",
|
|
975
|
+
[Pe.id]: "ul",
|
|
976
|
+
[Ee.id]: "st",
|
|
977
|
+
[Ue.id]: "fs",
|
|
978
|
+
[Ne.id]: "ff",
|
|
979
|
+
[Ae.id]: "cl",
|
|
980
980
|
[Q.id]: "va",
|
|
981
|
-
[
|
|
982
|
-
},
|
|
981
|
+
[we.id]: "va"
|
|
982
|
+
}, Mt = {
|
|
983
983
|
id: "doc.command.set-inline-format",
|
|
984
|
-
type:
|
|
985
|
-
handler: async (
|
|
986
|
-
const { segmentId: t, value: n, preCommandId: r } = e,
|
|
987
|
-
if (!Array.isArray(
|
|
984
|
+
type: C.COMMAND,
|
|
985
|
+
handler: async (s, e) => {
|
|
986
|
+
const { segmentId: t, value: n, preCommandId: r } = e, i = s.get(b), o = s.get(w), a = s.get(y), l = o.getSelections();
|
|
987
|
+
if (!Array.isArray(l) || l.length === 0)
|
|
988
988
|
return !1;
|
|
989
|
-
let
|
|
990
|
-
|
|
991
|
-
let
|
|
989
|
+
let d = a.getCurrentUniverDocInstance(), c = d.getUnitId();
|
|
990
|
+
c === q && (d = a.getUniverDocInstance(Y), c = d.getUnitId());
|
|
991
|
+
let u;
|
|
992
992
|
switch (r) {
|
|
993
|
-
case
|
|
994
|
-
case
|
|
995
|
-
case
|
|
996
|
-
case
|
|
993
|
+
case Te.id:
|
|
994
|
+
case De.id:
|
|
995
|
+
case Pe.id:
|
|
996
|
+
case Ee.id:
|
|
997
997
|
case Q.id:
|
|
998
|
-
case
|
|
999
|
-
|
|
1000
|
-
|
|
998
|
+
case we.id: {
|
|
999
|
+
u = pn(
|
|
1000
|
+
d.getBody().textRuns,
|
|
1001
1001
|
r,
|
|
1002
|
-
|
|
1002
|
+
l
|
|
1003
1003
|
);
|
|
1004
1004
|
break;
|
|
1005
1005
|
}
|
|
1006
|
-
case
|
|
1007
|
-
case
|
|
1008
|
-
|
|
1006
|
+
case Ue.id:
|
|
1007
|
+
case Ne.id: {
|
|
1008
|
+
u = n;
|
|
1009
1009
|
break;
|
|
1010
1010
|
}
|
|
1011
|
-
case
|
|
1012
|
-
|
|
1011
|
+
case Ae.id: {
|
|
1012
|
+
u = {
|
|
1013
1013
|
rgb: n
|
|
1014
1014
|
};
|
|
1015
1015
|
break;
|
|
@@ -1017,278 +1017,231 @@ const Lt = {
|
|
|
1017
1017
|
default:
|
|
1018
1018
|
throw new Error(`Unknown command: ${r} in handleInlineFormat`);
|
|
1019
1019
|
}
|
|
1020
|
-
const
|
|
1021
|
-
id:
|
|
1020
|
+
const h = {
|
|
1021
|
+
id: L.id,
|
|
1022
1022
|
params: {
|
|
1023
|
-
unitId:
|
|
1024
|
-
|
|
1023
|
+
unitId: c,
|
|
1024
|
+
actions: [],
|
|
1025
|
+
textRanges: l
|
|
1025
1026
|
}
|
|
1026
|
-
},
|
|
1027
|
+
}, g = new A(), f = new Oe();
|
|
1027
1028
|
f.reset();
|
|
1028
|
-
for (const
|
|
1029
|
-
const { startOffset:
|
|
1029
|
+
for (const p of l) {
|
|
1030
|
+
const { startOffset: _, endOffset: S } = p, I = {
|
|
1030
1031
|
dataStream: "",
|
|
1031
1032
|
textRuns: [
|
|
1032
1033
|
{
|
|
1033
1034
|
st: 0,
|
|
1034
|
-
ed:
|
|
1035
|
+
ed: S - _,
|
|
1035
1036
|
ts: {
|
|
1036
|
-
[
|
|
1037
|
+
[vt[r]]: u
|
|
1037
1038
|
}
|
|
1038
1039
|
}
|
|
1039
1040
|
]
|
|
1040
|
-
},
|
|
1041
|
-
|
|
1042
|
-
t:
|
|
1043
|
-
len:
|
|
1041
|
+
}, R = _ - f.cursor;
|
|
1042
|
+
R !== 0 && g.push({
|
|
1043
|
+
t: x.RETAIN,
|
|
1044
|
+
len: R,
|
|
1044
1045
|
segmentId: t
|
|
1045
|
-
}),
|
|
1046
|
-
t:
|
|
1047
|
-
body:
|
|
1048
|
-
len:
|
|
1046
|
+
}), g.push({
|
|
1047
|
+
t: x.RETAIN,
|
|
1048
|
+
body: I,
|
|
1049
|
+
len: S - _,
|
|
1049
1050
|
segmentId: t
|
|
1050
|
-
}), f.reset(), f.moveCursor(
|
|
1051
|
+
}), f.reset(), f.moveCursor(S);
|
|
1051
1052
|
}
|
|
1052
|
-
|
|
1053
|
-
const m = o.syncExecuteCommand(u.id, u.params), v = [
|
|
1054
|
-
he.id,
|
|
1055
|
-
ge.id,
|
|
1056
|
-
pe.id,
|
|
1057
|
-
Q.id,
|
|
1058
|
-
oe.id
|
|
1059
|
-
];
|
|
1060
|
-
return v.includes(r) && a.refreshSelection(), m ? (s.pushUndoRedo({
|
|
1061
|
-
unitID: h,
|
|
1062
|
-
undoMutations: [{ id: _.id, params: m }],
|
|
1063
|
-
redoMutations: [{ id: _.id, params: u.params }],
|
|
1064
|
-
undo() {
|
|
1065
|
-
return o.syncExecuteCommand(_.id, m), v.includes(r) && a.refreshSelection(), !0;
|
|
1066
|
-
},
|
|
1067
|
-
redo() {
|
|
1068
|
-
return o.syncExecuteCommand(_.id, u.params), v.includes(r) && a.refreshSelection(), !0;
|
|
1069
|
-
}
|
|
1070
|
-
}), !0) : !1;
|
|
1053
|
+
return h.params.actions = g.serialize(), !!i.syncExecuteCommand(h.id, h.params);
|
|
1071
1054
|
}
|
|
1072
1055
|
};
|
|
1073
|
-
function
|
|
1074
|
-
return
|
|
1056
|
+
function fn(s) {
|
|
1057
|
+
return s !== null && typeof s == "object";
|
|
1075
1058
|
}
|
|
1076
|
-
function
|
|
1059
|
+
function pn(s, e, t) {
|
|
1077
1060
|
let n = 0, r = 0;
|
|
1078
|
-
const
|
|
1079
|
-
for (; n !==
|
|
1080
|
-
const { startOffset: o, endOffset: a } = t[r], { st:
|
|
1081
|
-
if (a <=
|
|
1061
|
+
const i = vt[e];
|
|
1062
|
+
for (; n !== s.length && r !== t.length; ) {
|
|
1063
|
+
const { startOffset: o, endOffset: a } = t[r], { st: l, ed: d, ts: c } = s[n];
|
|
1064
|
+
if (a <= l)
|
|
1082
1065
|
r++;
|
|
1083
1066
|
else if (d <= o)
|
|
1084
1067
|
n++;
|
|
1085
1068
|
else {
|
|
1086
|
-
if ((
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
if (/va/.test(s))
|
|
1094
|
-
return e === Q.id ? V.SUBSCRIPT : V.SUPERSCRIPT;
|
|
1095
|
-
}
|
|
1096
|
-
if (Fn(l == null ? void 0 : l[s]) && l[s].s === E.FALSE)
|
|
1097
|
-
return {
|
|
1098
|
-
s: E.TRUE
|
|
1069
|
+
if (/bl|it/.test(i))
|
|
1070
|
+
return (c == null ? void 0 : c[i]) === V.TRUE ? V.FALSE : V.TRUE;
|
|
1071
|
+
if (/ul|st/.test(i))
|
|
1072
|
+
return fn(c == null ? void 0 : c[i]) && (c == null ? void 0 : c[i]).s === V.TRUE ? {
|
|
1073
|
+
s: V.FALSE
|
|
1074
|
+
} : {
|
|
1075
|
+
s: V.TRUE
|
|
1099
1076
|
};
|
|
1100
|
-
if (
|
|
1101
|
-
return
|
|
1102
|
-
if (e === oe.id && (l == null ? void 0 : l[s]) !== V.SUPERSCRIPT)
|
|
1103
|
-
return V.SUPERSCRIPT;
|
|
1104
|
-
if ((l == null ? void 0 : l[s]) === E.FALSE)
|
|
1105
|
-
return E.TRUE;
|
|
1077
|
+
if (/va/.test(i))
|
|
1078
|
+
return e === Q.id ? (c == null ? void 0 : c[i]) === k.SUBSCRIPT ? k.NORMAL : k.SUBSCRIPT : (c == null ? void 0 : c[i]) === k.SUPERSCRIPT ? k.NORMAL : k.SUPERSCRIPT;
|
|
1106
1079
|
n++;
|
|
1107
1080
|
}
|
|
1108
1081
|
}
|
|
1109
|
-
return /bl|it/.test(
|
|
1110
|
-
s:
|
|
1111
|
-
} :
|
|
1082
|
+
return /bl|it/.test(i) ? V.TRUE : /ul|st/.test(i) ? {
|
|
1083
|
+
s: V.TRUE
|
|
1084
|
+
} : e === Q.id ? k.SUBSCRIPT : k.SUPERSCRIPT;
|
|
1112
1085
|
}
|
|
1113
|
-
const
|
|
1114
|
-
id: "doc.command.bullet-list",
|
|
1115
|
-
type: I.COMMAND,
|
|
1116
|
-
handler: (i) => i.get(O).syncExecuteCommand(it.id, {
|
|
1117
|
-
listType: bt.BULLET_LIST
|
|
1118
|
-
})
|
|
1119
|
-
}, zn = {
|
|
1120
|
-
id: "doc.command.order-list",
|
|
1121
|
-
type: I.COMMAND,
|
|
1122
|
-
handler: (i) => i.get(O).syncExecuteCommand(it.id, {
|
|
1123
|
-
listType: bt.ORDER_LIST
|
|
1124
|
-
})
|
|
1125
|
-
}, it = {
|
|
1086
|
+
const Ge = {
|
|
1126
1087
|
id: "doc.command.list-operation",
|
|
1127
|
-
type:
|
|
1128
|
-
handler: (
|
|
1129
|
-
var
|
|
1130
|
-
const t =
|
|
1131
|
-
if (
|
|
1088
|
+
type: C.COMMAND,
|
|
1089
|
+
handler: (s, e) => {
|
|
1090
|
+
var O, N, P;
|
|
1091
|
+
const t = s.get(w), n = s.get(y), r = s.get(b), { listType: i } = e, o = n.getCurrentUniverDocInstance(), a = t.getActiveRange(), l = (O = t.getSelections()) != null ? O : [], d = (N = o.getBody()) == null ? void 0 : N.paragraphs, c = l.map(Ie);
|
|
1092
|
+
if (a == null || d == null)
|
|
1132
1093
|
return !1;
|
|
1133
|
-
const
|
|
1134
|
-
var
|
|
1135
|
-
return ((
|
|
1136
|
-
})
|
|
1137
|
-
let
|
|
1138
|
-
if (
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1094
|
+
const u = vn(a, d), { segmentId: h } = a, g = o.getUnitId(), f = u.every((T) => {
|
|
1095
|
+
var D;
|
|
1096
|
+
return ((D = T.bullet) == null ? void 0 : D.listType) === i;
|
|
1097
|
+
});
|
|
1098
|
+
let p = oe.generateRandomId(6);
|
|
1099
|
+
if (u.length === 1) {
|
|
1100
|
+
const T = d.indexOf(u[0]), D = d[T - 1], M = d[T + 1];
|
|
1101
|
+
D && D.bullet && D.bullet.listType === i ? p = D.bullet.listId : M && M.bullet && M.bullet.listType === i && (p = M.bullet.listId);
|
|
1141
1102
|
}
|
|
1142
|
-
const
|
|
1143
|
-
id:
|
|
1103
|
+
const _ = {
|
|
1104
|
+
id: L.id,
|
|
1144
1105
|
params: {
|
|
1145
1106
|
unitId: g,
|
|
1146
|
-
|
|
1107
|
+
actions: [],
|
|
1108
|
+
textRanges: c
|
|
1147
1109
|
}
|
|
1148
|
-
},
|
|
1149
|
-
|
|
1150
|
-
const
|
|
1151
|
-
for (const
|
|
1152
|
-
const { startIndex:
|
|
1153
|
-
|
|
1154
|
-
t:
|
|
1155
|
-
len:
|
|
1110
|
+
}, S = new Oe();
|
|
1111
|
+
S.reset();
|
|
1112
|
+
const I = new A();
|
|
1113
|
+
for (const T of u) {
|
|
1114
|
+
const { startIndex: D } = T;
|
|
1115
|
+
I.push({
|
|
1116
|
+
t: x.RETAIN,
|
|
1117
|
+
len: D - S.cursor,
|
|
1156
1118
|
segmentId: h
|
|
1157
1119
|
});
|
|
1158
|
-
const
|
|
1159
|
-
...
|
|
1120
|
+
const M = {
|
|
1121
|
+
...T.paragraphStyle,
|
|
1160
1122
|
hanging: void 0,
|
|
1161
1123
|
indentStart: void 0
|
|
1162
1124
|
};
|
|
1163
|
-
|
|
1164
|
-
t:
|
|
1125
|
+
I.push({
|
|
1126
|
+
t: x.RETAIN,
|
|
1165
1127
|
len: 1,
|
|
1166
1128
|
body: {
|
|
1167
1129
|
dataStream: "",
|
|
1168
1130
|
paragraphs: [
|
|
1169
|
-
|
|
1170
|
-
paragraphStyle:
|
|
1131
|
+
f ? {
|
|
1132
|
+
paragraphStyle: M,
|
|
1171
1133
|
startIndex: 0
|
|
1172
1134
|
} : {
|
|
1173
|
-
...
|
|
1135
|
+
...T,
|
|
1174
1136
|
startIndex: 0,
|
|
1175
1137
|
bullet: {
|
|
1176
|
-
...
|
|
1138
|
+
...(P = T.bullet) != null ? P : {
|
|
1177
1139
|
nestingLevel: 0,
|
|
1178
1140
|
textStyle: {
|
|
1179
1141
|
fs: 20
|
|
1180
1142
|
}
|
|
1181
1143
|
},
|
|
1182
|
-
listType:
|
|
1183
|
-
listId:
|
|
1144
|
+
listType: i,
|
|
1145
|
+
listId: p
|
|
1184
1146
|
}
|
|
1185
1147
|
}
|
|
1186
1148
|
]
|
|
1187
1149
|
},
|
|
1188
1150
|
segmentId: h,
|
|
1189
|
-
coverType:
|
|
1190
|
-
}),
|
|
1151
|
+
coverType: ut.REPLACE
|
|
1152
|
+
}), S.moveCursorTo(D + 1);
|
|
1191
1153
|
}
|
|
1192
|
-
|
|
1193
|
-
const b = r.syncExecuteCommand(m.id, m.params);
|
|
1194
|
-
return t.refreshSelection(), b && s.pushUndoRedo({
|
|
1195
|
-
unitID: g,
|
|
1196
|
-
undoMutations: [{ id: _.id, params: b }],
|
|
1197
|
-
redoMutations: [{ id: _.id, params: m.params }],
|
|
1198
|
-
undo() {
|
|
1199
|
-
return r.syncExecuteCommand(_.id, b), t.refreshSelection(), !0;
|
|
1200
|
-
},
|
|
1201
|
-
redo() {
|
|
1202
|
-
return r.syncExecuteCommand(_.id, m.params), t.refreshSelection(), !0;
|
|
1203
|
-
}
|
|
1204
|
-
}), !0;
|
|
1154
|
+
return _.params.actions = I.serialize(), !!r.syncExecuteCommand(_.id, _.params);
|
|
1205
1155
|
}
|
|
1156
|
+
}, _n = {
|
|
1157
|
+
id: "doc.command.bullet-list",
|
|
1158
|
+
type: C.COMMAND,
|
|
1159
|
+
handler: (s) => s.get(b).syncExecuteCommand(Ge.id, {
|
|
1160
|
+
listType: ht.BULLET_LIST
|
|
1161
|
+
})
|
|
1162
|
+
}, Sn = {
|
|
1163
|
+
id: "doc.command.order-list",
|
|
1164
|
+
type: C.COMMAND,
|
|
1165
|
+
handler: (s) => s.get(b).syncExecuteCommand(Ge.id, {
|
|
1166
|
+
listType: ht.ORDER_LIST
|
|
1167
|
+
})
|
|
1206
1168
|
};
|
|
1207
|
-
function
|
|
1208
|
-
const { startOffset: t, endOffset: n } =
|
|
1209
|
-
let
|
|
1169
|
+
function vn(s, e) {
|
|
1170
|
+
const { startOffset: t, endOffset: n } = s, r = [];
|
|
1171
|
+
let i = -1;
|
|
1210
1172
|
for (const o of e) {
|
|
1211
1173
|
const { startIndex: a } = o;
|
|
1212
|
-
(t >
|
|
1174
|
+
(t > i && t <= a || n > i && n <= a || a >= t && a <= n) && r.push(o), i = a;
|
|
1213
1175
|
}
|
|
1214
1176
|
return r;
|
|
1215
1177
|
}
|
|
1216
|
-
const
|
|
1178
|
+
const Mn = {
|
|
1217
1179
|
id: "doc.command-replace-content",
|
|
1218
|
-
type:
|
|
1219
|
-
handler: async (
|
|
1220
|
-
var
|
|
1221
|
-
const { unitId: t, body: n, textRanges: r, segmentId:
|
|
1222
|
-
if (
|
|
1180
|
+
type: C.COMMAND,
|
|
1181
|
+
handler: async (s, e) => {
|
|
1182
|
+
var g;
|
|
1183
|
+
const { unitId: t, body: n, textRanges: r, segmentId: i = "" } = e, o = s.get(y), a = s.get(b), l = s.get(w), d = (g = o.getUniverDocInstance(t)) == null ? void 0 : g.getSnapshot().body, c = l.getSelections();
|
|
1184
|
+
if (d == null || !Array.isArray(c) || c.length === 0)
|
|
1223
1185
|
return !1;
|
|
1224
|
-
const
|
|
1225
|
-
return
|
|
1226
|
-
unitID: t,
|
|
1227
|
-
undoMutations: [{ id: _.id, params: u }],
|
|
1228
|
-
redoMutations: [{ id: _.id, params: g.params }],
|
|
1229
|
-
undo() {
|
|
1230
|
-
return a.syncExecuteCommand(_.id, u), c.replaceTextRanges(h), !0;
|
|
1231
|
-
},
|
|
1232
|
-
redo() {
|
|
1233
|
-
return a.syncExecuteCommand(_.id, g.params), c.replaceTextRanges(r), !0;
|
|
1234
|
-
}
|
|
1235
|
-
}), !0) : !1;
|
|
1186
|
+
const u = It(t, i, d, n);
|
|
1187
|
+
return u.params.textRanges = r, !!a.syncExecuteCommand(u.id, u.params);
|
|
1236
1188
|
}
|
|
1237
|
-
},
|
|
1189
|
+
}, In = {
|
|
1238
1190
|
id: "doc.command-cover-content",
|
|
1239
|
-
type:
|
|
1240
|
-
handler: async (
|
|
1241
|
-
var
|
|
1242
|
-
const { unitId: t, body: n, segmentId: r = "" } = e,
|
|
1243
|
-
if (
|
|
1191
|
+
type: C.COMMAND,
|
|
1192
|
+
handler: async (s, e) => {
|
|
1193
|
+
var c;
|
|
1194
|
+
const { unitId: t, body: n, segmentId: r = "" } = e, i = s.get(y), o = s.get(b), a = s.get(Re), l = (c = i.getUniverDocInstance(t)) == null ? void 0 : c.getSnapshot().body;
|
|
1195
|
+
if (l == null)
|
|
1244
1196
|
return !1;
|
|
1245
|
-
const d =
|
|
1246
|
-
return o.syncExecuteCommand(
|
|
1197
|
+
const d = It(t, r, l, n);
|
|
1198
|
+
return d.params.noNeedSetTextRange = !0, d.params.noHistory = !0, o.syncExecuteCommand(
|
|
1247
1199
|
d.id,
|
|
1248
1200
|
d.params
|
|
1249
1201
|
), a.clearUndoRedo(t), !0;
|
|
1250
1202
|
}
|
|
1251
1203
|
};
|
|
1252
|
-
function
|
|
1204
|
+
function It(s, e, t, n) {
|
|
1253
1205
|
const r = {
|
|
1254
|
-
id:
|
|
1206
|
+
id: L.id,
|
|
1255
1207
|
params: {
|
|
1256
|
-
unitId:
|
|
1257
|
-
|
|
1208
|
+
unitId: s,
|
|
1209
|
+
actions: [],
|
|
1210
|
+
textRanges: []
|
|
1258
1211
|
}
|
|
1259
|
-
},
|
|
1260
|
-
return o > 0 &&
|
|
1261
|
-
t:
|
|
1212
|
+
}, i = new A(), o = (t == null ? void 0 : t.dataStream.length) - 2;
|
|
1213
|
+
return o > 0 && i.push({
|
|
1214
|
+
t: x.DELETE,
|
|
1262
1215
|
len: o,
|
|
1263
1216
|
line: 0,
|
|
1264
1217
|
segmentId: e
|
|
1265
|
-
}), n.dataStream.length > 0 &&
|
|
1266
|
-
t:
|
|
1218
|
+
}), n.dataStream.length > 0 && i.push({
|
|
1219
|
+
t: x.INSERT,
|
|
1267
1220
|
body: n,
|
|
1268
1221
|
len: n.dataStream.length,
|
|
1269
1222
|
line: 0,
|
|
1270
1223
|
segmentId: e
|
|
1271
|
-
}), r.params.
|
|
1224
|
+
}), r.params.actions = i.serialize(), r;
|
|
1272
1225
|
}
|
|
1273
|
-
const
|
|
1226
|
+
const ze = {
|
|
1274
1227
|
id: "doc.operation.move-cursor",
|
|
1275
|
-
type:
|
|
1276
|
-
handler: (
|
|
1277
|
-
},
|
|
1228
|
+
type: C.OPERATION,
|
|
1229
|
+
handler: (s, e) => !!e
|
|
1230
|
+
}, Ve = {
|
|
1278
1231
|
id: "doc.operation.move-selection",
|
|
1279
|
-
type:
|
|
1280
|
-
handler: (
|
|
1281
|
-
},
|
|
1282
|
-
const t =
|
|
1232
|
+
type: C.OPERATION,
|
|
1233
|
+
handler: (s, e) => !!e
|
|
1234
|
+
}, Cn = (s, e) => {
|
|
1235
|
+
const t = s.get(y).getUniverDocInstance(e.unitId), n = (t == null ? void 0 : t.zoomRatio) || 1;
|
|
1283
1236
|
return {
|
|
1284
|
-
...
|
|
1237
|
+
...oe.deepClone(e),
|
|
1285
1238
|
zoomRatio: n
|
|
1286
1239
|
};
|
|
1287
|
-
},
|
|
1240
|
+
}, G = {
|
|
1288
1241
|
id: "doc.operation.set-zoom-ratio",
|
|
1289
|
-
type:
|
|
1290
|
-
handler: (
|
|
1291
|
-
const t =
|
|
1242
|
+
type: C.OPERATION,
|
|
1243
|
+
handler: (s, e) => {
|
|
1244
|
+
const t = s.get(y).getUniverDocInstance(e.unitId);
|
|
1292
1245
|
if (!t)
|
|
1293
1246
|
return !1;
|
|
1294
1247
|
const n = t.getSnapshot();
|
|
@@ -1296,29 +1249,30 @@ const ee = {
|
|
|
1296
1249
|
zoomRatio: e.zoomRatio
|
|
1297
1250
|
} : n.settings.zoomRatio = e.zoomRatio, !0;
|
|
1298
1251
|
}
|
|
1299
|
-
},
|
|
1300
|
-
type:
|
|
1252
|
+
}, Ct = {
|
|
1253
|
+
type: C.COMMAND,
|
|
1301
1254
|
id: "doc.command.set-zoom-ratio",
|
|
1302
|
-
handler: async (
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1255
|
+
handler: async (s, e) => {
|
|
1256
|
+
var u, h;
|
|
1257
|
+
const t = s.get(b), n = s.get(Re), r = s.get(y);
|
|
1258
|
+
let i = r.getCurrentUniverDocInstance().getUnitId(), o = 1;
|
|
1259
|
+
if (e && (i = (u = e.documentId) != null ? u : i, o = (h = e.zoomRatio) != null ? h : o), !r.getUniverDocInstance(i))
|
|
1306
1260
|
return !1;
|
|
1307
|
-
const
|
|
1261
|
+
const l = {
|
|
1308
1262
|
zoomRatio: o,
|
|
1309
|
-
unitId:
|
|
1310
|
-
}, d =
|
|
1311
|
-
return t.syncExecuteCommand(
|
|
1312
|
-
unitID:
|
|
1313
|
-
undoMutations: [{ id:
|
|
1314
|
-
redoMutations: [{ id:
|
|
1263
|
+
unitId: i
|
|
1264
|
+
}, d = Cn(s, l);
|
|
1265
|
+
return t.syncExecuteCommand(G.id, l) ? (n.pushUndoRedo({
|
|
1266
|
+
unitID: i,
|
|
1267
|
+
undoMutations: [{ id: G.id, params: d }],
|
|
1268
|
+
redoMutations: [{ id: G.id, params: l }]
|
|
1315
1269
|
}), !0) : !1;
|
|
1316
1270
|
}
|
|
1317
|
-
},
|
|
1271
|
+
}, Rn = {
|
|
1318
1272
|
id: "doc.operation.select-all",
|
|
1319
|
-
type:
|
|
1320
|
-
handler: async (
|
|
1321
|
-
const e =
|
|
1273
|
+
type: C.COMMAND,
|
|
1274
|
+
handler: async (s) => {
|
|
1275
|
+
const e = s.get(y), t = s.get(w), n = e.getCurrentUniverDocInstance().getSnapshot().body;
|
|
1322
1276
|
if (n == null)
|
|
1323
1277
|
return !1;
|
|
1324
1278
|
const r = [
|
|
@@ -1329,538 +1283,78 @@ const ee = {
|
|
|
1329
1283
|
];
|
|
1330
1284
|
return t.replaceTextRanges(r), !0;
|
|
1331
1285
|
}
|
|
1332
|
-
}, Yn = 10, qn = 6;
|
|
1333
|
-
function Zn() {
|
|
1334
|
-
return ie.generateRandomId(qn);
|
|
1335
|
-
}
|
|
1336
|
-
function Kn(i) {
|
|
1337
|
-
const e = i.match(/data-copy-id="([^\s]+)"/);
|
|
1338
|
-
return e && e[1] ? e[1] : null;
|
|
1339
|
-
}
|
|
1340
|
-
class Jn {
|
|
1341
|
-
constructor() {
|
|
1342
|
-
S(this, "_cache", new Ht(Yn));
|
|
1343
|
-
}
|
|
1344
|
-
set(e, t) {
|
|
1345
|
-
this._cache.set(e, t);
|
|
1346
|
-
}
|
|
1347
|
-
get(e) {
|
|
1348
|
-
return this._cache.get(e);
|
|
1349
|
-
}
|
|
1350
|
-
clear() {
|
|
1351
|
-
this._cache.clear();
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
const St = new Jn();
|
|
1355
|
-
function Qn(i) {
|
|
1356
|
-
const e = i.style, t = {};
|
|
1357
|
-
for (let n = 0; n < e.length; n++) {
|
|
1358
|
-
const r = e[n], s = e.getPropertyValue(r);
|
|
1359
|
-
switch (r) {
|
|
1360
|
-
case "margin-top": {
|
|
1361
|
-
const o = parseInt(s);
|
|
1362
|
-
t.spaceAbove = /pt/.test(s) ? Ke(o) : o;
|
|
1363
|
-
break;
|
|
1364
|
-
}
|
|
1365
|
-
case "margin-bottom": {
|
|
1366
|
-
const o = parseInt(s);
|
|
1367
|
-
t.spaceBelow = /pt/.test(s) ? Ke(o) : o;
|
|
1368
|
-
break;
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
return Object.getOwnPropertyNames(t).length ? t : null;
|
|
1373
|
-
}
|
|
1374
|
-
function Ke(i) {
|
|
1375
|
-
return i / 0.75;
|
|
1376
|
-
}
|
|
1377
|
-
function st(i) {
|
|
1378
|
-
const e = i.style, t = {}, n = i.tagName.toLowerCase();
|
|
1379
|
-
switch (n) {
|
|
1380
|
-
case "b":
|
|
1381
|
-
case "em":
|
|
1382
|
-
case "strong": {
|
|
1383
|
-
t.bl = E.TRUE;
|
|
1384
|
-
break;
|
|
1385
|
-
}
|
|
1386
|
-
case "s": {
|
|
1387
|
-
t.st = {
|
|
1388
|
-
s: E.TRUE
|
|
1389
|
-
};
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1392
|
-
case "u": {
|
|
1393
|
-
t.ul = {
|
|
1394
|
-
s: E.TRUE
|
|
1395
|
-
};
|
|
1396
|
-
break;
|
|
1397
|
-
}
|
|
1398
|
-
case "i": {
|
|
1399
|
-
t.it = E.TRUE;
|
|
1400
|
-
break;
|
|
1401
|
-
}
|
|
1402
|
-
case "sub":
|
|
1403
|
-
case "sup": {
|
|
1404
|
-
t.va = n === "sup" ? V.SUPERSCRIPT : V.SUBSCRIPT;
|
|
1405
|
-
break;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
for (let r = 0; r < e.length; r++) {
|
|
1409
|
-
const s = e[r], o = e.getPropertyValue(s);
|
|
1410
|
-
switch (s) {
|
|
1411
|
-
case "font-family": {
|
|
1412
|
-
t.ff = o;
|
|
1413
|
-
break;
|
|
1414
|
-
}
|
|
1415
|
-
case "font-size": {
|
|
1416
|
-
const a = parseInt(o);
|
|
1417
|
-
Number.isNaN(a) || (t.fs = /pt$/.test(o) ? Ke(a) : a);
|
|
1418
|
-
break;
|
|
1419
|
-
}
|
|
1420
|
-
case "font-style": {
|
|
1421
|
-
o === "italic" && (t.it = E.TRUE);
|
|
1422
|
-
break;
|
|
1423
|
-
}
|
|
1424
|
-
case "font-weight": {
|
|
1425
|
-
Number(o) > 400 && (t.bl = E.TRUE);
|
|
1426
|
-
break;
|
|
1427
|
-
}
|
|
1428
|
-
case "text-decoration": {
|
|
1429
|
-
/underline/.test(o) ? t.ul = {
|
|
1430
|
-
s: E.TRUE
|
|
1431
|
-
} : /overline/.test(o) ? t.ol = {
|
|
1432
|
-
s: E.TRUE
|
|
1433
|
-
} : /line-through/.test(o) && (t.st = {
|
|
1434
|
-
s: E.TRUE
|
|
1435
|
-
});
|
|
1436
|
-
break;
|
|
1437
|
-
}
|
|
1438
|
-
case "color": {
|
|
1439
|
-
const a = new at(o);
|
|
1440
|
-
a.isValid && (t.cl = {
|
|
1441
|
-
rgb: a.toRgbString()
|
|
1442
|
-
});
|
|
1443
|
-
break;
|
|
1444
|
-
}
|
|
1445
|
-
case "background-color": {
|
|
1446
|
-
const a = new at(o);
|
|
1447
|
-
a.isValid && (t.bg = {
|
|
1448
|
-
rgb: a.toRgbString()
|
|
1449
|
-
});
|
|
1450
|
-
break;
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
return t;
|
|
1455
|
-
}
|
|
1456
|
-
function er(i) {
|
|
1457
|
-
const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
|
|
1458
|
-
return e.parseFromString(t, "text/html").querySelector("#univer-root");
|
|
1459
|
-
}
|
|
1460
|
-
function vt(i, e) {
|
|
1461
|
-
const t = i.tagName.toLowerCase();
|
|
1462
|
-
return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(i);
|
|
1463
|
-
}
|
|
1464
|
-
const Le = class Le {
|
|
1465
|
-
constructor() {
|
|
1466
|
-
S(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
1467
|
-
S(this, "_styleRules", []);
|
|
1468
|
-
S(this, "_afterProcessRules", []);
|
|
1469
|
-
}
|
|
1470
|
-
static use(e) {
|
|
1471
|
-
if (this._pluginList.includes(e))
|
|
1472
|
-
throw new Error(`Univer paste plugin ${e.name} already added`);
|
|
1473
|
-
this._pluginList.push(e);
|
|
1474
|
-
}
|
|
1475
|
-
convert(e) {
|
|
1476
|
-
const t = Le._pluginList.find((s) => s.checkPasteType(e)), n = er(e), r = {
|
|
1477
|
-
dataStream: "",
|
|
1478
|
-
textRuns: []
|
|
1479
|
-
};
|
|
1480
|
-
return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, n == null ? void 0 : n.childNodes, r), this._styleCache.clear(), this._styleRules = [], this._afterProcessRules = [], r;
|
|
1481
|
-
}
|
|
1482
|
-
_process(e, t, n) {
|
|
1483
|
-
var r;
|
|
1484
|
-
for (const s of t)
|
|
1485
|
-
if (s.nodeType === Node.TEXT_NODE) {
|
|
1486
|
-
const o = (r = s.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
|
|
1487
|
-
let a;
|
|
1488
|
-
e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += o, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
|
|
1489
|
-
st: n.dataStream.length - o.length,
|
|
1490
|
-
ed: n.dataStream.length,
|
|
1491
|
-
ts: a
|
|
1492
|
-
});
|
|
1493
|
-
} else if (s.nodeType === Node.ELEMENT_NODE) {
|
|
1494
|
-
const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => vt(s, h)), c = a ? a.getStyle(s) : st(s);
|
|
1495
|
-
this._styleCache.set(s, { ...o, ...c });
|
|
1496
|
-
const { childNodes: d } = s;
|
|
1497
|
-
this._process(s, d, n);
|
|
1498
|
-
const l = this._afterProcessRules.find(
|
|
1499
|
-
({ filter: h }) => vt(s, h)
|
|
1500
|
-
);
|
|
1501
|
-
l && l.handler(n, s);
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
};
|
|
1505
|
-
S(Le, "_pluginList", []);
|
|
1506
|
-
let fe = Le;
|
|
1507
|
-
const tr = {
|
|
1508
|
-
name: "univer-doc-paste-plugin-lark",
|
|
1509
|
-
checkPasteType(i) {
|
|
1510
|
-
return /lark-record-clipboard/i.test(i);
|
|
1511
|
-
},
|
|
1512
|
-
// TODO: @JOCS, support inline code copy from lark.
|
|
1513
|
-
stylesRules: [
|
|
1514
|
-
{
|
|
1515
|
-
filter: ["s"],
|
|
1516
|
-
getStyle(i) {
|
|
1517
|
-
const e = st(i);
|
|
1518
|
-
return {
|
|
1519
|
-
st: {
|
|
1520
|
-
s: E.TRUE
|
|
1521
|
-
},
|
|
1522
|
-
...e
|
|
1523
|
-
};
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
],
|
|
1527
|
-
afterProcessRules: [
|
|
1528
|
-
{
|
|
1529
|
-
filter(i) {
|
|
1530
|
-
return i.tagName === "DIV" && /ace-line/i.test(i.className);
|
|
1531
|
-
},
|
|
1532
|
-
handler(i) {
|
|
1533
|
-
i.paragraphs == null && (i.paragraphs = []), i.paragraphs.push({
|
|
1534
|
-
startIndex: i.dataStream.length
|
|
1535
|
-
}), i.dataStream += "\r";
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
]
|
|
1539
|
-
}, nr = {
|
|
1540
|
-
name: "univer-doc-paste-plugin-word",
|
|
1541
|
-
checkPasteType(i) {
|
|
1542
|
-
return /word|mso/i.test(i);
|
|
1543
|
-
},
|
|
1544
|
-
stylesRules: [
|
|
1545
|
-
{
|
|
1546
|
-
filter: ["b"],
|
|
1547
|
-
getStyle(i) {
|
|
1548
|
-
const e = st(i);
|
|
1549
|
-
return { bl: E.TRUE, ...e };
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
],
|
|
1553
|
-
afterProcessRules: [
|
|
1554
|
-
{
|
|
1555
|
-
filter(i) {
|
|
1556
|
-
return i.tagName === "P" && /mso/i.test(i.className);
|
|
1557
|
-
},
|
|
1558
|
-
handler(i, e) {
|
|
1559
|
-
i.paragraphs == null && (i.paragraphs = []);
|
|
1560
|
-
const t = {
|
|
1561
|
-
startIndex: i.dataStream.length
|
|
1562
|
-
}, n = Qn(e);
|
|
1563
|
-
n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
]
|
|
1567
1286
|
};
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
let s = 0;
|
|
1577
|
-
const o = [], a = [];
|
|
1578
|
-
for (const c of n) {
|
|
1579
|
-
const { st: d, ed: l } = c;
|
|
1580
|
-
if (d !== s && o.push(t.slice(s, d)), o.push(rr(t, c)), s = l, e)
|
|
1581
|
-
for (const h of r) {
|
|
1582
|
-
const { startIndex: g, paragraphStyle: u = {} } = h;
|
|
1583
|
-
if (g >= d && g <= l) {
|
|
1584
|
-
const { spaceAbove: p, spaceBelow: f } = u, m = [];
|
|
1585
|
-
p != null && (typeof p == "number" ? m.push(`margin-top: ${p}px`) : m.push(`margin-top: ${p.v}px`)), f != null && (typeof f == "number" ? m.push(`margin-bottom: ${f}px`) : m.push(`margin-bottom: ${f.v}px`)), a.push(
|
|
1586
|
-
`<p className="UniverNormal" ${m.length ? `style="${m.join(";")}"` : ""}>${o.join("")}</p>`
|
|
1587
|
-
), o.length = 0;
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
return a.join("") + o.join("");
|
|
1592
|
-
}
|
|
1593
|
-
class ir {
|
|
1594
|
-
convert(e) {
|
|
1595
|
-
if (e.length === 0)
|
|
1596
|
-
throw new Error("The bodyList length at least to be 1");
|
|
1597
|
-
if (e.length === 1)
|
|
1598
|
-
return Mt(e[0]);
|
|
1599
|
-
let t = "";
|
|
1600
|
-
for (const n of e)
|
|
1601
|
-
t += '<p className="UniverNormal">', t += Mt(n, !1), t += "</p>";
|
|
1602
|
-
return t;
|
|
1603
|
-
}
|
|
1604
|
-
}
|
|
1605
|
-
var sr = Object.defineProperty, or = Object.getOwnPropertyDescriptor, ar = (i, e, t, n) => {
|
|
1606
|
-
for (var r = n > 1 ? void 0 : n ? or(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1607
|
-
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1608
|
-
return n && r && sr(e, t, r), r;
|
|
1609
|
-
}, Ct = (i, e) => (t, n) => e(t, n, i);
|
|
1610
|
-
fe.use(nr);
|
|
1611
|
-
fe.use(tr);
|
|
1612
|
-
function cr(i) {
|
|
1613
|
-
const e = i.replace(/\n/g, "\r"), t = [];
|
|
1614
|
-
for (let n = 0; n < e.length; n++)
|
|
1615
|
-
e[n] === "\r" && t.push({ startIndex: n });
|
|
1616
|
-
return {
|
|
1617
|
-
dataStream: e,
|
|
1618
|
-
paragraphs: t
|
|
1619
|
-
};
|
|
1620
|
-
}
|
|
1621
|
-
const jt = Cn("doc.clipboard-service");
|
|
1622
|
-
let Je = class extends X {
|
|
1623
|
-
constructor(e, t) {
|
|
1624
|
-
super();
|
|
1625
|
-
S(this, "_clipboardHooks", []);
|
|
1626
|
-
S(this, "_htmlToUDM", new fe());
|
|
1627
|
-
S(this, "_umdToHtml", new ir());
|
|
1628
|
-
this._currentUniverService = e, this._clipboardInterfaceService = t;
|
|
1629
|
-
}
|
|
1630
|
-
async queryClipboardData() {
|
|
1631
|
-
const e = await this._clipboardInterfaceService.read();
|
|
1632
|
-
if (e.length === 0)
|
|
1633
|
-
return Promise.reject();
|
|
1634
|
-
try {
|
|
1635
|
-
let t = "", n = "";
|
|
1636
|
-
for (const s of e)
|
|
1637
|
-
for (const o of s.types)
|
|
1638
|
-
o === mn ? n = await s.getType(o).then((a) => a && a.text()) : o === _n && (t = await s.getType(o).then((a) => a && a.text()));
|
|
1639
|
-
if (!t)
|
|
1640
|
-
return cr(n);
|
|
1641
|
-
const r = Kn(t);
|
|
1642
|
-
if (r) {
|
|
1643
|
-
const s = St.get(r);
|
|
1644
|
-
if (s)
|
|
1645
|
-
return s;
|
|
1646
|
-
}
|
|
1647
|
-
return this._htmlToUDM.convert(t);
|
|
1648
|
-
} catch (t) {
|
|
1649
|
-
return Promise.reject(t);
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
async setClipboardData(e) {
|
|
1653
|
-
const t = Zn(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
|
|
1654
|
-
`) : e[0].dataStream;
|
|
1655
|
-
let r = this._umdToHtml.convert(e);
|
|
1656
|
-
return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), St.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
|
|
1657
|
-
}
|
|
1658
|
-
addClipboardHook(e) {
|
|
1659
|
-
return this._clipboardHooks.push(e), qe(() => {
|
|
1660
|
-
const t = this._clipboardHooks.indexOf(e);
|
|
1661
|
-
t > -1 && this._clipboardHooks.splice(t, 1);
|
|
1662
|
-
});
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
Je = ar([
|
|
1666
|
-
Ct(0, y),
|
|
1667
|
-
Ct(1, Sn)
|
|
1668
|
-
], Je);
|
|
1669
|
-
var lr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, ur = (i, e, t, n) => {
|
|
1670
|
-
for (var r = n > 1 ? void 0 : n ? dr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1671
|
-
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1672
|
-
return n && r && lr(e, t, r), r;
|
|
1673
|
-
}, ne = (i, e) => (t, n) => e(t, n, i);
|
|
1674
|
-
let Re = class extends X {
|
|
1675
|
-
constructor(i, e, t, n, r, s) {
|
|
1676
|
-
super(), this._logService = i, this._commandService = e, this._currentUniverService = t, this._docClipboardService = n, this._textSelectionManagerService = r, this._contextService = s, this._commandExecutedListener(), this.initialize();
|
|
1677
|
-
}
|
|
1678
|
-
initialize() {
|
|
1679
|
-
[ze, We, He].forEach(
|
|
1680
|
-
(i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))
|
|
1681
|
-
), [_t, Ne].forEach(
|
|
1682
|
-
(i) => this.disposeWithMe(this._commandService.registerCommand(i))
|
|
1683
|
-
);
|
|
1684
|
-
}
|
|
1685
|
-
_commandExecutedListener() {
|
|
1686
|
-
const i = [We.id, ze.id, He.id];
|
|
1687
|
-
this.disposeWithMe(
|
|
1688
|
-
this._commandService.onCommandExecuted((e) => {
|
|
1689
|
-
if (i.includes(e.id) && !(!this._contextService.getContextValue(N) && !this._contextService.getContextValue(_e)))
|
|
1690
|
-
switch (e.id) {
|
|
1691
|
-
case He.id: {
|
|
1692
|
-
this._handlePaste();
|
|
1693
|
-
break;
|
|
1694
|
-
}
|
|
1695
|
-
case ze.id: {
|
|
1696
|
-
this._handleCopy();
|
|
1697
|
-
break;
|
|
1698
|
-
}
|
|
1699
|
-
case We.id: {
|
|
1700
|
-
this._handleCut();
|
|
1701
|
-
break;
|
|
1702
|
-
}
|
|
1703
|
-
default:
|
|
1704
|
-
throw new Error(`Unhandled command ${e.id}`);
|
|
1705
|
-
}
|
|
1706
|
-
})
|
|
1707
|
-
);
|
|
1708
|
-
}
|
|
1709
|
-
async _handlePaste() {
|
|
1710
|
-
const { _docClipboardService: i } = this, {
|
|
1711
|
-
segmentId: e,
|
|
1712
|
-
endOffset: t,
|
|
1713
|
-
style: n
|
|
1714
|
-
} = this._textSelectionManagerService.getActiveRange() ?? {}, r = this._textSelectionManagerService.getSelections();
|
|
1715
|
-
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(t == null || r == null))
|
|
1716
|
-
try {
|
|
1717
|
-
const s = await i.queryClipboardData();
|
|
1718
|
-
let o = t;
|
|
1719
|
-
for (const c of r) {
|
|
1720
|
-
const { startOffset: d, endOffset: l } = c;
|
|
1721
|
-
d == null || l == null || l <= t && (o += s.dataStream.length - (l - d));
|
|
1722
|
-
}
|
|
1723
|
-
const a = [
|
|
1724
|
-
{
|
|
1725
|
-
startOffset: o,
|
|
1726
|
-
endOffset: o,
|
|
1727
|
-
style: n
|
|
1728
|
-
}
|
|
1729
|
-
];
|
|
1730
|
-
this._commandService.executeCommand(_t.id, { body: s, segmentId: e, textRanges: a });
|
|
1731
|
-
} catch {
|
|
1732
|
-
this._logService.error("[DocClipboardController] clipboard is empty");
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
_getDocumentBodyInRanges() {
|
|
1736
|
-
const i = this._textSelectionManagerService.getSelections(), e = this._currentUniverService.getCurrentUniverDocInstance(), t = [];
|
|
1737
|
-
if (i == null)
|
|
1738
|
-
return t;
|
|
1739
|
-
for (const n of i) {
|
|
1740
|
-
const { startOffset: r, endOffset: s, collapsed: o } = n;
|
|
1741
|
-
if (o || r == null || s == null)
|
|
1742
|
-
continue;
|
|
1743
|
-
const a = e.sliceBody(r, s);
|
|
1744
|
-
a != null && t.push(a);
|
|
1745
|
-
}
|
|
1746
|
-
return t;
|
|
1747
|
-
}
|
|
1748
|
-
async _handleCopy() {
|
|
1749
|
-
const { _docClipboardService: i } = this, e = this._getDocumentBodyInRanges();
|
|
1750
|
-
try {
|
|
1751
|
-
i.setClipboardData(e);
|
|
1752
|
-
} catch {
|
|
1753
|
-
this._logService.error("[DocClipboardController] set clipboard failed");
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
async _handleCut() {
|
|
1757
|
-
const {
|
|
1758
|
-
segmentId: i,
|
|
1759
|
-
endOffset: e,
|
|
1760
|
-
style: t
|
|
1761
|
-
} = this._textSelectionManagerService.getActiveRange() ?? {}, n = this._textSelectionManagerService.getSelections();
|
|
1762
|
-
if (i == null && this._logService.error("[DocClipboardController] segmentId is not existed"), !(e == null || n == null)) {
|
|
1763
|
-
this._handleCopy();
|
|
1764
|
-
try {
|
|
1765
|
-
let r = e;
|
|
1766
|
-
for (const o of n) {
|
|
1767
|
-
const { startOffset: a, endOffset: c } = o;
|
|
1768
|
-
a == null || c == null || c <= e && (r -= c - a);
|
|
1769
|
-
}
|
|
1770
|
-
const s = [
|
|
1771
|
-
{
|
|
1772
|
-
startOffset: r,
|
|
1773
|
-
endOffset: r,
|
|
1774
|
-
style: t
|
|
1775
|
-
}
|
|
1776
|
-
];
|
|
1777
|
-
this._commandService.executeCommand(Ne.id, { segmentId: i, textRanges: s });
|
|
1778
|
-
} catch {
|
|
1779
|
-
this._logService.error("[DocClipboardController] cut content failed");
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
}
|
|
1783
|
-
};
|
|
1784
|
-
Re = ur([
|
|
1785
|
-
F(j.Rendered, Re),
|
|
1786
|
-
ne(0, Xt),
|
|
1787
|
-
ne(1, O),
|
|
1788
|
-
ne(2, y),
|
|
1789
|
-
ne(3, jt),
|
|
1790
|
-
ne(4, w(U)),
|
|
1791
|
-
ne(5, Gt)
|
|
1792
|
-
], Re);
|
|
1793
|
-
var hr = Object.defineProperty, gr = Object.getOwnPropertyDescriptor, pr = (i, e, t, n) => {
|
|
1794
|
-
for (var r = n > 1 ? void 0 : n ? gr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1795
|
-
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1796
|
-
return n && r && hr(e, t, r), r;
|
|
1797
|
-
}, Xe = (i, e) => (t, n) => e(t, n, i);
|
|
1798
|
-
let xe = class extends me {
|
|
1799
|
-
constructor(i, e, t) {
|
|
1800
|
-
super(), this._docSkeletonManagerService = i, this._renderManagerService = e, this._commandService = t, this._initialRenderRefresh(), this._commandExecutedListener();
|
|
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();
|
|
1801
1295
|
}
|
|
1802
1296
|
_initialRenderRefresh() {
|
|
1803
|
-
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(
|
|
1804
|
-
if (
|
|
1297
|
+
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ce(this.dispose$)).subscribe((s) => {
|
|
1298
|
+
if (s == null)
|
|
1805
1299
|
return;
|
|
1806
|
-
const { skeleton: e, unitId: t } =
|
|
1300
|
+
const { skeleton: e, unitId: t } = s, n = this._renderManagerService.getRenderById(t);
|
|
1807
1301
|
if (n == null)
|
|
1808
1302
|
return;
|
|
1809
1303
|
const { mainComponent: r } = n;
|
|
1810
1304
|
r.changeSkeleton(e), this._recalculateSizeBySkeleton(n, e);
|
|
1811
1305
|
});
|
|
1812
1306
|
}
|
|
1813
|
-
_recalculateSizeBySkeleton(
|
|
1307
|
+
_recalculateSizeBySkeleton(s, e) {
|
|
1814
1308
|
var d;
|
|
1815
|
-
const { mainComponent: t, scene: n } =
|
|
1816
|
-
if (
|
|
1309
|
+
const { mainComponent: t, scene: n } = s, r = t, i = (d = e.getSkeletonData()) == null ? void 0 : d.pages;
|
|
1310
|
+
if (i == null)
|
|
1817
1311
|
return;
|
|
1818
1312
|
let o = 0, a = 0;
|
|
1819
|
-
for (let
|
|
1820
|
-
const
|
|
1821
|
-
r.pageLayoutType ===
|
|
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));
|
|
1822
1316
|
}
|
|
1823
|
-
r.resize(o, a), [
|
|
1317
|
+
r.resize(o, a), [Y, q].includes(s.unitId) || n.resize(o, a);
|
|
1824
1318
|
}
|
|
1825
1319
|
_commandExecutedListener() {
|
|
1826
|
-
const
|
|
1320
|
+
const s = [L.id], e = [Y, q];
|
|
1827
1321
|
this.disposeWithMe(
|
|
1828
1322
|
this._commandService.onCommandExecuted((t) => {
|
|
1829
1323
|
var n;
|
|
1830
|
-
if (
|
|
1831
|
-
const r = t.params, { unitId:
|
|
1324
|
+
if (s.includes(t.id)) {
|
|
1325
|
+
const r = t.params, { unitId: i } = r, o = this._docSkeletonManagerService.getSkeletonByUnitId(i);
|
|
1832
1326
|
if (o == null)
|
|
1833
1327
|
return;
|
|
1834
|
-
const { skeleton: a } = o,
|
|
1835
|
-
if (
|
|
1328
|
+
const { skeleton: a } = o, l = this._renderManagerService.getRenderById(i);
|
|
1329
|
+
if (l == null)
|
|
1836
1330
|
return;
|
|
1837
|
-
if (a.calculate(), e.includes(
|
|
1838
|
-
(n =
|
|
1331
|
+
if (a.calculate(), e.includes(i)) {
|
|
1332
|
+
(n = l.mainComponent) == null || n.makeDirty();
|
|
1839
1333
|
return;
|
|
1840
1334
|
}
|
|
1841
|
-
this._recalculateSizeBySkeleton(
|
|
1335
|
+
this._recalculateSizeBySkeleton(l, a);
|
|
1842
1336
|
}
|
|
1843
1337
|
})
|
|
1844
1338
|
);
|
|
1845
1339
|
}
|
|
1846
1340
|
};
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
],
|
|
1853
|
-
var
|
|
1854
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1855
|
-
(o = i
|
|
1856
|
-
return n && r &&
|
|
1857
|
-
},
|
|
1858
|
-
let
|
|
1859
|
-
constructor(e, t, n, r,
|
|
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) {
|
|
1860
1354
|
super();
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService =
|
|
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();
|
|
1864
1358
|
}
|
|
1865
1359
|
_initialize() {
|
|
1866
1360
|
this._initialRenderRefresh(), this._updateOnPluginChange();
|
|
@@ -1870,17 +1364,17 @@ let Oe = class extends X {
|
|
|
1870
1364
|
const t = this._docSkeletonManagerService.getCurrent();
|
|
1871
1365
|
if (t == null)
|
|
1872
1366
|
return;
|
|
1873
|
-
const { unitId: n, skeleton: r } = t,
|
|
1874
|
-
if (
|
|
1367
|
+
const { unitId: n, skeleton: r } = t, i = this._renderManagerService.getRenderById(n);
|
|
1368
|
+
if (i == null)
|
|
1875
1369
|
return;
|
|
1876
|
-
const { mainComponent: o, components: a, scene:
|
|
1877
|
-
e.forEach((
|
|
1878
|
-
const { unitId:
|
|
1879
|
-
r == null || r.getViewModel().getDataModel().updateDrawing(
|
|
1880
|
-
left:
|
|
1881
|
-
top:
|
|
1882
|
-
height:
|
|
1883
|
-
width:
|
|
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
|
|
1884
1378
|
});
|
|
1885
1379
|
}), r == null || r.calculate(), o == null || o.makeDirty();
|
|
1886
1380
|
});
|
|
@@ -1892,85 +1386,85 @@ let Oe = class extends X {
|
|
|
1892
1386
|
const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
|
|
1893
1387
|
if (r == null)
|
|
1894
1388
|
return;
|
|
1895
|
-
const { mainComponent:
|
|
1896
|
-
|
|
1389
|
+
const { mainComponent: i } = r;
|
|
1390
|
+
i.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
|
|
1897
1391
|
});
|
|
1898
1392
|
}
|
|
1899
1393
|
_commandExecutedListener() {
|
|
1900
|
-
const e = [
|
|
1394
|
+
const e = [L.id, G.id], t = [Y, q];
|
|
1901
1395
|
this.disposeWithMe(
|
|
1902
1396
|
this._commandService.onCommandExecuted((n) => {
|
|
1903
1397
|
var r;
|
|
1904
1398
|
if (e.includes(n.id)) {
|
|
1905
|
-
const
|
|
1399
|
+
const i = n.params, { unitId: o } = i, a = this._docSkeletonManagerService.getCurrent();
|
|
1906
1400
|
if (a == null)
|
|
1907
1401
|
return;
|
|
1908
|
-
const { unitId:
|
|
1909
|
-
if (o !==
|
|
1402
|
+
const { unitId: l, skeleton: d } = a;
|
|
1403
|
+
if (o !== l)
|
|
1910
1404
|
return;
|
|
1911
|
-
const
|
|
1912
|
-
if (
|
|
1405
|
+
const c = this._renderManagerService.getRenderById(l);
|
|
1406
|
+
if (c == null)
|
|
1913
1407
|
return;
|
|
1914
|
-
if (t.includes(
|
|
1915
|
-
(r =
|
|
1408
|
+
if (t.includes(l)) {
|
|
1409
|
+
(r = c.mainComponent) == null || r.makeDirty();
|
|
1916
1410
|
return;
|
|
1917
1411
|
}
|
|
1918
|
-
this._refreshFloatingObject(
|
|
1412
|
+
this._refreshFloatingObject(l, d, c);
|
|
1919
1413
|
}
|
|
1920
1414
|
})
|
|
1921
1415
|
);
|
|
1922
1416
|
}
|
|
1923
1417
|
_refreshFloatingObject(e, t, n) {
|
|
1924
|
-
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent:
|
|
1418
|
+
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: i, scene: o } = n, a = i;
|
|
1925
1419
|
if (!r)
|
|
1926
1420
|
return;
|
|
1927
|
-
const { left:
|
|
1421
|
+
const { left: l, top: d, pageLayoutType: c, pageMarginLeft: u, pageMarginTop: h } = a, { pages: g } = r, f = [];
|
|
1928
1422
|
o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
|
|
1929
|
-
for (let
|
|
1930
|
-
const
|
|
1931
|
-
this._liquid.translatePagePadding(
|
|
1932
|
-
const { aLeft:
|
|
1933
|
-
|
|
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({
|
|
1934
1428
|
unitId: e,
|
|
1935
|
-
subUnitId:
|
|
1936
|
-
floatingObjectId:
|
|
1429
|
+
subUnitId: bt,
|
|
1430
|
+
floatingObjectId: M,
|
|
1937
1431
|
floatingObject: {
|
|
1938
|
-
left:
|
|
1432
|
+
left: N + l + this._liquid.x,
|
|
1939
1433
|
top: P + d + this._liquid.y,
|
|
1940
|
-
width:
|
|
1941
|
-
height:
|
|
1434
|
+
width: D,
|
|
1435
|
+
height: T
|
|
1942
1436
|
}
|
|
1943
|
-
}), this._pageMarginCache.set(
|
|
1437
|
+
}), this._pageMarginCache.set(M, {
|
|
1944
1438
|
marginLeft: this._liquid.x,
|
|
1945
1439
|
marginTop: this._liquid.y
|
|
1946
1440
|
});
|
|
1947
|
-
}), this._liquid.translatePage(
|
|
1441
|
+
}), this._liquid.translatePage(_, c, u, h);
|
|
1948
1442
|
}
|
|
1949
|
-
this._floatingObjectManagerService.BatchAddOrUpdate(
|
|
1443
|
+
this._floatingObjectManagerService.BatchAddOrUpdate(f);
|
|
1950
1444
|
}
|
|
1951
1445
|
};
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
],
|
|
1960
|
-
var
|
|
1961
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
1962
|
-
(o = i
|
|
1963
|
-
return n && r &&
|
|
1964
|
-
},
|
|
1965
|
-
let
|
|
1966
|
-
constructor(e, t, n, r,
|
|
1446
|
+
he = Dn([
|
|
1447
|
+
j(z.Steady, he),
|
|
1448
|
+
te(0, E(B)),
|
|
1449
|
+
te(1, y),
|
|
1450
|
+
te(2, X),
|
|
1451
|
+
te(3, b),
|
|
1452
|
+
te(4, yt)
|
|
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) {
|
|
1967
1461
|
super();
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this.
|
|
1462
|
+
v(this, "_previousIMEContent", "");
|
|
1463
|
+
v(this, "_isCompositionStart", !0);
|
|
1464
|
+
v(this, "_onStartSubscription");
|
|
1465
|
+
v(this, "_onUpdateSubscription");
|
|
1466
|
+
v(this, "_onEndSubscription");
|
|
1467
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._textSelectionRenderManager = n, this._imeInputManagerService = r, this._commandService = i, this._initialize();
|
|
1974
1468
|
}
|
|
1975
1469
|
dispose() {
|
|
1976
1470
|
var e, t, n;
|
|
@@ -1984,7 +1478,7 @@ let ye = class extends X {
|
|
|
1984
1478
|
if (e == null)
|
|
1985
1479
|
return;
|
|
1986
1480
|
const { activeRange: t } = e;
|
|
1987
|
-
t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(
|
|
1481
|
+
t != null && (this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(oe.deepClone(t)), this._isCompositionStart = !0);
|
|
1988
1482
|
});
|
|
1989
1483
|
}
|
|
1990
1484
|
_initialOnCompositionUpdate() {
|
|
@@ -1998,100 +1492,86 @@ let ye = class extends X {
|
|
|
1998
1492
|
});
|
|
1999
1493
|
}
|
|
2000
1494
|
async _updateContent(e, t) {
|
|
2001
|
-
var
|
|
2002
|
-
const n = (
|
|
2003
|
-
if (
|
|
1495
|
+
var d;
|
|
1496
|
+
const n = (d = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : d.skeleton;
|
|
1497
|
+
if (e == null || n == null)
|
|
2004
1498
|
return;
|
|
2005
|
-
const r = this._currentUniverService.getCurrentUniverDocInstance(), { event:
|
|
1499
|
+
const r = this._currentUniverService.getCurrentUniverDocInstance(), { event: i, activeRange: o } = e;
|
|
2006
1500
|
if (n == null || o == null)
|
|
2007
1501
|
return;
|
|
2008
|
-
const
|
|
2009
|
-
|
|
2010
|
-
return;
|
|
2011
|
-
const g = h.length, u = [
|
|
2012
|
-
{
|
|
2013
|
-
startOffset: a + g,
|
|
2014
|
-
endOffset: a + g,
|
|
2015
|
-
style: d
|
|
2016
|
-
}
|
|
2017
|
-
];
|
|
2018
|
-
await this._commandService.executeCommand(Lt.id, {
|
|
1502
|
+
const l = i.data;
|
|
1503
|
+
l === this._previousIMEContent && t || (await this._commandService.executeCommand(St.id, {
|
|
2019
1504
|
unitId: r.getUnitId(),
|
|
2020
|
-
newText:
|
|
1505
|
+
newText: l,
|
|
2021
1506
|
oldTextLen: this._previousIMEContent.length,
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
segmentId: c
|
|
2026
|
-
}), t ? (this._previousIMERange.collapsed || (this._previousIMERange.collapsed = !0), this._previousIMEContent = h) : this._resetIME();
|
|
1507
|
+
isCompositionStart: this._isCompositionStart,
|
|
1508
|
+
isCompositionEnd: !t
|
|
1509
|
+
}), t ? (this._isCompositionStart && (this._isCompositionStart = !1), this._previousIMEContent = l) : this._resetIME());
|
|
2027
1510
|
}
|
|
2028
1511
|
_resetIME() {
|
|
2029
|
-
this._previousIMEContent = "", this.
|
|
2030
|
-
}
|
|
2031
|
-
_getDocObject() {
|
|
2032
|
-
return $e(this._currentUniverService, this._renderManagerService);
|
|
1512
|
+
this._previousIMEContent = "", this._isCompositionStart = !0, this._imeInputManagerService.clearUndoRedoMutationParamsCache(), this._imeInputManagerService.setActiveRange(null);
|
|
2033
1513
|
}
|
|
2034
1514
|
};
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
var
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
super(), this._textSelectionManagerService = i, this._commandService = e, this._commandExecutedListener();
|
|
1515
|
+
ge = wn([
|
|
1516
|
+
j(z.Rendered, ge),
|
|
1517
|
+
ne(0, E(B)),
|
|
1518
|
+
ne(1, y),
|
|
1519
|
+
ne(2, ae),
|
|
1520
|
+
ne(3, E(xe)),
|
|
1521
|
+
ne(4, b)
|
|
1522
|
+
], ge);
|
|
1523
|
+
var Un = Object.defineProperty, Nn = Object.getOwnPropertyDescriptor, An = (s, e, t, n) => {
|
|
1524
|
+
for (var r = n > 1 ? void 0 : n ? Nn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
1525
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1526
|
+
return n && r && Un(e, t, r), r;
|
|
1527
|
+
}, at = (s, e) => (t, n) => e(t, n, s);
|
|
1528
|
+
let me = class extends W {
|
|
1529
|
+
constructor(s, e) {
|
|
1530
|
+
super(), this._textSelectionManagerService = s, this._commandService = e, this._commandExecutedListener();
|
|
2052
1531
|
}
|
|
2053
1532
|
_commandExecutedListener() {
|
|
2054
|
-
const
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
1533
|
+
const s = [
|
|
1534
|
+
Te.id,
|
|
1535
|
+
De.id,
|
|
1536
|
+
Pe.id,
|
|
1537
|
+
Ee.id,
|
|
2059
1538
|
Q.id,
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
1539
|
+
we.id,
|
|
1540
|
+
Ue.id,
|
|
1541
|
+
Ne.id,
|
|
1542
|
+
Ae.id
|
|
2064
1543
|
];
|
|
2065
1544
|
this.disposeWithMe(
|
|
2066
1545
|
this._commandService.onCommandExecuted((e) => {
|
|
2067
|
-
|
|
1546
|
+
s.includes(e.id) && this._handleInlineFormat(e);
|
|
2068
1547
|
})
|
|
2069
1548
|
);
|
|
2070
1549
|
}
|
|
2071
|
-
_handleInlineFormat(
|
|
2072
|
-
|
|
2073
|
-
e
|
|
1550
|
+
_handleInlineFormat(s) {
|
|
1551
|
+
var t, n;
|
|
1552
|
+
const { segmentId: e } = (t = this._textSelectionManagerService.getActiveRange()) != null ? t : {};
|
|
1553
|
+
e != null && this._commandService.executeCommand(Mt.id, {
|
|
2074
1554
|
segmentId: e,
|
|
2075
|
-
preCommandId:
|
|
2076
|
-
...
|
|
1555
|
+
preCommandId: s.id,
|
|
1556
|
+
...(n = s.params) != null ? n : {}
|
|
2077
1557
|
});
|
|
2078
1558
|
}
|
|
2079
1559
|
};
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
],
|
|
2085
|
-
var
|
|
2086
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2087
|
-
(o = i
|
|
2088
|
-
return n && r &&
|
|
2089
|
-
},
|
|
2090
|
-
let
|
|
2091
|
-
constructor(e, t, n, r,
|
|
1560
|
+
me = An([
|
|
1561
|
+
j(z.Rendered, me),
|
|
1562
|
+
at(0, E(w)),
|
|
1563
|
+
at(1, b)
|
|
1564
|
+
], me);
|
|
1565
|
+
var Ln = Object.defineProperty, $n = Object.getOwnPropertyDescriptor, Bn = (s, e, t, n) => {
|
|
1566
|
+
for (var r = n > 1 ? void 0 : n ? $n(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
1567
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1568
|
+
return n && r && Ln(e, t, r), r;
|
|
1569
|
+
}, re = (s, e) => (t, n) => e(t, n, s);
|
|
1570
|
+
let fe = class extends W {
|
|
1571
|
+
constructor(e, t, n, r, i) {
|
|
2092
1572
|
super();
|
|
2093
|
-
|
|
2094
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = r, this._commandService =
|
|
1573
|
+
v(this, "_onInputSubscription");
|
|
1574
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionManagerService = r, this._commandService = i, this._initialize(), this._commandExecutedListener();
|
|
2095
1575
|
}
|
|
2096
1576
|
dispose() {
|
|
2097
1577
|
var e;
|
|
@@ -2100,16 +1580,16 @@ let Te = class extends X {
|
|
|
2100
1580
|
_initialize() {
|
|
2101
1581
|
}
|
|
2102
1582
|
_commandExecutedListener() {
|
|
2103
|
-
const e = [
|
|
1583
|
+
const e = [ze.id, Ve.id];
|
|
2104
1584
|
this.disposeWithMe(
|
|
2105
1585
|
this._commandService.onCommandExecuted((t) => {
|
|
2106
1586
|
if (!e.includes(t.id))
|
|
2107
1587
|
return;
|
|
2108
1588
|
const n = t.params;
|
|
2109
1589
|
switch (t.id) {
|
|
2110
|
-
case
|
|
1590
|
+
case ze.id:
|
|
2111
1591
|
return this._handleMoveCursor(n.direction);
|
|
2112
|
-
case
|
|
1592
|
+
case Ve.id:
|
|
2113
1593
|
return this._handleShiftMoveSelection(n.direction);
|
|
2114
1594
|
default:
|
|
2115
1595
|
throw new Error("Unknown command");
|
|
@@ -2118,112 +1598,112 @@ let Te = class extends X {
|
|
|
2118
1598
|
);
|
|
2119
1599
|
}
|
|
2120
1600
|
_handleShiftMoveSelection(e) {
|
|
2121
|
-
var
|
|
2122
|
-
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(),
|
|
2123
|
-
if (t == null ||
|
|
1601
|
+
var m, p, _;
|
|
1602
|
+
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), i = (m = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : m.skeleton, o = this._getDocObject();
|
|
1603
|
+
if (t == null || i == null || o == null)
|
|
2124
1604
|
return;
|
|
2125
|
-
const { startOffset: a, endOffset:
|
|
1605
|
+
const { startOffset: a, endOffset: l, style: d, collapsed: c, direction: u } = t;
|
|
2126
1606
|
if (n.length > 1) {
|
|
2127
|
-
let
|
|
2128
|
-
for (const
|
|
2129
|
-
|
|
1607
|
+
let S = Number.POSITIVE_INFINITY, I = Number.NEGATIVE_INFINITY;
|
|
1608
|
+
for (const R of n)
|
|
1609
|
+
S = Math.min(S, R.startOffset), I = Math.max(I, R.endOffset);
|
|
2130
1610
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2131
1611
|
{
|
|
2132
|
-
startOffset: e ===
|
|
2133
|
-
endOffset: e ===
|
|
1612
|
+
startOffset: e === U.LEFT || e === U.UP ? I : S,
|
|
1613
|
+
endOffset: e === U.LEFT || e === U.UP ? S : I,
|
|
2134
1614
|
style: d
|
|
2135
1615
|
}
|
|
2136
1616
|
]);
|
|
2137
1617
|
return;
|
|
2138
1618
|
}
|
|
2139
|
-
const
|
|
2140
|
-
let
|
|
2141
|
-
const p = r.getBody().dataStream.length
|
|
2142
|
-
if (e ===
|
|
2143
|
-
const
|
|
2144
|
-
|
|
1619
|
+
const h = c || u === Qe.FORWARD ? a : l;
|
|
1620
|
+
let g = c || u === Qe.FORWARD ? l : a;
|
|
1621
|
+
const f = (p = r.getBody().dataStream.length) != null ? p : Number.POSITIVE_INFINITY;
|
|
1622
|
+
if (e === U.LEFT || e === U.RIGHT) {
|
|
1623
|
+
const S = i.findNodeByCharIndex(g - 1), I = i.findNodeByCharIndex(g);
|
|
1624
|
+
g = e === U.RIGHT ? g + I.count : g - ((_ = S == null ? void 0 : S.count) != null ? _ : 0), g = Math.min(f - 2, Math.max(0, g)), this._textSelectionManagerService.replaceTextRanges([
|
|
2145
1625
|
{
|
|
2146
|
-
startOffset:
|
|
2147
|
-
endOffset:
|
|
1626
|
+
startOffset: h,
|
|
1627
|
+
endOffset: g,
|
|
2148
1628
|
style: d
|
|
2149
1629
|
}
|
|
2150
1630
|
]);
|
|
2151
1631
|
} else {
|
|
2152
|
-
const
|
|
2153
|
-
if (
|
|
2154
|
-
const
|
|
2155
|
-
if (
|
|
1632
|
+
const S = i.findNodeByCharIndex(g), I = o.document.getOffsetConfig(), R = this._getTopOrBottomPosition(i, S, e === U.DOWN);
|
|
1633
|
+
if (R == null) {
|
|
1634
|
+
const N = e === U.UP ? 0 : f - 2;
|
|
1635
|
+
if (N === g)
|
|
2156
1636
|
return;
|
|
2157
1637
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2158
1638
|
{
|
|
2159
|
-
startOffset:
|
|
2160
|
-
endOffset:
|
|
1639
|
+
startOffset: h,
|
|
1640
|
+
endOffset: N,
|
|
2161
1641
|
style: d
|
|
2162
1642
|
}
|
|
2163
1643
|
]);
|
|
2164
1644
|
return;
|
|
2165
1645
|
}
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2168
|
-
|
|
1646
|
+
const O = new et(I, i).getRangePointData(
|
|
1647
|
+
R,
|
|
1648
|
+
R
|
|
2169
1649
|
).cursorList[0];
|
|
2170
1650
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2171
1651
|
{
|
|
2172
|
-
startOffset:
|
|
2173
|
-
endOffset:
|
|
1652
|
+
startOffset: h,
|
|
1653
|
+
endOffset: O.endOffset,
|
|
2174
1654
|
style: d
|
|
2175
1655
|
}
|
|
2176
1656
|
]);
|
|
2177
1657
|
}
|
|
2178
1658
|
}
|
|
2179
1659
|
_handleMoveCursor(e) {
|
|
2180
|
-
var g;
|
|
2181
|
-
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(),
|
|
2182
|
-
if (t == null ||
|
|
1660
|
+
var h, g, f;
|
|
1661
|
+
const t = this._textSelectionManagerService.getActiveRange(), n = this._textSelectionManagerService.getSelections(), r = this._currentUniverService.getCurrentUniverDocInstance(), i = (h = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : h.skeleton, o = this._getDocObject();
|
|
1662
|
+
if (t == null || i == null || o == null || n == null)
|
|
2183
1663
|
return;
|
|
2184
|
-
const { startOffset: a, endOffset:
|
|
2185
|
-
if (e ===
|
|
2186
|
-
let
|
|
1664
|
+
const { startOffset: a, endOffset: l, style: d, collapsed: c } = t, u = (g = r.getBody().dataStream.length) != null ? g : Number.POSITIVE_INFINITY;
|
|
1665
|
+
if (e === U.LEFT || e === U.RIGHT) {
|
|
1666
|
+
let m;
|
|
2187
1667
|
if (!t.collapsed || n.length > 1) {
|
|
2188
|
-
let p = Number.POSITIVE_INFINITY,
|
|
2189
|
-
for (const
|
|
2190
|
-
p = Math.min(p,
|
|
2191
|
-
|
|
1668
|
+
let p = Number.POSITIVE_INFINITY, _ = Number.NEGATIVE_INFINITY;
|
|
1669
|
+
for (const S of n)
|
|
1670
|
+
p = Math.min(p, S.startOffset), _ = Math.max(_, S.endOffset);
|
|
1671
|
+
m = e === U.LEFT ? p : _;
|
|
2192
1672
|
} else {
|
|
2193
|
-
const p =
|
|
2194
|
-
e ===
|
|
1673
|
+
const p = i.findNodeByCharIndex(a - 1), _ = i.findNodeByCharIndex(a);
|
|
1674
|
+
e === U.LEFT ? m = Math.max(0, a - ((f = p == null ? void 0 : p.count) != null ? f : 0)) : m = Math.min(u - 2, l + _.count);
|
|
2195
1675
|
}
|
|
2196
1676
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2197
1677
|
{
|
|
2198
|
-
startOffset:
|
|
2199
|
-
endOffset:
|
|
1678
|
+
startOffset: m,
|
|
1679
|
+
endOffset: m,
|
|
2200
1680
|
style: d
|
|
2201
1681
|
}
|
|
2202
1682
|
]);
|
|
2203
1683
|
} else {
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2206
|
-
e ===
|
|
2207
|
-
e ===
|
|
1684
|
+
const m = i.findNodeByCharIndex(a), p = i.findNodeByCharIndex(l), _ = o.document.getOffsetConfig(), S = this._getTopOrBottomPosition(
|
|
1685
|
+
i,
|
|
1686
|
+
e === U.UP ? m : p,
|
|
1687
|
+
e === U.DOWN
|
|
2208
1688
|
);
|
|
2209
|
-
if (
|
|
2210
|
-
let
|
|
2211
|
-
|
|
1689
|
+
if (S == null) {
|
|
1690
|
+
let R;
|
|
1691
|
+
c ? R = e === U.UP ? 0 : u - 2 : R = e === U.UP ? a : l, this._textSelectionManagerService.replaceTextRanges([
|
|
2212
1692
|
{
|
|
2213
|
-
startOffset:
|
|
2214
|
-
endOffset:
|
|
1693
|
+
startOffset: R,
|
|
1694
|
+
endOffset: R,
|
|
2215
1695
|
style: d
|
|
2216
1696
|
}
|
|
2217
1697
|
]);
|
|
2218
1698
|
return;
|
|
2219
1699
|
}
|
|
2220
|
-
const
|
|
2221
|
-
|
|
2222
|
-
|
|
1700
|
+
const I = new et(_, i).getRangePointData(
|
|
1701
|
+
S,
|
|
1702
|
+
S
|
|
2223
1703
|
).cursorList[0];
|
|
2224
1704
|
this._textSelectionManagerService.replaceTextRanges([
|
|
2225
1705
|
{
|
|
2226
|
-
...
|
|
1706
|
+
...I,
|
|
2227
1707
|
style: d
|
|
2228
1708
|
}
|
|
2229
1709
|
]);
|
|
@@ -2232,10 +1712,10 @@ let Te = class extends X {
|
|
|
2232
1712
|
_getTopOrBottomPosition(e, t, n) {
|
|
2233
1713
|
if (t == null)
|
|
2234
1714
|
return;
|
|
2235
|
-
const r = this._getSpanLeftOffsetInLine(t),
|
|
2236
|
-
if (
|
|
1715
|
+
const r = this._getSpanLeftOffsetInLine(t), i = this._getNextOrPrevLine(t, n);
|
|
1716
|
+
if (i == null)
|
|
2237
1717
|
return;
|
|
2238
|
-
const o = this._matchPositionByLeftOffset(e,
|
|
1718
|
+
const o = this._matchPositionByLeftOffset(e, i, r);
|
|
2239
1719
|
if (o != null)
|
|
2240
1720
|
return { ...o, isBack: !0 };
|
|
2241
1721
|
}
|
|
@@ -2250,101 +1730,101 @@ let Te = class extends X {
|
|
|
2250
1730
|
const r = {
|
|
2251
1731
|
distance: Number.POSITIVE_INFINITY
|
|
2252
1732
|
};
|
|
2253
|
-
for (const
|
|
2254
|
-
const o =
|
|
2255
|
-
for (const a of
|
|
2256
|
-
const { left:
|
|
2257
|
-
|
|
1733
|
+
for (const i of t.divides) {
|
|
1734
|
+
const o = i.left;
|
|
1735
|
+
for (const a of i.spanGroup) {
|
|
1736
|
+
const { left: l } = a, d = o + l, c = Math.abs(n - d);
|
|
1737
|
+
c < r.distance && (r.span = a, r.distance = c);
|
|
2258
1738
|
}
|
|
2259
1739
|
}
|
|
2260
1740
|
if (r.span != null)
|
|
2261
1741
|
return e.findPositionBySpan(r.span);
|
|
2262
1742
|
}
|
|
2263
1743
|
_getNextOrPrevLine(e, t) {
|
|
2264
|
-
var
|
|
1744
|
+
var f, m, p, _, S, I, R, O, N, P, T, D;
|
|
2265
1745
|
const n = e.parent;
|
|
2266
1746
|
if (n == null)
|
|
2267
1747
|
return;
|
|
2268
1748
|
const r = n.parent;
|
|
2269
1749
|
if (r == null)
|
|
2270
1750
|
return;
|
|
2271
|
-
const
|
|
2272
|
-
if (
|
|
1751
|
+
const i = r.parent;
|
|
1752
|
+
if (i == null)
|
|
2273
1753
|
return;
|
|
2274
|
-
const o =
|
|
1754
|
+
const o = i.lines.indexOf(r);
|
|
2275
1755
|
if (o === -1)
|
|
2276
1756
|
return;
|
|
2277
1757
|
let a;
|
|
2278
|
-
if (t === !0 ? a =
|
|
1758
|
+
if (t === !0 ? a = i.lines[o + 1] : a = i.lines[o - 1], a != null)
|
|
2279
1759
|
return a;
|
|
2280
|
-
const
|
|
2281
|
-
if (
|
|
1760
|
+
const l = i.parent;
|
|
1761
|
+
if (l == null)
|
|
2282
1762
|
return;
|
|
2283
|
-
const d =
|
|
1763
|
+
const d = l.columns.indexOf(i);
|
|
2284
1764
|
if (d === -1)
|
|
2285
1765
|
return;
|
|
2286
1766
|
if (t === !0)
|
|
2287
|
-
a = (
|
|
1767
|
+
a = (f = l.columns[d + 1]) == null ? void 0 : f.lines[0];
|
|
2288
1768
|
else {
|
|
2289
|
-
const
|
|
2290
|
-
a =
|
|
1769
|
+
const M = (p = (m = l.columns) == null ? void 0 : m[d - 1]) == null ? void 0 : p.lines;
|
|
1770
|
+
a = M == null ? void 0 : M[M.length - 1];
|
|
2291
1771
|
}
|
|
2292
1772
|
if (a != null)
|
|
2293
1773
|
return a;
|
|
2294
|
-
const
|
|
2295
|
-
if (
|
|
1774
|
+
const c = l.parent;
|
|
1775
|
+
if (c == null)
|
|
2296
1776
|
return;
|
|
2297
|
-
const
|
|
2298
|
-
if (
|
|
1777
|
+
const u = c.sections.indexOf(l);
|
|
1778
|
+
if (u === -1)
|
|
2299
1779
|
return;
|
|
2300
1780
|
if (t === !0)
|
|
2301
|
-
a = (
|
|
1781
|
+
a = (S = (_ = c.sections[u - 1]) == null ? void 0 : _.columns[0]) == null ? void 0 : S.lines[0];
|
|
2302
1782
|
else {
|
|
2303
|
-
const
|
|
2304
|
-
a =
|
|
1783
|
+
const M = (R = (I = c.sections) == null ? void 0 : I[u - 1]) == null ? void 0 : R.columns, F = M == null ? void 0 : M[M.length - 1], $ = F == null ? void 0 : F.lines;
|
|
1784
|
+
a = $ == null ? void 0 : $[$.length - 1];
|
|
2305
1785
|
}
|
|
2306
1786
|
if (a != null)
|
|
2307
1787
|
return a;
|
|
2308
|
-
const
|
|
2309
|
-
if (
|
|
1788
|
+
const h = c.parent;
|
|
1789
|
+
if (h == null)
|
|
2310
1790
|
return;
|
|
2311
|
-
const
|
|
2312
|
-
if (
|
|
1791
|
+
const g = h.pages.indexOf(c);
|
|
1792
|
+
if (g !== -1) {
|
|
2313
1793
|
if (t === !0)
|
|
2314
|
-
a = (P = (
|
|
1794
|
+
a = (P = (N = (O = h.pages[g + 1]) == null ? void 0 : O.sections[0]) == null ? void 0 : N.columns[0]) == null ? void 0 : P.lines[0];
|
|
2315
1795
|
else {
|
|
2316
|
-
const
|
|
2317
|
-
if (
|
|
1796
|
+
const M = (T = h.pages[g - 1]) == null ? void 0 : T.sections;
|
|
1797
|
+
if (M == null)
|
|
2318
1798
|
return;
|
|
2319
|
-
const
|
|
2320
|
-
a =
|
|
1799
|
+
const F = (D = M[M.length - 1]) == null ? void 0 : D.columns, $ = F[F.length - 1], Ye = $ == null ? void 0 : $.lines;
|
|
1800
|
+
a = Ye[Ye.length - 1];
|
|
2321
1801
|
}
|
|
2322
1802
|
if (a != null)
|
|
2323
1803
|
return a;
|
|
2324
1804
|
}
|
|
2325
1805
|
}
|
|
2326
1806
|
_getDocObject() {
|
|
2327
|
-
return
|
|
1807
|
+
return ke(this._currentUniverService, this._renderManagerService);
|
|
2328
1808
|
}
|
|
2329
1809
|
};
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
],
|
|
2338
|
-
var
|
|
2339
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2340
|
-
(o = i
|
|
2341
|
-
return n && r &&
|
|
2342
|
-
},
|
|
2343
|
-
let
|
|
2344
|
-
constructor(e, t, n, r,
|
|
1810
|
+
fe = Bn([
|
|
1811
|
+
j(z.Rendered, fe),
|
|
1812
|
+
re(0, E(B)),
|
|
1813
|
+
re(1, y),
|
|
1814
|
+
re(2, X),
|
|
1815
|
+
re(3, E(w)),
|
|
1816
|
+
re(4, b)
|
|
1817
|
+
], fe);
|
|
1818
|
+
var Fn = Object.defineProperty, jn = Object.getOwnPropertyDescriptor, zn = (s, e, t, n) => {
|
|
1819
|
+
for (var r = n > 1 ? void 0 : n ? jn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
1820
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1821
|
+
return n && r && Fn(e, t, r), r;
|
|
1822
|
+
}, ie = (s, e) => (t, n) => e(t, n, s);
|
|
1823
|
+
let pe = class extends W {
|
|
1824
|
+
constructor(e, t, n, r, i) {
|
|
2345
1825
|
super();
|
|
2346
|
-
|
|
2347
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = r, this._commandService =
|
|
1826
|
+
v(this, "_onInputSubscription");
|
|
1827
|
+
this._docSkeletonManagerService = e, this._currentUniverService = t, this._renderManagerService = n, this._textSelectionRenderManager = r, this._commandService = i, this._initialize(), this._commandExecutedListener();
|
|
2348
1828
|
}
|
|
2349
1829
|
dispose() {
|
|
2350
1830
|
var e;
|
|
@@ -2355,112 +1835,110 @@ let De = class extends X {
|
|
|
2355
1835
|
}
|
|
2356
1836
|
_initialNormalInput() {
|
|
2357
1837
|
this._onInputSubscription = this._textSelectionRenderManager.onInput$.subscribe(async (e) => {
|
|
2358
|
-
var
|
|
1838
|
+
var f;
|
|
2359
1839
|
if (e == null)
|
|
2360
1840
|
return;
|
|
2361
|
-
const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: r, content:
|
|
2362
|
-
if (a.data == null ||
|
|
1841
|
+
const n = this._currentUniverService.getCurrentUniverDocInstance().getUnitId(), { event: r, content: i = "", activeRange: o } = e, a = r, l = (f = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : f.skeleton;
|
|
1842
|
+
if (a.data == null || l == null || !l || !o)
|
|
2363
1843
|
return;
|
|
2364
|
-
const { startOffset: d, segmentId:
|
|
1844
|
+
const { startOffset: d, segmentId: c, style: u } = o, h = i.length, g = [
|
|
2365
1845
|
{
|
|
2366
|
-
startOffset: d +
|
|
2367
|
-
endOffset: d +
|
|
2368
|
-
style:
|
|
1846
|
+
startOffset: d + h,
|
|
1847
|
+
endOffset: d + h,
|
|
1848
|
+
style: u
|
|
2369
1849
|
}
|
|
2370
1850
|
];
|
|
2371
|
-
await this._commandService.executeCommand(
|
|
1851
|
+
await this._commandService.executeCommand(be.id, {
|
|
2372
1852
|
unitId: n,
|
|
2373
1853
|
body: {
|
|
2374
|
-
dataStream:
|
|
1854
|
+
dataStream: i
|
|
2375
1855
|
},
|
|
2376
1856
|
range: o,
|
|
2377
|
-
textRanges:
|
|
2378
|
-
segmentId:
|
|
1857
|
+
textRanges: g,
|
|
1858
|
+
segmentId: c
|
|
2379
1859
|
});
|
|
2380
1860
|
});
|
|
2381
1861
|
}
|
|
2382
1862
|
_commandExecutedListener() {
|
|
2383
1863
|
}
|
|
2384
1864
|
_getDocObject() {
|
|
2385
|
-
return
|
|
1865
|
+
return ke(this._currentUniverService, this._renderManagerService);
|
|
2386
1866
|
}
|
|
2387
1867
|
};
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
],
|
|
2396
|
-
var
|
|
2397
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2398
|
-
(o = i
|
|
2399
|
-
return n && r &&
|
|
2400
|
-
},
|
|
2401
|
-
const
|
|
2402
|
-
let
|
|
2403
|
-
constructor(
|
|
2404
|
-
super(), this._renderManagerService =
|
|
1868
|
+
pe = zn([
|
|
1869
|
+
j(z.Rendered, pe),
|
|
1870
|
+
ie(0, E(B)),
|
|
1871
|
+
ie(1, y),
|
|
1872
|
+
ie(2, X),
|
|
1873
|
+
ie(3, ae),
|
|
1874
|
+
ie(4, b)
|
|
1875
|
+
], pe);
|
|
1876
|
+
var Vn = Object.defineProperty, kn = Object.getOwnPropertyDescriptor, Hn = (s, e, t, n) => {
|
|
1877
|
+
for (var r = n > 1 ? void 0 : n ? kn(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
1878
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1879
|
+
return n && r && Vn(e, t, r), r;
|
|
1880
|
+
}, ct = (s, e) => (t, n) => e(t, n, s);
|
|
1881
|
+
const Wn = "rgba(198, 198, 198, 1)", Xn = "rgba(255, 255, 255, 1)";
|
|
1882
|
+
let _e = class extends W {
|
|
1883
|
+
constructor(s, e) {
|
|
1884
|
+
super(), this._renderManagerService = s, this._currentUniverService = e, this._initialize(), this._commandExecutedListener();
|
|
2405
1885
|
}
|
|
2406
1886
|
_initialize() {
|
|
2407
1887
|
this._initialRenderRefresh();
|
|
2408
1888
|
}
|
|
2409
1889
|
_initialRenderRefresh() {
|
|
2410
|
-
this._renderManagerService.currentRender$.subscribe((
|
|
2411
|
-
var
|
|
2412
|
-
if (
|
|
1890
|
+
this._renderManagerService.currentRender$.subscribe((s) => {
|
|
1891
|
+
var i;
|
|
1892
|
+
if (s == null || this._currentUniverService.getUniverDocInstance(s) == null)
|
|
2413
1893
|
return;
|
|
2414
|
-
const e = this._renderManagerService.getRenderById(
|
|
1894
|
+
const e = this._renderManagerService.getRenderById(s);
|
|
2415
1895
|
if (e == null)
|
|
2416
1896
|
return;
|
|
2417
|
-
const { mainComponent: t } = e, n = t, r = (
|
|
1897
|
+
const { mainComponent: t } = e, n = t, r = (i = n.getSkeleton()) == null ? void 0 : i.getPageSize();
|
|
2418
1898
|
n.onPageRenderObservable.add((o) => {
|
|
2419
|
-
|
|
1899
|
+
var m, p, _, S;
|
|
1900
|
+
if ([Y, q].includes(s))
|
|
2420
1901
|
return;
|
|
2421
|
-
const { page: a, pageLeft:
|
|
2422
|
-
|
|
2423
|
-
width: (r == null ? void 0 : r.width)
|
|
2424
|
-
height: (r == null ? void 0 : r.height)
|
|
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,
|
|
2425
1906
|
strokeWidth: 1,
|
|
2426
|
-
stroke:
|
|
2427
|
-
fill:
|
|
1907
|
+
stroke: Wn,
|
|
1908
|
+
fill: Xn,
|
|
2428
1909
|
zIndex: 3
|
|
2429
|
-
}),
|
|
1910
|
+
}), c.restore();
|
|
2430
1911
|
});
|
|
2431
1912
|
});
|
|
2432
1913
|
}
|
|
2433
1914
|
_commandExecutedListener() {
|
|
2434
1915
|
}
|
|
2435
1916
|
};
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
],
|
|
2441
|
-
var
|
|
2442
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2443
|
-
(o = i
|
|
2444
|
-
return n && r &&
|
|
2445
|
-
},
|
|
2446
|
-
let
|
|
2447
|
-
constructor(e, t, n, r,
|
|
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) {
|
|
2448
1929
|
super();
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager =
|
|
2456
|
-
|
|
1930
|
+
v(this, "_moveInObserver");
|
|
1931
|
+
v(this, "_moveOutObserver");
|
|
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)));
|
|
2457
1938
|
}), this._initialize();
|
|
2458
1939
|
}
|
|
2459
1940
|
_initialize() {
|
|
2460
|
-
this._skeletonListener(), this._commandExecutedListener()
|
|
2461
|
-
// the content editable div should be regarded as part of the applications container
|
|
2462
|
-
this._layoutService.registerContainer(this._textSelectionRenderManager.__getEditorContainer())
|
|
2463
|
-
);
|
|
1941
|
+
this._skeletonListener(), this._commandExecutedListener();
|
|
2464
1942
|
}
|
|
2465
1943
|
dispose() {
|
|
2466
1944
|
this._renderManagerService.getRenderAll().forEach((e) => {
|
|
@@ -2474,25 +1952,25 @@ let Ee = class extends X {
|
|
|
2474
1952
|
return;
|
|
2475
1953
|
const { document: n, scene: r } = t;
|
|
2476
1954
|
this._moveInObserver = n.onPointerEnterObserver.add(() => {
|
|
2477
|
-
n.cursor =
|
|
1955
|
+
n.cursor = tt.TEXT;
|
|
2478
1956
|
}), this._moveOutObserver = n.onPointerLeaveObserver.add(() => {
|
|
2479
|
-
n.cursor =
|
|
2480
|
-
}), this._downObserver = n == null ? void 0 : n.onPointerDownObserver.add((
|
|
2481
|
-
this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(
|
|
2482
|
-
}), this._dblClickObserver = n == null ? void 0 : n.onDblclickObserver.add((
|
|
2483
|
-
this._textSelectionRenderManager.handleDblClick(
|
|
2484
|
-
}), this._tripleClickObserver = n == null ? void 0 : n.onTripleClickObserver.add((
|
|
2485
|
-
this._textSelectionRenderManager.handleTripleClick(
|
|
1957
|
+
n.cursor = tt.DEFAULT, r.resetCursor();
|
|
1958
|
+
}), this._downObserver = n == null ? void 0 : n.onPointerDownObserver.add((i, o) => {
|
|
1959
|
+
this._currentUniverService.getCurrentUniverDocInstance().getUnitId() !== e && this._currentUniverService.setCurrentUniverDocInstance(e), this._textSelectionRenderManager.eventTrigger(i), i.button !== 2 && o.stopPropagation();
|
|
1960
|
+
}), this._dblClickObserver = n == null ? void 0 : n.onDblclickObserver.add((i) => {
|
|
1961
|
+
this._textSelectionRenderManager.handleDblClick(i);
|
|
1962
|
+
}), this._tripleClickObserver = n == null ? void 0 : n.onTripleClickObserver.add((i) => {
|
|
1963
|
+
this._textSelectionRenderManager.handleTripleClick(i);
|
|
2486
1964
|
});
|
|
2487
1965
|
}
|
|
2488
1966
|
_commandExecutedListener() {
|
|
2489
|
-
const e = [
|
|
1967
|
+
const e = [G.id];
|
|
2490
1968
|
this.disposeWithMe(
|
|
2491
1969
|
this._commandService.onCommandExecuted((t) => {
|
|
2492
1970
|
var n;
|
|
2493
1971
|
if (e.includes(t.id)) {
|
|
2494
|
-
const r = t.params, { unitId:
|
|
2495
|
-
if (
|
|
1972
|
+
const r = t.params, { unitId: i } = r, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
|
|
1973
|
+
if (i !== o)
|
|
2496
1974
|
return;
|
|
2497
1975
|
this._textSelectionManagerService.refreshSelection();
|
|
2498
1976
|
}
|
|
@@ -2506,37 +1984,36 @@ let Ee = class extends X {
|
|
|
2506
1984
|
const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
|
|
2507
1985
|
if (r == null)
|
|
2508
1986
|
return;
|
|
2509
|
-
const { scene:
|
|
2510
|
-
this._textSelectionRenderManager.changeRuntime(n,
|
|
1987
|
+
const { scene: i, mainComponent: o } = r;
|
|
1988
|
+
this._textSelectionRenderManager.changeRuntime(n, i, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
2511
1989
|
unitId: t,
|
|
2512
1990
|
subUnitId: ""
|
|
2513
1991
|
});
|
|
2514
1992
|
});
|
|
2515
1993
|
}
|
|
2516
1994
|
_getDocObjectById(e) {
|
|
2517
|
-
return
|
|
1995
|
+
return Wt(e, this._renderManagerService);
|
|
2518
1996
|
}
|
|
2519
1997
|
};
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
var
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
constructor(e, t, n, r, s) {
|
|
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) {
|
|
2537
2014
|
super();
|
|
2538
|
-
|
|
2539
|
-
this._docSkeletonManagerService = e, this._currentUniverService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService =
|
|
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();
|
|
2540
2017
|
}
|
|
2541
2018
|
dispose() {
|
|
2542
2019
|
super.dispose();
|
|
@@ -2549,24 +2026,24 @@ let Ue = class extends X {
|
|
|
2549
2026
|
if (e == null)
|
|
2550
2027
|
return;
|
|
2551
2028
|
const { unitId: t } = e, n = this._renderManagerService.getRenderById(t);
|
|
2552
|
-
if (n == null || this._initializedRender.has(t) || [
|
|
2029
|
+
if (n == null || this._initializedRender.has(t) || [Y, q].includes(t))
|
|
2553
2030
|
return;
|
|
2554
2031
|
this._initializedRender.add(t);
|
|
2555
2032
|
const { scene: r } = n;
|
|
2556
2033
|
this.disposeWithMe(
|
|
2557
|
-
|
|
2558
|
-
r.onMouseWheelObserver.add((
|
|
2559
|
-
if (!
|
|
2034
|
+
Ke(
|
|
2035
|
+
r.onMouseWheelObserver.add((i) => {
|
|
2036
|
+
if (!i.ctrlKey)
|
|
2560
2037
|
return;
|
|
2561
|
-
const o = Math.abs(
|
|
2038
|
+
const o = Math.abs(i.deltaX);
|
|
2562
2039
|
let a = o < 40 ? 0.2 : o < 80 ? 0.4 : 0.2;
|
|
2563
|
-
a *=
|
|
2564
|
-
const
|
|
2565
|
-
let
|
|
2566
|
-
|
|
2567
|
-
zoomRatio:
|
|
2568
|
-
unitId:
|
|
2569
|
-
}),
|
|
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();
|
|
2570
2047
|
})
|
|
2571
2048
|
)
|
|
2572
2049
|
);
|
|
@@ -2581,7 +2058,7 @@ let Ue = class extends X {
|
|
|
2581
2058
|
// }
|
|
2582
2059
|
_skeletonListener() {
|
|
2583
2060
|
this.disposeWithMe(
|
|
2584
|
-
|
|
2061
|
+
Ke(
|
|
2585
2062
|
this._docSkeletonManagerService.currentSkeletonBefore$.subscribe((e) => {
|
|
2586
2063
|
if (e == null)
|
|
2587
2064
|
return;
|
|
@@ -2592,12 +2069,12 @@ let Ue = class extends X {
|
|
|
2592
2069
|
);
|
|
2593
2070
|
}
|
|
2594
2071
|
_commandExecutedListener() {
|
|
2595
|
-
const e = [
|
|
2072
|
+
const e = [G.id];
|
|
2596
2073
|
this.disposeWithMe(
|
|
2597
2074
|
this._commandService.onCommandExecuted((t) => {
|
|
2598
2075
|
if (e.includes(t.id)) {
|
|
2599
|
-
const n = this._currentUniverService.getCurrentUniverDocInstance(), r = t.params, { unitId:
|
|
2600
|
-
if (
|
|
2076
|
+
const n = this._currentUniverService.getCurrentUniverDocInstance(), r = t.params, { unitId: i } = r;
|
|
2077
|
+
if (i !== n.getUnitId())
|
|
2601
2078
|
return;
|
|
2602
2079
|
const o = n.zoomRatio || 1;
|
|
2603
2080
|
this._updateViewZoom(o);
|
|
@@ -2611,123 +2088,50 @@ let Ue = class extends X {
|
|
|
2611
2088
|
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
|
|
2612
2089
|
}
|
|
2613
2090
|
_calculatePagePosition(e, t) {
|
|
2614
|
-
const { document: n, scene: r } = e,
|
|
2615
|
-
if (
|
|
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)
|
|
2616
2093
|
return;
|
|
2617
|
-
const { width:
|
|
2618
|
-
let
|
|
2619
|
-
|
|
2620
|
-
const
|
|
2621
|
-
if (
|
|
2622
|
-
const
|
|
2623
|
-
|
|
2624
|
-
x:
|
|
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
|
|
2625
2102
|
});
|
|
2626
2103
|
}
|
|
2627
2104
|
return this;
|
|
2628
2105
|
}
|
|
2629
2106
|
_getDocObject() {
|
|
2630
|
-
return
|
|
2107
|
+
return ke(this._currentUniverService, this._renderManagerService);
|
|
2631
2108
|
}
|
|
2632
2109
|
};
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
],
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
},
|
|
2646
|
-
|
|
2647
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2648
|
-
binding: $.BACKSPACE
|
|
2649
|
-
}, zr = {
|
|
2650
|
-
id: wt.id,
|
|
2651
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2652
|
-
binding: $.DELETE
|
|
2653
|
-
}, Wr = {
|
|
2654
|
-
id: ee.id,
|
|
2655
|
-
binding: $.ARROW_UP,
|
|
2656
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2657
|
-
staticParameters: {
|
|
2658
|
-
direction: D.UP
|
|
2659
|
-
}
|
|
2660
|
-
}, Hr = {
|
|
2661
|
-
id: ee.id,
|
|
2662
|
-
binding: $.ARROW_DOWN,
|
|
2663
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2664
|
-
staticParameters: {
|
|
2665
|
-
direction: D.DOWN
|
|
2666
|
-
}
|
|
2667
|
-
}, Xr = {
|
|
2668
|
-
id: ee.id,
|
|
2669
|
-
binding: $.ARROW_LEFT,
|
|
2670
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2671
|
-
staticParameters: {
|
|
2672
|
-
direction: D.LEFT
|
|
2673
|
-
}
|
|
2674
|
-
}, Gr = {
|
|
2675
|
-
id: ee.id,
|
|
2676
|
-
binding: $.ARROW_RIGHT,
|
|
2677
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2678
|
-
staticParameters: {
|
|
2679
|
-
direction: D.RIGHT
|
|
2680
|
-
}
|
|
2681
|
-
}, Yr = {
|
|
2682
|
-
id: te.id,
|
|
2683
|
-
binding: $.ARROW_UP | Me.SHIFT,
|
|
2684
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2685
|
-
staticParameters: {
|
|
2686
|
-
direction: D.UP
|
|
2687
|
-
}
|
|
2688
|
-
}, qr = {
|
|
2689
|
-
id: te.id,
|
|
2690
|
-
binding: $.ARROW_DOWN | Me.SHIFT,
|
|
2691
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2692
|
-
staticParameters: {
|
|
2693
|
-
direction: D.DOWN
|
|
2694
|
-
}
|
|
2695
|
-
}, Zr = {
|
|
2696
|
-
id: te.id,
|
|
2697
|
-
binding: $.ARROW_LEFT | Me.SHIFT,
|
|
2698
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2699
|
-
staticParameters: {
|
|
2700
|
-
direction: D.LEFT
|
|
2701
|
-
}
|
|
2702
|
-
}, Kr = {
|
|
2703
|
-
id: te.id,
|
|
2704
|
-
binding: $.ARROW_RIGHT | Me.SHIFT,
|
|
2705
|
-
preconditions: (i) => i.getContextValue(N),
|
|
2706
|
-
staticParameters: {
|
|
2707
|
-
direction: D.RIGHT
|
|
2708
|
-
}
|
|
2709
|
-
}, Jr = {
|
|
2710
|
-
id: Ft.id,
|
|
2711
|
-
binding: $.A | Me.CTRL_COMMAND,
|
|
2712
|
-
preconditions: (i) => i.getContextValue(N) || i.getContextValue(_e)
|
|
2713
|
-
};
|
|
2714
|
-
var Qr = Object.defineProperty, ei = Object.getOwnPropertyDescriptor, ti = (i, e, t, n) => {
|
|
2715
|
-
for (var r = n > 1 ? void 0 : n ? ei(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2716
|
-
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
2717
|
-
return n && r && Qr(e, t, r), r;
|
|
2718
|
-
}, Ce = (i, e) => (t, n) => e(t, n, i);
|
|
2719
|
-
let we = class extends me {
|
|
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 {
|
|
2720
2124
|
constructor(e, t, n, r) {
|
|
2721
2125
|
super();
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
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());
|
|
2727
2131
|
this._renderManagerService = e, this._configService = t, this._currentUniverService = n, this._docViewModelManagerService = r, this._initialize();
|
|
2728
2132
|
}
|
|
2729
2133
|
_initialize() {
|
|
2730
|
-
this._currentUniverService.currentDoc$.pipe(
|
|
2134
|
+
this._currentUniverService.currentDoc$.pipe(ce(this.dispose$)).subscribe((e) => {
|
|
2731
2135
|
if (e == null)
|
|
2732
2136
|
return;
|
|
2733
2137
|
this._currentDocumentModel = e;
|
|
@@ -2743,114 +2147,99 @@ let we = class extends me {
|
|
|
2743
2147
|
if (n != null && r != null)
|
|
2744
2148
|
throw new Error("container or parentRenderUnitId can only exist one");
|
|
2745
2149
|
n == null && r != null ? this._renderManagerService.createRenderWithParent(t, r) : this._renderManagerService.createRender(t);
|
|
2746
|
-
const
|
|
2747
|
-
if (
|
|
2150
|
+
const i = this._renderManagerService.getRenderById(t);
|
|
2151
|
+
if (i == null)
|
|
2748
2152
|
return;
|
|
2749
|
-
const { scene: o, engine: a } =
|
|
2153
|
+
const { scene: o, engine: a } = i;
|
|
2750
2154
|
o.openTransformer(), this._scene = o;
|
|
2751
|
-
const
|
|
2155
|
+
const l = new Ft(He.VIEW_MAIN, o, {
|
|
2752
2156
|
left: 0,
|
|
2753
2157
|
top: 0,
|
|
2754
2158
|
bottom: 0,
|
|
2755
2159
|
right: 0,
|
|
2756
2160
|
isWheelPreventDefaultX: !0
|
|
2757
2161
|
});
|
|
2758
|
-
o.attachControl(), o.on(
|
|
2759
|
-
const
|
|
2760
|
-
if (
|
|
2761
|
-
const
|
|
2762
|
-
let
|
|
2763
|
-
|
|
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();
|
|
2764
2168
|
} else
|
|
2765
|
-
|
|
2766
|
-
}), this._configService.getConfig("hasScroll") !== !1 && t !==
|
|
2767
|
-
new
|
|
2768
|
-
new
|
|
2769
|
-
), this._addComponent(
|
|
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(() => {
|
|
2770
2174
|
o.render(), this._fps$.next(Math.round(a.getFps()).toString());
|
|
2771
2175
|
}), this._renderManagerService.setCurrent(t);
|
|
2772
2176
|
}
|
|
2773
2177
|
_addComponent(e) {
|
|
2774
|
-
const t = this._scene, n = this._currentDocumentModel, r = new
|
|
2178
|
+
const t = this._scene, n = this._currentDocumentModel, r = new Vt(je.MAIN, void 0, {
|
|
2775
2179
|
pageMarginLeft: n.documentStyle.marginLeft || 0,
|
|
2776
2180
|
pageMarginTop: n.documentStyle.marginTop || 0
|
|
2777
2181
|
});
|
|
2778
|
-
r.zIndex =
|
|
2182
|
+
r.zIndex = Gt, e.mainComponent = r, e.components.set(je.MAIN, r), t.addObjects([r], rt);
|
|
2779
2183
|
}
|
|
2780
2184
|
};
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
],
|
|
2788
|
-
var
|
|
2789
|
-
for (var r = n > 1 ? void 0 : n ?
|
|
2790
|
-
(o = i
|
|
2791
|
-
return n && r &&
|
|
2792
|
-
},
|
|
2793
|
-
const
|
|
2185
|
+
Me = tr([
|
|
2186
|
+
j(z.Ready, Me),
|
|
2187
|
+
le(0, X),
|
|
2188
|
+
le(1, gt),
|
|
2189
|
+
le(2, y),
|
|
2190
|
+
le(3, E(J))
|
|
2191
|
+
], Me);
|
|
2192
|
+
var nr = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, ir = (s, e, t, n) => {
|
|
2193
|
+
for (var r = n > 1 ? void 0 : n ? rr(e, t) : e, i = s.length - 1, o; i >= 0; i--)
|
|
2194
|
+
(o = s[i]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
2195
|
+
return n && r && nr(e, t, r), r;
|
|
2196
|
+
}, de = (s, e) => (t, n) => e(t, n, s);
|
|
2197
|
+
const sr = {
|
|
2794
2198
|
hasScroll: !0
|
|
2795
|
-
},
|
|
2796
|
-
var
|
|
2797
|
-
let
|
|
2798
|
-
constructor(e = {}, t, n, r,
|
|
2799
|
-
super(
|
|
2800
|
-
|
|
2801
|
-
this._injector = t, this._localeService = n, this._configService = r, this._currentUniverService =
|
|
2199
|
+
}, or = "docs";
|
|
2200
|
+
var Be;
|
|
2201
|
+
let lt = (Be = class extends Tt {
|
|
2202
|
+
constructor(e = {}, t, n, r, i) {
|
|
2203
|
+
super(or);
|
|
2204
|
+
v(this, "_config");
|
|
2205
|
+
this._injector = t, this._localeService = n, this._configService = r, this._currentUniverService = i, this._config = Object.assign(sr, e), this._initializeDependencies(t), this._initializeCommands();
|
|
2802
2206
|
}
|
|
2803
2207
|
initialize() {
|
|
2804
2208
|
}
|
|
2805
2209
|
_initializeCommands() {
|
|
2806
2210
|
[
|
|
2807
|
-
|
|
2808
|
-
te,
|
|
2809
|
-
Ut,
|
|
2810
|
-
wt,
|
|
2811
|
-
he,
|
|
2211
|
+
ze,
|
|
2812
2212
|
Ve,
|
|
2813
|
-
|
|
2814
|
-
|
|
2213
|
+
hn,
|
|
2214
|
+
gn,
|
|
2215
|
+
Te,
|
|
2216
|
+
De,
|
|
2217
|
+
Pe,
|
|
2218
|
+
Ee,
|
|
2815
2219
|
Q,
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2220
|
+
we,
|
|
2221
|
+
Ue,
|
|
2222
|
+
Ne,
|
|
2223
|
+
Ae,
|
|
2224
|
+
Mt,
|
|
2225
|
+
an,
|
|
2226
|
+
be,
|
|
2227
|
+
ye,
|
|
2228
|
+
ft,
|
|
2229
|
+
St,
|
|
2230
|
+
Xe,
|
|
2231
|
+
L,
|
|
2232
|
+
Mn,
|
|
2233
|
+
In,
|
|
2234
|
+
Ct,
|
|
2235
|
+
G,
|
|
2236
|
+
mt,
|
|
2237
|
+
Rn,
|
|
2238
|
+
Sn,
|
|
2239
|
+
_n,
|
|
2240
|
+
Ge
|
|
2837
2241
|
].forEach((e) => {
|
|
2838
|
-
this._injector.get(
|
|
2839
|
-
}), [
|
|
2840
|
-
Wr,
|
|
2841
|
-
Hr,
|
|
2842
|
-
Gr,
|
|
2843
|
-
Xr,
|
|
2844
|
-
Yr,
|
|
2845
|
-
qr,
|
|
2846
|
-
Zr,
|
|
2847
|
-
Kr,
|
|
2848
|
-
Jr,
|
|
2849
|
-
kr,
|
|
2850
|
-
zr,
|
|
2851
|
-
jr
|
|
2852
|
-
].forEach((e) => {
|
|
2853
|
-
this._injector.get(Mn).registerShortcut(e);
|
|
2242
|
+
this._injector.get(b).registerCommand(e);
|
|
2854
2243
|
});
|
|
2855
2244
|
}
|
|
2856
2245
|
onReady() {
|
|
@@ -2863,83 +2252,80 @@ let xt = (Ge = class extends Zt {
|
|
|
2863
2252
|
// { useFactory: () => docInjector.createInstance(CanvasView, this._config.standalone ?? true) },
|
|
2864
2253
|
// ], // FIXME: CanvasView shouldn't be a dependency of UniverDocs. Because it maybe created dynamically.
|
|
2865
2254
|
//views
|
|
2866
|
-
[
|
|
2255
|
+
[Me],
|
|
2867
2256
|
// services
|
|
2868
|
-
[
|
|
2869
|
-
[
|
|
2870
|
-
[
|
|
2871
|
-
[
|
|
2872
|
-
jt,
|
|
2873
|
-
{
|
|
2874
|
-
useClass: Je
|
|
2875
|
-
}
|
|
2876
|
-
],
|
|
2257
|
+
[B],
|
|
2258
|
+
[J],
|
|
2259
|
+
[Ce],
|
|
2260
|
+
[xe],
|
|
2877
2261
|
[
|
|
2878
|
-
|
|
2262
|
+
ae,
|
|
2879
2263
|
{
|
|
2880
|
-
useClass:
|
|
2264
|
+
useClass: kt
|
|
2881
2265
|
}
|
|
2882
2266
|
],
|
|
2883
|
-
[
|
|
2267
|
+
[w],
|
|
2884
2268
|
// controllers
|
|
2885
|
-
[
|
|
2886
|
-
[
|
|
2887
|
-
[
|
|
2888
|
-
[
|
|
2889
|
-
[
|
|
2890
|
-
[
|
|
2891
|
-
[
|
|
2892
|
-
[
|
|
2893
|
-
[
|
|
2894
|
-
[Oe]
|
|
2269
|
+
[ue],
|
|
2270
|
+
[_e],
|
|
2271
|
+
[Se],
|
|
2272
|
+
[pe],
|
|
2273
|
+
[ge],
|
|
2274
|
+
[me],
|
|
2275
|
+
[fe],
|
|
2276
|
+
[ve],
|
|
2277
|
+
[he]
|
|
2895
2278
|
].forEach((t) => e.add(t));
|
|
2896
2279
|
}
|
|
2897
|
-
},
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
],
|
|
2280
|
+
}, v(Be, "type", Dt.Doc), Be);
|
|
2281
|
+
lt = ir([
|
|
2282
|
+
de(1, E(Ht)),
|
|
2283
|
+
de(2, E(dt)),
|
|
2284
|
+
de(3, gt),
|
|
2285
|
+
de(4, y)
|
|
2286
|
+
], lt);
|
|
2904
2287
|
export {
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2288
|
+
an as BreakLineCommand,
|
|
2289
|
+
_n as BulletListCommand,
|
|
2290
|
+
In as CoverContentCommand,
|
|
2291
|
+
pt as CutContentCommand,
|
|
2292
|
+
Gt as DOCS_COMPONENT_DEFAULT_Z_INDEX,
|
|
2293
|
+
Xt as DOCS_COMPONENT_HEADER_LAYER_INDEX,
|
|
2294
|
+
rt as DOCS_COMPONENT_MAIN_LAYER_INDEX,
|
|
2295
|
+
je as DOCS_VIEW_KEY,
|
|
2296
|
+
ye as DeleteCommand,
|
|
2297
|
+
hn as DeleteLeftCommand,
|
|
2298
|
+
gn as DeleteRightCommand,
|
|
2299
|
+
Me as DocCanvasView,
|
|
2300
|
+
B as DocSkeletonManagerService,
|
|
2301
|
+
Ce as DocStateChangeManagerService,
|
|
2302
|
+
J as DocViewModelManagerService,
|
|
2303
|
+
St as IMEInputCommand,
|
|
2304
|
+
xe as IMEInputManagerService,
|
|
2305
|
+
gr as InnerPasteCommand,
|
|
2306
|
+
be as InsertCommand,
|
|
2307
|
+
ze as MoveCursorOperation,
|
|
2308
|
+
Ve as MoveSelectionOperation,
|
|
2309
|
+
hr as NORMAL_TEXT_SELECTION_PLUGIN_NAME,
|
|
2310
|
+
Sn as OrderListCommand,
|
|
2311
|
+
Mn as ReplaceContentCommand,
|
|
2312
|
+
L as RichTextEditingMutation,
|
|
2313
|
+
Rn as SelectAllOperation,
|
|
2314
|
+
Te as SetInlineFormatBoldCommand,
|
|
2315
|
+
Mt as SetInlineFormatCommand,
|
|
2316
|
+
Ne as SetInlineFormatFontFamilyCommand,
|
|
2317
|
+
Ue as SetInlineFormatFontSizeCommand,
|
|
2318
|
+
De as SetInlineFormatItalicCommand,
|
|
2319
|
+
Ee as SetInlineFormatStrikethroughCommand,
|
|
2935
2320
|
Q as SetInlineFormatSubscriptCommand,
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2321
|
+
we as SetInlineFormatSuperscriptCommand,
|
|
2322
|
+
Ae as SetInlineFormatTextColorCommand,
|
|
2323
|
+
Pe as SetInlineFormatUnderlineCommand,
|
|
2324
|
+
mt as SetTextSelectionsOperation,
|
|
2325
|
+
w as TextSelectionManagerService,
|
|
2326
|
+
lt as UniverDocsPlugin,
|
|
2327
|
+
ft as UpdateCommand,
|
|
2328
|
+
He as VIEWPORT_KEY,
|
|
2329
|
+
ke as getDocObject,
|
|
2330
|
+
Ie as serializeTextRange
|
|
2945
2331
|
};
|