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