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