@univerjs/docs-ui 0.1.15 → 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 -1250
- 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 +13 -13
- 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,454 +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
|
-
|
|
229
|
-
|
|
230
|
-
for (n in e = i.defaultProps, e)
|
|
231
|
-
r[n] === void 0 && (r[n] = e[n]);
|
|
232
|
-
return { $$typeof: vi, type: i, key: o, ref: s, props: r, _owner: Ri.current };
|
|
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 };
|
|
233
230
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
var
|
|
239
|
-
const
|
|
240
|
-
docsUiCanvasBackground:
|
|
241
|
-
},
|
|
242
|
-
function Ei(
|
|
243
|
-
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);
|
|
244
241
|
return {
|
|
245
|
-
id:
|
|
246
|
-
group:
|
|
247
|
-
type:
|
|
242
|
+
id: En.id,
|
|
243
|
+
group: T.TOOLBAR_FORMAT,
|
|
244
|
+
type: R.BUTTON,
|
|
248
245
|
icon: "BoldSingle",
|
|
249
246
|
title: "Set bold",
|
|
250
247
|
tooltip: "toolbar.bold",
|
|
251
|
-
positions: [
|
|
252
|
-
activated$: new
|
|
253
|
-
const
|
|
248
|
+
positions: [I.TOOLBAR_START],
|
|
249
|
+
activated$: new E((n) => {
|
|
250
|
+
const i = e.onCommandExecuted((r) => {
|
|
254
251
|
var s;
|
|
255
252
|
const o = r.id;
|
|
256
|
-
if (o ===
|
|
257
|
-
const a =
|
|
253
|
+
if (o === M.id || o === G.id) {
|
|
254
|
+
const a = L(t);
|
|
258
255
|
if (a == null)
|
|
259
256
|
return;
|
|
260
257
|
const c = (s = a.ts) == null ? void 0 : s.bl;
|
|
261
|
-
|
|
258
|
+
n.next(c === C.TRUE);
|
|
262
259
|
}
|
|
263
260
|
});
|
|
264
|
-
return
|
|
261
|
+
return n.next(!1), i.dispose;
|
|
265
262
|
}),
|
|
266
|
-
hidden$:
|
|
263
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
267
264
|
};
|
|
268
265
|
}
|
|
269
|
-
function
|
|
270
|
-
const e =
|
|
266
|
+
function yi(t) {
|
|
267
|
+
const e = t.get(S);
|
|
271
268
|
return {
|
|
272
|
-
id:
|
|
273
|
-
group:
|
|
274
|
-
type:
|
|
269
|
+
id: yn.id,
|
|
270
|
+
group: T.TOOLBAR_FORMAT,
|
|
271
|
+
type: R.BUTTON,
|
|
275
272
|
icon: "ItalicSingle",
|
|
276
273
|
title: "Set italic",
|
|
277
274
|
tooltip: "toolbar.italic",
|
|
278
|
-
positions: [
|
|
279
|
-
activated$: new
|
|
280
|
-
const
|
|
275
|
+
positions: [I.TOOLBAR_START],
|
|
276
|
+
activated$: new E((n) => {
|
|
277
|
+
const i = e.onCommandExecuted((r) => {
|
|
281
278
|
var s;
|
|
282
279
|
const o = r.id;
|
|
283
|
-
if (o ===
|
|
284
|
-
const a =
|
|
280
|
+
if (o === M.id || o === G.id) {
|
|
281
|
+
const a = L(t);
|
|
285
282
|
if (a == null)
|
|
286
283
|
return;
|
|
287
284
|
const c = (s = a.ts) == null ? void 0 : s.it;
|
|
288
|
-
|
|
285
|
+
n.next(c === C.TRUE);
|
|
289
286
|
}
|
|
290
287
|
});
|
|
291
|
-
return
|
|
288
|
+
return n.next(!1), i.dispose;
|
|
292
289
|
}),
|
|
293
|
-
hidden$:
|
|
290
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
294
291
|
};
|
|
295
292
|
}
|
|
296
|
-
function
|
|
297
|
-
const e =
|
|
293
|
+
function Mi(t) {
|
|
294
|
+
const e = t.get(S);
|
|
298
295
|
return {
|
|
299
|
-
id:
|
|
300
|
-
group:
|
|
301
|
-
type:
|
|
296
|
+
id: Mn.id,
|
|
297
|
+
group: T.TOOLBAR_FORMAT,
|
|
298
|
+
type: R.BUTTON,
|
|
302
299
|
icon: "UnderlineSingle",
|
|
303
300
|
title: "Set underline",
|
|
304
301
|
tooltip: "toolbar.underline",
|
|
305
|
-
positions: [
|
|
306
|
-
activated$: new
|
|
307
|
-
const
|
|
302
|
+
positions: [I.TOOLBAR_START],
|
|
303
|
+
activated$: new E((n) => {
|
|
304
|
+
const i = e.onCommandExecuted((r) => {
|
|
308
305
|
var s;
|
|
309
306
|
const o = r.id;
|
|
310
|
-
if (o ===
|
|
311
|
-
const a =
|
|
307
|
+
if (o === M.id || o === G.id) {
|
|
308
|
+
const a = L(t);
|
|
312
309
|
if (a == null)
|
|
313
310
|
return;
|
|
314
311
|
const c = (s = a.ts) == null ? void 0 : s.ul;
|
|
315
|
-
|
|
312
|
+
n.next((c == null ? void 0 : c.s) === C.TRUE);
|
|
316
313
|
}
|
|
317
314
|
});
|
|
318
|
-
return
|
|
315
|
+
return n.next(!1), i.dispose;
|
|
319
316
|
}),
|
|
320
|
-
hidden$:
|
|
317
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
321
318
|
};
|
|
322
319
|
}
|
|
323
|
-
function
|
|
324
|
-
const e =
|
|
320
|
+
function xi(t) {
|
|
321
|
+
const e = t.get(S);
|
|
325
322
|
return {
|
|
326
|
-
id:
|
|
327
|
-
group:
|
|
328
|
-
type:
|
|
323
|
+
id: xn.id,
|
|
324
|
+
group: T.TOOLBAR_FORMAT,
|
|
325
|
+
type: R.BUTTON,
|
|
329
326
|
icon: "StrikethroughSingle",
|
|
330
327
|
title: "Set strike through",
|
|
331
328
|
tooltip: "toolbar.strikethrough",
|
|
332
|
-
positions: [
|
|
333
|
-
activated$: new
|
|
334
|
-
const
|
|
329
|
+
positions: [I.TOOLBAR_START],
|
|
330
|
+
activated$: new E((n) => {
|
|
331
|
+
const i = e.onCommandExecuted((r) => {
|
|
335
332
|
var s;
|
|
336
333
|
const o = r.id;
|
|
337
|
-
if (o ===
|
|
338
|
-
const a =
|
|
334
|
+
if (o === M.id || o === G.id) {
|
|
335
|
+
const a = L(t);
|
|
339
336
|
if (a == null)
|
|
340
337
|
return;
|
|
341
338
|
const c = (s = a.ts) == null ? void 0 : s.st;
|
|
342
|
-
|
|
339
|
+
n.next((c == null ? void 0 : c.s) === C.TRUE);
|
|
343
340
|
}
|
|
344
341
|
});
|
|
345
|
-
return
|
|
342
|
+
return n.next(!1), i.dispose;
|
|
346
343
|
}),
|
|
347
|
-
hidden$:
|
|
344
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
348
345
|
};
|
|
349
346
|
}
|
|
350
|
-
function
|
|
351
|
-
const e =
|
|
347
|
+
function Pi(t) {
|
|
348
|
+
const e = t.get(S);
|
|
352
349
|
return {
|
|
353
|
-
id:
|
|
354
|
-
group:
|
|
355
|
-
type:
|
|
350
|
+
id: Pn.id,
|
|
351
|
+
group: T.TOOLBAR_FORMAT,
|
|
352
|
+
type: R.BUTTON,
|
|
356
353
|
icon: "SubscriptSingle",
|
|
357
354
|
tooltip: "toolbar.subscript",
|
|
358
|
-
positions: [
|
|
359
|
-
activated$: new
|
|
360
|
-
const
|
|
355
|
+
positions: [I.TOOLBAR_START],
|
|
356
|
+
activated$: new E((n) => {
|
|
357
|
+
const i = e.onCommandExecuted((r) => {
|
|
361
358
|
var s;
|
|
362
359
|
const o = r.id;
|
|
363
|
-
if (o ===
|
|
364
|
-
const a =
|
|
360
|
+
if (o === M.id || o === G.id) {
|
|
361
|
+
const a = L(t);
|
|
365
362
|
if (a == null)
|
|
366
363
|
return;
|
|
367
364
|
const c = (s = a.ts) == null ? void 0 : s.va;
|
|
368
|
-
|
|
365
|
+
n.next(c === k.SUBSCRIPT);
|
|
369
366
|
}
|
|
370
367
|
});
|
|
371
|
-
return
|
|
368
|
+
return n.next(!1), i.dispose;
|
|
372
369
|
}),
|
|
373
|
-
hidden$:
|
|
370
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
374
371
|
};
|
|
375
372
|
}
|
|
376
|
-
function
|
|
377
|
-
const e =
|
|
373
|
+
function Di(t) {
|
|
374
|
+
const e = t.get(S);
|
|
378
375
|
return {
|
|
379
|
-
id:
|
|
380
|
-
group:
|
|
381
|
-
type:
|
|
376
|
+
id: Dn.id,
|
|
377
|
+
group: T.TOOLBAR_FORMAT,
|
|
378
|
+
type: R.BUTTON,
|
|
382
379
|
icon: "SuperscriptSingle",
|
|
383
380
|
tooltip: "toolbar.superscript",
|
|
384
|
-
positions: [
|
|
385
|
-
activated$: new
|
|
386
|
-
const
|
|
381
|
+
positions: [I.TOOLBAR_START],
|
|
382
|
+
activated$: new E((n) => {
|
|
383
|
+
const i = e.onCommandExecuted((r) => {
|
|
387
384
|
var s;
|
|
388
385
|
const o = r.id;
|
|
389
|
-
if (o ===
|
|
390
|
-
const a =
|
|
386
|
+
if (o === M.id || o === G.id) {
|
|
387
|
+
const a = L(t);
|
|
391
388
|
if (a == null)
|
|
392
389
|
return;
|
|
393
390
|
const c = (s = a.ts) == null ? void 0 : s.va;
|
|
394
|
-
|
|
391
|
+
n.next(c === k.SUPERSCRIPT);
|
|
395
392
|
}
|
|
396
393
|
});
|
|
397
|
-
return
|
|
394
|
+
return n.next(!1), i.dispose;
|
|
398
395
|
}),
|
|
399
|
-
hidden$:
|
|
396
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
400
397
|
};
|
|
401
398
|
}
|
|
402
|
-
function
|
|
403
|
-
const e =
|
|
399
|
+
function Ni(t) {
|
|
400
|
+
const e = t.get(S);
|
|
404
401
|
return {
|
|
405
|
-
id:
|
|
402
|
+
id: lt.id,
|
|
406
403
|
tooltip: "toolbar.font",
|
|
407
|
-
group:
|
|
408
|
-
type:
|
|
409
|
-
label:
|
|
410
|
-
positions: [
|
|
411
|
-
selections:
|
|
404
|
+
group: T.TOOLBAR_FORMAT,
|
|
405
|
+
type: R.SELECTOR,
|
|
406
|
+
label: Dt,
|
|
407
|
+
positions: [I.TOOLBAR_START],
|
|
408
|
+
selections: rt.map((n) => ({
|
|
412
409
|
label: {
|
|
413
|
-
name:
|
|
410
|
+
name: Nt,
|
|
414
411
|
hoverable: !0
|
|
415
412
|
},
|
|
416
|
-
value:
|
|
413
|
+
value: n.value
|
|
417
414
|
})),
|
|
418
415
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
419
|
-
value$: new
|
|
420
|
-
const
|
|
416
|
+
value$: new E((n) => {
|
|
417
|
+
const i = rt[0].value, r = e.onCommandExecuted((o) => {
|
|
421
418
|
var a;
|
|
422
419
|
const s = o.id;
|
|
423
|
-
if (s ===
|
|
424
|
-
const c =
|
|
420
|
+
if (s === M.id || s === lt.id) {
|
|
421
|
+
const c = L(t);
|
|
425
422
|
if (c == null)
|
|
426
423
|
return;
|
|
427
424
|
const l = (a = c.ts) == null ? void 0 : a.ff;
|
|
428
|
-
|
|
425
|
+
n.next(l != null ? l : i);
|
|
429
426
|
}
|
|
430
427
|
});
|
|
431
|
-
return
|
|
428
|
+
return n.next(i), r.dispose;
|
|
432
429
|
}),
|
|
433
|
-
hidden$:
|
|
430
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
434
431
|
};
|
|
435
432
|
}
|
|
436
|
-
function
|
|
437
|
-
const e =
|
|
433
|
+
function Ui(t) {
|
|
434
|
+
const e = t.get(S);
|
|
438
435
|
return {
|
|
439
|
-
id:
|
|
440
|
-
group:
|
|
441
|
-
type:
|
|
436
|
+
id: dt.id,
|
|
437
|
+
group: T.TOOLBAR_FORMAT,
|
|
438
|
+
type: R.SELECTOR,
|
|
442
439
|
tooltip: "toolbar.fontSize",
|
|
443
440
|
label: {
|
|
444
|
-
name:
|
|
441
|
+
name: Ut,
|
|
445
442
|
props: {
|
|
446
443
|
min: 1,
|
|
447
444
|
max: 400
|
|
448
445
|
// disabled$,
|
|
449
446
|
}
|
|
450
447
|
},
|
|
451
|
-
positions: [
|
|
452
|
-
selections:
|
|
448
|
+
positions: [I.TOOLBAR_START],
|
|
449
|
+
selections: tn,
|
|
453
450
|
// disabled$,
|
|
454
|
-
value$: new
|
|
451
|
+
value$: new E((n) => {
|
|
455
452
|
const r = e.onCommandExecuted((o) => {
|
|
456
453
|
var a;
|
|
457
454
|
const s = o.id;
|
|
458
|
-
if (s ===
|
|
459
|
-
const c =
|
|
455
|
+
if (s === M.id || s === dt.id) {
|
|
456
|
+
const c = L(t);
|
|
460
457
|
if (c == null)
|
|
461
458
|
return;
|
|
462
459
|
const l = (a = c.ts) == null ? void 0 : a.fs;
|
|
463
|
-
|
|
460
|
+
n.next(l != null ? l : 14);
|
|
464
461
|
}
|
|
465
462
|
});
|
|
466
|
-
return
|
|
463
|
+
return n.next(14), r.dispose;
|
|
467
464
|
}),
|
|
468
|
-
hidden$:
|
|
465
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
469
466
|
};
|
|
470
467
|
}
|
|
471
|
-
function
|
|
472
|
-
const e =
|
|
468
|
+
function Ai(t) {
|
|
469
|
+
const e = t.get(S), n = t.get(Et);
|
|
473
470
|
return {
|
|
474
|
-
id:
|
|
471
|
+
id: ut.id,
|
|
475
472
|
icon: "FontColor",
|
|
476
473
|
tooltip: "toolbar.textColor.main",
|
|
477
|
-
group:
|
|
478
|
-
type:
|
|
479
|
-
positions: [
|
|
474
|
+
group: T.TOOLBAR_FORMAT,
|
|
475
|
+
type: R.BUTTON_SELECTOR,
|
|
476
|
+
positions: [I.TOOLBAR_START],
|
|
480
477
|
selections: [
|
|
481
478
|
{
|
|
482
479
|
label: {
|
|
483
|
-
name:
|
|
480
|
+
name: Qe,
|
|
484
481
|
hoverable: !1
|
|
485
482
|
}
|
|
486
483
|
}
|
|
487
484
|
],
|
|
488
|
-
value$: new
|
|
489
|
-
const r =
|
|
490
|
-
if (s.id ===
|
|
485
|
+
value$: new E((i) => {
|
|
486
|
+
const r = n.getCurrentTheme().textColor, o = e.onCommandExecuted((s) => {
|
|
487
|
+
if (s.id === ut.id) {
|
|
491
488
|
const a = s.params.value;
|
|
492
|
-
|
|
489
|
+
i.next(a != null ? a : r);
|
|
493
490
|
}
|
|
494
491
|
});
|
|
495
|
-
return
|
|
492
|
+
return i.next(r), o.dispose;
|
|
496
493
|
}),
|
|
497
|
-
hidden$:
|
|
494
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
498
495
|
// disabled$: getCurrentSheetDisabled$(accessor),
|
|
499
496
|
};
|
|
500
497
|
}
|
|
501
|
-
function
|
|
502
|
-
const e =
|
|
498
|
+
function Li(t) {
|
|
499
|
+
const e = t.get(S);
|
|
503
500
|
return {
|
|
504
|
-
id:
|
|
505
|
-
group:
|
|
506
|
-
type:
|
|
501
|
+
id: Nn.id,
|
|
502
|
+
group: T.TOOLBAR_LAYOUT,
|
|
503
|
+
type: R.BUTTON,
|
|
507
504
|
icon: "LeftJustifyingSingle",
|
|
508
505
|
tooltip: "toolbar.alignLeft",
|
|
509
|
-
positions: [
|
|
510
|
-
activated$: new
|
|
511
|
-
const
|
|
506
|
+
positions: [I.TOOLBAR_START],
|
|
507
|
+
activated$: new E((n) => {
|
|
508
|
+
const i = e.onCommandExecuted((r) => {
|
|
512
509
|
var s;
|
|
513
510
|
const o = r.id;
|
|
514
|
-
if (o ===
|
|
515
|
-
const a =
|
|
511
|
+
if (o === M.id || o === Ee.id) {
|
|
512
|
+
const a = Pe(t);
|
|
516
513
|
if (a == null)
|
|
517
514
|
return;
|
|
518
515
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
519
|
-
|
|
516
|
+
n.next(c === ve.LEFT);
|
|
520
517
|
}
|
|
521
518
|
});
|
|
522
|
-
return
|
|
519
|
+
return n.next(!1), i.dispose;
|
|
523
520
|
}),
|
|
524
|
-
hidden$:
|
|
521
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
525
522
|
};
|
|
526
523
|
}
|
|
527
|
-
function
|
|
528
|
-
const e =
|
|
524
|
+
function $i(t) {
|
|
525
|
+
const e = t.get(S);
|
|
529
526
|
return {
|
|
530
|
-
id:
|
|
531
|
-
group:
|
|
532
|
-
type:
|
|
527
|
+
id: Un.id,
|
|
528
|
+
group: T.TOOLBAR_LAYOUT,
|
|
529
|
+
type: R.BUTTON,
|
|
533
530
|
icon: "HorizontallySingle",
|
|
534
531
|
tooltip: "toolbar.alignCenter",
|
|
535
|
-
positions: [
|
|
536
|
-
activated$: new
|
|
537
|
-
const
|
|
532
|
+
positions: [I.TOOLBAR_START],
|
|
533
|
+
activated$: new E((n) => {
|
|
534
|
+
const i = e.onCommandExecuted((r) => {
|
|
538
535
|
var s;
|
|
539
536
|
const o = r.id;
|
|
540
|
-
if (o ===
|
|
541
|
-
const a =
|
|
537
|
+
if (o === M.id || o === Ee.id) {
|
|
538
|
+
const a = Pe(t);
|
|
542
539
|
if (a == null)
|
|
543
540
|
return;
|
|
544
541
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
545
|
-
|
|
542
|
+
n.next(c === ve.CENTER);
|
|
546
543
|
}
|
|
547
544
|
});
|
|
548
|
-
return
|
|
545
|
+
return n.next(!1), i.dispose;
|
|
549
546
|
}),
|
|
550
|
-
hidden$:
|
|
547
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
551
548
|
};
|
|
552
549
|
}
|
|
553
|
-
function
|
|
554
|
-
const e =
|
|
550
|
+
function wi(t) {
|
|
551
|
+
const e = t.get(S);
|
|
555
552
|
return {
|
|
556
|
-
id:
|
|
557
|
-
group:
|
|
558
|
-
type:
|
|
553
|
+
id: An.id,
|
|
554
|
+
group: T.TOOLBAR_LAYOUT,
|
|
555
|
+
type: R.BUTTON,
|
|
559
556
|
icon: "RightJustifyingSingle",
|
|
560
557
|
tooltip: "toolbar.alignRight",
|
|
561
|
-
positions: [
|
|
562
|
-
activated$: new
|
|
563
|
-
const
|
|
558
|
+
positions: [I.TOOLBAR_START],
|
|
559
|
+
activated$: new E((n) => {
|
|
560
|
+
const i = e.onCommandExecuted((r) => {
|
|
564
561
|
var s;
|
|
565
562
|
const o = r.id;
|
|
566
|
-
if (o ===
|
|
567
|
-
const a =
|
|
563
|
+
if (o === M.id || o === Ee.id) {
|
|
564
|
+
const a = Pe(t);
|
|
568
565
|
if (a == null)
|
|
569
566
|
return;
|
|
570
567
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
571
|
-
|
|
568
|
+
n.next(c === ve.RIGHT);
|
|
572
569
|
}
|
|
573
570
|
});
|
|
574
|
-
return
|
|
571
|
+
return n.next(!1), i.dispose;
|
|
575
572
|
}),
|
|
576
|
-
hidden$:
|
|
573
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
577
574
|
};
|
|
578
575
|
}
|
|
579
|
-
function
|
|
580
|
-
const e =
|
|
576
|
+
function Bi(t) {
|
|
577
|
+
const e = t.get(S);
|
|
581
578
|
return {
|
|
582
|
-
id:
|
|
583
|
-
group:
|
|
584
|
-
type:
|
|
579
|
+
id: Ln.id,
|
|
580
|
+
group: T.TOOLBAR_LAYOUT,
|
|
581
|
+
type: R.BUTTON,
|
|
585
582
|
icon: "AlignTextBothSingle",
|
|
586
583
|
tooltip: "toolbar.alignJustify",
|
|
587
|
-
positions: [
|
|
588
|
-
activated$: new
|
|
589
|
-
const
|
|
584
|
+
positions: [I.TOOLBAR_START],
|
|
585
|
+
activated$: new E((n) => {
|
|
586
|
+
const i = e.onCommandExecuted((r) => {
|
|
590
587
|
var s;
|
|
591
588
|
const o = r.id;
|
|
592
|
-
if (o ===
|
|
593
|
-
const a =
|
|
589
|
+
if (o === M.id || o === Ee.id) {
|
|
590
|
+
const a = Pe(t);
|
|
594
591
|
if (a == null)
|
|
595
592
|
return;
|
|
596
593
|
const c = (s = a.paragraphStyle) == null ? void 0 : s.horizontalAlign;
|
|
597
|
-
|
|
594
|
+
n.next(c === ve.JUSTIFIED);
|
|
598
595
|
}
|
|
599
596
|
});
|
|
600
|
-
return
|
|
597
|
+
return n.next(!1), i.dispose;
|
|
601
598
|
}),
|
|
602
|
-
hidden$:
|
|
599
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
603
600
|
};
|
|
604
601
|
}
|
|
605
|
-
function
|
|
602
|
+
function Fi(t) {
|
|
606
603
|
return {
|
|
607
|
-
id:
|
|
608
|
-
group:
|
|
609
|
-
type:
|
|
604
|
+
id: $n.id,
|
|
605
|
+
group: T.TOOLBAR_LAYOUT,
|
|
606
|
+
type: R.BUTTON,
|
|
610
607
|
icon: "OrderSingle",
|
|
611
608
|
tooltip: "toolbar.order",
|
|
612
|
-
positions: [
|
|
613
|
-
hidden$:
|
|
609
|
+
positions: [I.TOOLBAR_START],
|
|
610
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
614
611
|
};
|
|
615
612
|
}
|
|
616
|
-
function
|
|
613
|
+
function Vi(t) {
|
|
617
614
|
return {
|
|
618
|
-
id:
|
|
619
|
-
group:
|
|
620
|
-
type:
|
|
615
|
+
id: wn.id,
|
|
616
|
+
group: T.TOOLBAR_LAYOUT,
|
|
617
|
+
type: R.BUTTON,
|
|
621
618
|
icon: "UnorderSingle",
|
|
622
619
|
tooltip: "toolbar.unorder",
|
|
623
|
-
positions: [
|
|
624
|
-
hidden$:
|
|
620
|
+
positions: [I.TOOLBAR_START],
|
|
621
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
625
622
|
};
|
|
626
623
|
}
|
|
627
|
-
function
|
|
624
|
+
function ji(t) {
|
|
628
625
|
return {
|
|
629
|
-
id:
|
|
630
|
-
type:
|
|
626
|
+
id: Bn.id,
|
|
627
|
+
type: R.BUTTON,
|
|
631
628
|
title: "toolbar.resetColor",
|
|
632
629
|
icon: "NoColor",
|
|
633
|
-
positions:
|
|
630
|
+
positions: Fe.id
|
|
634
631
|
};
|
|
635
632
|
}
|
|
636
|
-
function
|
|
637
|
-
const e =
|
|
633
|
+
function Wi(t) {
|
|
634
|
+
const e = t.get(S), n = t.get(Et);
|
|
638
635
|
return {
|
|
639
|
-
id:
|
|
636
|
+
id: Fe.id,
|
|
640
637
|
tooltip: "toolbar.fillColor.main",
|
|
641
|
-
group:
|
|
642
|
-
type:
|
|
643
|
-
positions: [
|
|
638
|
+
group: T.TOOLBAR_FORMAT,
|
|
639
|
+
type: R.BUTTON_SELECTOR,
|
|
640
|
+
positions: [I.TOOLBAR_START],
|
|
644
641
|
icon: "PaintBucket",
|
|
645
642
|
selections: [
|
|
646
643
|
{
|
|
647
644
|
label: {
|
|
648
|
-
name:
|
|
645
|
+
name: Qe,
|
|
649
646
|
hoverable: !1
|
|
650
647
|
}
|
|
651
648
|
}
|
|
652
649
|
],
|
|
653
|
-
value$: new
|
|
654
|
-
const r =
|
|
655
|
-
if (s.id ===
|
|
650
|
+
value$: new E((i) => {
|
|
651
|
+
const r = n.getCurrentTheme().primaryColor, o = e.onCommandExecuted((s) => {
|
|
652
|
+
if (s.id === Fe.id) {
|
|
656
653
|
const a = s.params.value;
|
|
657
|
-
|
|
654
|
+
i.next(a != null ? a : r);
|
|
658
655
|
}
|
|
659
656
|
});
|
|
660
|
-
return
|
|
657
|
+
return i.next(r), o.dispose;
|
|
661
658
|
}),
|
|
662
|
-
hidden$:
|
|
659
|
+
hidden$: b(t, g.UNIVER_DOC)
|
|
663
660
|
};
|
|
664
661
|
}
|
|
665
|
-
function
|
|
662
|
+
function L(t) {
|
|
666
663
|
var c;
|
|
667
|
-
const e =
|
|
668
|
-
if (
|
|
664
|
+
const e = t.get(P), n = t.get(X), i = e.getCurrentUniverDocInstance(), r = n.getActiveRange();
|
|
665
|
+
if (i == null || r == null)
|
|
669
666
|
return;
|
|
670
|
-
const o = (c =
|
|
667
|
+
const o = (c = i.getBody()) == null ? void 0 : c.textRuns;
|
|
671
668
|
if (o == null)
|
|
672
669
|
return;
|
|
673
670
|
const { startOffset: s } = r;
|
|
@@ -685,12 +682,12 @@ function V(i) {
|
|
|
685
682
|
}
|
|
686
683
|
return a;
|
|
687
684
|
}
|
|
688
|
-
function
|
|
685
|
+
function Pe(t) {
|
|
689
686
|
var c;
|
|
690
|
-
const e =
|
|
691
|
-
if (
|
|
687
|
+
const e = t.get(P), n = t.get(X), i = e.getCurrentUniverDocInstance(), r = n.getActiveRange();
|
|
688
|
+
if (i == null || r == null)
|
|
692
689
|
return;
|
|
693
|
-
const o = (c =
|
|
690
|
+
const o = (c = i.getBody()) == null ? void 0 : c.paragraphs;
|
|
694
691
|
if (o == null)
|
|
695
692
|
return;
|
|
696
693
|
const { startOffset: s } = r;
|
|
@@ -703,98 +700,98 @@ function we(i) {
|
|
|
703
700
|
}
|
|
704
701
|
return null;
|
|
705
702
|
}
|
|
706
|
-
var
|
|
707
|
-
for (var r =
|
|
708
|
-
(s =
|
|
709
|
-
return
|
|
710
|
-
},
|
|
711
|
-
let
|
|
712
|
-
constructor(
|
|
713
|
-
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();
|
|
714
711
|
}
|
|
715
712
|
_initCustomComponents() {
|
|
716
|
-
const
|
|
717
|
-
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));
|
|
718
715
|
}
|
|
719
716
|
_initMenus() {
|
|
720
|
-
const { menu:
|
|
717
|
+
const { menu: t = {} } = this._config;
|
|
721
718
|
[
|
|
722
719
|
Ei,
|
|
720
|
+
yi,
|
|
721
|
+
Mi,
|
|
723
722
|
xi,
|
|
724
|
-
Di,
|
|
725
723
|
Pi,
|
|
726
|
-
|
|
724
|
+
Di,
|
|
727
725
|
Ui,
|
|
728
|
-
|
|
726
|
+
Ni,
|
|
729
727
|
Ai,
|
|
728
|
+
Li,
|
|
730
729
|
$i,
|
|
731
|
-
Bi,
|
|
732
730
|
wi,
|
|
731
|
+
Bi,
|
|
733
732
|
Fi,
|
|
734
733
|
Vi,
|
|
735
734
|
ji,
|
|
736
|
-
Wi
|
|
737
|
-
zi,
|
|
738
|
-
ki
|
|
735
|
+
Wi
|
|
739
736
|
].forEach((e) => {
|
|
740
|
-
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e),
|
|
737
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(e), t));
|
|
741
738
|
});
|
|
742
739
|
}
|
|
743
740
|
_init() {
|
|
744
741
|
this._initCustomComponents(), this._initMenus(), this._initDocBackground(), this._initFocusHandler();
|
|
745
742
|
}
|
|
746
743
|
_initDocBackground() {
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
744
|
+
const t = this._univerInstanceService.getAllUnitsForType(g.UNIVER_DOC)[0].getUnitId();
|
|
745
|
+
if (t == null)
|
|
749
746
|
return;
|
|
750
|
-
this._editorService.isEditor(
|
|
751
|
-
this._uiPartsService.registerComponent(
|
|
747
|
+
this._editorService.isEditor(t) || this.disposeWithMe(
|
|
748
|
+
this._uiPartsService.registerComponent(sn.CONTENT, () => Yn(bi, this._injector))
|
|
752
749
|
);
|
|
753
750
|
}
|
|
754
751
|
_initFocusHandler() {
|
|
755
752
|
this.disposeWithMe(
|
|
756
|
-
this._layoutService.registerFocusHandler(
|
|
757
|
-
this._injector.get(
|
|
753
|
+
this._layoutService.registerFocusHandler(g.UNIVER_DOC, () => {
|
|
754
|
+
this._injector.get(se).focus();
|
|
758
755
|
})
|
|
759
756
|
);
|
|
760
757
|
}
|
|
761
758
|
};
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
],
|
|
772
|
-
const
|
|
773
|
-
id:
|
|
774
|
-
preconditions:
|
|
775
|
-
binding:
|
|
776
|
-
},
|
|
777
|
-
id:
|
|
778
|
-
preconditions:
|
|
779
|
-
binding:
|
|
780
|
-
},
|
|
781
|
-
id:
|
|
782
|
-
preconditions:
|
|
783
|
-
binding:
|
|
784
|
-
},
|
|
785
|
-
function
|
|
786
|
-
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);
|
|
787
784
|
}
|
|
788
|
-
function
|
|
789
|
-
const e =
|
|
785
|
+
function Ji(t) {
|
|
786
|
+
const e = t.match(/data-copy-id="([^\s]+)"/);
|
|
790
787
|
return e && e[1] ? e[1] : null;
|
|
791
788
|
}
|
|
792
|
-
class
|
|
789
|
+
class Qi {
|
|
793
790
|
constructor() {
|
|
794
|
-
|
|
791
|
+
v(this, "_cache", new jt(Ki));
|
|
795
792
|
}
|
|
796
|
-
set(e,
|
|
797
|
-
this._cache.set(e,
|
|
793
|
+
set(e, n) {
|
|
794
|
+
this._cache.set(e, n);
|
|
798
795
|
}
|
|
799
796
|
get(e) {
|
|
800
797
|
return this._cache.get(e);
|
|
@@ -803,35 +800,35 @@ class tr {
|
|
|
803
800
|
this._cache.clear();
|
|
804
801
|
}
|
|
805
802
|
}
|
|
806
|
-
const
|
|
807
|
-
function
|
|
808
|
-
const e =
|
|
809
|
-
switch (
|
|
803
|
+
const gt = new Qi();
|
|
804
|
+
function et(t) {
|
|
805
|
+
const e = t.style, n = {}, i = t.tagName.toLowerCase();
|
|
806
|
+
switch (i) {
|
|
810
807
|
case "b":
|
|
811
808
|
case "em":
|
|
812
809
|
case "strong": {
|
|
813
|
-
|
|
810
|
+
n.bl = C.TRUE;
|
|
814
811
|
break;
|
|
815
812
|
}
|
|
816
813
|
case "s": {
|
|
817
|
-
|
|
814
|
+
n.st = {
|
|
818
815
|
s: C.TRUE
|
|
819
816
|
};
|
|
820
817
|
break;
|
|
821
818
|
}
|
|
822
819
|
case "u": {
|
|
823
|
-
|
|
820
|
+
n.ul = {
|
|
824
821
|
s: C.TRUE
|
|
825
822
|
};
|
|
826
823
|
break;
|
|
827
824
|
}
|
|
828
825
|
case "i": {
|
|
829
|
-
|
|
826
|
+
n.it = C.TRUE;
|
|
830
827
|
break;
|
|
831
828
|
}
|
|
832
829
|
case "sub":
|
|
833
830
|
case "sup": {
|
|
834
|
-
|
|
831
|
+
n.va = i === "sup" ? k.SUPERSCRIPT : k.SUBSCRIPT;
|
|
835
832
|
break;
|
|
836
833
|
}
|
|
837
834
|
}
|
|
@@ -839,63 +836,63 @@ function it(i) {
|
|
|
839
836
|
const o = e[r], s = e.getPropertyValue(o);
|
|
840
837
|
switch (o) {
|
|
841
838
|
case "font-family": {
|
|
842
|
-
|
|
839
|
+
n.ff = s;
|
|
843
840
|
break;
|
|
844
841
|
}
|
|
845
842
|
case "font-size": {
|
|
846
843
|
const a = Number.parseInt(s);
|
|
847
|
-
Number.isNaN(a) || (s.endsWith("pt") ?
|
|
844
|
+
Number.isNaN(a) || (s.endsWith("pt") ? n.fs = a : s.endsWith("px") && (n.fs = Sn(a)));
|
|
848
845
|
break;
|
|
849
846
|
}
|
|
850
847
|
case "font-style": {
|
|
851
|
-
s === "italic" && (
|
|
848
|
+
s === "italic" && (n.it = C.TRUE);
|
|
852
849
|
break;
|
|
853
850
|
}
|
|
854
851
|
case "font-weight": {
|
|
855
|
-
Number(s) > 400 && (
|
|
852
|
+
(Number(s) > 400 || String(s) === "bold") && (n.bl = C.TRUE);
|
|
856
853
|
break;
|
|
857
854
|
}
|
|
858
855
|
case "text-decoration": {
|
|
859
|
-
/underline/.test(s) ?
|
|
856
|
+
/underline/.test(s) ? n.ul = {
|
|
860
857
|
s: C.TRUE
|
|
861
|
-
} : /overline/.test(s) ?
|
|
858
|
+
} : /overline/.test(s) ? n.ol = {
|
|
862
859
|
s: C.TRUE
|
|
863
|
-
} : /line-through/.test(s) && (
|
|
860
|
+
} : /line-through/.test(s) && (n.st = {
|
|
864
861
|
s: C.TRUE
|
|
865
862
|
});
|
|
866
863
|
break;
|
|
867
864
|
}
|
|
868
865
|
case "color": {
|
|
869
|
-
const a = new
|
|
870
|
-
a.isValid && (
|
|
866
|
+
const a = new it(s);
|
|
867
|
+
a.isValid && (n.cl = {
|
|
871
868
|
rgb: a.toRgbString()
|
|
872
869
|
});
|
|
873
870
|
break;
|
|
874
871
|
}
|
|
875
872
|
case "background-color": {
|
|
876
|
-
const a = new
|
|
877
|
-
a.isValid && (
|
|
873
|
+
const a = new it(s);
|
|
874
|
+
a.isValid && (n.bg = {
|
|
878
875
|
rgb: a.toRgbString()
|
|
879
876
|
});
|
|
880
877
|
break;
|
|
881
878
|
}
|
|
882
879
|
}
|
|
883
880
|
}
|
|
884
|
-
return
|
|
881
|
+
return n;
|
|
885
882
|
}
|
|
886
|
-
function
|
|
887
|
-
const e = new DOMParser(),
|
|
888
|
-
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");
|
|
889
886
|
}
|
|
890
|
-
function
|
|
891
|
-
const
|
|
892
|
-
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);
|
|
893
890
|
}
|
|
894
|
-
const
|
|
891
|
+
const me = class me {
|
|
895
892
|
constructor() {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
893
|
+
v(this, "_styleCache", /* @__PURE__ */ new Map());
|
|
894
|
+
v(this, "_styleRules", []);
|
|
895
|
+
v(this, "_afterProcessRules", []);
|
|
899
896
|
}
|
|
900
897
|
static use(e) {
|
|
901
898
|
if (this._pluginList.includes(e))
|
|
@@ -903,48 +900,54 @@ const Ee = class Ee {
|
|
|
903
900
|
this._pluginList.push(e);
|
|
904
901
|
}
|
|
905
902
|
convert(e) {
|
|
906
|
-
const
|
|
903
|
+
const n = me._pluginList.find((o) => o.checkPasteType(e)), i = er(e), r = {
|
|
907
904
|
dataStream: "",
|
|
908
905
|
textRuns: []
|
|
909
906
|
};
|
|
910
|
-
return
|
|
911
|
-
}
|
|
912
|
-
_process(e,
|
|
913
|
-
var r;
|
|
914
|
-
for (const
|
|
915
|
-
if (
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
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
|
|
922
921
|
});
|
|
923
|
-
} else
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
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
|
+
}
|
|
932
935
|
}
|
|
933
936
|
}
|
|
934
937
|
};
|
|
935
|
-
|
|
936
|
-
let
|
|
937
|
-
const
|
|
938
|
+
v(me, "_pluginList", []);
|
|
939
|
+
let Y = me;
|
|
940
|
+
const tr = {
|
|
938
941
|
name: "univer-doc-paste-plugin-lark",
|
|
939
|
-
checkPasteType(
|
|
940
|
-
return /lark-record-clipboard/i.test(
|
|
942
|
+
checkPasteType(t) {
|
|
943
|
+
return /lark-record-clipboard/i.test(t);
|
|
941
944
|
},
|
|
942
945
|
// TODO: @JOCS, support inline code copy from lark.
|
|
943
946
|
stylesRules: [
|
|
944
947
|
{
|
|
945
948
|
filter: ["s"],
|
|
946
|
-
getStyle(
|
|
947
|
-
const e =
|
|
949
|
+
getStyle(t) {
|
|
950
|
+
const e = et(t);
|
|
948
951
|
return {
|
|
949
952
|
st: {
|
|
950
953
|
s: C.TRUE
|
|
@@ -956,163 +959,163 @@ const ir = {
|
|
|
956
959
|
],
|
|
957
960
|
afterProcessRules: [
|
|
958
961
|
{
|
|
959
|
-
filter(
|
|
960
|
-
return
|
|
962
|
+
filter(t) {
|
|
963
|
+
return t.tagName === "DIV" && /ace-line/i.test(t.className);
|
|
961
964
|
},
|
|
962
|
-
handler(
|
|
963
|
-
|
|
964
|
-
startIndex:
|
|
965
|
-
}),
|
|
965
|
+
handler(t) {
|
|
966
|
+
t.paragraphs == null && (t.paragraphs = []), t.paragraphs.push({
|
|
967
|
+
startIndex: t.dataStream.length
|
|
968
|
+
}), t.dataStream += "\r";
|
|
966
969
|
}
|
|
967
970
|
}
|
|
968
971
|
]
|
|
969
|
-
},
|
|
970
|
-
function
|
|
971
|
-
const e =
|
|
972
|
-
for (let
|
|
973
|
-
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);
|
|
974
977
|
switch (r) {
|
|
975
978
|
case "margin-top": {
|
|
976
979
|
const s = Number.parseInt(o);
|
|
977
|
-
|
|
980
|
+
n.spaceAbove = /pt/.test(o) ? ot(s) : s;
|
|
978
981
|
break;
|
|
979
982
|
}
|
|
980
983
|
case "margin-bottom": {
|
|
981
984
|
const s = Number.parseInt(o);
|
|
982
|
-
|
|
985
|
+
n.spaceBelow = /pt/.test(o) ? ot(s) : s;
|
|
983
986
|
break;
|
|
984
987
|
}
|
|
985
988
|
case "line-height": {
|
|
986
989
|
const s = Number.parseFloat(o);
|
|
987
|
-
|
|
990
|
+
n.lineSpacing = s;
|
|
988
991
|
break;
|
|
989
992
|
}
|
|
990
993
|
}
|
|
991
994
|
}
|
|
992
|
-
return Object.getOwnPropertyNames(
|
|
995
|
+
return Object.getOwnPropertyNames(n).length ? n : null;
|
|
993
996
|
}
|
|
994
|
-
const
|
|
997
|
+
const ir = {
|
|
995
998
|
name: "univer-doc-paste-plugin-word",
|
|
996
|
-
checkPasteType(
|
|
997
|
-
return /word|mso/i.test(
|
|
999
|
+
checkPasteType(t) {
|
|
1000
|
+
return /word|mso/i.test(t);
|
|
998
1001
|
},
|
|
999
1002
|
stylesRules: [
|
|
1000
1003
|
{
|
|
1001
1004
|
filter: ["b"],
|
|
1002
|
-
getStyle(
|
|
1003
|
-
const e =
|
|
1005
|
+
getStyle(t) {
|
|
1006
|
+
const e = et(t);
|
|
1004
1007
|
return { bl: C.TRUE, ...e };
|
|
1005
1008
|
}
|
|
1006
1009
|
}
|
|
1007
1010
|
],
|
|
1008
1011
|
afterProcessRules: [
|
|
1009
1012
|
{
|
|
1010
|
-
filter(
|
|
1011
|
-
return
|
|
1013
|
+
filter(t) {
|
|
1014
|
+
return t.tagName === "P";
|
|
1012
1015
|
},
|
|
1013
|
-
handler(
|
|
1014
|
-
|
|
1015
|
-
const
|
|
1016
|
-
startIndex:
|
|
1017
|
-
},
|
|
1018
|
-
|
|
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";
|
|
1019
1022
|
}
|
|
1020
1023
|
}
|
|
1021
1024
|
]
|
|
1022
|
-
},
|
|
1025
|
+
}, rr = ir, or = {
|
|
1023
1026
|
name: "univer-doc-paste-plugin-univer",
|
|
1024
|
-
checkPasteType(
|
|
1025
|
-
return /UniverNormal/i.test(
|
|
1027
|
+
checkPasteType(t) {
|
|
1028
|
+
return /UniverNormal/i.test(t);
|
|
1026
1029
|
},
|
|
1027
1030
|
stylesRules: [],
|
|
1028
1031
|
afterProcessRules: [
|
|
1029
1032
|
{
|
|
1030
|
-
filter(
|
|
1031
|
-
return
|
|
1033
|
+
filter(t) {
|
|
1034
|
+
return t.tagName === "P" && /UniverNormal/i.test(t.className);
|
|
1032
1035
|
},
|
|
1033
|
-
handler(
|
|
1034
|
-
|
|
1035
|
-
const
|
|
1036
|
-
startIndex:
|
|
1037
|
-
},
|
|
1038
|
-
|
|
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";
|
|
1039
1042
|
}
|
|
1040
1043
|
}
|
|
1041
1044
|
]
|
|
1042
|
-
},
|
|
1043
|
-
function
|
|
1044
|
-
const { st:
|
|
1045
|
-
let d =
|
|
1046
|
-
const
|
|
1047
|
-
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;
|
|
1048
1051
|
}
|
|
1049
|
-
function
|
|
1050
|
-
const { dataStream:
|
|
1052
|
+
function Ae(t, e, n) {
|
|
1053
|
+
const { dataStream: i, textRuns: r = [] } = t;
|
|
1051
1054
|
let o = e;
|
|
1052
1055
|
const s = [];
|
|
1053
1056
|
for (const a of r) {
|
|
1054
1057
|
const { st: c, ed: l } = a;
|
|
1055
|
-
|
|
1058
|
+
Ke.hasIntersectionBetweenTwoRanges(e, n, c, l) && (c > o ? (s.push(i.slice(o, c)), s.push(mt(i, {
|
|
1056
1059
|
...a,
|
|
1057
|
-
ed: Math.min(l,
|
|
1058
|
-
}))) : s.push(
|
|
1060
|
+
ed: Math.min(l, n)
|
|
1061
|
+
}))) : s.push(mt(i, {
|
|
1059
1062
|
...a,
|
|
1060
1063
|
st: o,
|
|
1061
|
-
ed: Math.min(l,
|
|
1062
|
-
}))), o = Math.max(e, Math.min(l,
|
|
1064
|
+
ed: Math.min(l, n)
|
|
1065
|
+
}))), o = Math.max(e, Math.min(l, n));
|
|
1063
1066
|
}
|
|
1064
|
-
return o !==
|
|
1067
|
+
return o !== n && s.push(i.slice(o, n)), s.join("");
|
|
1065
1068
|
}
|
|
1066
|
-
function
|
|
1067
|
-
var
|
|
1068
|
-
if (e && ((
|
|
1069
|
-
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;
|
|
1070
1073
|
let o = "", s = -1;
|
|
1071
1074
|
for (const a of r) {
|
|
1072
|
-
const { startIndex: c, paragraphStyle: l = {} } = a, { spaceAbove: u, spaceBelow: h, lineSpacing:
|
|
1073
|
-
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;
|
|
1074
1077
|
}
|
|
1075
|
-
return s !==
|
|
1078
|
+
return s !== i.length && (o += Ae(t, s, i.length)), o;
|
|
1076
1079
|
} else
|
|
1077
|
-
return
|
|
1080
|
+
return Ae(t, 0, t.dataStream.length);
|
|
1078
1081
|
}
|
|
1079
|
-
class
|
|
1082
|
+
class ar {
|
|
1080
1083
|
convert(e) {
|
|
1081
1084
|
if (e.length === 0)
|
|
1082
1085
|
throw new Error("The bodyList length at least to be 1");
|
|
1083
1086
|
if (e.length === 1)
|
|
1084
|
-
return
|
|
1085
|
-
let
|
|
1086
|
-
for (const
|
|
1087
|
-
|
|
1088
|
-
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;
|
|
1089
1092
|
}
|
|
1090
1093
|
}
|
|
1091
|
-
var
|
|
1092
|
-
for (var r =
|
|
1093
|
-
(s =
|
|
1094
|
-
return
|
|
1095
|
-
},
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
function
|
|
1100
|
-
const e =
|
|
1101
|
-
for (let
|
|
1102
|
-
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 });
|
|
1103
1106
|
return {
|
|
1104
1107
|
dataStream: e,
|
|
1105
|
-
paragraphs:
|
|
1108
|
+
paragraphs: n
|
|
1106
1109
|
};
|
|
1107
1110
|
}
|
|
1108
|
-
const
|
|
1109
|
-
let
|
|
1110
|
-
constructor(e,
|
|
1111
|
+
const ae = en("doc.clipboard-service");
|
|
1112
|
+
let je = class extends F {
|
|
1113
|
+
constructor(e, n, i, r, o) {
|
|
1111
1114
|
super();
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
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;
|
|
1116
1119
|
}
|
|
1117
1120
|
async copy() {
|
|
1118
1121
|
const e = this._getDocumentBodyInRanges();
|
|
@@ -1120,8 +1123,8 @@ let Xe = class extends k {
|
|
|
1120
1123
|
return !1;
|
|
1121
1124
|
try {
|
|
1122
1125
|
this._setClipboardData(e);
|
|
1123
|
-
} catch (
|
|
1124
|
-
return this._logService.error("[DocClipboardService] copy failed",
|
|
1126
|
+
} catch (n) {
|
|
1127
|
+
return this._logService.error("[DocClipboardService] copy failed", n), !1;
|
|
1125
1128
|
}
|
|
1126
1129
|
return !0;
|
|
1127
1130
|
}
|
|
@@ -1129,51 +1132,51 @@ let Xe = class extends k {
|
|
|
1129
1132
|
return this._cut();
|
|
1130
1133
|
}
|
|
1131
1134
|
async paste(e) {
|
|
1132
|
-
const
|
|
1133
|
-
return this._paste(t);
|
|
1134
|
-
}
|
|
1135
|
-
async legacyPaste(e, t) {
|
|
1136
|
-
const n = this._generateBodyFromHtmlAndText(e, t);
|
|
1135
|
+
const n = await this._generateBodyFromClipboardItems(e);
|
|
1137
1136
|
return this._paste(n);
|
|
1138
1137
|
}
|
|
1138
|
+
async legacyPaste(e, n) {
|
|
1139
|
+
const i = this._generateBodyFromHtmlAndText(e, n);
|
|
1140
|
+
return this._paste(i);
|
|
1141
|
+
}
|
|
1139
1142
|
async _cut() {
|
|
1140
1143
|
var o;
|
|
1141
1144
|
const {
|
|
1142
1145
|
segmentId: e,
|
|
1143
|
-
endOffset:
|
|
1144
|
-
style:
|
|
1146
|
+
endOffset: n,
|
|
1147
|
+
style: i
|
|
1145
1148
|
} = (o = this._textSelectionManagerService.getActiveRange()) != null ? o : {}, r = this._textSelectionManagerService.getSelections();
|
|
1146
|
-
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)
|
|
1147
1150
|
return !1;
|
|
1148
1151
|
this.copy();
|
|
1149
1152
|
try {
|
|
1150
|
-
let s =
|
|
1153
|
+
let s = n;
|
|
1151
1154
|
for (const c of r) {
|
|
1152
1155
|
const { startOffset: l, endOffset: u } = c;
|
|
1153
|
-
l == null || u == null || u <=
|
|
1156
|
+
l == null || u == null || u <= n && (s -= u - l);
|
|
1154
1157
|
}
|
|
1155
1158
|
const a = [
|
|
1156
1159
|
{
|
|
1157
1160
|
startOffset: s,
|
|
1158
1161
|
endOffset: s,
|
|
1159
|
-
style:
|
|
1162
|
+
style: i
|
|
1160
1163
|
}
|
|
1161
1164
|
];
|
|
1162
|
-
return this._commandService.executeCommand(
|
|
1165
|
+
return this._commandService.executeCommand(xt.id, { segmentId: e, textRanges: a });
|
|
1163
1166
|
} catch {
|
|
1164
1167
|
return this._logService.error("[DocClipboardController] cut content failed"), !1;
|
|
1165
1168
|
}
|
|
1166
1169
|
}
|
|
1167
1170
|
async _paste(e) {
|
|
1168
1171
|
var s;
|
|
1169
|
-
const { segmentId:
|
|
1170
|
-
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)
|
|
1171
1174
|
return !1;
|
|
1172
1175
|
try {
|
|
1173
|
-
let a =
|
|
1176
|
+
let a = i;
|
|
1174
1177
|
for (const l of o) {
|
|
1175
1178
|
const { startOffset: u, endOffset: h } = l;
|
|
1176
|
-
u == null || h == null || h <=
|
|
1179
|
+
u == null || h == null || h <= i && (a += e.dataStream.length - (h - u));
|
|
1177
1180
|
}
|
|
1178
1181
|
const c = [
|
|
1179
1182
|
{
|
|
@@ -1182,142 +1185,142 @@ let Xe = class extends k {
|
|
|
1182
1185
|
style: r
|
|
1183
1186
|
}
|
|
1184
1187
|
];
|
|
1185
|
-
return this._commandService.executeCommand(Pt.id, { body: e, segmentId:
|
|
1188
|
+
return this._commandService.executeCommand(Pt.id, { body: e, segmentId: n, textRanges: c });
|
|
1186
1189
|
} catch {
|
|
1187
1190
|
return this._logService.error("[DocClipboardController]", "clipboard is empty."), !1;
|
|
1188
1191
|
}
|
|
1189
1192
|
}
|
|
1190
1193
|
async _setClipboardData(e) {
|
|
1191
|
-
const
|
|
1194
|
+
const n = qi(), i = e.length > 1 ? e.map((o) => o.dataStream).join(`
|
|
1192
1195
|
`) : e[0].dataStream;
|
|
1193
1196
|
let r = this._umdToHtml.convert(e);
|
|
1194
|
-
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);
|
|
1195
1198
|
}
|
|
1196
1199
|
addClipboardHook(e) {
|
|
1197
|
-
return this._clipboardHooks.push(e),
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1200
|
+
return this._clipboardHooks.push(e), zt(() => {
|
|
1201
|
+
const n = this._clipboardHooks.indexOf(e);
|
|
1202
|
+
n > -1 && this._clipboardHooks.splice(n, 1);
|
|
1200
1203
|
});
|
|
1201
1204
|
}
|
|
1202
1205
|
_getDocumentBodyInRanges() {
|
|
1203
|
-
const e = this._textSelectionManagerService.getSelections(),
|
|
1204
|
-
if (e == null || !
|
|
1205
|
-
return
|
|
1206
|
+
const e = this._textSelectionManagerService.getSelections(), n = this._univerInstanceService.getCurrentUniverDocInstance(), i = [];
|
|
1207
|
+
if (e == null || !n)
|
|
1208
|
+
return i;
|
|
1206
1209
|
for (const r of e) {
|
|
1207
1210
|
const { startOffset: o, endOffset: s, collapsed: a } = r;
|
|
1208
1211
|
if (a || o == null || s == null)
|
|
1209
1212
|
continue;
|
|
1210
|
-
const c =
|
|
1211
|
-
c != null &&
|
|
1213
|
+
const c = n.sliceBody(o, s);
|
|
1214
|
+
c != null && i.push(c);
|
|
1212
1215
|
}
|
|
1213
|
-
return
|
|
1216
|
+
return i;
|
|
1214
1217
|
}
|
|
1215
1218
|
async _generateBodyFromClipboardItems(e) {
|
|
1216
1219
|
try {
|
|
1217
|
-
let
|
|
1220
|
+
let n = "", i = "";
|
|
1218
1221
|
for (const r of e)
|
|
1219
1222
|
for (const o of r.types)
|
|
1220
|
-
o ===
|
|
1221
|
-
return this._generateBodyFromHtmlAndText(
|
|
1222
|
-
} catch (
|
|
1223
|
-
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);
|
|
1224
1227
|
}
|
|
1225
1228
|
}
|
|
1226
|
-
_generateBodyFromHtmlAndText(e,
|
|
1229
|
+
_generateBodyFromHtmlAndText(e, n) {
|
|
1227
1230
|
if (!e) {
|
|
1228
|
-
if (
|
|
1229
|
-
return
|
|
1231
|
+
if (n)
|
|
1232
|
+
return ur(n);
|
|
1230
1233
|
throw new Error("[DocClipboardService] html and text cannot be both empty!");
|
|
1231
1234
|
}
|
|
1232
|
-
const
|
|
1233
|
-
if (
|
|
1234
|
-
const r =
|
|
1235
|
+
const i = Ji(e);
|
|
1236
|
+
if (i) {
|
|
1237
|
+
const r = gt.get(i);
|
|
1235
1238
|
if (r)
|
|
1236
1239
|
return r;
|
|
1237
1240
|
}
|
|
1238
1241
|
return this._htmlToUDM.convert(e);
|
|
1239
1242
|
}
|
|
1240
1243
|
};
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
],
|
|
1248
|
-
function
|
|
1249
|
-
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);
|
|
1250
1253
|
}
|
|
1251
|
-
const
|
|
1252
|
-
id:
|
|
1254
|
+
const tt = 999, hr = {
|
|
1255
|
+
id: hn.id,
|
|
1253
1256
|
name: "doc.command.copy",
|
|
1254
|
-
type:
|
|
1257
|
+
type: Ze.COMMAND,
|
|
1255
1258
|
multi: !0,
|
|
1256
|
-
priority:
|
|
1257
|
-
preconditions:
|
|
1258
|
-
handler: async (
|
|
1259
|
-
},
|
|
1260
|
-
id:
|
|
1259
|
+
priority: tt,
|
|
1260
|
+
preconditions: De,
|
|
1261
|
+
handler: async (t) => t.get(ae).copy()
|
|
1262
|
+
}, pr = {
|
|
1263
|
+
id: pn.id,
|
|
1261
1264
|
name: "doc.command.cut",
|
|
1262
|
-
type:
|
|
1265
|
+
type: Ze.COMMAND,
|
|
1263
1266
|
multi: !0,
|
|
1264
|
-
priority:
|
|
1265
|
-
preconditions:
|
|
1266
|
-
handler: async (
|
|
1267
|
-
},
|
|
1268
|
-
id:
|
|
1267
|
+
priority: tt,
|
|
1268
|
+
preconditions: De,
|
|
1269
|
+
handler: async (t) => t.get(ae).cut()
|
|
1270
|
+
}, _r = {
|
|
1271
|
+
id: _n.id,
|
|
1269
1272
|
name: "doc.command.paste",
|
|
1270
|
-
type:
|
|
1273
|
+
type: Ze.COMMAND,
|
|
1271
1274
|
multi: !0,
|
|
1272
|
-
priority:
|
|
1273
|
-
preconditions:
|
|
1274
|
-
handler: async (
|
|
1275
|
-
const e =
|
|
1276
|
-
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);
|
|
1277
1280
|
}
|
|
1278
1281
|
};
|
|
1279
|
-
var
|
|
1280
|
-
for (var r =
|
|
1281
|
-
(s =
|
|
1282
|
-
return
|
|
1283
|
-
},
|
|
1284
|
-
let
|
|
1285
|
-
constructor(
|
|
1286
|
-
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();
|
|
1287
1290
|
}
|
|
1288
1291
|
_init() {
|
|
1289
|
-
[
|
|
1292
|
+
[hr, pr, _r].forEach((t) => this.disposeWithMe(this._commandService.registerMultipleCommand(t))), [Pt, xt].forEach((t) => this.disposeWithMe(this._commandService.registerCommand(t))), this._initLegacyPasteCommand();
|
|
1290
1293
|
}
|
|
1291
1294
|
_initLegacyPasteCommand() {
|
|
1292
|
-
var
|
|
1293
|
-
(
|
|
1295
|
+
var t;
|
|
1296
|
+
(t = this._textSelectionRenderManager) == null || t.onPaste$.pipe(H(this.dispose$)).subscribe((e) => {
|
|
1294
1297
|
var o, s;
|
|
1295
|
-
if (!
|
|
1298
|
+
if (!De(this._contextService))
|
|
1296
1299
|
return;
|
|
1297
1300
|
e.event.preventDefault();
|
|
1298
|
-
const
|
|
1299
|
-
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);
|
|
1300
1303
|
});
|
|
1301
1304
|
}
|
|
1302
1305
|
};
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
],
|
|
1311
|
-
var
|
|
1312
|
-
for (var r =
|
|
1313
|
-
(s =
|
|
1314
|
-
return
|
|
1315
|
-
},
|
|
1316
|
-
let
|
|
1317
|
-
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) {
|
|
1318
1321
|
super();
|
|
1319
|
-
|
|
1320
|
-
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();
|
|
1321
1324
|
}
|
|
1322
1325
|
_initialize() {
|
|
1323
1326
|
this.disposeWithMe(
|
|
@@ -1325,36 +1328,39 @@ let Oe = class extends k {
|
|
|
1325
1328
|
this._resize(e);
|
|
1326
1329
|
})
|
|
1327
1330
|
), this._editorService.getAllEditor().forEach((e) => {
|
|
1328
|
-
const
|
|
1329
|
-
this._initialEditors.has(
|
|
1331
|
+
const n = e.editorUnitId;
|
|
1332
|
+
this._initialEditors.has(n) || (this._initialEditors.add(n), this._resize(n));
|
|
1330
1333
|
}), this._commandExecutedListener(), this._initialSetValue(), this._initialBlur(), this._initialFocus(), this._initialValueChange();
|
|
1331
1334
|
}
|
|
1332
1335
|
_resize(e) {
|
|
1333
|
-
var $,
|
|
1336
|
+
var j, $, w;
|
|
1334
1337
|
if (e == null)
|
|
1335
1338
|
return;
|
|
1336
|
-
const
|
|
1337
|
-
if ((
|
|
1339
|
+
const n = this._editorService.getEditor(e);
|
|
1340
|
+
if ((n == null ? void 0 : n.cancelDefaultResizeListener) === !0)
|
|
1338
1341
|
return;
|
|
1339
|
-
const
|
|
1340
|
-
if (
|
|
1342
|
+
const i = this._univerInstanceService.getUniverDocInstance(e);
|
|
1343
|
+
if (!i)
|
|
1341
1344
|
return;
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
const {
|
|
1347
|
-
let
|
|
1348
|
-
|
|
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);
|
|
1349
1355
|
l.transformByState({
|
|
1350
|
-
width:
|
|
1351
|
-
height:
|
|
1352
|
-
}), 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());
|
|
1353
1359
|
}
|
|
1354
1360
|
_initialSetValue() {
|
|
1355
1361
|
this.disposeWithMe(
|
|
1356
1362
|
this._editorService.setValue$.subscribe((e) => {
|
|
1357
|
-
this._commandService.executeCommand(
|
|
1363
|
+
this._commandService.executeCommand(Wn.id, {
|
|
1358
1364
|
unitId: e.editorUnitId,
|
|
1359
1365
|
body: e.body,
|
|
1360
1366
|
segmentId: null
|
|
@@ -1373,15 +1379,15 @@ let Oe = class extends k {
|
|
|
1373
1379
|
const e = (r = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : r.getUnitId();
|
|
1374
1380
|
if (e == null)
|
|
1375
1381
|
return;
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1382
|
+
const n = this._editorService.getEditor(e), i = this._editorService.getFocusEditor();
|
|
1383
|
+
n == null || n.isSheetEditor() || i && i.editorUnitId === e || this._editorService.blur();
|
|
1378
1384
|
})
|
|
1379
1385
|
);
|
|
1380
1386
|
}
|
|
1381
1387
|
_initialFocus() {
|
|
1382
1388
|
this.disposeWithMe(
|
|
1383
|
-
this._editorService.focus$.subscribe((
|
|
1384
|
-
this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.addTextRanges([
|
|
1389
|
+
this._editorService.focus$.subscribe((i) => {
|
|
1390
|
+
this._textSelectionRenderManager.removeAllTextRanges(), this._textSelectionRenderManager.addTextRanges([i]);
|
|
1385
1391
|
})
|
|
1386
1392
|
);
|
|
1387
1393
|
const e = [
|
|
@@ -1391,17 +1397,17 @@ let Oe = class extends k {
|
|
|
1391
1397
|
"univer-formula-help-param"
|
|
1392
1398
|
];
|
|
1393
1399
|
this.disposeWithMe(
|
|
1394
|
-
|
|
1395
|
-
const o =
|
|
1396
|
-
if (
|
|
1397
|
-
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();
|
|
1398
1404
|
return;
|
|
1399
1405
|
}
|
|
1400
1406
|
this._editorService.changeSpreadsheetFocusState(!1);
|
|
1401
1407
|
})
|
|
1402
|
-
), this._univerInstanceService.getAllUnitsForType(
|
|
1403
|
-
const r =
|
|
1404
|
-
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) => {
|
|
1405
1411
|
this._editorService.changeSpreadsheetFocusState(!0), a.stopPropagation();
|
|
1406
1412
|
});
|
|
1407
1413
|
});
|
|
@@ -1418,22 +1424,22 @@ let Oe = class extends k {
|
|
|
1418
1424
|
);
|
|
1419
1425
|
}
|
|
1420
1426
|
_valueChange() {
|
|
1421
|
-
var
|
|
1422
|
-
const e = (
|
|
1427
|
+
var i;
|
|
1428
|
+
const e = (i = this._univerInstanceService.getCurrentUniverDocInstance()) == null ? void 0 : i.getUnitId();
|
|
1423
1429
|
if (e == null)
|
|
1424
1430
|
return;
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1431
|
+
const n = this._editorService.getEditor(e);
|
|
1432
|
+
n == null || n.isSheetEditor() || this._editorService.refreshValueChange(e);
|
|
1427
1433
|
}
|
|
1428
1434
|
/**
|
|
1429
1435
|
* Listen to document edits to refresh the size of the formula editor.
|
|
1430
1436
|
*/
|
|
1431
1437
|
_commandExecutedListener() {
|
|
1432
|
-
const e = [
|
|
1438
|
+
const e = [Je.id, gn.id];
|
|
1433
1439
|
this.disposeWithMe(
|
|
1434
|
-
this._commandService.onCommandExecuted((
|
|
1435
|
-
if (e.includes(
|
|
1436
|
-
const
|
|
1440
|
+
this._commandService.onCommandExecuted((n) => {
|
|
1441
|
+
if (e.includes(n.id)) {
|
|
1442
|
+
const i = n.params, { unitId: r } = i;
|
|
1437
1443
|
if (this._editorService.isSheetEditor(r))
|
|
1438
1444
|
return;
|
|
1439
1445
|
this._resize(r), this._valueChange();
|
|
@@ -1442,122 +1448,25 @@ let Oe = class extends k {
|
|
|
1442
1448
|
);
|
|
1443
1449
|
}
|
|
1444
1450
|
};
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
var
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
super();
|
|
1462
|
-
g(this, "_docRenderMap", /* @__PURE__ */ new Set());
|
|
1463
|
-
this._docSkeletonManagerService = e, this._renderManagerService = t, this._commandService = n, this._editorService = r, this._initialRenderRefresh(), this._commandExecutedListener();
|
|
1464
|
-
}
|
|
1465
|
-
_initialRenderRefresh() {
|
|
1466
|
-
this._docSkeletonManagerService.currentSkeletonBefore$.pipe(le(this.dispose$)).subscribe((e) => {
|
|
1467
|
-
this._create(e);
|
|
1468
|
-
});
|
|
1469
|
-
}
|
|
1470
|
-
_create(e) {
|
|
1471
|
-
if (e == null)
|
|
1472
|
-
return;
|
|
1473
|
-
const { skeleton: t, unitId: n } = e;
|
|
1474
|
-
let r = this._renderManagerService.getRenderById(n);
|
|
1475
|
-
r == null && (this._renderManagerService.create(n), r = this._renderManagerService.getRenderById(n));
|
|
1476
|
-
const { mainComponent: o, components: s } = r, a = o, c = s.get(X.BACKGROUND);
|
|
1477
|
-
a.changeSkeleton(t), c.changeSkeleton(t), this._recalculateSizeBySkeleton(r, t);
|
|
1478
|
-
}
|
|
1479
|
-
_recalculateSizeBySkeleton(e, t) {
|
|
1480
|
-
var m;
|
|
1481
|
-
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;
|
|
1482
|
-
if (l == null)
|
|
1483
|
-
return;
|
|
1484
|
-
let u = 0, h = 0;
|
|
1485
|
-
for (let p = 0, S = l.length; p < S; p++) {
|
|
1486
|
-
const d = l[p], { pageWidth: _, pageHeight: R } = d;
|
|
1487
|
-
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));
|
|
1488
|
-
}
|
|
1489
|
-
a.resize(u, h), c.resize(u, h), this._editorService.isEditor(o) || r.resize(u, h);
|
|
1490
|
-
}
|
|
1491
|
-
_commandExecutedListener() {
|
|
1492
|
-
const e = [tt.id];
|
|
1493
|
-
this.disposeWithMe(
|
|
1494
|
-
this._commandService.onCommandExecuted((t) => {
|
|
1495
|
-
var n;
|
|
1496
|
-
if (e.includes(t.id)) {
|
|
1497
|
-
const r = t.params, { unitId: o } = r, s = this._docSkeletonManagerService.getSkeletonByUnitId(o);
|
|
1498
|
-
if (s == null)
|
|
1499
|
-
return;
|
|
1500
|
-
const { skeleton: a } = s, c = this._renderManagerService.getRenderById(o);
|
|
1501
|
-
if (c == null || !!a.getViewModel().getDataModel().getSnapshot().disabled)
|
|
1502
|
-
return;
|
|
1503
|
-
if (a.calculate(), this._editorService.isEditor(o)) {
|
|
1504
|
-
(n = c.mainComponent) == null || n.makeDirty();
|
|
1505
|
-
return;
|
|
1506
|
-
}
|
|
1507
|
-
this._recalculateSizeBySkeleton(c, a);
|
|
1508
|
-
}
|
|
1509
|
-
})
|
|
1510
|
-
);
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
Re = br([
|
|
1514
|
-
U(A.Rendered, Re),
|
|
1515
|
-
ge(0, O(ee)),
|
|
1516
|
-
ge(1, F),
|
|
1517
|
-
ge(2, v),
|
|
1518
|
-
ge(3, L)
|
|
1519
|
-
], Re);
|
|
1520
|
-
var Mr = Object.defineProperty, yr = Object.getOwnPropertyDescriptor, Er = (i, e, t, n) => {
|
|
1521
|
-
for (var r = n > 1 ? void 0 : n ? yr(e, t) : e, o = i.length - 1, s; o >= 0; o--)
|
|
1522
|
-
(s = i[o]) && (r = (n ? s(e, t, r) : s(r)) || r);
|
|
1523
|
-
return n && r && Mr(e, t, r), r;
|
|
1524
|
-
}, fe = (i, e) => (t, n) => e(t, n, i);
|
|
1525
|
-
let Te = class extends de {
|
|
1526
|
-
constructor(e, t, n, r) {
|
|
1527
|
-
super();
|
|
1528
|
-
g(this, "_scene");
|
|
1529
|
-
g(this, "_currentDocumentModel");
|
|
1530
|
-
g(this, "_fps$", new Ut(""));
|
|
1531
|
-
g(this, "fps$", this._fps$.asObservable());
|
|
1532
|
-
this._renderManagerService = e, this._configService = t, this._univerInstanceService = n, this._editorService = r, this._initialize();
|
|
1533
|
-
}
|
|
1534
|
-
_initialize() {
|
|
1535
|
-
this._renderManagerService.createRender$.pipe(le(this.dispose$)).subscribe((e) => {
|
|
1536
|
-
this._create(e);
|
|
1537
|
-
}), this._univerInstanceService.getCurrentTypeOfUnit$(f.UNIVER_DOC).pipe(le(this.dispose$)).subscribe((e) => {
|
|
1538
|
-
this._create(e == null ? void 0 : e.getUnitId());
|
|
1539
|
-
}), this._univerInstanceService.getAllUnitsForType(f.UNIVER_DOC).forEach((e) => {
|
|
1540
|
-
this._create(e.getUnitId());
|
|
1541
|
-
});
|
|
1542
|
-
}
|
|
1543
|
-
dispose() {
|
|
1544
|
-
this._fps$.complete();
|
|
1545
|
-
}
|
|
1546
|
-
_create(e) {
|
|
1547
|
-
if (e == null)
|
|
1548
|
-
return;
|
|
1549
|
-
const t = this._univerInstanceService.getUniverDocInstance(e);
|
|
1550
|
-
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();
|
|
1551
1467
|
}
|
|
1552
1468
|
_addNewRender() {
|
|
1553
|
-
const t = this.
|
|
1554
|
-
this._renderManagerService.createRender(t);
|
|
1555
|
-
const n = this._renderManagerService.getRenderById(t);
|
|
1556
|
-
if (n == null)
|
|
1557
|
-
return;
|
|
1558
|
-
const { scene: r, engine: o } = n;
|
|
1559
|
-
this._scene = r;
|
|
1560
|
-
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, {
|
|
1561
1470
|
left: 0,
|
|
1562
1471
|
top: 0,
|
|
1563
1472
|
bottom: 0,
|
|
@@ -1566,337 +1475,289 @@ let Te = class extends de {
|
|
|
1566
1475
|
isRelativeY: !0,
|
|
1567
1476
|
isWheelPreventDefaultX: !0
|
|
1568
1477
|
});
|
|
1569
|
-
|
|
1570
|
-
const
|
|
1571
|
-
if (
|
|
1572
|
-
const
|
|
1573
|
-
let
|
|
1574
|
-
|
|
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();
|
|
1575
1484
|
} else
|
|
1576
|
-
|
|
1577
|
-
}), this._configService.getConfig("hasScroll") !== !1 && new
|
|
1578
|
-
new
|
|
1579
|
-
new
|
|
1580
|
-
), this._addComponent(
|
|
1581
|
-
|
|
1582
|
-
})
|
|
1583
|
-
}
|
|
1584
|
-
_addComponent(
|
|
1585
|
-
const t
|
|
1586
|
-
pageMarginLeft:
|
|
1587
|
-
pageMarginTop:
|
|
1588
|
-
},
|
|
1589
|
-
|
|
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);
|
|
1590
1540
|
}
|
|
1591
1541
|
};
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
var
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
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) {
|
|
1606
1555
|
super();
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
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();
|
|
1610
1559
|
}
|
|
1611
1560
|
_initialize() {
|
|
1612
|
-
this._initialRenderRefresh(), this._updateOnPluginChange();
|
|
1613
|
-
}
|
|
1614
|
-
_updateOnPluginChange() {
|
|
1615
|
-
}
|
|
1616
|
-
_initialRenderRefresh() {
|
|
1617
1561
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1618
|
-
|
|
1619
|
-
return;
|
|
1620
|
-
const { skeleton: t, unitId: n } = e, r = this._renderManagerService.getRenderById(n);
|
|
1621
|
-
if (r == null)
|
|
1622
|
-
return;
|
|
1623
|
-
const { mainComponent: o } = r;
|
|
1624
|
-
o.changeSkeleton(t), this._refreshDrawing(n, t, r);
|
|
1562
|
+
e != null && this._refreshDrawing(e);
|
|
1625
1563
|
});
|
|
1626
1564
|
}
|
|
1627
1565
|
_commandExecutedListener() {
|
|
1628
|
-
const e = [
|
|
1566
|
+
const e = [Je.id, ye.id];
|
|
1629
1567
|
this.disposeWithMe(
|
|
1630
|
-
this._commandService.onCommandExecuted((
|
|
1631
|
-
var
|
|
1632
|
-
if (e.includes(
|
|
1633
|
-
const r =
|
|
1634
|
-
if (s
|
|
1635
|
-
return;
|
|
1636
|
-
const { unitId: a, skeleton: c } = s;
|
|
1637
|
-
if (o !== a)
|
|
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
|
-
|
|
1640
|
-
|
|
1641
|
-
return;
|
|
1642
|
-
if (this._editorService.isEditor(a)) {
|
|
1643
|
-
(n = l.mainComponent) == null || n.makeDirty();
|
|
1574
|
+
if (this._editorService.isEditor(o)) {
|
|
1575
|
+
(i = this._context.mainComponent) == null || i.makeDirty();
|
|
1644
1576
|
return;
|
|
1645
1577
|
}
|
|
1646
|
-
this._refreshDrawing(
|
|
1578
|
+
this._refreshDrawing(s);
|
|
1647
1579
|
}
|
|
1648
1580
|
})
|
|
1649
1581
|
);
|
|
1650
1582
|
}
|
|
1651
|
-
_refreshDrawing(e
|
|
1652
|
-
const
|
|
1653
|
-
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)
|
|
1654
1586
|
return;
|
|
1655
|
-
const { left:
|
|
1656
|
-
|
|
1657
|
-
for (let
|
|
1658
|
-
const
|
|
1659
|
-
this._liquid.translatePagePadding(
|
|
1660
|
-
const { aLeft:
|
|
1661
|
-
|
|
1662
|
-
unitId:
|
|
1663
|
-
subUnitId:
|
|
1664
|
-
floatingObjectId:
|
|
1665
|
-
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,
|
|
1666
1598
|
floatingObject: {
|
|
1667
|
-
left:
|
|
1668
|
-
top:
|
|
1669
|
-
width:
|
|
1670
|
-
height:
|
|
1599
|
+
left: w + a + this._liquid.x,
|
|
1600
|
+
top: Z + c + this._liquid.y,
|
|
1601
|
+
width: Ne,
|
|
1602
|
+
height: q
|
|
1671
1603
|
}
|
|
1672
|
-
}), this._pageMarginCache.set(
|
|
1604
|
+
}), this._pageMarginCache.set(ce, {
|
|
1673
1605
|
marginLeft: this._liquid.x,
|
|
1674
1606
|
marginTop: this._liquid.y
|
|
1675
1607
|
});
|
|
1676
|
-
}), this._liquid.restorePagePadding(
|
|
1608
|
+
}), this._liquid.restorePagePadding(f), this._liquid.translatePage(f, l, u, h);
|
|
1677
1609
|
}
|
|
1678
1610
|
}
|
|
1679
1611
|
};
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
constructor(e, t, n, r, o, s) {
|
|
1694
|
-
super();
|
|
1695
|
-
g(this, "_initializedRender", /* @__PURE__ */ new Set());
|
|
1696
|
-
this._docSkeletonManagerService = e, this._univerInstanceService = t, this._commandService = n, this._renderManagerService = r, this._textSelectionManagerService = o, this._editorService = s, this._initialize();
|
|
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
|
-
|
|
1700
|
-
}
|
|
1701
|
-
_initialize() {
|
|
1702
|
-
this._skeletonListener(), this._commandExecutedListener(), this._initialRenderRefresh();
|
|
1626
|
+
_init() {
|
|
1627
|
+
this._initSkeletonListener(), this._initCommandExecutedListener(), this._initRenderRefresher(), setTimeout(() => this._updateViewZoom(1, !0), 20);
|
|
1703
1628
|
}
|
|
1704
|
-
|
|
1705
|
-
this._docSkeletonManagerService.currentSkeleton$.subscribe((
|
|
1706
|
-
if (
|
|
1707
|
-
return;
|
|
1708
|
-
const { unitId: t } = e, n = this._renderManagerService.getRenderById(t);
|
|
1709
|
-
if (n == null || this._initializedRender.has(t) || this._editorService.isEditor(t))
|
|
1629
|
+
_initRenderRefresher() {
|
|
1630
|
+
this._docSkeletonManagerService.currentSkeleton$.subscribe((t) => {
|
|
1631
|
+
if (t == null)
|
|
1710
1632
|
return;
|
|
1711
|
-
this.
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
unitId: s.getUnitId()
|
|
1729
|
-
}), o.preventDefault();
|
|
1730
|
-
})
|
|
1731
|
-
)
|
|
1732
|
-
);
|
|
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
|
+
}));
|
|
1733
1650
|
});
|
|
1734
1651
|
}
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
B(
|
|
1745
|
-
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1746
|
-
if (e == null)
|
|
1747
|
-
return;
|
|
1748
|
-
const t = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
1749
|
-
if (!t)
|
|
1750
|
-
return;
|
|
1751
|
-
const n = t.zoomRatio || 1;
|
|
1752
|
-
this._updateViewZoom(n, !1);
|
|
1753
|
-
})
|
|
1754
|
-
)
|
|
1755
|
-
);
|
|
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
|
+
}));
|
|
1756
1661
|
}
|
|
1757
|
-
|
|
1758
|
-
const
|
|
1759
|
-
this.disposeWithMe(
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
}
|
|
1771
|
-
})
|
|
1772
|
-
);
|
|
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
|
+
}));
|
|
1773
1675
|
}
|
|
1774
|
-
_updateViewZoom(
|
|
1775
|
-
var
|
|
1776
|
-
const n = this.
|
|
1777
|
-
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();
|
|
1778
1680
|
}
|
|
1779
|
-
_calculatePagePosition(
|
|
1780
|
-
const { document: n, scene:
|
|
1781
|
-
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)
|
|
1782
1684
|
return;
|
|
1783
|
-
const { width:
|
|
1784
|
-
let
|
|
1785
|
-
|
|
1786
|
-
const
|
|
1787
|
-
if (
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1790
|
-
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
|
|
1791
1693
|
});
|
|
1792
1694
|
}
|
|
1793
1695
|
return this;
|
|
1794
1696
|
}
|
|
1795
|
-
_getDocObject() {
|
|
1796
|
-
return Nt(this._univerInstanceService, this._renderManagerService);
|
|
1797
|
-
}
|
|
1798
1697
|
};
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
let Me = class extends k {
|
|
1814
|
-
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) {
|
|
1815
1712
|
super();
|
|
1816
|
-
|
|
1817
|
-
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();
|
|
1818
1715
|
}
|
|
1819
1716
|
_initialize() {
|
|
1820
1717
|
this._init(), this._skeletonListener(), this._commandExecutedListener();
|
|
1821
1718
|
}
|
|
1822
1719
|
_init() {
|
|
1823
|
-
this.
|
|
1824
|
-
|
|
1825
|
-
this._create(e);
|
|
1826
|
-
})
|
|
1827
|
-
), this._renderManagerService.getRenderAll().forEach((e, t) => {
|
|
1828
|
-
this._create(t);
|
|
1829
|
-
});
|
|
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));
|
|
1830
1722
|
}
|
|
1831
|
-
_create(e) {
|
|
1832
|
-
if (e == null || this._univerInstanceService.getUniverDocInstance(e) == null)
|
|
1833
|
-
return;
|
|
1834
|
-
const t = this._getDocObjectById(e);
|
|
1835
|
-
t == null || t.document == null || this._loadedMap.has(t.document) || (this._initialMain(e), this._loadedMap.add(t.document));
|
|
1836
|
-
}
|
|
1837
|
-
// eslint-disable-next-line max-lines-per-function
|
|
1838
1723
|
_initialMain(e) {
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
)
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
})
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
(a == null ? void 0 : a.getUnitId()) !== e && this._univerInstanceService.setCurrentUnitForType(e), this._textSelectionRenderManager.eventTrigger(o);
|
|
1862
|
-
const { offsetX: c, offsetY: l } = o;
|
|
1863
|
-
this._editorService.getEditor(e) && (this._setEditorFocus(e), setTimeout(() => {
|
|
1864
|
-
this._setEditorFocus(e), this._textSelectionRenderManager.setCursorManually(c, l);
|
|
1865
|
-
}, 0)), o.button !== 2 && s.stopPropagation();
|
|
1866
|
-
})
|
|
1867
|
-
)
|
|
1868
|
-
), this.disposeWithMe(
|
|
1869
|
-
B(
|
|
1870
|
-
n == null ? void 0 : n.onDblclickObserver.add((o) => {
|
|
1871
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleDblClick(o);
|
|
1872
|
-
})
|
|
1873
|
-
)
|
|
1874
|
-
), this.disposeWithMe(
|
|
1875
|
-
B(
|
|
1876
|
-
n == null ? void 0 : n.onTripleClickObserver.add((o) => {
|
|
1877
|
-
this._isEditorReadOnly(e) || this._textSelectionRenderManager.handleTripleClick(o);
|
|
1878
|
-
})
|
|
1879
|
-
)
|
|
1880
|
-
);
|
|
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
|
+
}));
|
|
1881
1746
|
}
|
|
1882
1747
|
_isEditorReadOnly(e) {
|
|
1883
|
-
const
|
|
1884
|
-
return
|
|
1748
|
+
const n = this._editorService.getEditor(e);
|
|
1749
|
+
return n ? n.isReadOnly() : !1;
|
|
1885
1750
|
}
|
|
1886
1751
|
_setEditorFocus(e) {
|
|
1887
|
-
if (this._univerInstanceService.getAllUnitsForType(f.UNIVER_SHEET).length > 0) {
|
|
1888
|
-
const n = this._univerInstanceService.getCurrentUnitForType(f.UNIVER_SHEET);
|
|
1889
|
-
this._editorService.setOperationSheetUnitId(n.getUnitId());
|
|
1890
|
-
}
|
|
1891
1752
|
this._editorService.focusStyle(e);
|
|
1892
1753
|
}
|
|
1893
1754
|
_commandExecutedListener() {
|
|
1894
|
-
const e = [
|
|
1755
|
+
const e = [ye.id];
|
|
1895
1756
|
this.disposeWithMe(
|
|
1896
|
-
this._commandService.onCommandExecuted((
|
|
1897
|
-
var
|
|
1898
|
-
if (e.includes(
|
|
1899
|
-
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;
|
|
1900
1761
|
if (o !== s)
|
|
1901
1762
|
return;
|
|
1902
1763
|
this._textSelectionManagerService.refreshSelection();
|
|
@@ -1909,14 +1770,11 @@ let Me = class extends k {
|
|
|
1909
1770
|
this._docSkeletonManagerService.currentSkeleton$.subscribe((e) => {
|
|
1910
1771
|
if (e == null)
|
|
1911
1772
|
return;
|
|
1912
|
-
const {
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
const { scene: o, mainComponent: s } = r;
|
|
1916
|
-
this._textSelectionRenderManager.changeRuntime(n, o, s), this._textSelectionManagerService.setCurrentSelectionNotRefresh({
|
|
1917
|
-
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,
|
|
1918
1776
|
subUnitId: ""
|
|
1919
|
-
}), this._editorService.isEditor(
|
|
1777
|
+
}), this._editorService.isEditor(r) || this._textSelectionManagerService.replaceTextRanges([
|
|
1920
1778
|
{
|
|
1921
1779
|
startOffset: 0,
|
|
1922
1780
|
endOffset: 0
|
|
@@ -1925,129 +1783,117 @@ let Me = class extends k {
|
|
|
1925
1783
|
})
|
|
1926
1784
|
);
|
|
1927
1785
|
}
|
|
1928
|
-
_getDocObjectById(e) {
|
|
1929
|
-
return this._univerInstanceService.getUnitType(e) !== f.UNIVER_DOC ? null : Vn(e, this._renderManagerService);
|
|
1930
|
-
}
|
|
1931
1786
|
};
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
z(
|
|
1935
|
-
z(
|
|
1936
|
-
z(
|
|
1937
|
-
z(
|
|
1938
|
-
z(
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
constructor(i, e, t, n, r) {
|
|
1950
|
-
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();
|
|
1951
1804
|
}
|
|
1952
1805
|
_init() {
|
|
1953
|
-
this._textSelectionManagerService.textSelection$.pipe(
|
|
1954
|
-
if (
|
|
1806
|
+
this._textSelectionManagerService.textSelection$.pipe(H(this.dispose$)).subscribe((t) => {
|
|
1807
|
+
if (t == null)
|
|
1955
1808
|
return;
|
|
1956
|
-
const { isEditing: e, unitId:
|
|
1957
|
-
e && this._scrollToSelection(
|
|
1809
|
+
const { isEditing: e, unitId: n } = t;
|
|
1810
|
+
e && this._scrollToSelection(n);
|
|
1958
1811
|
});
|
|
1959
1812
|
}
|
|
1960
1813
|
// Let the selection show on the current screen.
|
|
1961
|
-
_scrollToSelection(
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
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)
|
|
1965
1817
|
return;
|
|
1966
1818
|
const { collapsed: r, startNodePosition: o } = e;
|
|
1967
1819
|
if (!r)
|
|
1968
1820
|
return;
|
|
1969
|
-
const s =
|
|
1970
|
-
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)
|
|
1971
1823
|
return;
|
|
1972
1824
|
const {
|
|
1973
|
-
left:
|
|
1974
|
-
top:
|
|
1975
|
-
right:
|
|
1976
|
-
bottom:
|
|
1977
|
-
} =
|
|
1978
|
-
let
|
|
1979
|
-
const
|
|
1980
|
-
d <
|
|
1981
|
-
const
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1984
|
-
_getDocObject() {
|
|
1985
|
-
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);
|
|
1986
1835
|
}
|
|
1987
1836
|
};
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
],
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
}, Se = (i, e) => (t, n) => e(t, n, i);
|
|
2001
|
-
function kr(i, e) {
|
|
2002
|
-
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);
|
|
2003
1849
|
return {
|
|
2004
|
-
left:
|
|
2005
|
-
top:
|
|
2006
|
-
right:
|
|
2007
|
-
bottom:
|
|
1850
|
+
left: n.x,
|
|
1851
|
+
top: n.y,
|
|
1852
|
+
right: i.x,
|
|
1853
|
+
bottom: i.y
|
|
2008
1854
|
};
|
|
2009
1855
|
}
|
|
2010
|
-
function
|
|
2011
|
-
const { scaleX:
|
|
1856
|
+
function Ct(t, e, n) {
|
|
1857
|
+
const { scaleX: i, scaleY: r } = n.getAncestorScale(), o = n.getViewport(K.VIEW_MAIN);
|
|
2012
1858
|
if (!o)
|
|
2013
1859
|
return {
|
|
2014
|
-
x:
|
|
1860
|
+
x: t,
|
|
2015
1861
|
y: e
|
|
2016
1862
|
};
|
|
2017
|
-
const { viewportScrollX: s, viewportScrollY: a } = o, c = (
|
|
1863
|
+
const { viewportScrollX: s, viewportScrollY: a } = o, c = (t - s) * i, l = (e - a) * r;
|
|
2018
1864
|
return {
|
|
2019
1865
|
x: c,
|
|
2020
1866
|
y: l
|
|
2021
1867
|
};
|
|
2022
1868
|
}
|
|
2023
|
-
let
|
|
2024
|
-
constructor(
|
|
2025
|
-
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;
|
|
2026
1872
|
}
|
|
2027
1873
|
// #region attach to object
|
|
2028
|
-
_createObjectPositionObserver(
|
|
2029
|
-
const
|
|
2030
|
-
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, _ = {
|
|
2031
1877
|
left: c,
|
|
2032
1878
|
right: c + u,
|
|
2033
1879
|
top: l,
|
|
2034
1880
|
bottom: l + h
|
|
2035
|
-
}, p =
|
|
1881
|
+
}, p = Fr(_, a);
|
|
2036
1882
|
return {
|
|
2037
1883
|
left: p.left,
|
|
2038
1884
|
right: p.right,
|
|
2039
1885
|
top: p.top,
|
|
2040
1886
|
bottom: p.bottom
|
|
2041
1887
|
};
|
|
2042
|
-
},
|
|
1888
|
+
}, i = n(), r = new Xn(i), o = new Kt();
|
|
2043
1889
|
o.add(this._commandService.onCommandExecuted((a) => {
|
|
2044
|
-
a.id ===
|
|
1890
|
+
a.id === ye.id && r.next(n());
|
|
2045
1891
|
}));
|
|
2046
|
-
const s = e.scene.getViewport(
|
|
2047
|
-
return o.add(s
|
|
2048
|
-
r.next(
|
|
1892
|
+
const s = e.scene.getViewport(K.VIEW_MAIN);
|
|
1893
|
+
return s && o.add(s.onScrollAfter$.subscribeEvent(() => {
|
|
1894
|
+
r.next(n());
|
|
2049
1895
|
})), {
|
|
2050
|
-
position:
|
|
1896
|
+
position: i,
|
|
2051
1897
|
position$: r,
|
|
2052
1898
|
disposable: o
|
|
2053
1899
|
};
|
|
@@ -2058,16 +1904,16 @@ let Ke = class extends k {
|
|
|
2058
1904
|
* @param popup popup item
|
|
2059
1905
|
* @returns disposable
|
|
2060
1906
|
*/
|
|
2061
|
-
attachPopupToObject(
|
|
2062
|
-
const
|
|
1907
|
+
attachPopupToObject(t, e) {
|
|
1908
|
+
const i = this._univerInstanceService.getCurrentUnitForType(g.UNIVER_DOC).getUnitId(), r = this._renderManagerService.getRenderById(i);
|
|
2063
1909
|
if (!r)
|
|
2064
1910
|
return {
|
|
2065
1911
|
dispose: () => {
|
|
2066
1912
|
}
|
|
2067
1913
|
};
|
|
2068
|
-
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({
|
|
2069
1915
|
...e,
|
|
2070
|
-
unitId:
|
|
1916
|
+
unitId: i,
|
|
2071
1917
|
subUnitId: "default",
|
|
2072
1918
|
anchorRect: o,
|
|
2073
1919
|
anchorRect$: s
|
|
@@ -2079,135 +1925,160 @@ let Ke = class extends k {
|
|
|
2079
1925
|
};
|
|
2080
1926
|
}
|
|
2081
1927
|
};
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
],
|
|
2088
|
-
var
|
|
2089
|
-
for (var r =
|
|
2090
|
-
(s =
|
|
2091
|
-
return
|
|
2092
|
-
},
|
|
2093
|
-
let
|
|
2094
|
-
constructor(
|
|
2095
|
-
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();
|
|
2096
1974
|
}
|
|
2097
1975
|
onRendered() {
|
|
2098
|
-
this.
|
|
1976
|
+
this._initUI(), this._initRenderModules(), this._markDocAsFocused();
|
|
2099
1977
|
}
|
|
2100
1978
|
_initializeCommands() {
|
|
2101
1979
|
[
|
|
2102
|
-
|
|
1980
|
+
ti,
|
|
1981
|
+
ni,
|
|
2103
1982
|
ri,
|
|
2104
|
-
|
|
1983
|
+
ii,
|
|
2105
1984
|
oi,
|
|
1985
|
+
si,
|
|
2106
1986
|
ai,
|
|
2107
1987
|
ci,
|
|
2108
1988
|
li,
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
].forEach((i) => {
|
|
2115
|
-
this._injector.get(Sn).registerShortcut(i);
|
|
1989
|
+
Gi,
|
|
1990
|
+
Xi,
|
|
1991
|
+
Yi
|
|
1992
|
+
].forEach((t) => {
|
|
1993
|
+
this._injector.get(mn).registerShortcut(t);
|
|
2116
1994
|
});
|
|
2117
1995
|
}
|
|
2118
|
-
_initDependencies(
|
|
1996
|
+
_initDependencies(t) {
|
|
2119
1997
|
[
|
|
2120
|
-
|
|
2121
|
-
[
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
]
|
|
2127
|
-
|
|
2128
|
-
[Oe],
|
|
2129
|
-
[Re],
|
|
2130
|
-
[Ie],
|
|
2131
|
-
[be],
|
|
2132
|
-
[Me],
|
|
2133
|
-
[ye],
|
|
2134
|
-
[
|
|
2135
|
-
// controllers
|
|
2136
|
-
ae,
|
|
2137
|
-
{
|
|
2138
|
-
useFactory: () => this._injector.createInstance(ae, this._config)
|
|
2139
|
-
}
|
|
2140
|
-
],
|
|
2141
|
-
[
|
|
2142
|
-
pe,
|
|
2143
|
-
{
|
|
2144
|
-
useClass: Xe
|
|
2145
|
-
}
|
|
2146
|
-
],
|
|
2147
|
-
[Ke],
|
|
2148
|
-
// Render views
|
|
2149
|
-
[Te]
|
|
2150
|
-
].forEach((t) => {
|
|
2151
|
-
i.add(t);
|
|
2152
|
-
});
|
|
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));
|
|
2153
2006
|
}
|
|
2154
2007
|
_markDocAsFocused() {
|
|
2155
|
-
const
|
|
2008
|
+
const t = this._injector.get(P), e = this._injector.get(A);
|
|
2156
2009
|
try {
|
|
2157
|
-
const
|
|
2158
|
-
if (!
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
this._logService.warn(t);
|
|
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);
|
|
2164
2016
|
}
|
|
2165
2017
|
}
|
|
2166
|
-
|
|
2167
|
-
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
|
+
});
|
|
2168
2038
|
}
|
|
2169
|
-
},
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
],
|
|
2175
|
-
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) {
|
|
2176
2046
|
return {
|
|
2177
|
-
left:
|
|
2178
|
-
top:
|
|
2179
|
-
width:
|
|
2180
|
-
height:
|
|
2047
|
+
left: t.positionH.posOffset,
|
|
2048
|
+
top: t.positionV.posOffset,
|
|
2049
|
+
width: t.size.width,
|
|
2050
|
+
height: t.size.height
|
|
2181
2051
|
};
|
|
2182
2052
|
}
|
|
2183
|
-
function
|
|
2053
|
+
function io(t, e = 0, n = 0) {
|
|
2184
2054
|
return {
|
|
2185
2055
|
size: {
|
|
2186
|
-
width:
|
|
2187
|
-
height:
|
|
2056
|
+
width: t.width,
|
|
2057
|
+
height: t.height
|
|
2188
2058
|
},
|
|
2189
2059
|
positionH: {
|
|
2190
|
-
relativeFrom:
|
|
2191
|
-
posOffset: (
|
|
2060
|
+
relativeFrom: qt.MARGIN,
|
|
2061
|
+
posOffset: (t.left || 0) - e
|
|
2192
2062
|
},
|
|
2193
2063
|
positionV: {
|
|
2194
|
-
relativeFrom:
|
|
2195
|
-
posOffset: (
|
|
2064
|
+
relativeFrom: Jt.PAGE,
|
|
2065
|
+
posOffset: (t.top || 0) - n
|
|
2196
2066
|
},
|
|
2197
|
-
angle:
|
|
2067
|
+
angle: t.angle || 0
|
|
2198
2068
|
};
|
|
2199
2069
|
}
|
|
2200
2070
|
export {
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
sr as
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
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
|
|
2213
2084
|
};
|