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