@univerjs/docs-ui 0.1.2 → 0.1.4

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