@univerjs/docs-ui 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +3 -3
- package/lib/es/index.js +873 -809
- package/lib/types/controllers/back-scroll.controller.d.ts +2 -2
- package/lib/types/controllers/doc-editor-bridge.controller.d.ts +2 -2
- package/lib/types/controllers/doc-ui.controller.d.ts +2 -2
- package/lib/types/controllers/floating-object.controller.d.ts +2 -2
- package/lib/types/controllers/menu/menu.d.ts +2 -0
- package/lib/types/controllers/page-render.controller.d.ts +2 -2
- package/lib/types/controllers/text-selection.controller.d.ts +2 -2
- package/lib/types/controllers/zoom.controller.d.ts +2 -2
- package/lib/types/docs-ui-plugin.d.ts +3 -3
- package/lib/types/locale/zh-CN.d.ts +4 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +2 -2
- package/lib/types/views/doc-canvas-view.d.ts +3 -3
- package/lib/umd/index.js +3 -3
- package/package.json +19 -19
package/lib/es/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { FOCUSING_DOC as
|
|
5
|
-
import { Inject as
|
|
6
|
-
import { KeyCode as P, MetaKeys as le, ILayoutService as
|
|
7
|
-
import { MoveCursorOperation as
|
|
8
|
-
import { connectInjector as
|
|
9
|
-
import { ITextSelectionRenderManager as de, pixelToPt as
|
|
1
|
+
var Bt = Object.defineProperty;
|
|
2
|
+
var Ft = (i, e, t) => e in i ? Bt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var m = (i, e, t) => (Ft(i, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { FOCUSING_DOC as xe, FOCUSING_UNIVER_EDITOR as Ge, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE as wt, Direction as V, EDITOR_ACTIVATED as Rt, LocaleService as Ze, RxDisposable as ce, ICommandService as v, BooleanNumber as C, UniverInstanceType as S, BaselineOffset as J, ThemeService as Tt, HorizontalAlign as De, IUniverInstanceService as D, Disposable as Y, OnLifecycle as N, LifecycleStages as A, Tools as qe, LRUMap as jt, ColorKit as rt, toDisposable as F, ILogService as It, CommandType as Ke, IContextService as Vt, checkForSubstrings as Wt, IConfigService as zt, DEFAULT_DOCUMENT_SUB_COMPONENT_ID as kt, IFloatingObjectManagerService as Ht, Plugin as Yt } from "@univerjs/core";
|
|
5
|
+
import { Inject as O, Injector as Pe, Optional as Xt, createIdentifier as Gt } from "@wendellhu/redi";
|
|
6
|
+
import { KeyCode as P, MetaKeys as le, ILayoutService as bt, MenuGroup as I, MenuItemType as T, MenuPosition as b, getMenuHiddenObservable as M, FONT_FAMILY_LIST as ot, FONT_SIZE_LIST as Zt, FontFamily as qt, FontFamilyItem as Kt, FontSize as Jt, DesktopUIPart as Qt, ComponentManager as en, IEditorService as $, IMenuService as tn, IUIController as nn, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as rn, HTML_CLIPBOARD_MIME_TYPE as on, IClipboardInterfaceService as Je, CopyCommand as sn, CutCommand as an, PasteCommand as cn, SetEditorResizeOperation as ln, IShortcutService as dn } from "@univerjs/ui";
|
|
7
|
+
import { MoveCursorOperation as Ue, MoveSelectionOperation as Le, SelectAllOperation as un, SetInlineFormatBoldCommand as hn, SetTextSelectionsOperation as U, SetInlineFormatCommand as ee, SetInlineFormatItalicCommand as gn, SetInlineFormatUnderlineCommand as _n, SetInlineFormatStrikethroughCommand as pn, SetInlineFormatSubscriptCommand as fn, SetInlineFormatSuperscriptCommand as mn, SetInlineFormatFontFamilyCommand as st, SetInlineFormatFontSizeCommand as at, SetInlineFormatTextColorCommand as ct, AlignLeftCommand as Sn, AlignOperationCommand as Ne, AlignCenterCommand as vn, AlignRightCommand as Cn, AlignJustifyCommand as On, OrderListCommand as Rn, BulletListCommand as Tn, ResetInlineFormatTextBackgroundColorCommand as In, SetInlineFormatTextBackgroundColorCommand as ke, TextSelectionManagerService as te, BreakLineCommand as bn, DeleteLeftCommand as Mn, DeleteRightCommand as yn, CutContentCommand as Mt, InnerPasteCommand as yt, VIEWPORT_KEY as Ae, CoverContentCommand as En, RichTextEditingMutation as Qe, DocSkeletonManagerService as ne, DOCS_COMPONENT_MAIN_LAYER_INDEX as je, DOCS_COMPONENT_HEADER_LAYER_INDEX as xn, DOCS_VIEW_KEY as lt, DOCS_COMPONENT_DEFAULT_Z_INDEX as Dn, SetDocZoomRatioOperation as et, SetDocZoomRatioCommand as Pn, getDocObject as Et, getDocObjectById as Un } from "@univerjs/docs";
|
|
8
|
+
import { connectInjector as Ln } from "@wendellhu/redi/react-bindings";
|
|
9
|
+
import { ITextSelectionRenderManager as de, pixelToPt as Nn, ptToPixel as dt, ScrollBar as He, IRenderManagerService as W, PageLayoutType as ut, Viewport as An, EVENT_TYPE as $n, Layer as ht, Documents as Bn, Liquid as Fn, Rect as wn, CURSOR_TYPE as gt, NodePositionConvertToCursor as jn, getAnchorBounding as Vn } from "@univerjs/engine-render";
|
|
10
10
|
import Wn from "react";
|
|
11
|
-
import { Observable as E, takeUntil as ae, fromEvent as
|
|
12
|
-
import { ColorPicker as
|
|
13
|
-
const
|
|
11
|
+
import { Observable as E, takeUntil as ae, fromEvent as _t, BehaviorSubject as zn } from "rxjs";
|
|
12
|
+
import { ColorPicker as kn } from "@univerjs/design";
|
|
13
|
+
const Hn = {
|
|
14
14
|
undo: !0,
|
|
15
15
|
redo: !0,
|
|
16
16
|
// Undo redo
|
|
@@ -38,7 +38,7 @@ const kn = {
|
|
|
38
38
|
// 'Wrap mode'
|
|
39
39
|
textRotateMode: !0
|
|
40
40
|
// 'Text Rotation Mode'
|
|
41
|
-
},
|
|
41
|
+
}, Yn = {
|
|
42
42
|
outerLeft: !1,
|
|
43
43
|
outerRight: !1,
|
|
44
44
|
header: !0,
|
|
@@ -51,90 +51,90 @@ const kn = {
|
|
|
51
51
|
frozenContent: !1,
|
|
52
52
|
infoBar: !0,
|
|
53
53
|
toolbar: !0
|
|
54
|
-
},
|
|
54
|
+
}, Xn = {
|
|
55
55
|
layout: {
|
|
56
|
-
docContainerConfig:
|
|
57
|
-
toolbarConfig:
|
|
56
|
+
docContainerConfig: Yn,
|
|
57
|
+
toolbarConfig: Hn
|
|
58
58
|
}
|
|
59
|
-
},
|
|
60
|
-
function
|
|
61
|
-
return
|
|
59
|
+
}, Gn = "DocUI";
|
|
60
|
+
function B(i) {
|
|
61
|
+
return i.getContextValue(xe) && i.getContextValue(Ge);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
63
|
+
function Zn(i) {
|
|
64
|
+
return i.getContextValue(xe) && i.getContextValue(Ge) && !i.getContextValue(wt);
|
|
65
65
|
}
|
|
66
|
-
const
|
|
67
|
-
id:
|
|
66
|
+
const qn = {
|
|
67
|
+
id: Ue.id,
|
|
68
68
|
binding: P.ARROW_UP,
|
|
69
|
-
preconditions:
|
|
69
|
+
preconditions: B,
|
|
70
70
|
staticParameters: {
|
|
71
|
-
direction:
|
|
71
|
+
direction: V.UP
|
|
72
72
|
}
|
|
73
|
-
},
|
|
74
|
-
id:
|
|
73
|
+
}, Kn = {
|
|
74
|
+
id: Ue.id,
|
|
75
75
|
binding: P.ARROW_DOWN,
|
|
76
|
-
preconditions:
|
|
76
|
+
preconditions: B,
|
|
77
77
|
staticParameters: {
|
|
78
|
-
direction:
|
|
78
|
+
direction: V.DOWN
|
|
79
79
|
}
|
|
80
|
-
},
|
|
81
|
-
id:
|
|
80
|
+
}, Jn = {
|
|
81
|
+
id: Ue.id,
|
|
82
82
|
binding: P.ARROW_LEFT,
|
|
83
|
-
preconditions:
|
|
83
|
+
preconditions: B,
|
|
84
84
|
staticParameters: {
|
|
85
|
-
direction:
|
|
85
|
+
direction: V.LEFT
|
|
86
86
|
}
|
|
87
|
-
},
|
|
88
|
-
id:
|
|
87
|
+
}, Qn = {
|
|
88
|
+
id: Ue.id,
|
|
89
89
|
binding: P.ARROW_RIGHT,
|
|
90
|
-
preconditions:
|
|
90
|
+
preconditions: B,
|
|
91
91
|
staticParameters: {
|
|
92
|
-
direction:
|
|
92
|
+
direction: V.RIGHT
|
|
93
93
|
}
|
|
94
|
-
},
|
|
95
|
-
id:
|
|
94
|
+
}, ei = {
|
|
95
|
+
id: Le.id,
|
|
96
96
|
binding: P.ARROW_UP | le.SHIFT,
|
|
97
|
-
preconditions:
|
|
97
|
+
preconditions: B,
|
|
98
98
|
staticParameters: {
|
|
99
|
-
direction:
|
|
99
|
+
direction: V.UP
|
|
100
100
|
}
|
|
101
|
-
},
|
|
102
|
-
id:
|
|
101
|
+
}, ti = {
|
|
102
|
+
id: Le.id,
|
|
103
103
|
binding: P.ARROW_DOWN | le.SHIFT,
|
|
104
|
-
preconditions:
|
|
104
|
+
preconditions: B,
|
|
105
105
|
staticParameters: {
|
|
106
|
-
direction:
|
|
106
|
+
direction: V.DOWN
|
|
107
107
|
}
|
|
108
|
-
},
|
|
109
|
-
id:
|
|
108
|
+
}, ni = {
|
|
109
|
+
id: Le.id,
|
|
110
110
|
binding: P.ARROW_LEFT | le.SHIFT,
|
|
111
|
-
preconditions:
|
|
111
|
+
preconditions: B,
|
|
112
112
|
staticParameters: {
|
|
113
|
-
direction:
|
|
113
|
+
direction: V.LEFT
|
|
114
114
|
}
|
|
115
|
-
},
|
|
116
|
-
id:
|
|
115
|
+
}, ii = {
|
|
116
|
+
id: Le.id,
|
|
117
117
|
binding: P.ARROW_RIGHT | le.SHIFT,
|
|
118
|
-
preconditions:
|
|
118
|
+
preconditions: B,
|
|
119
119
|
staticParameters: {
|
|
120
|
-
direction:
|
|
120
|
+
direction: V.RIGHT
|
|
121
121
|
}
|
|
122
|
-
},
|
|
122
|
+
}, ri = {
|
|
123
123
|
id: un.id,
|
|
124
124
|
binding: P.A | le.CTRL_COMMAND,
|
|
125
|
-
preconditions: (
|
|
125
|
+
preconditions: (i) => i.getContextValue(Ge) && (i.getContextValue(xe) || i.getContextValue(Rt))
|
|
126
126
|
};
|
|
127
|
-
var
|
|
128
|
-
for (var
|
|
129
|
-
(o =
|
|
130
|
-
return n &&
|
|
131
|
-
},
|
|
132
|
-
let
|
|
133
|
-
constructor(
|
|
134
|
-
|
|
127
|
+
var oi = Object.defineProperty, si = Object.getOwnPropertyDescriptor, ai = (i, e, t, n) => {
|
|
128
|
+
for (var r = n > 1 ? void 0 : n ? si(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
129
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
130
|
+
return n && r && oi(e, t, r), r;
|
|
131
|
+
}, pt = (i, e) => (t, n) => e(t, n, i);
|
|
132
|
+
let Ye = class {
|
|
133
|
+
constructor(i, e, t) {
|
|
134
|
+
m(this, "_docContainer");
|
|
135
135
|
// 获取SheetContainer组件
|
|
136
|
-
|
|
137
|
-
if (this._docContainer =
|
|
136
|
+
m(this, "getComponent", (i) => {
|
|
137
|
+
if (this._docContainer = i, !i.getContentRef().current)
|
|
138
138
|
throw new Error("container is not ready");
|
|
139
139
|
});
|
|
140
140
|
/**
|
|
@@ -144,10 +144,10 @@ let He = class {
|
|
|
144
144
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
145
145
|
*
|
|
146
146
|
*/
|
|
147
|
-
|
|
148
|
-
this._localeService.setLocale(
|
|
147
|
+
m(this, "changeLocale", (i) => {
|
|
148
|
+
this._localeService.setLocale(i);
|
|
149
149
|
});
|
|
150
|
-
this._config =
|
|
150
|
+
this._config = i, this._localeService = e, this._injector = t;
|
|
151
151
|
}
|
|
152
152
|
getUIConfig() {
|
|
153
153
|
return {
|
|
@@ -160,27 +160,27 @@ let He = class {
|
|
|
160
160
|
getContentRef() {
|
|
161
161
|
return this._docContainer.getContentRef();
|
|
162
162
|
}
|
|
163
|
-
UIDidMount(
|
|
163
|
+
UIDidMount(i) {
|
|
164
164
|
if (this._docContainer)
|
|
165
|
-
return
|
|
165
|
+
return i(this._docContainer);
|
|
166
166
|
}
|
|
167
167
|
getDocContainer() {
|
|
168
168
|
return this._docContainer;
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
],
|
|
175
|
-
var
|
|
176
|
-
for (var
|
|
177
|
-
(o =
|
|
178
|
-
return n &&
|
|
179
|
-
}, _e = (
|
|
171
|
+
Ye = ai([
|
|
172
|
+
pt(1, O(Ze)),
|
|
173
|
+
pt(2, O(Pe))
|
|
174
|
+
], Ye);
|
|
175
|
+
var ci = Object.defineProperty, li = Object.getOwnPropertyDescriptor, di = (i, e, t, n) => {
|
|
176
|
+
for (var r = n > 1 ? void 0 : n ? li(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
177
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
178
|
+
return n && r && ci(e, t, r), r;
|
|
179
|
+
}, _e = (i, e) => (t, n) => e(t, n, i);
|
|
180
180
|
let se = class extends ce {
|
|
181
|
-
constructor(e, t, n,
|
|
181
|
+
constructor(e, t, n, r, s) {
|
|
182
182
|
super();
|
|
183
|
-
|
|
183
|
+
m(this, "_docContainerController");
|
|
184
184
|
/**
|
|
185
185
|
* Change language
|
|
186
186
|
* @param {string} locale new language
|
|
@@ -188,10 +188,10 @@ let se = class extends ce {
|
|
|
188
188
|
* e: {target: HTMLSelectElement } reference from https://stackoverflow.com/a/48443771
|
|
189
189
|
*
|
|
190
190
|
*/
|
|
191
|
-
|
|
191
|
+
m(this, "changeLocale", (e) => {
|
|
192
192
|
this._localeService.setLocale(e);
|
|
193
193
|
});
|
|
194
|
-
this._localeService = t, this._injector = n, this._textSelectionRenderManager =
|
|
194
|
+
this._localeService = t, this._injector = n, this._textSelectionRenderManager = r, this._layoutService = s, this._docContainerController = this._injector.createInstance(Ye, e), this._registerContainer();
|
|
195
195
|
}
|
|
196
196
|
_registerContainer() {
|
|
197
197
|
this._layoutService && this.disposeWithMe(
|
|
@@ -203,14 +203,14 @@ let se = class extends ce {
|
|
|
203
203
|
return this._docContainerController;
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
se =
|
|
207
|
-
_e(1,
|
|
208
|
-
_e(2,
|
|
206
|
+
se = di([
|
|
207
|
+
_e(1, O(Ze)),
|
|
208
|
+
_e(2, O(Pe)),
|
|
209
209
|
_e(3, de),
|
|
210
|
-
_e(4, Xt(
|
|
210
|
+
_e(4, Xt(bt))
|
|
211
211
|
], se);
|
|
212
|
-
const
|
|
213
|
-
var
|
|
212
|
+
const $e = "UI_PLUGIN_DOCS", tt = `${$e}_COLOR_PICKER_COMPONENT`, xt = `${$e}_FONT_FAMILY_COMPONENT`, Dt = `${$e}_FONT_FAMILY_ITEM_COMPONENT`, Pt = `${$e}_FONT_SIZE_COMPONENT`;
|
|
213
|
+
var Ut = { exports: {} }, Be = {};
|
|
214
214
|
/**
|
|
215
215
|
* @license React
|
|
216
216
|
* react-jsx-runtime.production.min.js
|
|
@@ -220,148 +220,148 @@ var Dt = { exports: {} }, $e = {};
|
|
|
220
220
|
* This source code is licensed under the MIT license found in the
|
|
221
221
|
* LICENSE file in the root directory of this source tree.
|
|
222
222
|
*/
|
|
223
|
-
var
|
|
224
|
-
function
|
|
225
|
-
var n,
|
|
223
|
+
var ui = Wn, hi = Symbol.for("react.element"), gi = Symbol.for("react.fragment"), _i = Object.prototype.hasOwnProperty, pi = ui.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, fi = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
224
|
+
function Lt(i, e, t) {
|
|
225
|
+
var n, r = {}, s = null, o = null;
|
|
226
226
|
t !== void 0 && (s = "" + t), e.key !== void 0 && (s = "" + e.key), e.ref !== void 0 && (o = e.ref);
|
|
227
227
|
for (n in e)
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
for (n in e =
|
|
231
|
-
|
|
232
|
-
return { $$typeof:
|
|
228
|
+
_i.call(e, n) && !fi.hasOwnProperty(n) && (r[n] = e[n]);
|
|
229
|
+
if (i && i.defaultProps)
|
|
230
|
+
for (n in e = i.defaultProps, e)
|
|
231
|
+
r[n] === void 0 && (r[n] = e[n]);
|
|
232
|
+
return { $$typeof: hi, type: i, key: s, ref: o, props: r, _owner: pi.current };
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
const
|
|
240
|
-
docsUiCanvasBackground:
|
|
241
|
-
},
|
|
242
|
-
function
|
|
243
|
-
const e =
|
|
234
|
+
Be.Fragment = gi;
|
|
235
|
+
Be.jsx = Lt;
|
|
236
|
+
Be.jsxs = Lt;
|
|
237
|
+
Ut.exports = Be;
|
|
238
|
+
var mi = Ut.exports;
|
|
239
|
+
const Si = "univer-docs-ui-canvas-background", vi = {
|
|
240
|
+
docsUiCanvasBackground: Si
|
|
241
|
+
}, Ci = () => /* @__PURE__ */ mi.jsx("div", { className: vi.docsUiCanvasBackground });
|
|
242
|
+
function Oi(i) {
|
|
243
|
+
const e = i.get(v);
|
|
244
244
|
return {
|
|
245
245
|
id: hn.id,
|
|
246
|
-
group:
|
|
247
|
-
type:
|
|
246
|
+
group: I.TOOLBAR_FORMAT,
|
|
247
|
+
type: T.BUTTON,
|
|
248
248
|
icon: "BoldSingle",
|
|
249
249
|
title: "Set bold",
|
|
250
250
|
tooltip: "toolbar.bold",
|
|
251
|
-
positions: [
|
|
251
|
+
positions: [b.TOOLBAR_START],
|
|
252
252
|
activated$: new E((t) => {
|
|
253
|
-
const n = e.onCommandExecuted((
|
|
253
|
+
const n = e.onCommandExecuted((r) => {
|
|
254
254
|
var o;
|
|
255
|
-
const s =
|
|
255
|
+
const s = r.id;
|
|
256
256
|
if (s === U.id || s === ee.id) {
|
|
257
|
-
const a =
|
|
257
|
+
const a = z(i);
|
|
258
258
|
if (a == null)
|
|
259
259
|
return;
|
|
260
260
|
const c = (o = a.ts) == null ? void 0 : o.bl;
|
|
261
|
-
t.next(c ===
|
|
261
|
+
t.next(c === C.TRUE);
|
|
262
262
|
}
|
|
263
263
|
});
|
|
264
264
|
return t.next(!1), n.dispose;
|
|
265
265
|
}),
|
|
266
|
-
hidden$: M(
|
|
266
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const e =
|
|
269
|
+
function Ri(i) {
|
|
270
|
+
const e = i.get(v);
|
|
271
271
|
return {
|
|
272
272
|
id: gn.id,
|
|
273
|
-
group:
|
|
274
|
-
type:
|
|
273
|
+
group: I.TOOLBAR_FORMAT,
|
|
274
|
+
type: T.BUTTON,
|
|
275
275
|
icon: "ItalicSingle",
|
|
276
276
|
title: "Set italic",
|
|
277
277
|
tooltip: "toolbar.italic",
|
|
278
|
-
positions: [
|
|
278
|
+
positions: [b.TOOLBAR_START],
|
|
279
279
|
activated$: new E((t) => {
|
|
280
|
-
const n = e.onCommandExecuted((
|
|
280
|
+
const n = e.onCommandExecuted((r) => {
|
|
281
281
|
var o;
|
|
282
|
-
const s =
|
|
282
|
+
const s = r.id;
|
|
283
283
|
if (s === U.id || s === ee.id) {
|
|
284
|
-
const a =
|
|
284
|
+
const a = z(i);
|
|
285
285
|
if (a == null)
|
|
286
286
|
return;
|
|
287
287
|
const c = (o = a.ts) == null ? void 0 : o.it;
|
|
288
|
-
t.next(c ===
|
|
288
|
+
t.next(c === C.TRUE);
|
|
289
289
|
}
|
|
290
290
|
});
|
|
291
291
|
return t.next(!1), n.dispose;
|
|
292
292
|
}),
|
|
293
|
-
hidden$: M(
|
|
293
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const e =
|
|
296
|
+
function Ti(i) {
|
|
297
|
+
const e = i.get(v);
|
|
298
298
|
return {
|
|
299
299
|
id: _n.id,
|
|
300
|
-
group:
|
|
301
|
-
type:
|
|
300
|
+
group: I.TOOLBAR_FORMAT,
|
|
301
|
+
type: T.BUTTON,
|
|
302
302
|
icon: "UnderlineSingle",
|
|
303
303
|
title: "Set underline",
|
|
304
304
|
tooltip: "toolbar.underline",
|
|
305
|
-
positions: [
|
|
305
|
+
positions: [b.TOOLBAR_START],
|
|
306
306
|
activated$: new E((t) => {
|
|
307
|
-
const n = e.onCommandExecuted((
|
|
307
|
+
const n = e.onCommandExecuted((r) => {
|
|
308
308
|
var o;
|
|
309
|
-
const s =
|
|
309
|
+
const s = r.id;
|
|
310
310
|
if (s === U.id || s === ee.id) {
|
|
311
|
-
const a =
|
|
311
|
+
const a = z(i);
|
|
312
312
|
if (a == null)
|
|
313
313
|
return;
|
|
314
314
|
const c = (o = a.ts) == null ? void 0 : o.ul;
|
|
315
|
-
t.next((c == null ? void 0 : c.s) ===
|
|
315
|
+
t.next((c == null ? void 0 : c.s) === C.TRUE);
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
318
|
return t.next(!1), n.dispose;
|
|
319
319
|
}),
|
|
320
|
-
hidden$: M(
|
|
320
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
const e =
|
|
323
|
+
function Ii(i) {
|
|
324
|
+
const e = i.get(v);
|
|
325
325
|
return {
|
|
326
326
|
id: pn.id,
|
|
327
|
-
group:
|
|
328
|
-
type:
|
|
327
|
+
group: I.TOOLBAR_FORMAT,
|
|
328
|
+
type: T.BUTTON,
|
|
329
329
|
icon: "StrikethroughSingle",
|
|
330
330
|
title: "Set strike through",
|
|
331
331
|
tooltip: "toolbar.strikethrough",
|
|
332
|
-
positions: [
|
|
332
|
+
positions: [b.TOOLBAR_START],
|
|
333
333
|
activated$: new E((t) => {
|
|
334
|
-
const n = e.onCommandExecuted((
|
|
334
|
+
const n = e.onCommandExecuted((r) => {
|
|
335
335
|
var o;
|
|
336
|
-
const s =
|
|
336
|
+
const s = r.id;
|
|
337
337
|
if (s === U.id || s === ee.id) {
|
|
338
|
-
const a =
|
|
338
|
+
const a = z(i);
|
|
339
339
|
if (a == null)
|
|
340
340
|
return;
|
|
341
341
|
const c = (o = a.ts) == null ? void 0 : o.st;
|
|
342
|
-
t.next((c == null ? void 0 : c.s) ===
|
|
342
|
+
t.next((c == null ? void 0 : c.s) === C.TRUE);
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
return t.next(!1), n.dispose;
|
|
346
346
|
}),
|
|
347
|
-
hidden$: M(
|
|
347
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
const e =
|
|
350
|
+
function bi(i) {
|
|
351
|
+
const e = i.get(v);
|
|
352
352
|
return {
|
|
353
353
|
id: fn.id,
|
|
354
|
-
group:
|
|
355
|
-
type:
|
|
354
|
+
group: I.TOOLBAR_FORMAT,
|
|
355
|
+
type: T.BUTTON,
|
|
356
356
|
icon: "SubscriptSingle",
|
|
357
357
|
tooltip: "toolbar.subscript",
|
|
358
|
-
positions: [
|
|
358
|
+
positions: [b.TOOLBAR_START],
|
|
359
359
|
activated$: new E((t) => {
|
|
360
|
-
const n = e.onCommandExecuted((
|
|
360
|
+
const n = e.onCommandExecuted((r) => {
|
|
361
361
|
var o;
|
|
362
|
-
const s =
|
|
362
|
+
const s = r.id;
|
|
363
363
|
if (s === U.id || s === ee.id) {
|
|
364
|
-
const a =
|
|
364
|
+
const a = z(i);
|
|
365
365
|
if (a == null)
|
|
366
366
|
return;
|
|
367
367
|
const c = (o = a.ts) == null ? void 0 : o.va;
|
|
@@ -370,24 +370,24 @@ function br(r) {
|
|
|
370
370
|
});
|
|
371
371
|
return t.next(!1), n.dispose;
|
|
372
372
|
}),
|
|
373
|
-
hidden$: M(
|
|
373
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
const e =
|
|
376
|
+
function Mi(i) {
|
|
377
|
+
const e = i.get(v);
|
|
378
378
|
return {
|
|
379
|
-
id:
|
|
380
|
-
group:
|
|
381
|
-
type:
|
|
379
|
+
id: mn.id,
|
|
380
|
+
group: I.TOOLBAR_FORMAT,
|
|
381
|
+
type: T.BUTTON,
|
|
382
382
|
icon: "SuperscriptSingle",
|
|
383
383
|
tooltip: "toolbar.superscript",
|
|
384
|
-
positions: [
|
|
384
|
+
positions: [b.TOOLBAR_START],
|
|
385
385
|
activated$: new E((t) => {
|
|
386
|
-
const n = e.onCommandExecuted((
|
|
386
|
+
const n = e.onCommandExecuted((r) => {
|
|
387
387
|
var o;
|
|
388
|
-
const s =
|
|
388
|
+
const s = r.id;
|
|
389
389
|
if (s === U.id || s === ee.id) {
|
|
390
|
-
const a =
|
|
390
|
+
const a = z(i);
|
|
391
391
|
if (a == null)
|
|
392
392
|
return;
|
|
393
393
|
const c = (o = a.ts) == null ? void 0 : o.va;
|
|
@@ -396,254 +396,292 @@ function Ir(r) {
|
|
|
396
396
|
});
|
|
397
397
|
return t.next(!1), n.dispose;
|
|
398
398
|
}),
|
|
399
|
-
hidden$: M(
|
|
399
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
const e =
|
|
402
|
+
function yi(i) {
|
|
403
|
+
const e = i.get(v);
|
|
404
404
|
return {
|
|
405
|
-
id:
|
|
405
|
+
id: st.id,
|
|
406
406
|
tooltip: "toolbar.font",
|
|
407
|
-
group:
|
|
408
|
-
type:
|
|
409
|
-
label:
|
|
410
|
-
positions: [
|
|
411
|
-
selections:
|
|
407
|
+
group: I.TOOLBAR_FORMAT,
|
|
408
|
+
type: T.SELECTOR,
|
|
409
|
+
label: xt,
|
|
410
|
+
positions: [b.TOOLBAR_START],
|
|
411
|
+
selections: ot.map((t) => ({
|
|
412
412
|
label: {
|
|
413
|
-
name:
|
|
413
|
+
name: Dt,
|
|
414
414
|
hoverable: !0
|
|
415
415
|
},
|
|
416
416
|
value: t.value
|
|
417
417
|
})),
|
|
418
418
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
419
419
|
value$: new E((t) => {
|
|
420
|
-
const n =
|
|
420
|
+
const n = ot[0].value, r = e.onCommandExecuted((s) => {
|
|
421
421
|
var a;
|
|
422
422
|
const o = s.id;
|
|
423
|
-
if (o === U.id || o ===
|
|
424
|
-
const c =
|
|
423
|
+
if (o === U.id || o === st.id) {
|
|
424
|
+
const c = z(i);
|
|
425
425
|
if (c == null)
|
|
426
426
|
return;
|
|
427
427
|
const d = (a = c.ts) == null ? void 0 : a.ff;
|
|
428
428
|
t.next(d != null ? d : n);
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
|
-
return t.next(n),
|
|
431
|
+
return t.next(n), r.dispose;
|
|
432
432
|
}),
|
|
433
|
-
hidden$: M(
|
|
433
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
|
-
function
|
|
437
|
-
const e =
|
|
436
|
+
function Ei(i) {
|
|
437
|
+
const e = i.get(v);
|
|
438
438
|
return {
|
|
439
|
-
id:
|
|
440
|
-
group:
|
|
441
|
-
type:
|
|
439
|
+
id: at.id,
|
|
440
|
+
group: I.TOOLBAR_FORMAT,
|
|
441
|
+
type: T.SELECTOR,
|
|
442
442
|
tooltip: "toolbar.fontSize",
|
|
443
443
|
label: {
|
|
444
|
-
name:
|
|
444
|
+
name: Pt,
|
|
445
445
|
props: {
|
|
446
446
|
min: 1,
|
|
447
447
|
max: 400
|
|
448
448
|
// disabled$,
|
|
449
449
|
}
|
|
450
450
|
},
|
|
451
|
-
positions: [
|
|
451
|
+
positions: [b.TOOLBAR_START],
|
|
452
452
|
selections: Zt,
|
|
453
453
|
// disabled$,
|
|
454
454
|
value$: new E((t) => {
|
|
455
|
-
const
|
|
455
|
+
const r = e.onCommandExecuted((s) => {
|
|
456
456
|
var a;
|
|
457
457
|
const o = s.id;
|
|
458
|
-
if (o === U.id || o ===
|
|
459
|
-
const c =
|
|
458
|
+
if (o === U.id || o === at.id) {
|
|
459
|
+
const c = z(i);
|
|
460
460
|
if (c == null)
|
|
461
461
|
return;
|
|
462
462
|
const d = (a = c.ts) == null ? void 0 : a.fs;
|
|
463
463
|
t.next(d != null ? d : 14);
|
|
464
464
|
}
|
|
465
465
|
});
|
|
466
|
-
return t.next(14),
|
|
466
|
+
return t.next(14), r.dispose;
|
|
467
467
|
}),
|
|
468
|
-
hidden$: M(
|
|
468
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
const e =
|
|
471
|
+
function xi(i) {
|
|
472
|
+
const e = i.get(v), t = i.get(Tt);
|
|
473
473
|
return {
|
|
474
|
-
id:
|
|
474
|
+
id: ct.id,
|
|
475
475
|
icon: "FontColor",
|
|
476
476
|
tooltip: "toolbar.textColor.main",
|
|
477
|
-
group:
|
|
478
|
-
type:
|
|
479
|
-
positions: [
|
|
477
|
+
group: I.TOOLBAR_FORMAT,
|
|
478
|
+
type: T.BUTTON_SELECTOR,
|
|
479
|
+
positions: [b.TOOLBAR_START],
|
|
480
480
|
selections: [
|
|
481
481
|
{
|
|
482
482
|
label: {
|
|
483
|
-
name:
|
|
483
|
+
name: tt,
|
|
484
484
|
hoverable: !1
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
],
|
|
488
488
|
value$: new E((n) => {
|
|
489
|
-
const
|
|
490
|
-
if (o.id ===
|
|
489
|
+
const r = t.getCurrentTheme().textColor, s = e.onCommandExecuted((o) => {
|
|
490
|
+
if (o.id === ct.id) {
|
|
491
491
|
const a = o.params.value;
|
|
492
|
-
n.next(a != null ? a :
|
|
492
|
+
n.next(a != null ? a : r);
|
|
493
493
|
}
|
|
494
494
|
});
|
|
495
|
-
return n.next(
|
|
495
|
+
return n.next(r), s.dispose;
|
|
496
496
|
}),
|
|
497
|
-
hidden$: M(
|
|
497
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
498
498
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
|
-
function
|
|
502
|
-
const e =
|
|
501
|
+
function Di(i) {
|
|
502
|
+
const e = i.get(v);
|
|
503
503
|
return {
|
|
504
|
-
id:
|
|
505
|
-
group:
|
|
506
|
-
type:
|
|
504
|
+
id: Sn.id,
|
|
505
|
+
group: I.TOOLBAR_LAYOUT,
|
|
506
|
+
type: T.BUTTON,
|
|
507
507
|
icon: "LeftJustifyingSingle",
|
|
508
508
|
tooltip: "toolbar.alignLeft",
|
|
509
|
-
positions: [
|
|
509
|
+
positions: [b.TOOLBAR_START],
|
|
510
510
|
activated$: new E((t) => {
|
|
511
|
-
const n = e.onCommandExecuted((
|
|
511
|
+
const n = e.onCommandExecuted((r) => {
|
|
512
512
|
var o;
|
|
513
|
-
const s =
|
|
514
|
-
if (s === U.id || s ===
|
|
515
|
-
const a =
|
|
513
|
+
const s = r.id;
|
|
514
|
+
if (s === U.id || s === Ne.id) {
|
|
515
|
+
const a = Fe(i);
|
|
516
516
|
if (a == null)
|
|
517
517
|
return;
|
|
518
518
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
519
|
-
t.next(c ===
|
|
519
|
+
t.next(c === De.LEFT);
|
|
520
520
|
}
|
|
521
521
|
});
|
|
522
522
|
return t.next(!1), n.dispose;
|
|
523
523
|
}),
|
|
524
|
-
hidden$: M(
|
|
524
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
const e =
|
|
527
|
+
function Pi(i) {
|
|
528
|
+
const e = i.get(v);
|
|
529
529
|
return {
|
|
530
530
|
id: vn.id,
|
|
531
|
-
group:
|
|
532
|
-
type:
|
|
531
|
+
group: I.TOOLBAR_LAYOUT,
|
|
532
|
+
type: T.BUTTON,
|
|
533
533
|
icon: "HorizontallySingle",
|
|
534
534
|
tooltip: "toolbar.alignCenter",
|
|
535
|
-
positions: [
|
|
535
|
+
positions: [b.TOOLBAR_START],
|
|
536
536
|
activated$: new E((t) => {
|
|
537
|
-
const n = e.onCommandExecuted((
|
|
537
|
+
const n = e.onCommandExecuted((r) => {
|
|
538
538
|
var o;
|
|
539
|
-
const s =
|
|
540
|
-
if (s === U.id || s ===
|
|
541
|
-
const a =
|
|
539
|
+
const s = r.id;
|
|
540
|
+
if (s === U.id || s === Ne.id) {
|
|
541
|
+
const a = Fe(i);
|
|
542
542
|
if (a == null)
|
|
543
543
|
return;
|
|
544
544
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
545
|
-
t.next(c ===
|
|
545
|
+
t.next(c === De.CENTER);
|
|
546
546
|
}
|
|
547
547
|
});
|
|
548
548
|
return t.next(!1), n.dispose;
|
|
549
549
|
}),
|
|
550
|
-
hidden$: M(
|
|
550
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
const e =
|
|
553
|
+
function Ui(i) {
|
|
554
|
+
const e = i.get(v);
|
|
555
555
|
return {
|
|
556
556
|
id: Cn.id,
|
|
557
|
-
group:
|
|
558
|
-
type:
|
|
557
|
+
group: I.TOOLBAR_LAYOUT,
|
|
558
|
+
type: T.BUTTON,
|
|
559
559
|
icon: "RightJustifyingSingle",
|
|
560
560
|
tooltip: "toolbar.alignRight",
|
|
561
|
-
positions: [
|
|
561
|
+
positions: [b.TOOLBAR_START],
|
|
562
562
|
activated$: new E((t) => {
|
|
563
|
-
const n = e.onCommandExecuted((
|
|
563
|
+
const n = e.onCommandExecuted((r) => {
|
|
564
564
|
var o;
|
|
565
|
-
const s =
|
|
566
|
-
if (s === U.id || s ===
|
|
567
|
-
const a =
|
|
565
|
+
const s = r.id;
|
|
566
|
+
if (s === U.id || s === Ne.id) {
|
|
567
|
+
const a = Fe(i);
|
|
568
568
|
if (a == null)
|
|
569
569
|
return;
|
|
570
570
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
571
|
-
t.next(c ===
|
|
571
|
+
t.next(c === De.RIGHT);
|
|
572
572
|
}
|
|
573
573
|
});
|
|
574
574
|
return t.next(!1), n.dispose;
|
|
575
575
|
}),
|
|
576
|
-
hidden$: M(
|
|
576
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
|
-
function
|
|
580
|
-
const e =
|
|
579
|
+
function Li(i) {
|
|
580
|
+
const e = i.get(v);
|
|
581
581
|
return {
|
|
582
582
|
id: On.id,
|
|
583
|
-
group:
|
|
584
|
-
type:
|
|
583
|
+
group: I.TOOLBAR_LAYOUT,
|
|
584
|
+
type: T.BUTTON,
|
|
585
585
|
icon: "AlignTextBothSingle",
|
|
586
586
|
tooltip: "toolbar.alignJustify",
|
|
587
|
-
positions: [
|
|
587
|
+
positions: [b.TOOLBAR_START],
|
|
588
588
|
activated$: new E((t) => {
|
|
589
|
-
const n = e.onCommandExecuted((
|
|
589
|
+
const n = e.onCommandExecuted((r) => {
|
|
590
590
|
var o;
|
|
591
|
-
const s =
|
|
592
|
-
if (s === U.id || s ===
|
|
593
|
-
const a =
|
|
591
|
+
const s = r.id;
|
|
592
|
+
if (s === U.id || s === Ne.id) {
|
|
593
|
+
const a = Fe(i);
|
|
594
594
|
if (a == null)
|
|
595
595
|
return;
|
|
596
596
|
const c = (o = a.paragraphStyle) == null ? void 0 : o.horizontalAlign;
|
|
597
|
-
t.next(c ===
|
|
597
|
+
t.next(c === De.JUSTIFIED);
|
|
598
598
|
}
|
|
599
599
|
});
|
|
600
600
|
return t.next(!1), n.dispose;
|
|
601
601
|
}),
|
|
602
|
-
hidden$: M(
|
|
602
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
603
603
|
};
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function Ni(i) {
|
|
606
606
|
return {
|
|
607
607
|
id: Rn.id,
|
|
608
|
-
group:
|
|
609
|
-
type:
|
|
608
|
+
group: I.TOOLBAR_LAYOUT,
|
|
609
|
+
type: T.BUTTON,
|
|
610
610
|
icon: "OrderSingle",
|
|
611
611
|
tooltip: "toolbar.order",
|
|
612
|
-
positions: [
|
|
613
|
-
hidden$: M(
|
|
612
|
+
positions: [b.TOOLBAR_START],
|
|
613
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function Ai(i) {
|
|
617
617
|
return {
|
|
618
618
|
id: Tn.id,
|
|
619
|
-
group:
|
|
620
|
-
type:
|
|
619
|
+
group: I.TOOLBAR_LAYOUT,
|
|
620
|
+
type: T.BUTTON,
|
|
621
621
|
icon: "UnorderSingle",
|
|
622
622
|
tooltip: "toolbar.unorder",
|
|
623
|
-
positions: [
|
|
624
|
-
hidden$: M(
|
|
623
|
+
positions: [b.TOOLBAR_START],
|
|
624
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
625
625
|
};
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function $i(i) {
|
|
628
|
+
return {
|
|
629
|
+
id: In.id,
|
|
630
|
+
type: T.BUTTON,
|
|
631
|
+
title: "toolbar.resetColor",
|
|
632
|
+
icon: "NoColor",
|
|
633
|
+
positions: ke.id
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function Bi(i) {
|
|
637
|
+
const e = i.get(v), t = i.get(Tt);
|
|
638
|
+
return {
|
|
639
|
+
id: ke.id,
|
|
640
|
+
tooltip: "toolbar.fillColor.main",
|
|
641
|
+
group: I.TOOLBAR_FORMAT,
|
|
642
|
+
type: T.BUTTON_SELECTOR,
|
|
643
|
+
positions: [b.TOOLBAR_START],
|
|
644
|
+
icon: "PaintBucket",
|
|
645
|
+
selections: [
|
|
646
|
+
{
|
|
647
|
+
label: {
|
|
648
|
+
name: tt,
|
|
649
|
+
hoverable: !1
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
],
|
|
653
|
+
value$: new E((n) => {
|
|
654
|
+
const r = t.getCurrentTheme().primaryColor, s = e.onCommandExecuted((o) => {
|
|
655
|
+
if (o.id === ke.id) {
|
|
656
|
+
const a = o.params.value;
|
|
657
|
+
n.next(a != null ? a : r);
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
return n.next(r), s.dispose;
|
|
661
|
+
}),
|
|
662
|
+
hidden$: M(i, S.UNIVER_DOC)
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
function z(i) {
|
|
628
666
|
var c;
|
|
629
|
-
const e =
|
|
630
|
-
if (n == null ||
|
|
667
|
+
const e = i.get(D), t = i.get(te), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
|
|
668
|
+
if (n == null || r == null)
|
|
631
669
|
return;
|
|
632
670
|
const s = (c = n.getBody()) == null ? void 0 : c.textRuns;
|
|
633
671
|
if (s == null)
|
|
634
672
|
return;
|
|
635
|
-
const { startOffset: o } =
|
|
673
|
+
const { startOffset: o } = r;
|
|
636
674
|
return s.find(({ st: d, ed: u }) => o >= d && o < u);
|
|
637
675
|
}
|
|
638
|
-
function
|
|
676
|
+
function Fe(i) {
|
|
639
677
|
var c;
|
|
640
|
-
const e =
|
|
641
|
-
if (n == null ||
|
|
678
|
+
const e = i.get(D), t = i.get(te), n = e.getCurrentUniverDocInstance(), r = t.getActiveRange();
|
|
679
|
+
if (n == null || r == null)
|
|
642
680
|
return;
|
|
643
681
|
const s = (c = n.getBody()) == null ? void 0 : c.paragraphs;
|
|
644
682
|
if (s == null)
|
|
645
683
|
return;
|
|
646
|
-
const { startOffset: o } =
|
|
684
|
+
const { startOffset: o } = r;
|
|
647
685
|
let a = -1;
|
|
648
686
|
for (const d of s) {
|
|
649
687
|
const { startIndex: u } = d;
|
|
@@ -653,70 +691,72 @@ function we(r) {
|
|
|
653
691
|
}
|
|
654
692
|
return null;
|
|
655
693
|
}
|
|
656
|
-
var
|
|
657
|
-
for (var
|
|
658
|
-
(o =
|
|
659
|
-
return n &&
|
|
660
|
-
}, k = (
|
|
694
|
+
var Fi = Object.defineProperty, wi = Object.getOwnPropertyDescriptor, ji = (i, e, t, n) => {
|
|
695
|
+
for (var r = n > 1 ? void 0 : n ? wi(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
696
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
697
|
+
return n && r && Fi(e, t, r), r;
|
|
698
|
+
}, k = (i, e) => (t, n) => e(t, n, i);
|
|
661
699
|
let Se = class extends Y {
|
|
662
|
-
constructor(
|
|
663
|
-
super(), this._injector =
|
|
700
|
+
constructor(i, e, t, n, r, s, o) {
|
|
701
|
+
super(), this._injector = i, this._componentManager = e, this._layoutService = t, this._editorService = n, this._menuService = r, this._uiController = s, this._univerInstanceService = o, this._init();
|
|
664
702
|
}
|
|
665
703
|
_initCustomComponents() {
|
|
666
|
-
const
|
|
667
|
-
this.disposeWithMe(
|
|
704
|
+
const i = this._componentManager;
|
|
705
|
+
this.disposeWithMe(i.register(tt, kn)), this.disposeWithMe(i.register(xt, qt)), this.disposeWithMe(i.register(Dt, Kt)), this.disposeWithMe(i.register(Pt, Jt));
|
|
668
706
|
}
|
|
669
707
|
_initMenus() {
|
|
670
708
|
[
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
709
|
+
Oi,
|
|
710
|
+
Ri,
|
|
711
|
+
Ti,
|
|
712
|
+
Ii,
|
|
713
|
+
bi,
|
|
714
|
+
Mi,
|
|
715
|
+
Ei,
|
|
716
|
+
yi,
|
|
717
|
+
xi,
|
|
718
|
+
Di,
|
|
719
|
+
Pi,
|
|
720
|
+
Ui,
|
|
721
|
+
Li,
|
|
722
|
+
Ni,
|
|
723
|
+
Ai,
|
|
724
|
+
$i,
|
|
725
|
+
Bi
|
|
726
|
+
].forEach((i) => {
|
|
727
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(i)));
|
|
688
728
|
});
|
|
689
729
|
}
|
|
690
730
|
_init() {
|
|
691
731
|
this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
|
|
692
732
|
}
|
|
693
733
|
_initDocBackground() {
|
|
694
|
-
const
|
|
695
|
-
if (
|
|
734
|
+
const i = this._univerInstanceService.getAllUnitsForType(S.UNIVER_DOC)[0].getUnitId();
|
|
735
|
+
if (i == null)
|
|
696
736
|
return;
|
|
697
|
-
this._editorService.isEditor(
|
|
698
|
-
this._uiController.registerComponent(Qt.CONTENT, () =>
|
|
737
|
+
this._editorService.isEditor(i) || this.disposeWithMe(
|
|
738
|
+
this._uiController.registerComponent(Qt.CONTENT, () => Ln(Ci, this._injector))
|
|
699
739
|
);
|
|
700
740
|
}
|
|
701
741
|
_initFocusHandler() {
|
|
702
742
|
this.disposeWithMe(
|
|
703
|
-
this._layoutService.registerFocusHandler(
|
|
743
|
+
this._layoutService.registerFocusHandler(S.UNIVER_DOC, () => {
|
|
704
744
|
this._injector.get(de).focus();
|
|
705
745
|
})
|
|
706
746
|
);
|
|
707
747
|
}
|
|
708
748
|
};
|
|
709
|
-
Se =
|
|
710
|
-
|
|
711
|
-
k(0,
|
|
712
|
-
k(1,
|
|
713
|
-
k(2,
|
|
714
|
-
k(3,
|
|
749
|
+
Se = ji([
|
|
750
|
+
N(A.Rendered, Se),
|
|
751
|
+
k(0, O(Pe)),
|
|
752
|
+
k(1, O(en)),
|
|
753
|
+
k(2, bt),
|
|
754
|
+
k(3, $),
|
|
715
755
|
k(4, tn),
|
|
716
756
|
k(5, nn),
|
|
717
757
|
k(6, D)
|
|
718
758
|
], Se);
|
|
719
|
-
const
|
|
759
|
+
const Vi = {
|
|
720
760
|
toolbar: {
|
|
721
761
|
undo: "Undo",
|
|
722
762
|
redo: "Redo",
|
|
@@ -732,6 +772,10 @@ const Br = {
|
|
|
732
772
|
main: "Text color",
|
|
733
773
|
right: "Choose color"
|
|
734
774
|
},
|
|
775
|
+
fillColor: {
|
|
776
|
+
main: "Text Background color",
|
|
777
|
+
right: "Choose color"
|
|
778
|
+
},
|
|
735
779
|
resetColor: "Reset",
|
|
736
780
|
order: "Ordered list",
|
|
737
781
|
unorder: "Unordered list",
|
|
@@ -740,7 +784,7 @@ const Br = {
|
|
|
740
784
|
alignRight: "Align Right",
|
|
741
785
|
alignJustify: "Justify"
|
|
742
786
|
}
|
|
743
|
-
},
|
|
787
|
+
}, to = Vi, Wi = {
|
|
744
788
|
toolbar: {
|
|
745
789
|
undo: "撤销",
|
|
746
790
|
redo: "重做",
|
|
@@ -756,6 +800,10 @@ const Br = {
|
|
|
756
800
|
main: "文本颜色",
|
|
757
801
|
right: "颜色选择"
|
|
758
802
|
},
|
|
803
|
+
fillColor: {
|
|
804
|
+
main: "文本背景色",
|
|
805
|
+
right: "背景色选择"
|
|
806
|
+
},
|
|
759
807
|
resetColor: "重置颜色",
|
|
760
808
|
order: "有序列表",
|
|
761
809
|
unorder: "无序列表",
|
|
@@ -764,29 +812,29 @@ const Br = {
|
|
|
764
812
|
alignRight: "右对齐",
|
|
765
813
|
alignJustify: "两端对齐"
|
|
766
814
|
}
|
|
767
|
-
},
|
|
815
|
+
}, zi = Wi, ki = {
|
|
768
816
|
id: bn.id,
|
|
769
|
-
preconditions:
|
|
817
|
+
preconditions: Zn,
|
|
770
818
|
binding: P.ENTER
|
|
771
|
-
},
|
|
772
|
-
id: In.id,
|
|
773
|
-
preconditions: $,
|
|
774
|
-
binding: P.BACKSPACE
|
|
775
|
-
}, Vr = {
|
|
819
|
+
}, Hi = {
|
|
776
820
|
id: Mn.id,
|
|
777
|
-
preconditions:
|
|
821
|
+
preconditions: B,
|
|
822
|
+
binding: P.BACKSPACE
|
|
823
|
+
}, Yi = {
|
|
824
|
+
id: yn.id,
|
|
825
|
+
preconditions: B,
|
|
778
826
|
binding: P.DELETE
|
|
779
|
-
},
|
|
780
|
-
function
|
|
781
|
-
return
|
|
827
|
+
}, Xi = 10, Gi = 6;
|
|
828
|
+
function Zi() {
|
|
829
|
+
return qe.generateRandomId(Gi);
|
|
782
830
|
}
|
|
783
|
-
function
|
|
784
|
-
const e =
|
|
831
|
+
function qi(i) {
|
|
832
|
+
const e = i.match(/data-copy-id="([^\s]+)"/);
|
|
785
833
|
return e && e[1] ? e[1] : null;
|
|
786
834
|
}
|
|
787
|
-
class
|
|
835
|
+
class Ki {
|
|
788
836
|
constructor() {
|
|
789
|
-
|
|
837
|
+
m(this, "_cache", new jt(Xi));
|
|
790
838
|
}
|
|
791
839
|
set(e, t) {
|
|
792
840
|
this._cache.set(e, t);
|
|
@@ -798,30 +846,30 @@ class Gr {
|
|
|
798
846
|
this._cache.clear();
|
|
799
847
|
}
|
|
800
848
|
}
|
|
801
|
-
const
|
|
802
|
-
function
|
|
803
|
-
const e =
|
|
849
|
+
const ft = new Ki();
|
|
850
|
+
function nt(i) {
|
|
851
|
+
const e = i.style, t = {}, n = i.tagName.toLowerCase();
|
|
804
852
|
switch (n) {
|
|
805
853
|
case "b":
|
|
806
854
|
case "em":
|
|
807
855
|
case "strong": {
|
|
808
|
-
t.bl =
|
|
856
|
+
t.bl = C.TRUE;
|
|
809
857
|
break;
|
|
810
858
|
}
|
|
811
859
|
case "s": {
|
|
812
860
|
t.st = {
|
|
813
|
-
s:
|
|
861
|
+
s: C.TRUE
|
|
814
862
|
};
|
|
815
863
|
break;
|
|
816
864
|
}
|
|
817
865
|
case "u": {
|
|
818
866
|
t.ul = {
|
|
819
|
-
s:
|
|
867
|
+
s: C.TRUE
|
|
820
868
|
};
|
|
821
869
|
break;
|
|
822
870
|
}
|
|
823
871
|
case "i": {
|
|
824
|
-
t.it =
|
|
872
|
+
t.it = C.TRUE;
|
|
825
873
|
break;
|
|
826
874
|
}
|
|
827
875
|
case "sub":
|
|
@@ -830,8 +878,8 @@ function et(r) {
|
|
|
830
878
|
break;
|
|
831
879
|
}
|
|
832
880
|
}
|
|
833
|
-
for (let
|
|
834
|
-
const s = e[
|
|
881
|
+
for (let r = 0; r < e.length; r++) {
|
|
882
|
+
const s = e[r], o = e.getPropertyValue(s);
|
|
835
883
|
switch (s) {
|
|
836
884
|
case "font-family": {
|
|
837
885
|
t.ff = o;
|
|
@@ -839,36 +887,36 @@ function et(r) {
|
|
|
839
887
|
}
|
|
840
888
|
case "font-size": {
|
|
841
889
|
const a = Number.parseInt(o);
|
|
842
|
-
Number.isNaN(a) || (o.endsWith("pt") ? t.fs = a : o.endsWith("px") && (t.fs =
|
|
890
|
+
Number.isNaN(a) || (o.endsWith("pt") ? t.fs = a : o.endsWith("px") && (t.fs = Nn(a)));
|
|
843
891
|
break;
|
|
844
892
|
}
|
|
845
893
|
case "font-style": {
|
|
846
|
-
o === "italic" && (t.it =
|
|
894
|
+
o === "italic" && (t.it = C.TRUE);
|
|
847
895
|
break;
|
|
848
896
|
}
|
|
849
897
|
case "font-weight": {
|
|
850
|
-
Number(o) > 400 && (t.bl =
|
|
898
|
+
Number(o) > 400 && (t.bl = C.TRUE);
|
|
851
899
|
break;
|
|
852
900
|
}
|
|
853
901
|
case "text-decoration": {
|
|
854
902
|
/underline/.test(o) ? t.ul = {
|
|
855
|
-
s:
|
|
903
|
+
s: C.TRUE
|
|
856
904
|
} : /overline/.test(o) ? t.ol = {
|
|
857
|
-
s:
|
|
905
|
+
s: C.TRUE
|
|
858
906
|
} : /line-through/.test(o) && (t.st = {
|
|
859
|
-
s:
|
|
907
|
+
s: C.TRUE
|
|
860
908
|
});
|
|
861
909
|
break;
|
|
862
910
|
}
|
|
863
911
|
case "color": {
|
|
864
|
-
const a = new
|
|
912
|
+
const a = new rt(o);
|
|
865
913
|
a.isValid && (t.cl = {
|
|
866
914
|
rgb: a.toRgbString()
|
|
867
915
|
});
|
|
868
916
|
break;
|
|
869
917
|
}
|
|
870
918
|
case "background-color": {
|
|
871
|
-
const a = new
|
|
919
|
+
const a = new rt(o);
|
|
872
920
|
a.isValid && (t.bg = {
|
|
873
921
|
rgb: a.toRgbString()
|
|
874
922
|
});
|
|
@@ -878,19 +926,19 @@ function et(r) {
|
|
|
878
926
|
}
|
|
879
927
|
return t;
|
|
880
928
|
}
|
|
881
|
-
function
|
|
882
|
-
const e = new DOMParser(), t = `<x-univer id="univer-root">${
|
|
929
|
+
function Ji(i) {
|
|
930
|
+
const e = new DOMParser(), t = `<x-univer id="univer-root">${i}</x-univer>`;
|
|
883
931
|
return e.parseFromString(t, "text/html").querySelector("#univer-root");
|
|
884
932
|
}
|
|
885
|
-
function
|
|
886
|
-
const t =
|
|
887
|
-
return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(
|
|
933
|
+
function mt(i, e) {
|
|
934
|
+
const t = i.tagName.toLowerCase();
|
|
935
|
+
return typeof e == "string" ? t === e : Array.isArray(e) ? e.some((n) => n === t) : e(i);
|
|
888
936
|
}
|
|
889
|
-
const
|
|
937
|
+
const Ee = class Ee {
|
|
890
938
|
constructor() {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
939
|
+
m(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
940
|
+
m(this, "_styleRules", []);
|
|
941
|
+
m(this, "_afterProcessRules", []);
|
|
894
942
|
}
|
|
895
943
|
static use(e) {
|
|
896
944
|
if (this._pluginList.includes(e))
|
|
@@ -898,17 +946,17 @@ const ye = class ye {
|
|
|
898
946
|
this._pluginList.push(e);
|
|
899
947
|
}
|
|
900
948
|
convert(e) {
|
|
901
|
-
const t =
|
|
949
|
+
const t = Ee._pluginList.find((s) => s.checkPasteType(e)), n = Ji(e), r = {
|
|
902
950
|
dataStream: "",
|
|
903
951
|
textRuns: []
|
|
904
952
|
};
|
|
905
|
-
return t && (this._styleRules = [...t.stylesRules], this._afterProcessRules = [...t.afterProcessRules]), this._styleCache.clear(), this._process(null, n == null ? void 0 : n.childNodes,
|
|
953
|
+
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;
|
|
906
954
|
}
|
|
907
955
|
_process(e, t, n) {
|
|
908
|
-
var
|
|
956
|
+
var r;
|
|
909
957
|
for (const s of t)
|
|
910
958
|
if (s.nodeType === Node.TEXT_NODE) {
|
|
911
|
-
const o = (
|
|
959
|
+
const o = (r = s.nodeValue) == null ? void 0 : r.replace(/[\r\n]/g, "");
|
|
912
960
|
let a;
|
|
913
961
|
e && this._styleCache.has(e) && (a = this._styleCache.get(e)), n.dataStream += o, a && Object.getOwnPropertyNames(a).length && n.textRuns.push({
|
|
914
962
|
st: n.dataStream.length - o.length,
|
|
@@ -916,33 +964,33 @@ const ye = class ye {
|
|
|
916
964
|
ts: a
|
|
917
965
|
});
|
|
918
966
|
} else if (s.nodeType === Node.ELEMENT_NODE) {
|
|
919
|
-
const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) =>
|
|
967
|
+
const o = e ? this._styleCache.get(e) : {}, a = this._styleRules.find(({ filter: h }) => mt(s, h)), c = a ? a.getStyle(s) : nt(s);
|
|
920
968
|
this._styleCache.set(s, { ...o, ...c });
|
|
921
969
|
const { childNodes: d } = s;
|
|
922
970
|
this._process(s, d, n);
|
|
923
971
|
const u = this._afterProcessRules.find(
|
|
924
|
-
({ filter: h }) =>
|
|
972
|
+
({ filter: h }) => mt(s, h)
|
|
925
973
|
);
|
|
926
974
|
u && u.handler(n, s);
|
|
927
975
|
}
|
|
928
976
|
}
|
|
929
977
|
};
|
|
930
|
-
|
|
931
|
-
let Q =
|
|
932
|
-
const
|
|
978
|
+
m(Ee, "_pluginList", []);
|
|
979
|
+
let Q = Ee;
|
|
980
|
+
const Qi = {
|
|
933
981
|
name: "univer-doc-paste-plugin-lark",
|
|
934
|
-
checkPasteType(
|
|
935
|
-
return /lark-record-clipboard/i.test(
|
|
982
|
+
checkPasteType(i) {
|
|
983
|
+
return /lark-record-clipboard/i.test(i);
|
|
936
984
|
},
|
|
937
985
|
// TODO: @JOCS, support inline code copy from lark.
|
|
938
986
|
stylesRules: [
|
|
939
987
|
{
|
|
940
988
|
filter: ["s"],
|
|
941
|
-
getStyle(
|
|
942
|
-
const e =
|
|
989
|
+
getStyle(i) {
|
|
990
|
+
const e = nt(i);
|
|
943
991
|
return {
|
|
944
992
|
st: {
|
|
945
|
-
s:
|
|
993
|
+
s: C.TRUE
|
|
946
994
|
},
|
|
947
995
|
...e
|
|
948
996
|
};
|
|
@@ -951,30 +999,30 @@ const qr = {
|
|
|
951
999
|
],
|
|
952
1000
|
afterProcessRules: [
|
|
953
1001
|
{
|
|
954
|
-
filter(
|
|
955
|
-
return
|
|
1002
|
+
filter(i) {
|
|
1003
|
+
return i.tagName === "DIV" && /ace-line/i.test(i.className);
|
|
956
1004
|
},
|
|
957
|
-
handler(
|
|
958
|
-
|
|
959
|
-
startIndex:
|
|
960
|
-
}),
|
|
1005
|
+
handler(i) {
|
|
1006
|
+
i.paragraphs == null && (i.paragraphs = []), i.paragraphs.push({
|
|
1007
|
+
startIndex: i.dataStream.length
|
|
1008
|
+
}), i.dataStream += "\r";
|
|
961
1009
|
}
|
|
962
1010
|
}
|
|
963
1011
|
]
|
|
964
|
-
},
|
|
965
|
-
function
|
|
966
|
-
const e =
|
|
1012
|
+
}, er = Qi;
|
|
1013
|
+
function Nt(i) {
|
|
1014
|
+
const e = i.style, t = {};
|
|
967
1015
|
for (let n = 0; n < e.length; n++) {
|
|
968
|
-
const
|
|
969
|
-
switch (
|
|
1016
|
+
const r = e[n], s = e.getPropertyValue(r);
|
|
1017
|
+
switch (r) {
|
|
970
1018
|
case "margin-top": {
|
|
971
1019
|
const o = Number.parseInt(s);
|
|
972
|
-
t.spaceAbove = /pt/.test(s) ?
|
|
1020
|
+
t.spaceAbove = /pt/.test(s) ? dt(o) : o;
|
|
973
1021
|
break;
|
|
974
1022
|
}
|
|
975
1023
|
case "margin-bottom": {
|
|
976
1024
|
const o = Number.parseInt(s);
|
|
977
|
-
t.spaceBelow = /pt/.test(s) ?
|
|
1025
|
+
t.spaceBelow = /pt/.test(s) ? dt(o) : o;
|
|
978
1026
|
break;
|
|
979
1027
|
}
|
|
980
1028
|
case "line-height": {
|
|
@@ -986,71 +1034,71 @@ function Ut(r) {
|
|
|
986
1034
|
}
|
|
987
1035
|
return Object.getOwnPropertyNames(t).length ? t : null;
|
|
988
1036
|
}
|
|
989
|
-
const
|
|
1037
|
+
const tr = {
|
|
990
1038
|
name: "univer-doc-paste-plugin-word",
|
|
991
|
-
checkPasteType(
|
|
992
|
-
return /word|mso/i.test(
|
|
1039
|
+
checkPasteType(i) {
|
|
1040
|
+
return /word|mso/i.test(i);
|
|
993
1041
|
},
|
|
994
1042
|
stylesRules: [
|
|
995
1043
|
{
|
|
996
1044
|
filter: ["b"],
|
|
997
|
-
getStyle(
|
|
998
|
-
const e =
|
|
999
|
-
return { bl:
|
|
1045
|
+
getStyle(i) {
|
|
1046
|
+
const e = nt(i);
|
|
1047
|
+
return { bl: C.TRUE, ...e };
|
|
1000
1048
|
}
|
|
1001
1049
|
}
|
|
1002
1050
|
],
|
|
1003
1051
|
afterProcessRules: [
|
|
1004
1052
|
{
|
|
1005
|
-
filter(
|
|
1006
|
-
return
|
|
1053
|
+
filter(i) {
|
|
1054
|
+
return i.tagName === "P" && /mso/i.test(i.className);
|
|
1007
1055
|
},
|
|
1008
|
-
handler(
|
|
1009
|
-
|
|
1056
|
+
handler(i, e) {
|
|
1057
|
+
i.paragraphs == null && (i.paragraphs = []);
|
|
1010
1058
|
const t = {
|
|
1011
|
-
startIndex:
|
|
1012
|
-
}, n =
|
|
1013
|
-
n && (t.paragraphStyle = n),
|
|
1059
|
+
startIndex: i.dataStream.length
|
|
1060
|
+
}, n = Nt(e);
|
|
1061
|
+
n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
|
|
1014
1062
|
}
|
|
1015
1063
|
}
|
|
1016
1064
|
]
|
|
1017
|
-
},
|
|
1065
|
+
}, nr = tr, ir = {
|
|
1018
1066
|
name: "univer-doc-paste-plugin-univer",
|
|
1019
|
-
checkPasteType(
|
|
1020
|
-
return /UniverNormal/i.test(
|
|
1067
|
+
checkPasteType(i) {
|
|
1068
|
+
return /UniverNormal/i.test(i);
|
|
1021
1069
|
},
|
|
1022
1070
|
stylesRules: [],
|
|
1023
1071
|
afterProcessRules: [
|
|
1024
1072
|
{
|
|
1025
|
-
filter(
|
|
1026
|
-
return
|
|
1073
|
+
filter(i) {
|
|
1074
|
+
return i.tagName === "P" && /UniverNormal/i.test(i.className);
|
|
1027
1075
|
},
|
|
1028
|
-
handler(
|
|
1029
|
-
|
|
1076
|
+
handler(i, e) {
|
|
1077
|
+
i.paragraphs == null && (i.paragraphs = []);
|
|
1030
1078
|
const t = {
|
|
1031
|
-
startIndex:
|
|
1032
|
-
}, n =
|
|
1033
|
-
n && (t.paragraphStyle = n),
|
|
1079
|
+
startIndex: i.dataStream.length
|
|
1080
|
+
}, n = Nt(e);
|
|
1081
|
+
n && (t.paragraphStyle = n), i.paragraphs.push(t), i.dataStream += "\r";
|
|
1034
1082
|
}
|
|
1035
1083
|
}
|
|
1036
1084
|
]
|
|
1037
|
-
},
|
|
1038
|
-
function
|
|
1039
|
-
const { st: t, ed: n, ts:
|
|
1040
|
-
let l =
|
|
1085
|
+
}, rr = ir;
|
|
1086
|
+
function St(i, e) {
|
|
1087
|
+
const { st: t, ed: n, ts: r = {} } = e, { ff: s, fs: o, it: a, bl: c, ul: d, st: u, ol: h, bg: p, cl: g, va: f } = r;
|
|
1088
|
+
let l = i.slice(t, n);
|
|
1041
1089
|
const _ = [];
|
|
1042
|
-
return a ===
|
|
1090
|
+
return a === C.TRUE && (l = `<i>${l}</i>`), f === J.SUPERSCRIPT ? l = `<sup>${l}</sup>` : f === J.SUBSCRIPT && (l = `<sub>${l}</sub>`), (d == null ? void 0 : d.s) === C.TRUE && (l = `<u>${l}</u>`), (u == null ? void 0 : u.s) === C.TRUE && (l = `<s>${l}</s>`), c === C.TRUE && (l = `<strong>${l}</strong>`), s && _.push(`font-family: ${s}`), g && _.push(`color: ${g.rgb}`), o && _.push(`font-size: ${o}pt`), h && _.push("text-decoration: overline"), p && _.push(`background: ${p.rgb}`), _.length ? `<span style="${_.join("; ")};">${l}</span>` : l;
|
|
1043
1091
|
}
|
|
1044
|
-
function
|
|
1045
|
-
const { dataStream: n, textRuns:
|
|
1092
|
+
function Ve(i, e, t) {
|
|
1093
|
+
const { dataStream: n, textRuns: r = [] } = i;
|
|
1046
1094
|
let s = e;
|
|
1047
1095
|
const o = [];
|
|
1048
|
-
for (const a of
|
|
1096
|
+
for (const a of r) {
|
|
1049
1097
|
const { st: c, ed: d } = a;
|
|
1050
|
-
|
|
1098
|
+
qe.hasIntersectionBetweenTwoRanges(e, t, c, d) && (c > s ? (o.push(n.slice(s, c)), o.push(St(n, {
|
|
1051
1099
|
...a,
|
|
1052
1100
|
ed: Math.min(d, t)
|
|
1053
|
-
}))) : o.push(
|
|
1101
|
+
}))) : o.push(St(n, {
|
|
1054
1102
|
...a,
|
|
1055
1103
|
st: s,
|
|
1056
1104
|
ed: Math.min(d, t)
|
|
@@ -1058,41 +1106,41 @@ function je(r, e, t) {
|
|
|
1058
1106
|
}
|
|
1059
1107
|
return s !== t && o.push(n.slice(s, t)), o.join("");
|
|
1060
1108
|
}
|
|
1061
|
-
function
|
|
1109
|
+
function vt(i, e = !0) {
|
|
1062
1110
|
var t;
|
|
1063
|
-
if (e && ((t =
|
|
1064
|
-
const { dataStream: n, paragraphs:
|
|
1111
|
+
if (e && ((t = i.paragraphs) != null && t.length)) {
|
|
1112
|
+
const { dataStream: n, paragraphs: r = [] } = i;
|
|
1065
1113
|
let s = "", o = -1;
|
|
1066
|
-
for (const a of
|
|
1114
|
+
for (const a of r) {
|
|
1067
1115
|
const { startIndex: c, paragraphStyle: d = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing: p } = d, g = [];
|
|
1068
|
-
u != null && (typeof u == "number" ? g.push(`margin-top: ${u}px`) : g.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? g.push(`margin-bottom: ${h}px`) : g.push(`margin-bottom: ${h.v}px`)), p != null && g.push(`line-height: ${p}`), c > o + 1 ? s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}>${
|
|
1116
|
+
u != null && (typeof u == "number" ? g.push(`margin-top: ${u}px`) : g.push(`margin-top: ${u.v}px`)), h != null && (typeof h == "number" ? g.push(`margin-bottom: ${h}px`) : g.push(`margin-bottom: ${h.v}px`)), p != null && g.push(`line-height: ${p}`), c > o + 1 ? s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}>${Ve(i, o + 1, c)}</p>` : s += `<p class="UniverNormal" ${g.length ? `style="${g.join("; ")};"` : ""}></p>`, o = c;
|
|
1069
1117
|
}
|
|
1070
|
-
return o !== n.length && (s +=
|
|
1118
|
+
return o !== n.length && (s += Ve(i, o, n.length)), s;
|
|
1071
1119
|
} else
|
|
1072
|
-
return
|
|
1120
|
+
return Ve(i, 0, i.dataStream.length);
|
|
1073
1121
|
}
|
|
1074
|
-
class
|
|
1122
|
+
class or {
|
|
1075
1123
|
convert(e) {
|
|
1076
1124
|
if (e.length === 0)
|
|
1077
1125
|
throw new Error("The bodyList length at least to be 1");
|
|
1078
1126
|
if (e.length === 1)
|
|
1079
|
-
return
|
|
1127
|
+
return vt(e[0]);
|
|
1080
1128
|
let t = "";
|
|
1081
1129
|
for (const n of e)
|
|
1082
|
-
t += '<p className="UniverNormal">', t +=
|
|
1130
|
+
t += '<p className="UniverNormal">', t += vt(n, !1), t += "</p>";
|
|
1083
1131
|
return t;
|
|
1084
1132
|
}
|
|
1085
1133
|
}
|
|
1086
|
-
var
|
|
1087
|
-
for (var
|
|
1088
|
-
(o =
|
|
1089
|
-
return n &&
|
|
1090
|
-
},
|
|
1091
|
-
Q.use(
|
|
1092
|
-
Q.use(
|
|
1093
|
-
Q.use(
|
|
1094
|
-
function
|
|
1095
|
-
const e =
|
|
1134
|
+
var sr = Object.defineProperty, ar = Object.getOwnPropertyDescriptor, cr = (i, e, t, n) => {
|
|
1135
|
+
for (var r = n > 1 ? void 0 : n ? ar(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1136
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1137
|
+
return n && r && sr(e, t, r), r;
|
|
1138
|
+
}, ie = (i, e) => (t, n) => e(t, n, i);
|
|
1139
|
+
Q.use(nr);
|
|
1140
|
+
Q.use(er);
|
|
1141
|
+
Q.use(rr);
|
|
1142
|
+
function lr(i) {
|
|
1143
|
+
const e = i.replace(/\n/g, "\r"), t = [];
|
|
1096
1144
|
for (let n = 0; n < e.length; n++)
|
|
1097
1145
|
e[n] === "\r" && t.push({ startIndex: n });
|
|
1098
1146
|
return {
|
|
@@ -1101,13 +1149,13 @@ function si(r) {
|
|
|
1101
1149
|
};
|
|
1102
1150
|
}
|
|
1103
1151
|
const ue = Gt("doc.clipboard-service");
|
|
1104
|
-
let
|
|
1105
|
-
constructor(e, t, n,
|
|
1152
|
+
let Xe = class extends Y {
|
|
1153
|
+
constructor(e, t, n, r, s) {
|
|
1106
1154
|
super();
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
this.
|
|
1155
|
+
m(this, "_clipboardHooks", []);
|
|
1156
|
+
m(this, "_htmlToUDM", new Q());
|
|
1157
|
+
m(this, "_umdToHtml", new or());
|
|
1158
|
+
this._univerInstanceService = e, this._logService = t, this._commandService = n, this._clipboardInterfaceService = r, this._textSelectionManagerService = s;
|
|
1111
1159
|
}
|
|
1112
1160
|
async copy() {
|
|
1113
1161
|
const e = this._getDocumentBodyInRanges();
|
|
@@ -1137,13 +1185,13 @@ let Ye = class extends Y {
|
|
|
1137
1185
|
segmentId: e,
|
|
1138
1186
|
endOffset: t,
|
|
1139
1187
|
style: n
|
|
1140
|
-
} = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {},
|
|
1141
|
-
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null ||
|
|
1188
|
+
} = (s = this._textSelectionManagerService.getActiveRange()) != null ? s : {}, r = this._textSelectionManagerService.getSelections();
|
|
1189
|
+
if (e == null && this._logService.error("[DocClipboardController] segmentId is not existed"), t == null || r == null)
|
|
1142
1190
|
return !1;
|
|
1143
1191
|
this.copy();
|
|
1144
1192
|
try {
|
|
1145
1193
|
let o = t;
|
|
1146
|
-
for (const c of
|
|
1194
|
+
for (const c of r) {
|
|
1147
1195
|
const { startOffset: d, endOffset: u } = c;
|
|
1148
1196
|
d == null || u == null || u <= t && (o -= u - d);
|
|
1149
1197
|
}
|
|
@@ -1154,14 +1202,14 @@ let Ye = class extends Y {
|
|
|
1154
1202
|
style: n
|
|
1155
1203
|
}
|
|
1156
1204
|
];
|
|
1157
|
-
return this._commandService.executeCommand(
|
|
1205
|
+
return this._commandService.executeCommand(Mt.id, { segmentId: e, textRanges: a });
|
|
1158
1206
|
} catch {
|
|
1159
1207
|
return this._logService.error("[DocClipboardController] cut content failed"), !1;
|
|
1160
1208
|
}
|
|
1161
1209
|
}
|
|
1162
1210
|
async _paste(e) {
|
|
1163
1211
|
var o;
|
|
1164
|
-
const { segmentId: t, endOffset: n, style:
|
|
1212
|
+
const { segmentId: t, endOffset: n, style: r } = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, s = this._textSelectionManagerService.getSelections();
|
|
1165
1213
|
if (t == null && this._logService.error("[DocClipboardController] segmentId does not exist!"), n == null || s == null)
|
|
1166
1214
|
return !1;
|
|
1167
1215
|
try {
|
|
@@ -1174,32 +1222,32 @@ let Ye = class extends Y {
|
|
|
1174
1222
|
{
|
|
1175
1223
|
startOffset: a,
|
|
1176
1224
|
endOffset: a,
|
|
1177
|
-
style:
|
|
1225
|
+
style: r
|
|
1178
1226
|
}
|
|
1179
1227
|
];
|
|
1180
|
-
return this._commandService.executeCommand(
|
|
1228
|
+
return this._commandService.executeCommand(yt.id, { body: e, segmentId: t, textRanges: c });
|
|
1181
1229
|
} catch {
|
|
1182
1230
|
return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
|
|
1183
1231
|
}
|
|
1184
1232
|
}
|
|
1185
1233
|
async _setClipboardData(e) {
|
|
1186
|
-
const t =
|
|
1234
|
+
const t = Zi(), n = e.length > 1 ? e.map((s) => s.dataStream).join(`
|
|
1187
1235
|
`) : e[0].dataStream;
|
|
1188
|
-
let
|
|
1189
|
-
return e.length === 1 && (
|
|
1236
|
+
let r = this._umdToHtml.convert(e);
|
|
1237
|
+
return e.length === 1 && (r = r.replace(/(<[a-z]+)/, (s, o) => `${o} data-copy-id="${t}"`), ft.set(t, e[0])), this._clipboardInterfaceService.write(n, r);
|
|
1190
1238
|
}
|
|
1191
1239
|
addClipboardHook(e) {
|
|
1192
|
-
return this._clipboardHooks.push(e),
|
|
1240
|
+
return this._clipboardHooks.push(e), F(() => {
|
|
1193
1241
|
const t = this._clipboardHooks.indexOf(e);
|
|
1194
1242
|
t > -1 && this._clipboardHooks.splice(t, 1);
|
|
1195
1243
|
});
|
|
1196
1244
|
}
|
|
1197
1245
|
_getDocumentBodyInRanges() {
|
|
1198
|
-
const e = this._textSelectionManagerService.getSelections(), t = this.
|
|
1199
|
-
if (e == null)
|
|
1246
|
+
const e = this._textSelectionManagerService.getSelections(), t = this._univerInstanceService.getCurrentUniverDocInstance(), n = [];
|
|
1247
|
+
if (e == null || !t)
|
|
1200
1248
|
return n;
|
|
1201
|
-
for (const
|
|
1202
|
-
const { startOffset: s, endOffset: o, collapsed: a } =
|
|
1249
|
+
for (const r of e) {
|
|
1250
|
+
const { startOffset: s, endOffset: o, collapsed: a } = r;
|
|
1203
1251
|
if (a || s == null || o == null)
|
|
1204
1252
|
continue;
|
|
1205
1253
|
const c = t.sliceBody(s, o);
|
|
@@ -1210,9 +1258,9 @@ let Ye = class extends Y {
|
|
|
1210
1258
|
async _generateBodyFromClipboardItems(e) {
|
|
1211
1259
|
try {
|
|
1212
1260
|
let t = "", n = "";
|
|
1213
|
-
for (const
|
|
1214
|
-
for (const s of
|
|
1215
|
-
s === rn ? n = await
|
|
1261
|
+
for (const r of e)
|
|
1262
|
+
for (const s of r.types)
|
|
1263
|
+
s === rn ? n = await r.getType(s).then((o) => o && o.text()) : s === on && (t = await r.getType(s).then((o) => o && o.text()));
|
|
1216
1264
|
return this._generateBodyFromHtmlAndText(t, n);
|
|
1217
1265
|
} catch (t) {
|
|
1218
1266
|
return Promise.reject(t);
|
|
@@ -1221,98 +1269,98 @@ let Ye = class extends Y {
|
|
|
1221
1269
|
_generateBodyFromHtmlAndText(e, t) {
|
|
1222
1270
|
if (!e) {
|
|
1223
1271
|
if (t)
|
|
1224
|
-
return
|
|
1272
|
+
return lr(t);
|
|
1225
1273
|
throw new Error("[DocClipboardService] html and text cannot be both empty!");
|
|
1226
1274
|
}
|
|
1227
|
-
const n =
|
|
1275
|
+
const n = qi(e);
|
|
1228
1276
|
if (n) {
|
|
1229
|
-
const
|
|
1230
|
-
if (
|
|
1231
|
-
return
|
|
1277
|
+
const r = ft.get(n);
|
|
1278
|
+
if (r)
|
|
1279
|
+
return r;
|
|
1232
1280
|
}
|
|
1233
1281
|
return this._htmlToUDM.convert(e);
|
|
1234
1282
|
}
|
|
1235
1283
|
};
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
],
|
|
1243
|
-
function
|
|
1244
|
-
return
|
|
1284
|
+
Xe = cr([
|
|
1285
|
+
ie(0, D),
|
|
1286
|
+
ie(1, It),
|
|
1287
|
+
ie(2, v),
|
|
1288
|
+
ie(3, Je),
|
|
1289
|
+
ie(4, O(te))
|
|
1290
|
+
], Xe);
|
|
1291
|
+
function we(i) {
|
|
1292
|
+
return i.getContextValue(xe) || i.getContextValue(Rt);
|
|
1245
1293
|
}
|
|
1246
|
-
const
|
|
1294
|
+
const it = 999, dr = {
|
|
1247
1295
|
id: sn.id,
|
|
1248
1296
|
name: "doc.command.copy",
|
|
1249
|
-
type:
|
|
1297
|
+
type: Ke.COMMAND,
|
|
1250
1298
|
multi: !0,
|
|
1251
|
-
priority:
|
|
1252
|
-
preconditions:
|
|
1253
|
-
handler: async (
|
|
1254
|
-
},
|
|
1299
|
+
priority: it,
|
|
1300
|
+
preconditions: we,
|
|
1301
|
+
handler: async (i) => i.get(ue).copy()
|
|
1302
|
+
}, ur = {
|
|
1255
1303
|
id: an.id,
|
|
1256
1304
|
name: "doc.command.cut",
|
|
1257
|
-
type:
|
|
1305
|
+
type: Ke.COMMAND,
|
|
1258
1306
|
multi: !0,
|
|
1259
|
-
priority:
|
|
1260
|
-
preconditions:
|
|
1261
|
-
handler: async (
|
|
1262
|
-
},
|
|
1307
|
+
priority: it,
|
|
1308
|
+
preconditions: we,
|
|
1309
|
+
handler: async (i) => i.get(ue).cut()
|
|
1310
|
+
}, hr = {
|
|
1263
1311
|
id: cn.id,
|
|
1264
1312
|
name: "doc.command.paste",
|
|
1265
|
-
type:
|
|
1313
|
+
type: Ke.COMMAND,
|
|
1266
1314
|
multi: !0,
|
|
1267
|
-
priority:
|
|
1268
|
-
preconditions:
|
|
1269
|
-
handler: async (
|
|
1270
|
-
const e =
|
|
1315
|
+
priority: it,
|
|
1316
|
+
preconditions: we,
|
|
1317
|
+
handler: async (i) => {
|
|
1318
|
+
const e = i.get(ue), n = await i.get(Je).read();
|
|
1271
1319
|
return n.length === 0 ? !1 : e.paste(n);
|
|
1272
1320
|
}
|
|
1273
1321
|
};
|
|
1274
|
-
var
|
|
1275
|
-
for (var
|
|
1276
|
-
(o =
|
|
1277
|
-
return n &&
|
|
1278
|
-
},
|
|
1279
|
-
let
|
|
1280
|
-
constructor(
|
|
1281
|
-
super(), this._commandService =
|
|
1322
|
+
var gr = Object.defineProperty, _r = Object.getOwnPropertyDescriptor, pr = (i, e, t, n) => {
|
|
1323
|
+
for (var r = n > 1 ? void 0 : n ? _r(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1324
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1325
|
+
return n && r && gr(e, t, r), r;
|
|
1326
|
+
}, re = (i, e) => (t, n) => e(t, n, i);
|
|
1327
|
+
let ve = class extends ce {
|
|
1328
|
+
constructor(i, e, t, n, r) {
|
|
1329
|
+
super(), this._commandService = i, this._clipboardInterfaceService = e, this._docClipboardService = t, this._textSelectionRenderManager = n, this._contextService = r, this._init();
|
|
1282
1330
|
}
|
|
1283
1331
|
_init() {
|
|
1284
|
-
[
|
|
1332
|
+
[dr, ur, hr].forEach((i) => this.disposeWithMe(this._commandService.registerMultipleCommand(i))), [yt, Mt].forEach((i) => this.disposeWithMe(this._commandService.registerCommand(i))), this._initLegacyPasteCommand();
|
|
1285
1333
|
}
|
|
1286
1334
|
_initLegacyPasteCommand() {
|
|
1287
|
-
var
|
|
1288
|
-
(
|
|
1335
|
+
var i;
|
|
1336
|
+
(i = this._textSelectionRenderManager) == null || i.onPaste$.pipe(ae(this.dispose$)).subscribe((e) => {
|
|
1289
1337
|
var s, o;
|
|
1290
|
-
if (!
|
|
1338
|
+
if (!we(this._contextService))
|
|
1291
1339
|
return;
|
|
1292
1340
|
e.event.preventDefault();
|
|
1293
|
-
const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"),
|
|
1294
|
-
this._docClipboardService.legacyPaste(n,
|
|
1341
|
+
const t = e.event, n = (s = t.clipboardData) == null ? void 0 : s.getData("text/html"), r = (o = t.clipboardData) == null ? void 0 : o.getData("text/plain");
|
|
1342
|
+
this._docClipboardService.legacyPaste(n, r);
|
|
1295
1343
|
});
|
|
1296
1344
|
}
|
|
1297
1345
|
};
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
],
|
|
1306
|
-
var
|
|
1307
|
-
for (var
|
|
1308
|
-
(o =
|
|
1309
|
-
return n &&
|
|
1310
|
-
}, Z = (
|
|
1311
|
-
let
|
|
1312
|
-
constructor(e, t, n,
|
|
1346
|
+
ve = pr([
|
|
1347
|
+
N(A.Rendered, ve),
|
|
1348
|
+
re(0, v),
|
|
1349
|
+
re(1, Je),
|
|
1350
|
+
re(2, ue),
|
|
1351
|
+
re(3, de),
|
|
1352
|
+
re(4, Vt)
|
|
1353
|
+
], ve);
|
|
1354
|
+
var fr = Object.defineProperty, mr = Object.getOwnPropertyDescriptor, Sr = (i, e, t, n) => {
|
|
1355
|
+
for (var r = n > 1 ? void 0 : n ? mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1356
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1357
|
+
return n && r && fr(e, t, r), r;
|
|
1358
|
+
}, Z = (i, e) => (t, n) => e(t, n, i);
|
|
1359
|
+
let Ce = class extends Y {
|
|
1360
|
+
constructor(e, t, n, r, s, o) {
|
|
1313
1361
|
super();
|
|
1314
|
-
|
|
1315
|
-
this.
|
|
1362
|
+
m(this, "_initialEditors", /* @__PURE__ */ new Set());
|
|
1363
|
+
this._univerInstanceService = e, this._docSkeletonManagerService = t, this._editorService = n, this._commandService = r, this._textSelectionRenderManager = s, this._renderManagerService = o, this._initialize();
|
|
1316
1364
|
}
|
|
1317
1365
|
_initialize() {
|
|
1318
1366
|
this.disposeWithMe(
|
|
@@ -1325,31 +1373,31 @@ let ve = class extends Y {
|
|
|
1325
1373
|
}), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
|
|
1326
1374
|
}
|
|
1327
1375
|
_resize(e) {
|
|
1328
|
-
var
|
|
1376
|
+
var L, w, j;
|
|
1329
1377
|
if (e == null)
|
|
1330
1378
|
return;
|
|
1331
1379
|
const t = this._editorService.getEditor(e);
|
|
1332
1380
|
if ((t == null ? void 0 : t.cancelDefaultResizeListener) === !0)
|
|
1333
1381
|
return;
|
|
1334
|
-
const n = (
|
|
1335
|
-
if (t == null || t.render == null || n == null ||
|
|
1382
|
+
const n = (L = this._docSkeletonManagerService.getSkeletonByUnitId(e)) == null ? void 0 : L.skeleton, r = this._univerInstanceService.getUniverDocInstance(e);
|
|
1383
|
+
if (t == null || t.render == null || n == null || r == null)
|
|
1336
1384
|
return;
|
|
1337
1385
|
n.calculate();
|
|
1338
|
-
const { marginTop: s = 0, marginBottom: o = 0, marginLeft: a = 0, marginRight: c = 0 } =
|
|
1386
|
+
const { marginTop: s = 0, marginBottom: o = 0, marginLeft: a = 0, marginRight: c = 0 } = r.getSnapshot().documentStyle, { scene: d, mainComponent: u } = t.render;
|
|
1339
1387
|
let { actualHeight: h, actualWidth: p } = n.getActualSize();
|
|
1340
1388
|
h += s + o, p += a + c;
|
|
1341
1389
|
const { width: g, height: f } = t.getBoundingClientRect(), l = d.getViewport(Ae.VIEW_MAIN);
|
|
1342
1390
|
let _ = l == null ? void 0 : l.getScrollBar();
|
|
1343
|
-
const
|
|
1391
|
+
const R = Math.max(p, g), y = Math.max(h, f);
|
|
1344
1392
|
d.transformByState({
|
|
1345
|
-
width:
|
|
1393
|
+
width: R,
|
|
1346
1394
|
height: y
|
|
1347
|
-
}), u == null || u.resize(
|
|
1395
|
+
}), u == null || u.resize(R, y), t.isSingle() ? p > g ? _ == null ? l && new He(l, { barSize: 8, enableVertical: !1 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (j = l == null ? void 0 : l.getScrollBar()) == null || j.dispose()) : h > f ? _ == null ? l && new He(l, { enableHorizontal: !1, barSize: 8 }) : l == null || l.resetSizeAndScrollBar() : (_ = null, l == null || l.scrollTo({ x: 0, y: 0 }), (w = l == null ? void 0 : l.getScrollBar()) == null || w.dispose());
|
|
1348
1396
|
}
|
|
1349
1397
|
_initialSetValue() {
|
|
1350
1398
|
this.disposeWithMe(
|
|
1351
1399
|
this._editorService.setValue$.subscribe((e) => {
|
|
1352
|
-
this._commandService.executeCommand(
|
|
1400
|
+
this._commandService.executeCommand(En.id, {
|
|
1353
1401
|
unitId: e.editorUnitId,
|
|
1354
1402
|
body: e.body,
|
|
1355
1403
|
segmentId: null
|
|
@@ -1364,11 +1412,12 @@ let ve = class extends Y {
|
|
|
1364
1412
|
})
|
|
1365
1413
|
), this.disposeWithMe(
|
|
1366
1414
|
this._textSelectionRenderManager.onBlur$.subscribe(() => {
|
|
1367
|
-
|
|
1415
|
+
var r;
|
|
1416
|
+
const e = (r = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : r.getUnitId();
|
|
1368
1417
|
if (e == null)
|
|
1369
1418
|
return;
|
|
1370
|
-
const t = this._editorService.getEditor(e);
|
|
1371
|
-
t == null || t.isSheetEditor() || this._editorService.blur();
|
|
1419
|
+
const t = this._editorService.getEditor(e), n = this._editorService.getFocusEditor();
|
|
1420
|
+
t == null || t.isSheetEditor() || n && n.editorUnitId === e || this._editorService.blur();
|
|
1372
1421
|
})
|
|
1373
1422
|
);
|
|
1374
1423
|
}
|
|
@@ -1385,7 +1434,7 @@ let ve = class extends Y {
|
|
|
1385
1434
|
"univer-formula-help-param"
|
|
1386
1435
|
];
|
|
1387
1436
|
this.disposeWithMe(
|
|
1388
|
-
|
|
1437
|
+
_t(window, "mousedown").subscribe((n) => {
|
|
1389
1438
|
const s = n.target.classList[0] || "";
|
|
1390
1439
|
if (Wt(s, e)) {
|
|
1391
1440
|
this._editorService.changeSpreadsheetFocusState(!0), n.stopPropagation();
|
|
@@ -1393,9 +1442,9 @@ let ve = class extends Y {
|
|
|
1393
1442
|
}
|
|
1394
1443
|
this._editorService.changeSpreadsheetFocusState(!1);
|
|
1395
1444
|
})
|
|
1396
|
-
), this.
|
|
1397
|
-
const
|
|
1398
|
-
o != null &&
|
|
1445
|
+
), this._univerInstanceService.getAllUnitsForType(S.UNIVER_SHEET).forEach((n) => {
|
|
1446
|
+
const r = n.getUnitId(), s = this._renderManagerService.getRenderById(r), o = s == null ? void 0 : s.engine.getCanvas().getCanvasEle();
|
|
1447
|
+
o != null && _t(o, "mousedown").subscribe((a) => {
|
|
1399
1448
|
this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
|
|
1400
1449
|
});
|
|
1401
1450
|
});
|
|
@@ -1412,7 +1461,8 @@ let ve = class extends Y {
|
|
|
1412
1461
|
);
|
|
1413
1462
|
}
|
|
1414
1463
|
_valueChange() {
|
|
1415
|
-
|
|
1464
|
+
var n;
|
|
1465
|
+
const e = (n = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : n.getUnitId();
|
|
1416
1466
|
if (e == null)
|
|
1417
1467
|
return;
|
|
1418
1468
|
const t = this._editorService.getEditor(e);
|
|
@@ -1422,38 +1472,38 @@ let ve = class extends Y {
|
|
|
1422
1472
|
* Listen to document edits to refresh the size of the normula editor.
|
|
1423
1473
|
*/
|
|
1424
1474
|
_commandExecutedListener() {
|
|
1425
|
-
const e = [
|
|
1475
|
+
const e = [Qe.id, ln.id];
|
|
1426
1476
|
this.disposeWithMe(
|
|
1427
1477
|
this._commandService.onCommandExecuted((t) => {
|
|
1428
1478
|
if (e.includes(t.id)) {
|
|
1429
|
-
const n = t.params, { unitId:
|
|
1430
|
-
if (this._editorService.isSheetEditor(
|
|
1479
|
+
const n = t.params, { unitId: r } = n;
|
|
1480
|
+
if (this._editorService.isSheetEditor(r))
|
|
1431
1481
|
return;
|
|
1432
|
-
this._resize(
|
|
1482
|
+
this._resize(r), this._valueChange();
|
|
1433
1483
|
}
|
|
1434
1484
|
})
|
|
1435
1485
|
);
|
|
1436
1486
|
}
|
|
1437
1487
|
};
|
|
1438
|
-
|
|
1439
|
-
|
|
1488
|
+
Ce = Sr([
|
|
1489
|
+
N(A.Rendered, Ce),
|
|
1440
1490
|
Z(0, D),
|
|
1441
|
-
Z(1,
|
|
1442
|
-
Z(2,
|
|
1443
|
-
Z(3,
|
|
1491
|
+
Z(1, O(ne)),
|
|
1492
|
+
Z(2, $),
|
|
1493
|
+
Z(3, v),
|
|
1444
1494
|
Z(4, de),
|
|
1445
|
-
Z(5,
|
|
1446
|
-
],
|
|
1447
|
-
var
|
|
1448
|
-
for (var
|
|
1449
|
-
(o =
|
|
1450
|
-
return n &&
|
|
1451
|
-
}, pe = (
|
|
1452
|
-
let
|
|
1453
|
-
constructor(e, t, n,
|
|
1495
|
+
Z(5, W)
|
|
1496
|
+
], Ce);
|
|
1497
|
+
var vr = Object.defineProperty, Cr = Object.getOwnPropertyDescriptor, Or = (i, e, t, n) => {
|
|
1498
|
+
for (var r = n > 1 ? void 0 : n ? Cr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1499
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1500
|
+
return n && r && vr(e, t, r), r;
|
|
1501
|
+
}, pe = (i, e) => (t, n) => e(t, n, i);
|
|
1502
|
+
let Oe = class extends ce {
|
|
1503
|
+
constructor(e, t, n, r) {
|
|
1454
1504
|
super();
|
|
1455
|
-
|
|
1456
|
-
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService =
|
|
1505
|
+
m(this, "_docRenderMap", /* @__PURE__ */ new Set());
|
|
1506
|
+
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
|
|
1457
1507
|
}
|
|
1458
1508
|
_initialRenderRefresh() {
|
|
1459
1509
|
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(ae(this.dispose$)).subscribe((e) => {
|
|
@@ -1464,30 +1514,30 @@ let Ce = class extends ce {
|
|
|
1464
1514
|
if (e == null)
|
|
1465
1515
|
return;
|
|
1466
1516
|
const { skeleton: t, unitId: n } = e;
|
|
1467
|
-
let
|
|
1468
|
-
|
|
1469
|
-
const { mainComponent: s } =
|
|
1470
|
-
s.changeSkeleton(t), this._recalculateSizeBySkeleton(
|
|
1517
|
+
let r = this._renderManagerService.getRenderById(n);
|
|
1518
|
+
r == null && (this._renderManagerService.create(n), r = this._renderManagerService.getRenderById(n));
|
|
1519
|
+
const { mainComponent: s } = r;
|
|
1520
|
+
s.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
|
|
1471
1521
|
}
|
|
1472
1522
|
_recalculateSizeBySkeleton(e, t) {
|
|
1473
1523
|
var u;
|
|
1474
|
-
const { mainComponent: n, scene:
|
|
1524
|
+
const { mainComponent: n, scene: r, unitId: s } = e, o = n, a = (u = t.getSkeletonData()) == null ? void 0 : u.pages;
|
|
1475
1525
|
if (a == null)
|
|
1476
1526
|
return;
|
|
1477
1527
|
let c = 0, d = 0;
|
|
1478
1528
|
for (let h = 0, p = a.length; h < p; h++) {
|
|
1479
1529
|
const g = a[h], { pageWidth: f, pageHeight: l } = g;
|
|
1480
|
-
o.pageLayoutType ===
|
|
1530
|
+
o.pageLayoutType === ut.VERTICAL ? (d += l, d += o.pageMarginTop, h === p - 1 && (d += o.pageMarginTop), c = Math.max(c, f)) : o.pageLayoutType === ut.HORIZONTAL && (c += f, h !== p - 1 && (c += o.pageMarginLeft), d = Math.max(d, l));
|
|
1481
1531
|
}
|
|
1482
|
-
o.resize(c, d), this._editorService.isEditor(s) ||
|
|
1532
|
+
o.resize(c, d), this._editorService.isEditor(s) || r.resize(c, d);
|
|
1483
1533
|
}
|
|
1484
1534
|
_commandExecutedListener() {
|
|
1485
|
-
const e = [
|
|
1535
|
+
const e = [Qe.id];
|
|
1486
1536
|
this.disposeWithMe(
|
|
1487
1537
|
this._commandService.onCommandExecuted((t) => {
|
|
1488
1538
|
var n;
|
|
1489
1539
|
if (e.includes(t.id)) {
|
|
1490
|
-
const
|
|
1540
|
+
const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getSkeletonByUnitId(s);
|
|
1491
1541
|
if (o == null)
|
|
1492
1542
|
return;
|
|
1493
1543
|
const { skeleton: a } = o, c = this._renderManagerService.getRenderById(s);
|
|
@@ -1503,33 +1553,33 @@ let Ce = class extends ce {
|
|
|
1503
1553
|
);
|
|
1504
1554
|
}
|
|
1505
1555
|
};
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
pe(0,
|
|
1509
|
-
pe(1,
|
|
1510
|
-
pe(2,
|
|
1511
|
-
pe(3,
|
|
1512
|
-
],
|
|
1513
|
-
var
|
|
1514
|
-
for (var
|
|
1515
|
-
(o =
|
|
1516
|
-
return n &&
|
|
1517
|
-
}, fe = (
|
|
1518
|
-
let
|
|
1519
|
-
constructor(e, t, n,
|
|
1556
|
+
Oe = Or([
|
|
1557
|
+
N(A.Rendered, Oe),
|
|
1558
|
+
pe(0, O(ne)),
|
|
1559
|
+
pe(1, W),
|
|
1560
|
+
pe(2, v),
|
|
1561
|
+
pe(3, $)
|
|
1562
|
+
], Oe);
|
|
1563
|
+
var Rr = Object.defineProperty, Tr = Object.getOwnPropertyDescriptor, Ir = (i, e, t, n) => {
|
|
1564
|
+
for (var r = n > 1 ? void 0 : n ? Tr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1565
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1566
|
+
return n && r && Rr(e, t, r), r;
|
|
1567
|
+
}, fe = (i, e) => (t, n) => e(t, n, i);
|
|
1568
|
+
let Re = class extends ce {
|
|
1569
|
+
constructor(e, t, n, r) {
|
|
1520
1570
|
super();
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
this._renderManagerService = e, this._configService = t, this.
|
|
1571
|
+
m(this, "_scene");
|
|
1572
|
+
m(this, "_currentDocumentModel");
|
|
1573
|
+
m(this, "_fps$", new zn(""));
|
|
1574
|
+
m(this, "fps$", this._fps$.asObservable());
|
|
1575
|
+
this._renderManagerService = e, this._configService = t, this._univerInstanceService = n, this._editorService = r, this._initialize();
|
|
1526
1576
|
}
|
|
1527
1577
|
_initialize() {
|
|
1528
1578
|
this._renderManagerService.createRender$.pipe(ae(this.dispose$)).subscribe((e) => {
|
|
1529
1579
|
this._create(e);
|
|
1530
|
-
}), this.
|
|
1580
|
+
}), this._univerInstanceService.getCurrentTypeOfUnit$(S.UNIVER_DOC).pipe(ae(this.dispose$)).subscribe((e) => {
|
|
1531
1581
|
this._create(e == null ? void 0 : e.getUnitId());
|
|
1532
|
-
}), this.
|
|
1582
|
+
}), this._univerInstanceService.getAllUnitsForType(S.UNIVER_DOC).forEach((e) => {
|
|
1533
1583
|
this._create(e.getUnitId());
|
|
1534
1584
|
});
|
|
1535
1585
|
}
|
|
@@ -1539,14 +1589,15 @@ let Oe = class extends ce {
|
|
|
1539
1589
|
_create(e) {
|
|
1540
1590
|
if (e == null)
|
|
1541
1591
|
return;
|
|
1542
|
-
const t = this.
|
|
1592
|
+
const t = this._univerInstanceService.getUniverDocInstance(e);
|
|
1543
1593
|
t != null && (this._currentDocumentModel = t, this._renderManagerService.has(e) || this._addNewRender());
|
|
1544
1594
|
}
|
|
1595
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1545
1596
|
_addNewRender() {
|
|
1546
|
-
const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(),
|
|
1547
|
-
if (n != null &&
|
|
1597
|
+
const e = this._currentDocumentModel, t = e.getUnitId(), n = e.getContainer(), r = e.getParentRenderUnitId();
|
|
1598
|
+
if (n != null && r != null)
|
|
1548
1599
|
throw new Error("container or parentRenderUnitId can only exist one");
|
|
1549
|
-
n == null &&
|
|
1600
|
+
n == null && r != null ? this._renderManagerService.createRenderWithParent(t, r) : this._renderManagerService.createRender(t);
|
|
1550
1601
|
const s = this._renderManagerService.getRenderById(t);
|
|
1551
1602
|
if (s == null)
|
|
1552
1603
|
return;
|
|
@@ -1559,7 +1610,7 @@ let Oe = class extends ce {
|
|
|
1559
1610
|
right: 0,
|
|
1560
1611
|
isWheelPreventDefaultX: !0
|
|
1561
1612
|
});
|
|
1562
|
-
o.attachControl(), o.on(
|
|
1613
|
+
o.attachControl(), o.on($n.wheel, (h, p) => {
|
|
1563
1614
|
const g = h;
|
|
1564
1615
|
if (g.ctrlKey) {
|
|
1565
1616
|
const f = Math.abs(g.deltaX);
|
|
@@ -1567,39 +1618,39 @@ let Oe = class extends ce {
|
|
|
1567
1618
|
l *= g.deltaY > 0 ? -1 : 1, o.scaleX < 1 && (l /= 2), o.scaleX + l > 4 ? o.scale(4, 4) : o.scaleX + l < 0.1 ? o.scale(0.1, 0.1) : g.preventDefault();
|
|
1568
1619
|
} else
|
|
1569
1620
|
c.onMouseWheel(g, p);
|
|
1570
|
-
}), this._configService.getConfig("hasScroll") !== !1 && new
|
|
1571
|
-
new
|
|
1572
|
-
new
|
|
1621
|
+
}), this._configService.getConfig("hasScroll") !== !1 && new He(c), o.addLayer(
|
|
1622
|
+
new ht(o, [], je),
|
|
1623
|
+
new ht(o, [], xn)
|
|
1573
1624
|
), this._addComponent(s), this._currentDocumentModel.getShouldRenderLoopImmediately() && a.runRenderLoop(() => {
|
|
1574
1625
|
o.render(), this._fps$.next(Math.round(a.getFps()).toString());
|
|
1575
1626
|
}), this._renderManagerService.setCurrent(t);
|
|
1576
1627
|
}
|
|
1577
1628
|
_addComponent(e) {
|
|
1578
|
-
const t = this._scene, n = this._currentDocumentModel,
|
|
1629
|
+
const t = this._scene, n = this._currentDocumentModel, r = new Bn(lt.MAIN, void 0, {
|
|
1579
1630
|
pageMarginLeft: n.documentStyle.marginLeft || 0,
|
|
1580
1631
|
pageMarginTop: n.documentStyle.marginTop || 0
|
|
1581
1632
|
});
|
|
1582
|
-
|
|
1633
|
+
r.zIndex = Dn, e.mainComponent = r, e.components.set(lt.MAIN, r), t.addObjects([r], je), this._editorService.getEditor(n.getUnitId()) == null && t.enableLayerCache(je);
|
|
1583
1634
|
}
|
|
1584
1635
|
};
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
fe(0,
|
|
1636
|
+
Re = Ir([
|
|
1637
|
+
N(A.Starting, Re),
|
|
1638
|
+
fe(0, W),
|
|
1588
1639
|
fe(1, zt),
|
|
1589
1640
|
fe(2, D),
|
|
1590
|
-
fe(3,
|
|
1591
|
-
],
|
|
1592
|
-
var
|
|
1593
|
-
for (var
|
|
1594
|
-
(o =
|
|
1595
|
-
return n &&
|
|
1596
|
-
}, q = (
|
|
1597
|
-
let
|
|
1598
|
-
constructor(e, t, n,
|
|
1641
|
+
fe(3, $)
|
|
1642
|
+
], Re);
|
|
1643
|
+
var br = Object.defineProperty, Mr = Object.getOwnPropertyDescriptor, yr = (i, e, t, n) => {
|
|
1644
|
+
for (var r = n > 1 ? void 0 : n ? Mr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1645
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1646
|
+
return n && r && br(e, t, r), r;
|
|
1647
|
+
}, q = (i, e) => (t, n) => e(t, n, i);
|
|
1648
|
+
let Te = class extends Y {
|
|
1649
|
+
constructor(e, t, n, r, s, o) {
|
|
1599
1650
|
super();
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
this._docSkeletonManagerService = e, this.
|
|
1651
|
+
m(this, "_liquid", new Fn());
|
|
1652
|
+
m(this, "_pageMarginCache", /* @__PURE__ */ new Map());
|
|
1653
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._renderManagerService = n, this._commandService = r, this._floatingObjectManagerService = s, this._editorService = o, this._initialize(), this._commandExecutedListener();
|
|
1603
1654
|
}
|
|
1604
1655
|
_initialize() {
|
|
1605
1656
|
this._initialRenderRefresh(), this._updateOnPluginChange();
|
|
@@ -1609,39 +1660,39 @@ let Re = class extends Y {
|
|
|
1609
1660
|
const t = this._docSkeletonManagerService.getCurrent();
|
|
1610
1661
|
if (t == null)
|
|
1611
1662
|
return;
|
|
1612
|
-
const { unitId: n, skeleton:
|
|
1663
|
+
const { unitId: n, skeleton: r } = t, s = this._renderManagerService.getRenderById(n);
|
|
1613
1664
|
if (s == null)
|
|
1614
1665
|
return;
|
|
1615
1666
|
const { mainComponent: o, components: a, scene: c } = s, d = o, { left: u, top: h } = d;
|
|
1616
1667
|
e.forEach((p) => {
|
|
1617
|
-
const { unitId: g, subUnitId: f, floatingObjectId: l, floatingObject: _ } = p, { left:
|
|
1618
|
-
|
|
1619
|
-
left:
|
|
1620
|
-
top: y - h -
|
|
1621
|
-
height:
|
|
1622
|
-
width:
|
|
1668
|
+
const { unitId: g, subUnitId: f, floatingObjectId: l, floatingObject: _ } = p, { left: R = 0, top: y = 0, width: L = 0, height: w = 0, angle: j, flipX: X, flipY: G, skewX: he, skewY: ge } = _, x = this._pageMarginCache.get(l), At = (x == null ? void 0 : x.marginLeft) || 0, $t = (x == null ? void 0 : x.marginTop) || 0;
|
|
1669
|
+
r == null || r.getViewModel().getDataModel().updateDrawing(l, {
|
|
1670
|
+
left: R - u - At,
|
|
1671
|
+
top: y - h - $t,
|
|
1672
|
+
height: w,
|
|
1673
|
+
width: L
|
|
1623
1674
|
});
|
|
1624
|
-
}),
|
|
1675
|
+
}), r == null || r.calculate(), o == null || o.makeDirty();
|
|
1625
1676
|
});
|
|
1626
1677
|
}
|
|
1627
1678
|
_initialRenderRefresh() {
|
|
1628
1679
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1629
1680
|
if (e == null)
|
|
1630
1681
|
return;
|
|
1631
|
-
const { skeleton: t, unitId: n } = e,
|
|
1632
|
-
if (
|
|
1682
|
+
const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
|
|
1683
|
+
if (r == null)
|
|
1633
1684
|
return;
|
|
1634
|
-
const { mainComponent: s } =
|
|
1635
|
-
s.changeSkeleton(t), this._refreshFloatingObject(n, t,
|
|
1685
|
+
const { mainComponent: s } = r;
|
|
1686
|
+
s.changeSkeleton(t), this._refreshFloatingObject(n, t, r);
|
|
1636
1687
|
});
|
|
1637
1688
|
}
|
|
1638
1689
|
_commandExecutedListener() {
|
|
1639
|
-
const e = [
|
|
1690
|
+
const e = [Qe.id, et.id];
|
|
1640
1691
|
this.disposeWithMe(
|
|
1641
1692
|
this._commandService.onCommandExecuted((t) => {
|
|
1642
1693
|
var n;
|
|
1643
1694
|
if (e.includes(t.id)) {
|
|
1644
|
-
const
|
|
1695
|
+
const r = t.params, { unitId: s } = r, o = this._docSkeletonManagerService.getCurrent();
|
|
1645
1696
|
if (o == null)
|
|
1646
1697
|
return;
|
|
1647
1698
|
const { unitId: a, skeleton: c } = o;
|
|
@@ -1660,18 +1711,18 @@ let Re = class extends Y {
|
|
|
1660
1711
|
);
|
|
1661
1712
|
}
|
|
1662
1713
|
_refreshFloatingObject(e, t, n) {
|
|
1663
|
-
const
|
|
1664
|
-
if (!
|
|
1714
|
+
const r = t == null ? void 0 : t.getSkeletonData(), { mainComponent: s, scene: o } = n, a = s;
|
|
1715
|
+
if (!r)
|
|
1665
1716
|
return;
|
|
1666
|
-
const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: p } = a, { pages: g } =
|
|
1717
|
+
const { left: c, top: d, pageLayoutType: u, pageMarginLeft: h, pageMarginTop: p } = a, { pages: g } = r, f = [];
|
|
1667
1718
|
o.getAncestorScale(), this._liquid.reset(), this._pageMarginCache.clear();
|
|
1668
1719
|
for (let l = 0, _ = g.length; l < _; l++) {
|
|
1669
|
-
const
|
|
1670
|
-
this._liquid.translatePagePadding(
|
|
1720
|
+
const R = g[l], { skeDrawings: y, marginLeft: L, marginTop: w } = R;
|
|
1721
|
+
this._liquid.translatePagePadding(R), y.forEach((j) => {
|
|
1671
1722
|
const { aLeft: X, aTop: G, height: he, width: ge, objectId: x } = j;
|
|
1672
1723
|
f.push({
|
|
1673
1724
|
unitId: e,
|
|
1674
|
-
subUnitId:
|
|
1725
|
+
subUnitId: kt,
|
|
1675
1726
|
floatingObjectId: x,
|
|
1676
1727
|
floatingObject: {
|
|
1677
1728
|
left: X + c + this._liquid.x,
|
|
@@ -1683,57 +1734,59 @@ let Re = class extends Y {
|
|
|
1683
1734
|
marginLeft: this._liquid.x,
|
|
1684
1735
|
marginTop: this._liquid.y
|
|
1685
1736
|
});
|
|
1686
|
-
}), this._liquid.translatePage(
|
|
1737
|
+
}), this._liquid.translatePage(R, u, h, p);
|
|
1687
1738
|
}
|
|
1688
1739
|
this._floatingObjectManagerService.BatchAddOrUpdate(f);
|
|
1689
1740
|
}
|
|
1690
1741
|
};
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
q(0,
|
|
1742
|
+
Te = yr([
|
|
1743
|
+
N(A.Steady, Te),
|
|
1744
|
+
q(0, O(ne)),
|
|
1694
1745
|
q(1, D),
|
|
1695
|
-
q(2,
|
|
1696
|
-
q(3,
|
|
1697
|
-
q(4,
|
|
1698
|
-
q(5,
|
|
1699
|
-
],
|
|
1700
|
-
var
|
|
1701
|
-
for (var
|
|
1702
|
-
(o =
|
|
1703
|
-
return n &&
|
|
1704
|
-
}, We = (
|
|
1705
|
-
const
|
|
1706
|
-
let
|
|
1707
|
-
constructor(
|
|
1708
|
-
super(), this._renderManagerService =
|
|
1746
|
+
q(2, W),
|
|
1747
|
+
q(3, v),
|
|
1748
|
+
q(4, Ht),
|
|
1749
|
+
q(5, $)
|
|
1750
|
+
], Te);
|
|
1751
|
+
var Er = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Dr = (i, e, t, n) => {
|
|
1752
|
+
for (var r = n > 1 ? void 0 : n ? xr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1753
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1754
|
+
return n && r && Er(e, t, r), r;
|
|
1755
|
+
}, We = (i, e) => (t, n) => e(t, n, i);
|
|
1756
|
+
const Pr = "rgba(198, 198, 198, 1)", Ur = "rgba(255, 255, 255, 1)";
|
|
1757
|
+
let Ie = class extends Y {
|
|
1758
|
+
constructor(i, e, t) {
|
|
1759
|
+
super(), this._renderManagerService = i, this._editorService = e, this._univerInstanceService = t, this._initialize(), this._commandExecutedListener();
|
|
1709
1760
|
}
|
|
1710
1761
|
_initialize() {
|
|
1711
1762
|
this._initialRenderRefresh();
|
|
1712
1763
|
}
|
|
1713
1764
|
_initialRenderRefresh() {
|
|
1714
|
-
this._renderManagerService.currentRender$.subscribe((
|
|
1765
|
+
this._renderManagerService.currentRender$.subscribe((i) => {
|
|
1715
1766
|
var s;
|
|
1716
|
-
if (
|
|
1767
|
+
if (i == null)
|
|
1717
1768
|
return;
|
|
1718
|
-
const e = this._renderManagerService.getRenderById(
|
|
1719
|
-
if (this._editorService.isEditor(
|
|
1769
|
+
const e = this._renderManagerService.getRenderById(i);
|
|
1770
|
+
if (this._editorService.isEditor(i) || this._univerInstanceService.getUniverDocInstance(i) == null || e == null)
|
|
1720
1771
|
return;
|
|
1721
|
-
const { mainComponent: t } = e, n = t,
|
|
1772
|
+
const { mainComponent: t } = e, n = t, r = (s = n.getSkeleton()) == null ? void 0 : s.getPageSize();
|
|
1722
1773
|
this.disposeWithMe(
|
|
1723
|
-
|
|
1774
|
+
F(
|
|
1724
1775
|
n.onPageRenderObservable.add((o) => {
|
|
1725
|
-
var
|
|
1726
|
-
if (this._editorService.isEditor(
|
|
1776
|
+
var _, R, y, L;
|
|
1777
|
+
if (this._editorService.isEditor(i))
|
|
1727
1778
|
return;
|
|
1728
1779
|
const { page: a, pageLeft: c, pageTop: d, ctx: u } = o, { width: h, pageWidth: p, height: g, pageHeight: f } = a;
|
|
1729
|
-
u.save(), u.translate(c - 0.5, d - 0.5)
|
|
1730
|
-
|
|
1731
|
-
|
|
1780
|
+
u.save(), u.translate(c - 0.5, d - 0.5);
|
|
1781
|
+
const l = {
|
|
1782
|
+
width: (R = (_ = r == null ? void 0 : r.width) != null ? _ : p) != null ? R : h,
|
|
1783
|
+
height: (L = (y = r == null ? void 0 : r.height) != null ? y : f) != null ? L : g,
|
|
1732
1784
|
strokeWidth: 1,
|
|
1733
|
-
stroke:
|
|
1734
|
-
fill:
|
|
1785
|
+
stroke: Pr,
|
|
1786
|
+
fill: Ur,
|
|
1735
1787
|
zIndex: 3
|
|
1736
|
-
}
|
|
1788
|
+
};
|
|
1789
|
+
wn.drawWith(u, l), u.restore();
|
|
1737
1790
|
})
|
|
1738
1791
|
)
|
|
1739
1792
|
);
|
|
@@ -1742,22 +1795,22 @@ let Te = class extends Y {
|
|
|
1742
1795
|
_commandExecutedListener() {
|
|
1743
1796
|
}
|
|
1744
1797
|
};
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
We(0,
|
|
1748
|
-
We(1,
|
|
1798
|
+
Ie = Dr([
|
|
1799
|
+
N(A.Rendered, Ie),
|
|
1800
|
+
We(0, W),
|
|
1801
|
+
We(1, $),
|
|
1749
1802
|
We(2, D)
|
|
1750
|
-
],
|
|
1751
|
-
var
|
|
1752
|
-
for (var
|
|
1753
|
-
(o =
|
|
1754
|
-
return n &&
|
|
1755
|
-
}, K = (
|
|
1803
|
+
], Ie);
|
|
1804
|
+
var Lr = Object.defineProperty, Nr = Object.getOwnPropertyDescriptor, Ar = (i, e, t, n) => {
|
|
1805
|
+
for (var r = n > 1 ? void 0 : n ? Nr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1806
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1807
|
+
return n && r && Lr(e, t, r), r;
|
|
1808
|
+
}, K = (i, e) => (t, n) => e(t, n, i);
|
|
1756
1809
|
let be = class extends Y {
|
|
1757
|
-
constructor(e, t, n,
|
|
1810
|
+
constructor(e, t, n, r, s, o) {
|
|
1758
1811
|
super();
|
|
1759
|
-
|
|
1760
|
-
this._docSkeletonManagerService = e, this.
|
|
1812
|
+
m(this, "_initializedRender", /* @__PURE__ */ new Set());
|
|
1813
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = s, this._editorService = o, this._initialize();
|
|
1761
1814
|
}
|
|
1762
1815
|
dispose() {
|
|
1763
1816
|
super.dispose();
|
|
@@ -1773,20 +1826,23 @@ let be = class extends Y {
|
|
|
1773
1826
|
if (n == null || this._initializedRender.has(t) || this._editorService.isEditor(t))
|
|
1774
1827
|
return;
|
|
1775
1828
|
this._initializedRender.add(t);
|
|
1776
|
-
const { scene:
|
|
1829
|
+
const { scene: r } = n;
|
|
1777
1830
|
this.disposeWithMe(
|
|
1778
|
-
|
|
1779
|
-
|
|
1831
|
+
F(
|
|
1832
|
+
r.onMouseWheelObserver.add((s) => {
|
|
1780
1833
|
if (!s.ctrlKey)
|
|
1781
1834
|
return;
|
|
1782
|
-
const o =
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
const
|
|
1786
|
-
let
|
|
1787
|
-
|
|
1835
|
+
const o = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1836
|
+
if (!o)
|
|
1837
|
+
return;
|
|
1838
|
+
const a = Math.abs(s.deltaX);
|
|
1839
|
+
let c = a < 40 ? 0.2 : a < 80 ? 0.4 : 0.2;
|
|
1840
|
+
c *= s.deltaY > 0 ? -1 : 1, r.scaleX < 1 && (c /= 2);
|
|
1841
|
+
const d = o.zoomRatio;
|
|
1842
|
+
let u = +Number.parseFloat(`${d + c}`).toFixed(1);
|
|
1843
|
+
u = u >= 4 ? 4 : u <= 0.1 ? 0.1 : u, this._commandService.executeCommand(Pn.id, {
|
|
1788
1844
|
zoomRatio: u,
|
|
1789
|
-
unitId:
|
|
1845
|
+
unitId: o.getUnitId()
|
|
1790
1846
|
}), s.preventDefault();
|
|
1791
1847
|
})
|
|
1792
1848
|
)
|
|
@@ -1802,22 +1858,28 @@ let be = class extends Y {
|
|
|
1802
1858
|
// }
|
|
1803
1859
|
_skeletonListener() {
|
|
1804
1860
|
this.disposeWithMe(
|
|
1805
|
-
|
|
1861
|
+
F(
|
|
1806
1862
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1807
1863
|
if (e == null)
|
|
1808
1864
|
return;
|
|
1809
|
-
const
|
|
1865
|
+
const t = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1866
|
+
if (!t)
|
|
1867
|
+
return;
|
|
1868
|
+
const n = t.zoomRatio || 1;
|
|
1810
1869
|
this._updateViewZoom(n, !1);
|
|
1811
1870
|
})
|
|
1812
1871
|
)
|
|
1813
1872
|
);
|
|
1814
1873
|
}
|
|
1815
1874
|
_commandExecutedListener() {
|
|
1816
|
-
const e = [
|
|
1875
|
+
const e = [et.id];
|
|
1817
1876
|
this.disposeWithMe(
|
|
1818
1877
|
this._commandService.onCommandExecuted((t) => {
|
|
1819
1878
|
if (e.includes(t.id)) {
|
|
1820
|
-
const n = this.
|
|
1879
|
+
const n = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1880
|
+
if (!n)
|
|
1881
|
+
return;
|
|
1882
|
+
const r = t.params, { unitId: s } = r;
|
|
1821
1883
|
if (s !== n.getUnitId())
|
|
1822
1884
|
return;
|
|
1823
1885
|
const o = n.zoomRatio || 1;
|
|
@@ -1827,49 +1889,49 @@ let be = class extends Y {
|
|
|
1827
1889
|
);
|
|
1828
1890
|
}
|
|
1829
1891
|
_updateViewZoom(e, t = !0) {
|
|
1830
|
-
var
|
|
1892
|
+
var r;
|
|
1831
1893
|
const n = this._getDocObject();
|
|
1832
|
-
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (
|
|
1894
|
+
n != null && (n.scene.scale(e, e), this._calculatePagePosition(n, e), t && this._textSelectionManagerService.refreshSelection(), (r = n.scene.getTransformer()) == null || r.hideControl());
|
|
1833
1895
|
}
|
|
1834
1896
|
_calculatePagePosition(e, t) {
|
|
1835
|
-
const { document: n, scene:
|
|
1897
|
+
const { document: n, scene: r } = e, s = r == null ? void 0 : r.getParent(), { width: o, height: a, pageMarginLeft: c, pageMarginTop: d } = n;
|
|
1836
1898
|
if (s == null || o === Number.POSITIVE_INFINITY || a === Number.POSITIVE_INFINITY)
|
|
1837
1899
|
return;
|
|
1838
1900
|
const { width: u, height: h } = s;
|
|
1839
1901
|
let p = 0, g = 0, f = 0, l = 0, _ = Number.POSITIVE_INFINITY;
|
|
1840
|
-
u > (o + c * 2) * t ? (p = u / 2 - o * t / 2, p /= t, f = (u - c * 2) / t, _ = 0) : (p = c, f = o + c * 2, _ = (f - u / t) / 2), h > a ? (g = h / 2 - a / 2, l = (h - d * 2) / t) : (g = d, l = a + d * 2),
|
|
1841
|
-
const
|
|
1842
|
-
if (_ !== Number.POSITIVE_INFINITY &&
|
|
1843
|
-
const y =
|
|
1844
|
-
|
|
1902
|
+
u > (o + c * 2) * t ? (p = u / 2 - o * t / 2, p /= t, f = (u - c * 2) / t, _ = 0) : (p = c, f = o + c * 2, _ = (f - u / t) / 2), h > a ? (g = h / 2 - a / 2, l = (h - d * 2) / t) : (g = d, l = a + d * 2), r.resize(f, l + 200), n.translate(p, g);
|
|
1903
|
+
const R = r.getViewport(Ae.VIEW_MAIN);
|
|
1904
|
+
if (_ !== Number.POSITIVE_INFINITY && R != null) {
|
|
1905
|
+
const y = R.getBarScroll(_, 0).x;
|
|
1906
|
+
R.scrollTo({
|
|
1845
1907
|
x: y
|
|
1846
1908
|
});
|
|
1847
1909
|
}
|
|
1848
1910
|
return this;
|
|
1849
1911
|
}
|
|
1850
1912
|
_getDocObject() {
|
|
1851
|
-
return
|
|
1913
|
+
return Et(this._univerInstanceService, this._renderManagerService);
|
|
1852
1914
|
}
|
|
1853
1915
|
};
|
|
1854
|
-
be =
|
|
1855
|
-
|
|
1856
|
-
K(0,
|
|
1916
|
+
be = Ar([
|
|
1917
|
+
N(A.Rendered, be),
|
|
1918
|
+
K(0, O(ne)),
|
|
1857
1919
|
K(1, D),
|
|
1858
|
-
K(2,
|
|
1859
|
-
K(3,
|
|
1860
|
-
K(4,
|
|
1861
|
-
K(5,
|
|
1920
|
+
K(2, v),
|
|
1921
|
+
K(3, W),
|
|
1922
|
+
K(4, O(te)),
|
|
1923
|
+
K(5, $)
|
|
1862
1924
|
], be);
|
|
1863
|
-
var
|
|
1864
|
-
for (var
|
|
1865
|
-
(o =
|
|
1866
|
-
return n &&
|
|
1867
|
-
}, H = (
|
|
1868
|
-
let
|
|
1869
|
-
constructor(e, t, n,
|
|
1925
|
+
var $r = Object.defineProperty, Br = Object.getOwnPropertyDescriptor, Fr = (i, e, t, n) => {
|
|
1926
|
+
for (var r = n > 1 ? void 0 : n ? Br(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
1927
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
1928
|
+
return n && r && $r(e, t, r), r;
|
|
1929
|
+
}, H = (i, e) => (t, n) => e(t, n, i);
|
|
1930
|
+
let Me = class extends Y {
|
|
1931
|
+
constructor(e, t, n, r, s, o, a) {
|
|
1870
1932
|
super();
|
|
1871
|
-
|
|
1872
|
-
this._docSkeletonManagerService = e, this.
|
|
1933
|
+
m(this, "_loadedMap", /* @__PURE__ */ new WeakSet());
|
|
1934
|
+
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionRenderManager = s, this._textSelectionManagerService = o, this._editorService = a, this._initialize();
|
|
1873
1935
|
}
|
|
1874
1936
|
_initialize() {
|
|
1875
1937
|
this._init(), this._skeletonListener(), this._commandExecutedListener();
|
|
@@ -1884,7 +1946,7 @@ let Ie = class extends Y {
|
|
|
1884
1946
|
});
|
|
1885
1947
|
}
|
|
1886
1948
|
_create(e) {
|
|
1887
|
-
if (e == null || this.
|
|
1949
|
+
if (e == null || this._univerInstanceService.getUniverDocInstance(e) == null)
|
|
1888
1950
|
return;
|
|
1889
1951
|
const t = this._getDocObjectById(e);
|
|
1890
1952
|
t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
|
|
@@ -1893,25 +1955,26 @@ let Ie = class extends Y {
|
|
|
1893
1955
|
const t = this._getDocObjectById(e);
|
|
1894
1956
|
if (t == null)
|
|
1895
1957
|
return;
|
|
1896
|
-
const { document: n, scene:
|
|
1958
|
+
const { document: n, scene: r } = t;
|
|
1897
1959
|
this.disposeWithMe(
|
|
1898
|
-
|
|
1960
|
+
F(
|
|
1899
1961
|
n.onPointerEnterObserver.add(() => {
|
|
1900
|
-
this._isEditorReadOnly(e) || (n.cursor =
|
|
1962
|
+
this._isEditorReadOnly(e) || (n.cursor = gt.TEXT);
|
|
1901
1963
|
})
|
|
1902
1964
|
)
|
|
1903
1965
|
), this.disposeWithMe(
|
|
1904
|
-
|
|
1966
|
+
F(
|
|
1905
1967
|
n.onPointerLeaveObserver.add(() => {
|
|
1906
|
-
n.cursor =
|
|
1968
|
+
n.cursor = gt.DEFAULT, r.resetCursor();
|
|
1907
1969
|
})
|
|
1908
1970
|
)
|
|
1909
1971
|
), this.disposeWithMe(
|
|
1910
|
-
|
|
1972
|
+
F(
|
|
1911
1973
|
n == null ? void 0 : n.onPointerDownObserver.add((s, o) => {
|
|
1912
1974
|
if (this._isEditorReadOnly(e))
|
|
1913
1975
|
return;
|
|
1914
|
-
|
|
1976
|
+
const a = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1977
|
+
(a == null ? void 0 : a.getUnitId()) !== e && this._univerInstanceService.setCurrentUnitForType(e), this._textSelectionRenderManager.eventTrigger(s);
|
|
1915
1978
|
const { offsetX: c, offsetY: d } = s;
|
|
1916
1979
|
this._editorService.getEditor(e) && setTimeout(() => {
|
|
1917
1980
|
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, d);
|
|
@@ -1919,13 +1982,13 @@ let Ie = class extends Y {
|
|
|
1919
1982
|
})
|
|
1920
1983
|
)
|
|
1921
1984
|
), this.disposeWithMe(
|
|
1922
|
-
|
|
1985
|
+
F(
|
|
1923
1986
|
n == null ? void 0 : n.onDblclickObserver.add((s) => {
|
|
1924
1987
|
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(s);
|
|
1925
1988
|
})
|
|
1926
1989
|
)
|
|
1927
1990
|
), this.disposeWithMe(
|
|
1928
|
-
|
|
1991
|
+
F(
|
|
1929
1992
|
n == null ? void 0 : n.onTripleClickObserver.add((s) => {
|
|
1930
1993
|
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(s);
|
|
1931
1994
|
})
|
|
@@ -1937,19 +2000,19 @@ let Ie = class extends Y {
|
|
|
1937
2000
|
return t ? t.isReadOnly() : !1;
|
|
1938
2001
|
}
|
|
1939
2002
|
_setEditorFocus(e) {
|
|
1940
|
-
if (this.
|
|
1941
|
-
const n = this.
|
|
2003
|
+
if (this._univerInstanceService.getAllUnitsForType(S.UNIVER_SHEET).length > 0) {
|
|
2004
|
+
const n = this._univerInstanceService.getCurrentUnitForType(S.UNIVER_SHEET);
|
|
1942
2005
|
this._editorService.setOperationSheetUnitId(n.getUnitId());
|
|
1943
2006
|
}
|
|
1944
2007
|
this._editorService.focusStyle(e);
|
|
1945
2008
|
}
|
|
1946
2009
|
_commandExecutedListener() {
|
|
1947
|
-
const e = [
|
|
2010
|
+
const e = [et.id];
|
|
1948
2011
|
this.disposeWithMe(
|
|
1949
2012
|
this._commandService.onCommandExecuted((t) => {
|
|
1950
2013
|
var n;
|
|
1951
2014
|
if (e.includes(t.id)) {
|
|
1952
|
-
const
|
|
2015
|
+
const r = t.params, { unitId: s } = r, o = (n = this._textSelectionManagerService.getCurrentSelection()) == null ? void 0 : n.unitId;
|
|
1953
2016
|
if (s !== o)
|
|
1954
2017
|
return;
|
|
1955
2018
|
this._textSelectionManagerService.refreshSelection();
|
|
@@ -1962,10 +2025,10 @@ let Ie = class extends Y {
|
|
|
1962
2025
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1963
2026
|
if (e == null)
|
|
1964
2027
|
return;
|
|
1965
|
-
const { unitId: t, skeleton: n } = e,
|
|
1966
|
-
if (
|
|
2028
|
+
const { unitId: t, skeleton: n } = e, r = this._renderManagerService.getRenderById(t);
|
|
2029
|
+
if (r == null)
|
|
1967
2030
|
return;
|
|
1968
|
-
const { scene: s, mainComponent: o } =
|
|
2031
|
+
const { scene: s, mainComponent: o } = r;
|
|
1969
2032
|
this._textSelectionRenderManager.changeRuntime(n, s, o), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
1970
2033
|
unitId: t,
|
|
1971
2034
|
subUnitId: ""
|
|
@@ -1974,119 +2037,117 @@ let Ie = class extends Y {
|
|
|
1974
2037
|
);
|
|
1975
2038
|
}
|
|
1976
2039
|
_getDocObjectById(e) {
|
|
1977
|
-
return
|
|
2040
|
+
return this._univerInstanceService.getUnitType(e) !== S.UNIVER_DOC ? null : Un(e, this._renderManagerService);
|
|
1978
2041
|
}
|
|
1979
2042
|
};
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
H(0,
|
|
2043
|
+
Me = Fr([
|
|
2044
|
+
N(A.Rendered, Me),
|
|
2045
|
+
H(0, O(ne)),
|
|
1983
2046
|
H(1, D),
|
|
1984
|
-
H(2,
|
|
1985
|
-
H(3,
|
|
2047
|
+
H(2, v),
|
|
2048
|
+
H(3, W),
|
|
1986
2049
|
H(4, de),
|
|
1987
|
-
H(5,
|
|
1988
|
-
H(6,
|
|
1989
|
-
],
|
|
1990
|
-
var
|
|
1991
|
-
for (var
|
|
1992
|
-
(o =
|
|
1993
|
-
return n &&
|
|
1994
|
-
}, oe = (
|
|
1995
|
-
const
|
|
1996
|
-
let
|
|
1997
|
-
constructor(
|
|
1998
|
-
super(), this._docSkeletonManagerService =
|
|
2050
|
+
H(5, O(te)),
|
|
2051
|
+
H(6, $)
|
|
2052
|
+
], Me);
|
|
2053
|
+
var wr = Object.defineProperty, jr = Object.getOwnPropertyDescriptor, Vr = (i, e, t, n) => {
|
|
2054
|
+
for (var r = n > 1 ? void 0 : n ? jr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2055
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
2056
|
+
return n && r && wr(e, t, r), r;
|
|
2057
|
+
}, oe = (i, e) => (t, n) => e(t, n, i);
|
|
2058
|
+
const Ct = 1.5;
|
|
2059
|
+
let ye = class extends ce {
|
|
2060
|
+
constructor(i, e, t, n, r) {
|
|
2061
|
+
super(), this._docSkeletonManagerService = i, this._textSelectionManagerService = e, this._editorService = t, this._univerInstanceService = n, this._renderManagerService = r, this._init();
|
|
1999
2062
|
}
|
|
2000
2063
|
_init() {
|
|
2001
|
-
this._textSelectionManagerService.textSelection$.pipe(ae(this.dispose$)).subscribe((
|
|
2002
|
-
if (
|
|
2064
|
+
this._textSelectionManagerService.textSelection$.pipe(ae(this.dispose$)).subscribe((i) => {
|
|
2065
|
+
if (i == null)
|
|
2003
2066
|
return;
|
|
2004
|
-
const { isEditing: e, unitId: t } =
|
|
2067
|
+
const { isEditing: e, unitId: t } = i;
|
|
2005
2068
|
e && this._scrollToSelection(t);
|
|
2006
2069
|
});
|
|
2007
2070
|
}
|
|
2008
2071
|
// Let the selection show on the current screen.
|
|
2009
|
-
_scrollToSelection(
|
|
2072
|
+
_scrollToSelection(i) {
|
|
2010
2073
|
var x;
|
|
2011
2074
|
const e = this._textSelectionManagerService.getActiveRange(), t = this._getDocObject(), n = (x = this._docSkeletonManagerService.getCurrent()) == null ? void 0 : x.skeleton;
|
|
2012
2075
|
if (e == null || t == null || n == null)
|
|
2013
2076
|
return;
|
|
2014
|
-
const { collapsed:
|
|
2015
|
-
if (!
|
|
2077
|
+
const { collapsed: r, startNodePosition: s } = e;
|
|
2078
|
+
if (!r)
|
|
2016
2079
|
return;
|
|
2017
|
-
const o = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = o, d = new
|
|
2080
|
+
const o = t.document.getOffsetConfig(), { docsLeft: a, docsTop: c } = o, d = new jn(o, n), { contentBoxPointGroup: u } = d.getRangePointData(s, s), { left: h, top: p, height: g } = Vn(u), f = h + a, l = p + c, _ = t.scene.getViewport(Ae.VIEW_MAIN), R = !!this._editorService.getEditor(i);
|
|
2018
2081
|
if (_ == null)
|
|
2019
2082
|
return;
|
|
2020
2083
|
const {
|
|
2021
2084
|
left: y,
|
|
2022
|
-
top:
|
|
2023
|
-
right:
|
|
2085
|
+
top: L,
|
|
2086
|
+
right: w,
|
|
2024
2087
|
bottom: j
|
|
2025
2088
|
} = _.getBounding().viewBound;
|
|
2026
2089
|
let X = 0, G = 0;
|
|
2027
|
-
const he =
|
|
2028
|
-
l <
|
|
2090
|
+
const he = R ? 0 : 100;
|
|
2091
|
+
l < L ? X = l - L : l > j - g && (X = l - j + g + he), f < y ? G = f - y : f > w - Ct && (G = f - w + Ct);
|
|
2029
2092
|
const ge = _.getBarScroll(G, X);
|
|
2030
2093
|
_.scrollBy(ge);
|
|
2031
2094
|
}
|
|
2032
2095
|
_getDocObject() {
|
|
2033
|
-
return
|
|
2096
|
+
return Et(this._univerInstanceService, this._renderManagerService);
|
|
2034
2097
|
}
|
|
2035
2098
|
};
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
oe(0,
|
|
2039
|
-
oe(1,
|
|
2040
|
-
oe(2,
|
|
2099
|
+
ye = Vr([
|
|
2100
|
+
N(A.Rendered, ye),
|
|
2101
|
+
oe(0, O(ne)),
|
|
2102
|
+
oe(1, O(te)),
|
|
2103
|
+
oe(2, $),
|
|
2041
2104
|
oe(3, D),
|
|
2042
|
-
oe(4,
|
|
2043
|
-
],
|
|
2044
|
-
var
|
|
2045
|
-
for (var
|
|
2046
|
-
(o =
|
|
2047
|
-
return n &&
|
|
2048
|
-
}, ze = (
|
|
2049
|
-
let
|
|
2050
|
-
constructor(
|
|
2051
|
-
super(
|
|
2052
|
-
zhCN:
|
|
2053
|
-
}), this._config =
|
|
2105
|
+
oe(4, W)
|
|
2106
|
+
], ye);
|
|
2107
|
+
var Wr = Object.defineProperty, zr = Object.getOwnPropertyDescriptor, kr = (i, e, t, n) => {
|
|
2108
|
+
for (var r = n > 1 ? void 0 : n ? zr(e, t) : e, s = i.length - 1, o; s >= 0; s--)
|
|
2109
|
+
(o = i[s]) && (r = (n ? o(e, t, r) : o(r)) || r);
|
|
2110
|
+
return n && r && Wr(e, t, r), r;
|
|
2111
|
+
}, ze = (i, e) => (t, n) => e(t, n, i), me;
|
|
2112
|
+
let Ot = (me = class extends Yt {
|
|
2113
|
+
constructor(i, e, t, n) {
|
|
2114
|
+
super(), this._config = i, this._injector = e, this._localeService = t, this._logService = n, this._localeService.load({
|
|
2115
|
+
zhCN: zi
|
|
2116
|
+
}), this._config = qe.deepMerge({}, Xn, this._config), this._initDependencies(e), this._initializeCommands();
|
|
2054
2117
|
}
|
|
2055
2118
|
onRendered() {
|
|
2056
2119
|
this._initModules(), this._markDocAsFocused();
|
|
2057
2120
|
}
|
|
2058
|
-
onDestroy() {
|
|
2059
|
-
}
|
|
2060
2121
|
_initializeCommands() {
|
|
2061
2122
|
[
|
|
2062
|
-
Zn,
|
|
2063
2123
|
qn,
|
|
2064
|
-
Jn,
|
|
2065
2124
|
Kn,
|
|
2066
2125
|
Qn,
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2126
|
+
Jn,
|
|
2127
|
+
ei,
|
|
2128
|
+
ti,
|
|
2129
|
+
ni,
|
|
2130
|
+
ii,
|
|
2131
|
+
ri,
|
|
2132
|
+
Hi,
|
|
2133
|
+
Yi,
|
|
2134
|
+
ki
|
|
2135
|
+
].forEach((i) => {
|
|
2136
|
+
this._injector.get(dn).registerShortcut(i);
|
|
2076
2137
|
});
|
|
2077
2138
|
}
|
|
2078
|
-
_initDependencies(
|
|
2139
|
+
_initDependencies(i) {
|
|
2079
2140
|
[
|
|
2080
2141
|
// Controller
|
|
2081
2142
|
[Se],
|
|
2082
|
-
[me],
|
|
2083
2143
|
[ve],
|
|
2084
2144
|
[Ce],
|
|
2085
|
-
[
|
|
2145
|
+
[Oe],
|
|
2086
2146
|
[Te],
|
|
2087
|
-
[be],
|
|
2088
2147
|
[Ie],
|
|
2148
|
+
[be],
|
|
2089
2149
|
[Me],
|
|
2150
|
+
[ye],
|
|
2090
2151
|
[
|
|
2091
2152
|
// controllers
|
|
2092
2153
|
se,
|
|
@@ -2097,20 +2158,23 @@ let vt = (Ve = class extends Ht {
|
|
|
2097
2158
|
[
|
|
2098
2159
|
ue,
|
|
2099
2160
|
{
|
|
2100
|
-
useClass:
|
|
2161
|
+
useClass: Xe
|
|
2101
2162
|
}
|
|
2102
2163
|
],
|
|
2103
2164
|
// Render views
|
|
2104
|
-
[
|
|
2165
|
+
[Re]
|
|
2105
2166
|
].forEach((t) => {
|
|
2106
|
-
|
|
2167
|
+
i.add(t);
|
|
2107
2168
|
});
|
|
2108
2169
|
}
|
|
2109
2170
|
_markDocAsFocused() {
|
|
2110
|
-
const
|
|
2171
|
+
const i = this._injector.get(D), e = this._injector.get($);
|
|
2111
2172
|
try {
|
|
2112
|
-
const t =
|
|
2113
|
-
|
|
2173
|
+
const t = i.getCurrentUniverDocInstance();
|
|
2174
|
+
if (!t)
|
|
2175
|
+
return;
|
|
2176
|
+
const n = t.getUnitId();
|
|
2177
|
+
e.isEditor(n) || i.focusUnit(t.getUnitId());
|
|
2114
2178
|
} catch (t) {
|
|
2115
2179
|
this._logService.warn(t);
|
|
2116
2180
|
}
|
|
@@ -2118,22 +2182,22 @@ let vt = (Ve = class extends Ht {
|
|
|
2118
2182
|
_initModules() {
|
|
2119
2183
|
this._injector.get(se);
|
|
2120
2184
|
}
|
|
2121
|
-
},
|
|
2122
|
-
|
|
2123
|
-
ze(1,
|
|
2124
|
-
ze(2,
|
|
2125
|
-
ze(3,
|
|
2126
|
-
],
|
|
2185
|
+
}, m(me, "pluginName", Gn), m(me, "type", S.UNIVER_DOC), me);
|
|
2186
|
+
Ot = kr([
|
|
2187
|
+
ze(1, O(Pe)),
|
|
2188
|
+
ze(2, O(Ze)),
|
|
2189
|
+
ze(3, It)
|
|
2190
|
+
], Ot);
|
|
2127
2191
|
export {
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2192
|
+
Gn as DOC_UI_PLUGIN_NAME,
|
|
2193
|
+
Yn as DefaultDocContainerConfig,
|
|
2194
|
+
Xn as DefaultDocUiConfig,
|
|
2195
|
+
Hn as DefaultToolbarConfig,
|
|
2196
|
+
Re as DocCanvasView,
|
|
2197
|
+
er as PastePluginLark,
|
|
2198
|
+
rr as PastePluginUniver,
|
|
2199
|
+
nr as PastePluginWord,
|
|
2200
|
+
Ot as UniverDocsUIPlugin,
|
|
2201
|
+
to as enUS,
|
|
2202
|
+
zi as zhCN
|
|
2139
2203
|
};
|