@univerjs/sheets-zen-editor 0.5.4 → 0.5.5-experimental.20250123-34738ff

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,210 +1,192 @@
1
- var ue = Object.defineProperty;
2
- var fe = (e, n, r) => n in e ? ue(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
3
- var S = (e, n, r) => fe(e, typeof n != "symbol" ? n + "" : n, r);
4
- import { CommandType as M, IUniverInstanceService as D, delayAnimationFrame as w, DOCS_ZEN_EDITOR_UNIT_ID_KEY as v, Tools as Q, UniverInstanceType as j, DocumentFlavor as ee, DocumentDataModel as ge, createIdentifier as he, DEFAULT_EMPTY_DOCUMENT_VALUE as me, useDependency as x, ICommandService as te, FOCUSING_DOC as _e, FOCUSING_UNIVER_EDITOR as pe, EDITOR_ACTIVATED as ve, FOCUSING_EDITOR_STANDALONE as Ee, Disposable as Se, RxDisposable as Ie, Plugin as Ce, merge as Oe, Inject as ye, Injector as Ne, IConfigService as be } from "@univerjs/core";
5
- import { IEditorService as U, VIEWPORT_KEY as Te, DocBackScrollRenderController as Re } from "@univerjs/docs-ui";
6
- import { IRenderManagerService as ne } from "@univerjs/engine-render";
7
- import { IEditorBridgeService as Z, EditingRenderController as ze, getCurrentExclusiveRangeInterest$ as xe, getCurrentRangeDisable$ as Pe, getEditorObject as Me } from "@univerjs/sheets-ui";
8
- import { IZenZoneService as R, ISidebarService as A, MenuItemType as De, ContextMenuPosition as we, ContextMenuGroup as je, KeyCode as re, MetaKeys as Ue, IMenuManagerService as Ze, IShortcutService as Ae } from "@univerjs/ui";
9
- import Le, { forwardRef as L, useRef as ie, createElement as $, useEffect as $e } from "react";
10
- import { BehaviorSubject as Be, takeUntil as ke } from "rxjs";
11
- import { WorkbookEditablePermission as Fe, WorksheetEditPermission as Ve, WorksheetSetCellValuePermission as We, WorksheetSetCellStylePermission as He, RangeProtectionPermissionEditPoint as Ye } from "@univerjs/sheets";
12
- const B = {
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
+ import { CommandType, IUniverInstanceService, delayAnimationFrame, DOCS_ZEN_EDITOR_UNIT_ID_KEY, Tools, UniverInstanceType, DocumentFlavor, DocumentDataModel, createIdentifier, DEFAULT_EMPTY_DOCUMENT_VALUE, useDependency, ICommandService, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, Disposable, RxDisposable, Plugin, merge, Inject, Injector, IConfigService } from "@univerjs/core";
6
+ import { IEditorService, VIEWPORT_KEY, DocBackScrollRenderController } from "@univerjs/docs-ui";
7
+ import { IRenderManagerService } from "@univerjs/engine-render";
8
+ import { IEditorBridgeService, EditingRenderController, getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, getEditorObject } from "@univerjs/sheets-ui";
9
+ import { IZenZoneService, ISidebarService, MenuItemType, ContextMenuPosition, ContextMenuGroup, KeyCode, MetaKeys, IMenuManagerService, IShortcutService } from "@univerjs/ui";
10
+ import { jsxs, jsx } from "react/jsx-runtime";
11
+ import { forwardRef, useRef, createElement, useEffect } from "react";
12
+ import { BehaviorSubject, takeUntil } from "rxjs";
13
+ import { WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetSetCellStylePermission, RangeProtectionPermissionEditPoint } from "@univerjs/sheets";
14
+ const OpenZenEditorCommand = {
13
15
  id: "zen-editor.command.open-zen-editor",
14
- type: M.COMMAND,
15
- handler: async (e) => {
16
- var O;
17
- const n = e.get(R), r = e.get(U), t = e.get(Z), i = e.get(D), s = e.get(A);
18
- s.visible && (s.close(), await w()), n.open();
19
- const o = r.getEditor(v);
20
- if (o == null)
16
+ type: CommandType.COMMAND,
17
+ handler: /* @__PURE__ */ __name(async (accessor) => {
18
+ var _a4;
19
+ const zenZoneService = accessor.get(IZenZoneService), editorService = accessor.get(IEditorService), editorBridgeService = accessor.get(IEditorBridgeService), univerInstanceService = accessor.get(IUniverInstanceService), sideBarService = accessor.get(ISidebarService);
20
+ sideBarService.visible && (sideBarService.close(), await delayAnimationFrame()), zenZoneService.open();
21
+ const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);
22
+ if (editor == null)
21
23
  return !1;
22
- const a = t.getLatestEditCellState();
23
- if (a == null)
24
+ const editCellState = editorBridgeService.getLatestEditCellState();
25
+ if (editCellState == null)
24
26
  return !1;
25
- const c = (O = a.documentLayoutObject.documentModel) == null ? void 0 : O.getSnapshot();
26
- if (c == null)
27
+ const snapshot = (_a4 = editCellState.documentLayoutObject.documentModel) == null ? void 0 : _a4.getSnapshot();
28
+ if (snapshot == null)
27
29
  return !1;
28
- i.focusUnit(v);
29
- const { body: u, drawings: d, drawingsOrder: l, tableSource: g, settings: h } = Q.deepClone(c), E = {
30
- ...o.getDocumentData(),
31
- body: u,
32
- drawings: d,
33
- drawingsOrder: l,
34
- tableSource: g,
35
- settings: h
36
- }, m = [
30
+ univerInstanceService.focusUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY);
31
+ const { body, drawings, drawingsOrder, tableSource, settings } = Tools.deepClone(snapshot), newSnapshot = {
32
+ ...editor.getDocumentData(),
33
+ body,
34
+ drawings,
35
+ drawingsOrder,
36
+ tableSource,
37
+ settings
38
+ }, textRanges = [
37
39
  {
38
40
  startOffset: 0,
39
41
  endOffset: 0,
40
42
  collapsed: !0
41
43
  }
42
44
  ];
43
- return o.focus(), o.setDocumentData(E, m), o.clearUndoRedoHistory(), !0;
44
- }
45
- }, k = {
45
+ return editor.focus(), editor.setDocumentData(newSnapshot, textRanges), editor.clearUndoRedoHistory(), !0;
46
+ }, "handler")
47
+ }, CancelZenEditCommand = {
46
48
  id: "zen-editor.command.cancel-zen-edit",
47
- type: M.COMMAND,
48
- handler: async (e) => {
49
- const n = e.get(R), r = e.get(Z), t = e.get(D), i = e.get(A);
50
- i.visible && (i.close(), await w()), n.close();
51
- const s = t.getCurrentUnitForType(j.UNIVER_SHEET);
52
- return s ? (t.focusUnit(s.getUnitId()), r.refreshEditCellState(), !0) : !1;
53
- }
54
- }, F = {
49
+ type: CommandType.COMMAND,
50
+ handler: /* @__PURE__ */ __name(async (accessor) => {
51
+ const zenZoneEditorService = accessor.get(IZenZoneService), editorBridgeService = accessor.get(IEditorBridgeService), univerInstanceManager = accessor.get(IUniverInstanceService), sideBarService = accessor.get(ISidebarService);
52
+ sideBarService.visible && (sideBarService.close(), await delayAnimationFrame()), zenZoneEditorService.close();
53
+ const currentSheetInstance = univerInstanceManager.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
54
+ return currentSheetInstance ? (univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()), editorBridgeService.refreshEditCellState(), !0) : !1;
55
+ }, "handler")
56
+ }, ConfirmZenEditCommand = {
55
57
  id: "zen-editor.command.confirm-zen-edit",
56
- type: M.COMMAND,
57
- handler: async (e) => {
58
- var u;
59
- const n = e.get(R), r = e.get(Z), t = e.get(D), i = e.get(U), s = e.get(A);
60
- s.visible && (s.close(), await w()), n.close();
61
- const o = i.getEditor(v);
62
- if (o == null)
58
+ type: CommandType.COMMAND,
59
+ handler: /* @__PURE__ */ __name(async (accessor) => {
60
+ var _a4;
61
+ const zenZoneEditorService = accessor.get(IZenZoneService), editorBridgeService = accessor.get(IEditorBridgeService), univerInstanceManager = accessor.get(IUniverInstanceService), editorService = accessor.get(IEditorService), sideBarService = accessor.get(ISidebarService);
62
+ sideBarService.visible && (sideBarService.close(), await delayAnimationFrame()), zenZoneEditorService.close();
63
+ const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);
64
+ if (editor == null)
63
65
  return !1;
64
- const a = e.get(ne), c = t.getCurrentUnitForType(j.UNIVER_SHEET);
65
- if (c) {
66
- const d = c.getUnitId(), l = (u = a.getRenderById(d)) == null ? void 0 : u.with(ze);
67
- if (l) {
68
- const g = Q.deepClone(o.getDocumentData());
69
- g.documentStyle.documentFlavor = ee.UNSPECIFIED, l.submitCellData(new ge(g));
66
+ const renderManagerService = accessor.get(IRenderManagerService), currentSheetInstance = univerInstanceManager.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
67
+ if (currentSheetInstance) {
68
+ const currentSheetId = currentSheetInstance.getUnitId(), editingRenderController = (_a4 = renderManagerService.getRenderById(currentSheetId)) == null ? void 0 : _a4.with(EditingRenderController);
69
+ if (editingRenderController) {
70
+ const snapshot = Tools.deepClone(editor.getDocumentData());
71
+ snapshot.documentStyle.documentFlavor = DocumentFlavor.UNSPECIFIED, editingRenderController.submitCellData(new DocumentDataModel(snapshot));
70
72
  }
71
- return t.focusUnit(c.getUnitId()), r.refreshEditCellState(), !0;
73
+ return univerInstanceManager.focusUnit(currentSheetInstance.getUnitId()), editorBridgeService.refreshEditCellState(), !0;
72
74
  }
73
75
  return !1;
74
- }
75
- }, Ge = "sheets-zen-editor.config", H = {};
76
- var P = { exports: {} }, I = {};
77
- /**
78
- * @license React
79
- * react-jsx-runtime.production.min.js
80
- *
81
- * Copyright (c) Facebook, Inc. and its affiliates.
82
- *
83
- * This source code is licensed under the MIT license found in the
84
- * LICENSE file in the root directory of this source tree.
85
- */
86
- var Y;
87
- function qe() {
88
- if (Y) return I;
89
- Y = 1;
90
- var e = Le, n = Symbol.for("react.element"), r = Symbol.for("react.fragment"), t = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
91
- function o(a, c, u) {
92
- var d, l = {}, g = null, h = null;
93
- u !== void 0 && (g = "" + u), c.key !== void 0 && (g = "" + c.key), c.ref !== void 0 && (h = c.ref);
94
- for (d in c) t.call(c, d) && !s.hasOwnProperty(d) && (l[d] = c[d]);
95
- if (a && a.defaultProps) for (d in c = a.defaultProps, c) l[d] === void 0 && (l[d] = c[d]);
96
- return { $$typeof: n, type: a, key: g, ref: h, props: l, _owner: i.current };
97
- }
98
- return I.Fragment = r, I.jsx = o, I.jsxs = o, I;
99
- }
100
- var G;
101
- function Je() {
102
- return G || (G = 1, P.exports = qe()), P.exports;
103
- }
104
- var _ = Je(), f = function() {
105
- return f = Object.assign || function(e) {
106
- for (var n, r = 1, t = arguments.length; r < t; r++) {
107
- n = arguments[r];
108
- for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
76
+ }, "handler")
77
+ }, SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY = "sheets-zen-editor.config", defaultPluginConfig = {};
78
+ var __assign = function() {
79
+ return __assign = Object.assign || function(t) {
80
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
81
+ s = arguments[i];
82
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
109
83
  }
110
- return e;
111
- }, f.apply(this, arguments);
112
- }, Ke = function(e, n) {
113
- var r = {};
114
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (r[t] = e[t]);
115
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
116
- for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
117
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (r[t[i]] = e[t[i]]);
118
- return r;
119
- }, V = L(function(e, n) {
120
- var r = e.icon, t = e.id, i = e.className, s = e.extend, o = Ke(e, ["icon", "id", "className", "extend"]), a = "univerjs-icon univerjs-icon-".concat(t, " ").concat(i || "").trim(), c = ie("_".concat(et()));
121
- return oe(r, "".concat(t), { defIds: r.defIds, idSuffix: c.current }, f({ ref: n, className: a }, o), s);
84
+ return t;
85
+ }, __assign.apply(this, arguments);
86
+ }, __rest = function(s, e) {
87
+ var t = {};
88
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
89
+ if (s != null && typeof Object.getOwnPropertySymbols == "function")
90
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)
91
+ e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
92
+ return t;
93
+ }, IconBase = forwardRef(function(props, ref) {
94
+ var icon = props.icon, id = props.id, className = props.className, extend = props.extend, restProps = __rest(props, ["icon", "id", "className", "extend"]), cls = "univerjs-icon univerjs-icon-".concat(id, " ").concat(className || "").trim(), idSuffix = useRef("_".concat(generateShortUuid()));
95
+ return render(icon, "".concat(id), { defIds: icon.defIds, idSuffix: idSuffix.current }, __assign({ ref, className: cls }, restProps), extend);
122
96
  });
123
- function oe(e, n, r, t, i) {
124
- return $(e.tag, f(f({ key: n }, Xe(e, r, i)), t), (Qe(e, r).children || []).map(function(s, o) {
125
- return oe(s, "".concat(n, "-").concat(e.tag, "-").concat(o), r, void 0, i);
97
+ function render(node, id, runtimeProps, rootProps, extend) {
98
+ return createElement(node.tag, __assign(__assign({ key: id }, replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend)), rootProps), (replaceRuntimeIdsInDefs(node, runtimeProps).children || []).map(function(child, index) {
99
+ return render(child, "".concat(id, "-").concat(node.tag, "-").concat(index), runtimeProps, void 0, extend);
126
100
  }));
127
101
  }
128
- function Xe(e, n, r) {
129
- var t = f({}, e.attrs);
130
- r != null && r.colorChannel1 && t.fill === "colorChannel1" && (t.fill = r.colorChannel1);
131
- var i = n.defIds;
132
- return !i || i.length === 0 || (e.tag === "use" && t["xlink:href"] && (t["xlink:href"] = t["xlink:href"] + n.idSuffix), Object.entries(t).forEach(function(s) {
133
- var o = s[0], a = s[1];
134
- typeof a == "string" && (t[o] = a.replace(/url\(#(.*)\)/, "url(#$1".concat(n.idSuffix, ")")));
135
- })), t;
102
+ __name(render, "render");
103
+ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
104
+ var attrs = __assign({}, node.attrs);
105
+ extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
106
+ var defIds = runtimeProps.defIds;
107
+ return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a4) {
108
+ var key = _a4[0], value = _a4[1];
109
+ typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
110
+ })), attrs;
136
111
  }
137
- function Qe(e, n) {
138
- var r, t = n.defIds;
139
- return !t || t.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? f(f({}, e), { children: e.children.map(function(i) {
140
- return typeof i.attrs.id == "string" && t && t.indexOf(i.attrs.id) > -1 ? f(f({}, i), { attrs: f(f({}, i.attrs), { id: i.attrs.id + n.idSuffix }) }) : i;
141
- }) }) : e;
112
+ __name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
113
+ function replaceRuntimeIdsInDefs(node, runtimeProps) {
114
+ var _a4, defIds = runtimeProps.defIds;
115
+ return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a4 = node.children) === null || _a4 === void 0) && _a4.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
116
+ return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
117
+ }) }) : node;
142
118
  }
