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