143
- function et() {
119
+ __name(replaceRuntimeIdsInDefs, "replaceRuntimeIdsInDefs");
120
+ function generateShortUuid() {
144
121
  return Math.random().toString(36).substring(2, 8);
145
122
  }
146
- V.displayName = "UniverIcon";
147
- var tt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, se = L(function(e, n) {
148
- return $(V, Object.assign({}, e, {
123
+ __name(generateShortUuid, "generateShortUuid");
124
+ IconBase.displayName = "UniverIcon";
125
+ var element$1 = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, CheckMarkSingle = forwardRef(function(props, ref) {
126
+ return createElement(IconBase, Object.assign({}, props, {
149
127
  id: "check-mark-single",
150
- ref: n,
151
- icon: tt
128
+ ref,
129
+ icon: element$1
152
130
  }));
153
131
  });
154
- se.displayName = "CheckMarkSingle";
155
- var nt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, ce = L(function(e, n) {
156
- return $(V, Object.assign({}, e, {
132
+ CheckMarkSingle.displayName = "CheckMarkSingle";
133
+ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M3.71274 2.86421C3.47843 2.6299 3.09853 2.6299 2.86421 2.86421C2.6299 3.09853 2.6299 3.47843 2.86421 3.71274L7.15154 8.00007L2.86421 12.2874C2.6299 12.5217 2.6299 12.9016 2.86421 13.1359C3.09853 13.3702 3.47843 13.3702 3.71274 13.1359L8.00007 8.84859L12.2874 13.1359C12.5217 13.3702 12.9016 13.3702 13.1359 13.1359C13.3702 12.9016 13.3702 12.5217 13.1359 12.2874L8.84859 8.00007L13.1359 3.71274C13.3702 3.47843 13.3702 3.09853 13.1359 2.86421C12.9016 2.6299 12.5217 2.6299 12.2874 2.86421L8.00007 7.15154L3.71274 2.86421Z" } }] }, CloseSingle = forwardRef(function(props, ref) {
134
+ return createElement(IconBase, Object.assign({}, props, {
157
135
  id: "close-single",
158
- ref: n,
159
- icon: nt
136
+ ref,
137
+ icon: element
160
138
  }));
161
139
  });
162
- ce.displayName = "CloseSingle";
163
- function ae(e) {
164
- var n, r, t = "";
165
- if (typeof e == "string" || typeof e == "number") t += e;
140
+ CloseSingle.displayName = "CloseSingle";
141
+ function r(e) {
142
+ var t, f, n = "";
143
+ if (typeof e == "string" || typeof e == "number") n += e;
166
144
  else if (typeof e == "object") if (Array.isArray(e)) {
167
- var i = e.length;
168
- for (n = 0; n < i; n++) e[n] && (r = ae(e[n])) && (t && (t += " "), t += r);
169
- } else for (r in e) e[r] && (t && (t += " "), t += r);
170
- return t;
145
+ var o = e.length;
146
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
147
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
148
+ return n;
171
149
  }
172
- function q() {
173
- for (var e, n, r = 0, t = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (n = ae(e)) && (t && (t += " "), t += n);
174
- return t;
150
+ __name(r, "r");
151
+ function clsx() {
152
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
153
+ return n;
175
154
  }
176
- class rt {
155
+ __name(clsx, "clsx");
156
+ const _ZenEditorManagerService = class _ZenEditorManagerService {
177
157
  constructor() {
178
- S(this, "_position", null);
179
- S(this, "_position$", new Be(null));
180
- S(this, "position$", this._position$.asObservable());
158
+ __publicField(this, "_position", null);
159
+ __publicField(this, "_position$", new BehaviorSubject(null));
160
+ __publicField(this, "position$", this._position$.asObservable());
181
161
  }
182
162
  dispose() {
183
163
  this._position$.complete(), this._position = null;
184
164
  }
185
- setPosition(n) {
186
- this._position = n, this._refresh(n);
165
+ setPosition(param) {
166
+ this._position = param, this._refresh(param);
187
167
  }
188
168
  getPosition() {
189
169
  return this._position;
190
170
  }
191
- _refresh(n) {
192
- this._position$.next(n);
171
+ _refresh(param) {
172
+ this._position$.next(param);
193
173
  }
194
- }
195
- const W = he(
174
+ };
175
+ __name(_ZenEditorManagerService, "ZenEditorManagerService");
176
+ let ZenEditorManagerService = _ZenEditorManagerService;
177
+ const IZenEditorManagerService = createIdentifier(
196
178
  "univer.sheet-zen-editor-manager.service"
197
- ), it = "univer-zen-editor", ot = "univer-zen-editor-icon-wrapper", st = "univer-zen-editor-icon-container", ct = "univer-zen-editor-icon-success", at = "univer-zen-editor-icon-error", dt = "univer-zen-editor-canvas-container", p = {
198
- zenEditor: it,
199
- zenEditorIconWrapper: ot,
200
- zenEditorIconContainer: st,
201
- zenEditorIconSuccess: ct,
202
- zenEditorIconError: at,
203
- zenEditorCanvasContainer: dt
204
- }, lt = "ZEN_EDITOR_PLUGIN_", ut = `${lt}ZEN_EDITOR_COMPONENT`, ft = {
205
- id: v,
179
+ ), zenEditor = "univer-zen-editor", zenEditorIconWrapper = "univer-zen-editor-icon-wrapper", zenEditorIconContainer = "univer-zen-editor-icon-container", zenEditorIconSuccess = "univer-zen-editor-icon-success", zenEditorIconError = "univer-zen-editor-icon-error", zenEditorCanvasContainer = "univer-zen-editor-canvas-container", styles = {
180
+ zenEditor,
181
+ zenEditorIconWrapper,
182
+ zenEditorIconContainer,
183
+ zenEditorIconSuccess,
184
+ zenEditorIconError,
185
+ zenEditorCanvasContainer
186
+ }, COMPONENT_PREFIX = "ZEN_EDITOR_PLUGIN_", ZEN_EDITOR_COMPONENT = `${COMPONENT_PREFIX}ZEN_EDITOR_COMPONENT`, INITIAL_SNAPSHOT = {
187
+ id: DOCS_ZEN_EDITOR_UNIT_ID_KEY,
206
188
  body: {
207
- dataStream: `${me}`,
189
+ dataStream: `${DEFAULT_EMPTY_DOCUMENT_VALUE}`,
208
190
  textRuns: [],
209
191
  tables: [],
210
192
  customBlocks: [],
@@ -223,7 +205,7 @@ const W = he(
223
205
  width: 595,
224
206
  height: Number.POSITIVE_INFINITY
225
207
  },
226
- documentFlavor: ee.MODERN,
208
+ documentFlavor: DocumentFlavor.MODERN,
227
209
  marginTop: 0,
228
210
  marginBottom: 0,
229
211
  marginRight: 0,
@@ -236,217 +218,222 @@ const W = he(
236
218
  drawings: {},
237
219
  drawingsOrder: []
238
220
  };
239
- function gt() {
240
- const e = ie(null), n = x(W), r = x(U), t = x(te);
241
- $e(() => {
242
- const o = e.current;
243
- if (!o)
221
+ function ZenEditor() {
222
+ const editorRef = useRef(null), zenEditorService = useDependency(IZenEditorManagerService), editorService = useDependency(IEditorService), commandService = useDependency(ICommandService);
223
+ useEffect(() => {
224
+ const editorDom = editorRef.current;
225
+ if (!editorDom)
244
226
  return;
245
- const a = r.register(
227
+ const registerSubscription = editorService.register(
246
228
  {
247
- editorUnitId: v,
248
- initialSnapshot: ft,
229
+ editorUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY,
230
+ initialSnapshot: INITIAL_SNAPSHOT,
249
231
  scrollBar: !0,
250
- noNeedVerticalAlign: !0,
251
232
  backScrollOffset: 100
252
233
  },
253
- o
254
- ), c = new ResizeObserver(() => {
255
- n.setPosition(o.getBoundingClientRect());
234
+ editorDom
235
+ ), resizeObserver = new ResizeObserver(() => {
236
+ zenEditorService.setPosition(editorDom.getBoundingClientRect());
256
237
  });
257
- return c.observe(o), () => {
258
- a.dispose(), c.unobserve(o);
238
+ return resizeObserver.observe(editorDom), () => {
239
+ registerSubscription.dispose(), resizeObserver.unobserve(editorDom);
259
240
  };
260
241
  }, []);
261
- function i() {
262
- t.executeCommand(k.id);
242
+ function handleCloseBtnClick() {
243
+ const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);
244
+ editor == null || editor.blur(), commandService.executeCommand(CancelZenEditCommand.id);
263
245
  }
264
- function s() {
265
- t.executeCommand(F.id);
246
+ __name(handleCloseBtnClick, "handleCloseBtnClick");
247
+ function handleConfirmBtnClick() {
248
+ const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);
249
+ editor == null || editor.blur(), commandService.executeCommand(ConfirmZenEditCommand.id);
266
250
  }
267
- return /* @__PURE__ */ _.jsxs("div", { className: p.zenEditor, children: [
268
- /* @__PURE__ */ _.jsxs("div", { className: p.zenEditorIconWrapper, children: [
269
- /* @__PURE__ */ _.jsx(
251
+ return __name(handleConfirmBtnClick, "handleConfirmBtnClick"), /* @__PURE__ */ jsxs("div", { className: styles.zenEditor, children: [
252
+ /* @__PURE__ */ jsxs("div", { className: styles.zenEditorIconWrapper, children: [
253
+ /* @__PURE__ */ jsx(
270
254
  "span",
271
255
  {
272
- className: q(p.zenEditorIconContainer, p.zenEditorIconError),
273
- onClick: i,
274
- children: /* @__PURE__ */ _.jsx(ce, { style: { fontSize: "22px" } })
256
+ className: clsx(styles.zenEditorIconContainer, styles.zenEditorIconError),
257
+ onClick: handleCloseBtnClick,
258
+ children: /* @__PURE__ */ jsx(CloseSingle, { style: { fontSize: "22px" } })
275
259
  }
276
260
  ),
277
- /* @__PURE__ */ _.jsx(
261
+ /* @__PURE__ */ jsx(
278
262
  "span",
279
263
  {
280
- className: q(p.zenEditorIconContainer, p.zenEditorIconSuccess),
281
- onClick: s,
282
- children: /* @__PURE__ */ _.jsx(se, { style: { fontSize: "22px" } })
264
+ className: clsx(styles.zenEditorIconContainer, styles.zenEditorIconSuccess),
265
+ onClick: handleConfirmBtnClick,
266
+ children: /* @__PURE__ */ jsx(CheckMarkSingle, { style: { fontSize: "22px" } })
283
267
  }
284
268
  )
285
269
  ] }),
286
- /* @__PURE__ */ _.jsx("div", { className: p.zenEditorCanvasContainer, ref: e })
270
+ /* @__PURE__ */ jsx("div", { className: styles.zenEditorCanvasContainer, ref: editorRef })
287
271
  ] });
288
272
  }
289
- function ht(e) {
273
+ __name(ZenEditor, "ZenEditor");
274
+ function ZenEditorMenuItemFactory(accessor) {
290
275
  return {
291
- id: B.id,
292
- type: De.BUTTON,
276
+ id: OpenZenEditorCommand.id,
277
+ type: MenuItemType.BUTTON,
293
278
  title: "rightClick.zenEditor",
294
279
  icon: "AmplifySingle",
295
- hidden$: xe(e),
296
- disabled$: Pe(e, { workbookTypes: [Fe], worksheetTypes: [Ve, We, He], rangeTypes: [Ye] })
280
+ hidden$: getCurrentExclusiveRangeInterest$(accessor),
281
+ disabled$: getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetSetCellStylePermission], rangeTypes: [RangeProtectionPermissionEditPoint] })
297
282
  };
298
283
  }
299
- const mt = {
300
- [we.MAIN_AREA]: {
301
- [je.OTHERS]: {
302
- [B.id]: {
284
+ __name(ZenEditorMenuItemFactory, "ZenEditorMenuItemFactory");
285
+ const menuSchema = {
286
+ [ContextMenuPosition.MAIN_AREA]: {
287
+ [ContextMenuGroup.OTHERS]: {
288
+ [OpenZenEditorCommand.id]: {
303
289
  order: 2,
304
- menuItemFactory: ht
290
+ menuItemFactory: ZenEditorMenuItemFactory
305
291
  }
306
292
  }
307
293
  }
308
- }, _t = {
309
- id: F.id,
294
+ }, ZenEditorConfirmShortcut = {
295
+ id: ConfirmZenEditCommand.id,
310
296
  description: "shortcut.sheet.zen-edit-confirm",
311
297
  group: "4_sheet-edit",
312
- preconditions: (e) => de(e),
313
- binding: re.ENTER | Ue.ALT
314
- }, pt = {
315
- id: k.id,
298
+ preconditions: /* @__PURE__ */ __name((contextService) => whenZenEditorActivated(contextService), "preconditions"),
299
+ binding: KeyCode.ENTER | MetaKeys.ALT
300
+ }, ZenEditorCancelShortcut = {
301
+ id: CancelZenEditCommand.id,
316
302
  description: "shortcut.sheet.zen-edit-cancel",
317
303
  group: "4_sheet-edit",
318
- preconditions: (e) => de(e),
319
- binding: re.ESC
304
+ preconditions: /* @__PURE__ */ __name((contextService) => whenZenEditorActivated(contextService), "preconditions"),
305
+ binding: KeyCode.ESC
320
306
  };
321
- function de(e) {
322
- return e.getContextValue(_e) && e.getContextValue(pe) && e.getContextValue(ve) && !e.getContextValue(Ee);
307
+ function whenZenEditorActivated(contextService) {
308
+ return contextService.getContextValue(FOCUSING_DOC) && contextService.getContextValue(FOCUSING_UNIVER_EDITOR) && contextService.getContextValue(EDITOR_ACTIVATED) && !contextService.getContextValue(FOCUSING_EDITOR_STANDALONE);
323
309
  }
324
- var vt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, St = (e, n, r, t) => {
325
- for (var i = t > 1 ? void 0 : t ? Et(n, r) : n, s = e.length - 1, o; s >= 0; s--)
326
- (o = e[s]) && (i = (t ? o(n, r, i) : o(i)) || i);
327
- return t && i && vt(n, r, i), i;
328
- }, y = (e, n) => (r, t) => n(r, t, e);
329
- let b = class extends Se {
330
- constructor(e, n, r, t) {
331
- super(), this._zenZoneService = e, this._commandService = n, this._menuManagerService = r, this._shortcutService = t, this._initialize();
310
+ __name(whenZenEditorActivated, "whenZenEditorActivated");
311
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
312
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
313
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
314
+ return kind && result && __defProp$2(target, key, result), result;
315
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a;
316
+ let ZenEditorUIController = (_a = class extends Disposable {
317
+ constructor(_zenZoneService, _commandService, _menuManagerService, _shortcutService) {
318
+ super(), this._zenZoneService = _zenZoneService, this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._shortcutService = _shortcutService, this._initialize();
332
319
  }
333
320
  _initialize() {
334
321
  this._initCustomComponents(), this._initCommands(), this._initMenus(), this._initShortcuts();
335
322
  }
336
323
  _initCustomComponents() {
337
- this.disposeWithMe(this._zenZoneService.set(ut, gt));
324
+ this.disposeWithMe(this._zenZoneService.set(ZEN_EDITOR_COMPONENT, ZenEditor));
338
325
  }
339
326
  _initCommands() {
340
- [B, k, F].forEach((e) => {
341
- this.disposeWithMe(this._commandService.registerCommand(e));
327
+ [OpenZenEditorCommand, CancelZenEditCommand, ConfirmZenEditCommand].forEach((c) => {
328
+ this.disposeWithMe(this._commandService.registerCommand(c));
342
329
  });
343
330
  }
344
331
  _initMenus() {
345
- this._menuManagerService.mergeMenu(mt);
332
+ this._menuManagerService.mergeMenu(menuSchema);
346
333
  }
347
334
  _initShortcuts() {
348
- [_t, pt].forEach((e) => {
349
- this.disposeWithMe(this._shortcutService.registerShortcut(e));
335
+ [ZenEditorConfirmShortcut, ZenEditorCancelShortcut].forEach((item) => {
336
+ this.disposeWithMe(this._shortcutService.registerShortcut(item));
350
337
  });
351
338
  }
352
- };
353
- b = St([
354
- y(0, R),
355
- y(1, te),
356
- y(2, Ze),
357
- y(3, Ae)
358
- ], b);
359
- var It = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, Ot = (e, n, r, t) => {
360
- for (var i = t > 1 ? void 0 : t ? Ct(n, r) : n, s = e.length - 1, o; s >= 0; s--)
361
- (o = e[s]) && (i = (t ? o(n, r, i) : o(i)) || i);
362
- return t && i && It(n, r, i), i;
363
- }, J = (e, n) => (r, t) => n(r, t, e);
364
- let T = class extends Ie {
365
- constructor(e, n) {
366
- super(), this._zenEditorManagerService = e, this._renderManagerService = n, this._initialize();
339
+ }, __name(_a, "ZenEditorUIController"), _a);
340
+ ZenEditorUIController = __decorateClass$2([
341
+ __decorateParam$2(0, IZenZoneService),
342
+ __decorateParam$2(1, ICommandService),
343
+ __decorateParam$2(2, IMenuManagerService),
344
+ __decorateParam$2(3, IShortcutService)
345
+ ], ZenEditorUIController);
346
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
347
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
348
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
349
+ return kind && result && __defProp$1(target, key, result), result;
350
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1"), _a2;
351
+ let ZenEditorController = (_a2 = class extends RxDisposable {
352
+ constructor(_zenEditorManagerService, _renderManagerService) {
353
+ super(), this._zenEditorManagerService = _zenEditorManagerService, this._renderManagerService = _renderManagerService, this._initialize();
367
354
  }
368
355
  _initialize() {
369
356
  this._syncZenEditorSize();
370
357
  }
371
358
  // Listen to changes in the size of the zen editor container to set the size of the editor.
372
359
  _syncZenEditorSize() {
373
- this._zenEditorManagerService.position$.pipe(ke(this.dispose$)).subscribe((e) => {
374
- if (e == null)
360
+ this._zenEditorManagerService.position$.pipe(takeUntil(this.dispose$)).subscribe((position) => {
361
+ if (position == null)
375
362
  return;
376
- const { width: n, height: r } = e, t = Me(v, this._renderManagerService);
377
- t != null && requestIdleCallback(() => {
378
- t.engine.resizeBySize(n, r), this._calculatePagePosition(t), this._scrollToTop();
363
+ const { width, height } = position, editorObject = getEditorObject(DOCS_ZEN_EDITOR_UNIT_ID_KEY, this._renderManagerService);
364
+ editorObject != null && requestIdleCallback(() => {
365
+ editorObject.engine.resizeBySize(width, height), this._calculatePagePosition(editorObject), this._scrollToTop();
379
366
  });
380
367
  });
381
368
  }
382
- _calculatePagePosition(e) {
383
- const { document: n, scene: r, docBackground: t } = e, i = r == null ? void 0 : r.getParent(), { width: s, height: o, pageMarginLeft: a, pageMarginTop: c } = n;
384
- if (i == null || s === Number.POSITIVE_INFINITY || o === Number.POSITIVE_INFINITY)
369
+ _calculatePagePosition(currentRender) {
370
+ const { document: docsComponent, scene, docBackground } = currentRender, parent = scene == null ? void 0 : scene.getParent(), { width: docsWidth, height: docsHeight, pageMarginLeft, pageMarginTop } = docsComponent;
371
+ if (parent == null || docsWidth === Number.POSITIVE_INFINITY || docsHeight === Number.POSITIVE_INFINITY)
385
372
  return;
386
- const { width: u, height: d } = i;
387
- let l = 0;
388
- const g = c;
389
- let h = 0, C = 0, E = Number.POSITIVE_INFINITY;
390
- const { scaleX: m, scaleY: O } = r.getAncestorScale();
391
- u > (s + a * 2) * m ? (l = u / 2 - s * m / 2, l /= m, h = (u - a * 2) / m, E = 0) : (l = a, h = s + a * 2, E = (h - u / m) / 2), d > o ? C = (d - c * 2) / O : C = o + c * 2, r.resize(h, C), n.translate(l, g), t.translate(l, g);
392
- const z = r.getViewport(Te.VIEW_MAIN);
393
- if (E !== Number.POSITIVE_INFINITY && z != null) {
394
- const le = z.transScroll2ViewportScrollValue(E, 0).x;
395
- z.scrollToBarPos({
396
- x: le
373
+ const { width: engineWidth, height: engineHeight } = parent;
374
+ let docsLeft = 0;
375
+ const docsTop = pageMarginTop;
376
+ let sceneWidth = 0, sceneHeight = 0, scrollToX = Number.POSITIVE_INFINITY;
377
+ const { scaleX, scaleY } = scene.getAncestorScale();
378
+ engineWidth > (docsWidth + pageMarginLeft * 2) * scaleX ? (docsLeft = engineWidth / 2 - docsWidth * scaleX / 2, docsLeft /= scaleX, sceneWidth = (engineWidth - pageMarginLeft * 2) / scaleX, scrollToX = 0) : (docsLeft = pageMarginLeft, sceneWidth = docsWidth + pageMarginLeft * 2, scrollToX = (sceneWidth - engineWidth / scaleX) / 2), engineHeight > docsHeight ? sceneHeight = (engineHeight - pageMarginTop * 2) / scaleY : sceneHeight = docsHeight + pageMarginTop * 2, scene.resize(sceneWidth, sceneHeight), docsComponent.translate(docsLeft, docsTop), docBackground.translate(docsLeft, docsTop);
379
+ const viewport = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
380
+ if (scrollToX !== Number.POSITIVE_INFINITY && viewport != null) {
381
+ const actualX = viewport.transScroll2ViewportScrollValue(scrollToX, 0).x;
382
+ viewport.scrollToBarPos({
383
+ x: actualX
397
384
  });
398
385
  }
399
386
  return this;
400
387
  }
401
388
  _scrollToTop() {
402
- var r;
403
- const e = (r = this._renderManagerService.getRenderById(v)) == null ? void 0 : r.with(Re), n = {
389
+ var _a4;
390
+ const backScrollController = (_a4 = this._renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY)) == null ? void 0 : _a4.with(DocBackScrollRenderController), textRange = {
404
391
  startOffset: 0,
405
392
  endOffset: 0
406
393
  };
407
- e && e.scrollToRange(n);
394
+ backScrollController && backScrollController.scrollToRange(textRange);
408
395
  }
409
- };
410
- T = Ot([
411
- J(0, W),
412
- J(1, ne)
413
- ], T);
414
- var yt = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, bt = (e, n, r, t) => {
415
- for (var i = t > 1 ? void 0 : t ? Nt(n, r) : n, s = e.length - 1, o; s >= 0; s--)
416
- (o = e[s]) && (i = (t ? o(n, r, i) : o(i)) || i);
417
- return t && i && yt(n, r, i), i;
418
- }, K = (e, n) => (r, t) => n(r, t, e), N;
419
- let X = (N = class extends Ce {
420
- constructor(e = H, n, r) {
421
- super(), this._config = e, this._injector = n, this._configService = r;
422
- const { menu: t, ...i } = Oe(
396
+ }, __name(_a2, "ZenEditorController"), _a2);
397
+ ZenEditorController = __decorateClass$1([
398
+ __decorateParam$1(0, IZenEditorManagerService),
399
+ __decorateParam$1(1, IRenderManagerService)
400
+ ], ZenEditorController);
401
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
402
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
403
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
404
+ return kind && result && __defProp2(target, key, result), result;
405
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam"), _a3;
406
+ let UniverSheetsZenEditorPlugin = (_a3 = class extends Plugin {
407
+ constructor(_config = defaultPluginConfig, _injector, _configService) {
408
+ super(), this._config = _config, this._injector = _injector, this._configService = _configService;
409
+ const { menu, ...rest } = merge(
423
410
  {},
424
- H,
411
+ defaultPluginConfig,
425
412
  this._config
426
413
  );
427
- t && this._configService.setConfig("menu", t, { merge: !0 }), this._configService.setConfig(Ge, i), this._initializeDependencies(this._injector);
414
+ menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY, rest), this._initializeDependencies(this._injector);
428
415
  }
429
- _initializeDependencies(e) {
416
+ _initializeDependencies(injector) {
430
417
  [
431
- [b],
432
- [T],
433
- [W, { useClass: rt }]
434
- ].forEach((r) => e.add(r));
418
+ [ZenEditorUIController],
419
+ [ZenEditorController],
420
+ [IZenEditorManagerService, { useClass: ZenEditorManagerService }]
421
+ ].forEach((dependency) => injector.add(dependency));
435
422
  }
436
423
  onReady() {
437
- this._injector.get(b);
424
+ this._injector.get(ZenEditorUIController);
438
425
  }
439
426
  onSteady() {
440
- this._injector.get(T);
427
+ this._injector.get(ZenEditorController);
441
428
  }
442
- }, S(N, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), S(N, "type", j.UNIVER_SHEET), N);
443
- X = bt([
444
- K(1, ye(Ne)),
445
- K(2, be)
446
- ], X);
429
+ }, __name(_a3, "UniverSheetsZenEditorPlugin"), __publicField(_a3, "pluginName", "SHEET_ZEN_EDITOR_PLUGIN"), __publicField(_a3, "type", UniverInstanceType.UNIVER_SHEET), _a3);
430
+ UniverSheetsZenEditorPlugin = __decorateClass([
431
+ __decorateParam(1, Inject(Injector)),
432
+ __decorateParam(2, IConfigService)
433
+ ], UniverSheetsZenEditorPlugin);
447
434
  export {
448
- k as CancelZenEditCommand,
449
- F as ConfirmZenEditCommand,
450
- B as OpenZenEditorCommand,
451
- X as UniverSheetsZenEditorPlugin
435
+ CancelZenEditCommand,
436
+ ConfirmZenEditCommand,
437
+ OpenZenEditorCommand,
438
+ UniverSheetsZenEditorPlugin
452
439
  };