@univerjs/docs-quick-insert-ui 0.6.9-nightly.202504091607 → 0.6.10-alpha.0

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,25 +1,25 @@
1
- var Re = Object.defineProperty;
2
- var ke = (t, e, i) => e in t ? Re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
- var _ = (t, e, i) => ke(t, typeof e != "symbol" ? e + "" : e, i);
4
- import { CommandType as b, ICommandService as D, RANGE_DIRECTION as De, LocaleService as X, generateRandomId as Ne, DisposableCollection as Ee, toDisposable as $e, Direction as T, Inject as g, IUniverInstanceService as pe, Disposable as Y, UniverInstanceType as ee, DeleteDirection as Te, DependentOn as Ue, Injector as Qe, Plugin as He } from "@univerjs/core";
5
- import { UniverDocsDrawingPlugin as Ke } from "@univerjs/docs-drawing";
6
- import { InsertDocImageCommand as je, UniverDocsDrawingUIPlugin as Ae } from "@univerjs/docs-drawing-ui";
7
- import { UniverDrawingPlugin as Le } from "@univerjs/drawing";
8
- import { UniverDrawingUIPlugin as We } from "@univerjs/drawing-ui";
9
- import { useDependency as y, KeyCode as O, ComponentManager as fe, IShortcutService as he, useObservable as B, UniverUIPlugin as qe } from "@univerjs/ui";
10
- import { DocSelectionManagerService as me, DocSkeletonManagerService as ze, RichTextEditingMutation as Be } from "@univerjs/docs";
11
- import { CutContentCommand as Ve, DocCanvasPopManagerService as Fe, OrderListCommand as Ge, BulletListCommand as Ze, HorizontalLineCommand as Je, DocCreateTableOperation as Xe, InsertCommand as Ye, IMEInputCommand as et, DeleteCommand as tt, MoveCursorOperation as nt, DeleteLeftCommand as it } from "@univerjs/docs-ui";
12
- import { IRenderManagerService as rt } from "@univerjs/engine-render";
13
- import { map as ot, distinctUntilChanged as st, tap as N, combineLatest as ct, BehaviorSubject as V, of as at } from "rxjs";
14
- import { jsx as f, jsxs as ce } from "react/jsx-runtime";
15
- import { clsx as ae, Menu as dt, MenuItemGroup as ut, MenuItem as lt, Tooltip as pt } from "@univerjs/design";
16
- import { useMemo as de, useState as ue, useRef as $, useEffect as E, forwardRef as te, createElement as ne } from "react";
17
- const ve = {
1
+ var He = Object.defineProperty;
2
+ var Ke = (t, e, i) => e in t ? He(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
3
+ var g = (t, e, i) => Ke(t, typeof e != "symbol" ? e + "" : e, i);
4
+ import { CommandType as w, ICommandService as T, RANGE_DIRECTION as je, LocaleService as ue, generateRandomId as Le, DisposableCollection as Ae, toDisposable as Be, Direction as A, Inject as f, IUniverInstanceService as pe, Disposable as Z, UniverInstanceType as Q, DeleteDirection as We, DependentOn as Ve, Injector as qe, Plugin as ze } from "@univerjs/core";
5
+ import { UniverDocsDrawingPlugin as Fe } from "@univerjs/docs-drawing";
6
+ import { InsertDocImageCommand as Ge, UniverDocsDrawingUIPlugin as Ze } from "@univerjs/docs-drawing-ui";
7
+ import { UniverDrawingPlugin as Je } from "@univerjs/drawing";
8
+ import { UniverDrawingUIPlugin as Xe } from "@univerjs/drawing-ui";
9
+ import { IRenderManagerService as le } from "@univerjs/engine-render";
10
+ import { useDependency as S, KeyCode as M, ComponentManager as Ie, IShortcutService as Se, useObservable as R, UniverUIPlugin as Ye } from "@univerjs/ui";
11
+ import { CutContentCommand as et, DocCanvasPopManagerService as Pe, DocEventManagerService as he, OrderListCommand as tt, BulletListCommand as nt, HorizontalLineCommand as it, DocCreateTableOperation as rt, InsertCommand as st, IMEInputCommand as ot, DeleteCommand as ct, MoveCursorOperation as at, DeleteLeftCommand as dt } from "@univerjs/docs-ui";
12
+ import { map as ut, distinctUntilChanged as pt, tap as K, combineLatest as ye, BehaviorSubject as ne, of as lt } from "rxjs";
13
+ import { DocSelectionManagerService as Oe, DocSkeletonManagerService as ht, RichTextEditingMutation as ft } from "@univerjs/docs";
14
+ import { jsx as h, jsxs as ve } from "react/jsx-runtime";
15
+ import { clsx as me, Menu as vt, MenuItemGroup as mt, MenuItem as gt, Tooltip as _t } from "@univerjs/design";
16
+ import { useMemo as se, useState as ge, useRef as L, useEffect as j, forwardRef as J, createElement as X } from "react";
17
+ const Me = {
18
18
  id: "doc.command.delete-search-key",
19
- type: b.COMMAND,
19
+ type: w.COMMAND,
20
20
  handler: (t, e) => {
21
- const i = t.get(D), { start: n, end: r } = e;
22
- return i.syncExecuteCommand(Ve.id, {
21
+ const i = t.get(T), { start: n, end: r } = e;
22
+ return i.syncExecuteCommand(et.id, {
23
23
  segmentId: "",
24
24
  textRanges: [{
25
25
  startOffset: n,
@@ -30,176 +30,189 @@ const ve = {
30
30
  startOffset: n,
31
31
  endOffset: r,
32
32
  collapsed: !1,
33
- direction: De.FORWARD
33
+ direction: je.FORWARD
34
34
  }]
35
35
  });
36
36
  }
37
- }, ft = "docs.quick.insert.keyword-input-placeholder", U = () => {
38
- const t = y(X);
39
- return /* @__PURE__ */ f("div", { className: "univer-translate-y-1.5 univer-text-sm univer-text-gray-500", children: t.t("docQuickInsert.keywordInputPlaceholder") });
37
+ }, Ct = "docs.quick.insert.keyword-input-placeholder", B = () => {
38
+ const t = S(ue);
39
+ return /* @__PURE__ */ h("div", { className: "univer-translate-y-1.5 univer-text-sm univer-text-gray-500", children: t.t("docQuickInsert.keywordInputPlaceholder") });
40
40
  };
41
- U.componentKey = ft;
42
- const ht = "docs.quick.insert.placeholder", Q = () => {
43
- const t = y(X);
44
- return /* @__PURE__ */ f(
41
+ B.componentKey = Ct;
42
+ const xe = {
43
+ type: w.OPERATION,
44
+ id: "doc.operation.show-quick-insert-popup",
45
+ handler(t, e) {
46
+ const i = t.get(C);
47
+ return e ? (i.showPopup(e), !0) : !1;
48
+ }
49
+ }, U = {
50
+ type: w.OPERATION,
51
+ id: "doc.operation.close-quick-insert-popup",
52
+ handler(t) {
53
+ return t.get(C).closePopup(), !0;
54
+ }
55
+ }, It = "docs.quick.insert.placeholder", W = () => {
56
+ const t = S(ue);
57
+ return /* @__PURE__ */ h(
45
58
  "div",
46
59
  {
47
60
  className: `
48
61
  univer-flex univer-h-full univer-items-center univer-justify-center univer-rounded-lg univer-bg-white
49
62
  univer-px-12 univer-py-6 univer-text-gray-400
50
63
  `,
51
- children: /* @__PURE__ */ f("span", { children: t.t("docQuickInsert.placeholder") })
64
+ children: /* @__PURE__ */ h("span", { children: t.t("docQuickInsert.placeholder") })
52
65
  }
53
66
  );
54
67
  };
55
- Q.componentKey = ht;
56
- function G(t, e) {
68
+ W.componentKey = It;
69
+ function oe(t, e) {
57
70
  return t.map((i) => ({ ...i })).filter((i) => {
58
71
  if ("children" in i)
59
- return i.children = G(i.children, e), i.children.length > 0;
72
+ return i.children = oe(i.children, e), i.children.length > 0;
60
73
  const n = i.keywords;
61
74
  return n ? n.some((r) => r.includes(e)) : i.title.toLowerCase().includes(e);
62
75
  });
63
76
  }
64
- function ge(t, e) {
77
+ function be(t, e) {
65
78
  return t.map((i) => {
66
79
  const n = { ...i };
67
- return "children" in n && (n.children = ge(n.children, e)), n.title = e.t(n.title), "keywords" in n && (n.keywords = n.keywords.concat(n.title).map((r) => r.toLowerCase())), n;
80
+ return "children" in n && (n.children = be(n.children, e)), n.title = e.t(n.title), "keywords" in n && (n.keywords = n.keywords.concat(n.title).map((r) => r.toLowerCase())), n;
68
81
  });
69
82
  }
70
- const mt = [O.ARROW_UP, O.ARROW_DOWN, O.ENTER], H = () => {
71
- const t = y(X), e = y(C), i = y(fe), n = y(he), r = y(D), s = de(() => Ne(), []), [a, d] = ue(0), o = $(null), c = $(0);
72
- c.current = 0;
73
- const u = B(e.filterKeyword$, ""), p = B(e.editPopup$), x = B(p == null ? void 0 : p.popup.menus$, []), L = de(() => ge(x, t), [x]), [W, Me] = ue(() => G(L, u.toLowerCase()));
74
- E(() => {
75
- const h = requestIdleCallback(() => {
76
- Me(G(L, u.toLowerCase()));
83
+ const St = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
84
+ const t = S(ue), e = S(C), i = S(Ie), n = S(Se), r = S(T), s = se(() => Le(), []), [c, u] = ge(0), o = L(null), a = L(0);
85
+ a.current = 0;
86
+ const d = R(e.filterKeyword$, ""), p = R(e.editPopup$), I = R(p == null ? void 0 : p.popup.menus$, []), P = se(() => be(I, t), [I]), [H, k] = ge(() => oe(P, d.toLowerCase()));
87
+ j(() => {
88
+ const v = requestIdleCallback(() => {
89
+ k(oe(P, d.toLowerCase()));
77
90
  });
78
91
  return () => {
79
- cancelIdleCallback(h);
92
+ cancelIdleCallback(v);
80
93
  };
81
- }, [L, u]);
82
- const re = (h) => {
83
- e.emitMenuSelected(h), r.executeCommand(k.id);
94
+ }, [P, d]);
95
+ const ee = (v) => {
96
+ e.emitMenuSelected(v), r.executeCommand(U.id);
84
97
  };
85
- E(() => {
86
- const h = new Ee();
87
- n.getAllShortcuts().filter((l) => l.binding && mt.includes(l.binding)).forEach((l) => {
88
- const S = l.preconditions;
89
- l.preconditions = () => !1, h.add($e(() => {
90
- l.preconditions = S;
98
+ j(() => {
99
+ const v = new Ae();
100
+ n.getAllShortcuts().filter((l) => l.binding && St.includes(l.binding)).forEach((l) => {
101
+ const O = l.preconditions;
102
+ l.preconditions = () => !1, v.add(Be(() => {
103
+ l.preconditions = O;
91
104
  }));
92
105
  });
93
- const I = {
106
+ const y = {
94
107
  id: `quick.insert.popup.enter.${s}`,
95
- type: b.OPERATION,
108
+ type: w.OPERATION,
96
109
  handler: () => {
97
110
  const l = o.current;
98
- l && re(l);
111
+ l && ee(l);
99
112
  }
100
- }, M = {
113
+ }, $ = {
101
114
  id: `quick.insert.popup.move.cursor.up.${s}`,
102
- type: b.OPERATION,
115
+ type: w.OPERATION,
103
116
  handler: () => {
104
- d((l) => {
105
- const S = l - 1;
106
- return S >= 0 ? S : c.current - 1;
117
+ u((l) => {
118
+ const O = l - 1;
119
+ return O >= 0 ? O : a.current - 1;
107
120
  });
108
121
  }
109
- }, P = {
122
+ }, b = {
110
123
  id: `quick.insert.popup.move.cursor.down.${s}`,
111
- type: b.OPERATION,
124
+ type: w.OPERATION,
112
125
  handler: () => {
113
- d((l) => {
114
- const S = l + 1;
115
- return S <= c.current - 1 ? S : 0;
126
+ u((l) => {
127
+ const O = l + 1;
128
+ return O <= a.current - 1 ? O : 0;
116
129
  });
117
130
  }
118
131
  };
119
- return h.add(r.registerCommand(M)), h.add(r.registerCommand(P)), h.add(r.registerCommand(I)), h.add(n.registerShortcut({
132
+ return v.add(r.registerCommand($)), v.add(r.registerCommand(b)), v.add(r.registerCommand(y)), v.add(n.registerShortcut({
120
133
  priority: 1e3,
121
- id: M.id,
122
- binding: O.ARROW_UP,
134
+ id: $.id,
135
+ binding: M.ARROW_UP,
123
136
  preconditions: () => !0,
124
137
  staticParameters: {
125
- direction: T.UP
138
+ direction: A.UP
126
139
  }
127
- })), h.add(n.registerShortcut({
140
+ })), v.add(n.registerShortcut({
128
141
  priority: 1e3,
129
- id: P.id,
130
- binding: O.ARROW_DOWN,
142
+ id: b.id,
143
+ binding: M.ARROW_DOWN,
131
144
  preconditions: () => !0,
132
145
  staticParameters: {
133
- direction: T.DOWN
146
+ direction: A.DOWN
134
147
  }
135
- })), h.add(n.registerShortcut({
148
+ })), v.add(n.registerShortcut({
136
149
  priority: 1e3,
137
- id: I.id,
138
- binding: O.ENTER,
150
+ id: y.id,
151
+ binding: M.ENTER,
139
152
  preconditions: () => !0
140
153
  })), () => {
141
- h.dispose();
154
+ v.dispose();
142
155
  };
143
- }, []), E(() => {
144
- d(0);
145
- }, [W]);
146
- const q = $(/* @__PURE__ */ new Map());
147
- E(() => () => {
148
- q.current.clear();
156
+ }, []), j(() => {
157
+ u(0);
158
+ }, [H]);
159
+ const x = L(/* @__PURE__ */ new Map());
160
+ j(() => () => {
161
+ x.current.clear();
149
162
  }, []);
150
- function oe(h) {
151
- return h.map((m) => {
152
- const z = m.icon, I = z ? i.get(z) : null;
163
+ function D(v) {
164
+ return v.map((m) => {
165
+ const te = m.icon, y = te ? i.get(te) : null;
153
166
  if ("children" in m)
154
- return /* @__PURE__ */ f(
155
- ut,
167
+ return /* @__PURE__ */ h(
168
+ mt,
156
169
  {
157
- title: /* @__PURE__ */ ce(
170
+ title: /* @__PURE__ */ ve(
158
171
  "div",
159
172
  {
160
173
  className: `
161
174
  univer-mb-2 univer-flex univer-items-center univer-text-xs univer-text-gray-400
162
175
  `,
163
176
  children: [
164
- I && /* @__PURE__ */ f("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ f(I, {}) }),
165
- /* @__PURE__ */ f("span", { children: m.title })
177
+ y && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(y, {}) }),
178
+ /* @__PURE__ */ h("span", { children: m.title })
166
179
  ]
167
180
  }
168
181
  ),
169
- children: oe(m.children)
182
+ children: D(m.children)
170
183
  },
171
184
  m.id
172
185
  );
173
- const M = c.current, P = a === M;
174
- if (P) {
186
+ const $ = a.current, b = c === $;
187
+ if (b) {
175
188
  o.current = m;
176
- const l = q.current.get(m.id);
189
+ const l = x.current.get(m.id);
177
190
  l == null || l.scrollIntoView({
178
191
  block: "nearest"
179
192
  });
180
193
  }
181
- return c.current++, /* @__PURE__ */ f(
182
- lt,
194
+ return a.current++, /* @__PURE__ */ h(
195
+ gt,
183
196
  {
184
197
  ref: (l) => {
185
- l && q.current.set(m.id, l);
198
+ l && x.current.set(m.id, l);
186
199
  },
187
- onMouseEnter: () => d(M),
188
- onMouseLeave: () => d(Number.NaN),
189
- className: ae("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm", {
190
- "hover:univer-bg-transparent": !P,
191
- "univer-bg-gray-100": P
200
+ onMouseEnter: () => u($),
201
+ onMouseLeave: () => u(Number.NaN),
202
+ className: me("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm", {
203
+ "hover:univer-bg-transparent": !b,
204
+ "univer-bg-gray-100": b
192
205
  }),
193
206
  onClick: () => {
194
- re(m);
207
+ ee(m);
195
208
  },
196
- children: /* @__PURE__ */ ce(
209
+ children: /* @__PURE__ */ ve(
197
210
  "div",
198
211
  {
199
212
  className: "univer-flex univer-w-full univer-items-center univer-px-1",
200
213
  children: [
201
- I && /* @__PURE__ */ f("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ f(I, {}) }),
202
- /* @__PURE__ */ f(pt, { showIfEllipsis: !0, title: m.title, placement: "right", children: /* @__PURE__ */ f("span", { className: "univer-truncate", children: m.title }) })
214
+ y && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(y, {}) }),
215
+ /* @__PURE__ */ h(_t, { showIfEllipsis: !0, title: m.title, placement: "right", children: /* @__PURE__ */ h("span", { className: "univer-truncate", children: m.title }) })
203
216
  ]
204
217
  }
205
218
  )
@@ -208,77 +221,60 @@ const mt = [O.ARROW_UP, O.ARROW_DOWN, O.ENTER], H = () => {
208
221
  );
209
222
  });
210
223
  }
211
- const we = W.length > 0, se = (p == null ? void 0 : p.popup.Placeholder) || i.get(Q.componentKey);
212
- return /* @__PURE__ */ f(
213
- "div",
214
- {
215
- className: ae(`
216
- univer-rounded-lg univer-border univer-border-solid univer-border-gray-100 univer-bg-white
217
- univer-shadow-[0_0_10px_0_rgba(0,0,0,0.1)]
218
- `),
219
- children: we ? /* @__PURE__ */ f(
220
- "div",
221
- {
222
- className: `
223
- univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto univer-overflow-x-hidden
224
- `,
225
- children: /* @__PURE__ */ f(dt, { children: oe(W) })
226
- }
227
- ) : se && /* @__PURE__ */ f(se, {})
228
- }
229
- );
224
+ const Qe = H.length > 0, fe = (p == null ? void 0 : p.popup.Placeholder) || i.get(W.componentKey);
225
+ return /* @__PURE__ */ h("div", { className: me("univer-mt-2"), children: Qe ? /* @__PURE__ */ h(vt, { wrapperClass: "univer-max-h-[360px] univer-w-[220px]", children: D(H) }) : fe && /* @__PURE__ */ h(fe, {}) });
230
226
  };
231
- H.componentKey = "docs.quick.insert.popup";
232
- var vt = Object.getOwnPropertyDescriptor, gt = (t, e, i, n) => {
233
- for (var r = n > 1 ? void 0 : n ? vt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
234
- (a = t[s]) && (r = a(r) || r);
227
+ V.componentKey = "docs.quick.insert.popup";
228
+ var Pt = Object.getOwnPropertyDescriptor, yt = (t, e, i, n) => {
229
+ for (var r = n > 1 ? void 0 : n ? Pt(e, i) : e, s = t.length - 1, c; s >= 0; s--)
230
+ (c = t[s]) && (r = c(r) || r);
235
231
  return r;
236
- }, w = (t, e) => (i, n) => e(i, n, t);
237
- const le = {
232
+ }, N = (t, e) => (i, n) => e(i, n, t);
233
+ const _e = {
238
234
  dispose: () => {
239
235
  }
240
236
  };
241
- let C = class extends Y {
237
+ let C = class extends Z {
242
238
  constructor(e, i, n, r, s) {
243
239
  super();
244
- _(this, "_popups", /* @__PURE__ */ new Set());
245
- _(this, "_editPopup$", new V(void 0));
246
- _(this, "editPopup$", this._editPopup$.asObservable());
247
- _(this, "_isComposing$", new V(!1));
248
- _(this, "isComposing$", this._isComposing$.asObservable());
249
- _(this, "_inputOffset$", new V({ start: 0, end: 0 }));
250
- _(this, "inputOffset$", this._inputOffset$.asObservable());
251
- _(this, "filterKeyword$");
252
- _(this, "_menuSelectedCallbacks", /* @__PURE__ */ new Set());
253
- _(this, "_inputPlaceholderRenderRoot", null);
240
+ g(this, "_popups", /* @__PURE__ */ new Set());
241
+ g(this, "_editPopup$", new ne(void 0));
242
+ g(this, "editPopup$", this._editPopup$.asObservable());
243
+ g(this, "_isComposing$", new ne(!1));
244
+ g(this, "isComposing$", this._isComposing$.asObservable());
245
+ g(this, "_inputOffset$", new ne({ start: 0, end: 0 }));
246
+ g(this, "inputOffset$", this._inputOffset$.asObservable());
247
+ g(this, "filterKeyword$");
248
+ g(this, "_menuSelectedCallbacks", /* @__PURE__ */ new Set());
249
+ g(this, "_inputPlaceholderRenderRoot", null);
254
250
  this._docCanvasPopupManagerService = e, this._univerInstanceService = i, this._commandService = n, this._renderManagerService = r, this._docSelectionManagerService = s, this.disposeWithMe(this._editPopup$);
255
- const a = (o, c) => {
256
- var u, p;
257
- return (p = (u = this._univerInstanceService.getCurrentUnitOfType(ee.UNIVER_DOC)) == null ? void 0 : u.getBody()) == null ? void 0 : p.dataStream.slice(o, c);
251
+ const c = (o, a) => {
252
+ var d, p;
253
+ return (p = (d = this._univerInstanceService.getCurrentUnitOfType(Q.UNIVER_DOC)) == null ? void 0 : d.getBody()) == null ? void 0 : p.dataStream.slice(o, a);
258
254
  };
259
- let d = "";
255
+ let u = "";
260
256
  this.filterKeyword$ = this._inputOffset$.pipe(
261
- ot((o) => {
262
- var u;
263
- const c = a(o.start, o.end);
264
- return (u = c == null ? void 0 : c.slice(1)) != null ? u : "";
257
+ ut((o) => {
258
+ var d;
259
+ const a = c(o.start, o.end);
260
+ return (d = a == null ? void 0 : a.slice(1)) != null ? d : "";
265
261
  }),
266
- st(),
267
- N((o) => {
268
- d = o;
262
+ pt(),
263
+ K((o) => {
264
+ u = o;
269
265
  })
270
- ), this.disposeWithMe(ct([
271
- this.filterKeyword$.pipe(N((o) => {
272
- var c, u, p;
273
- o.length > 0 ? (u = (c = this._inputPlaceholderRenderRoot) == null ? void 0 : c.unmount) == null || u.dispose() : (p = this._inputPlaceholderRenderRoot) == null || p.mount();
266
+ ), this.disposeWithMe(ye([
267
+ this.filterKeyword$.pipe(K((o) => {
268
+ var a, d, p;
269
+ o.length > 0 ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : (p = this._inputPlaceholderRenderRoot) == null || p.mount();
274
270
  })),
275
- this.isComposing$.pipe(N((o) => {
276
- var c, u, p;
277
- o ? (u = (c = this._inputPlaceholderRenderRoot) == null ? void 0 : c.unmount) == null || u.dispose() : d.length <= 0 && ((p = this._inputPlaceholderRenderRoot) == null || p.mount());
271
+ this.isComposing$.pipe(K((o) => {
272
+ var a, d, p;
273
+ o ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : u.length <= 0 && ((p = this._inputPlaceholderRenderRoot) == null || p.mount());
278
274
  })),
279
- this.editPopup$.pipe(N((o) => {
280
- var c, u;
281
- o || ((u = (c = this._inputPlaceholderRenderRoot) == null ? void 0 : c.unmount) == null || u.dispose(), this._inputPlaceholderRenderRoot = null);
275
+ this.editPopup$.pipe(K((o) => {
276
+ var a, d;
277
+ o || ((d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose(), this._inputPlaceholderRenderRoot = null);
282
278
  }))
283
279
  ]).subscribe());
284
280
  }
@@ -297,6 +293,10 @@ let C = class extends Y {
297
293
  setInputOffset(e) {
298
294
  this._inputOffset$.next(e);
299
295
  }
296
+ getDocEventManagerService(e) {
297
+ var i;
298
+ return (i = this._renderManagerService.getRenderById(e)) == null ? void 0 : i.with(he);
299
+ }
300
300
  resolvePopup(e) {
301
301
  return Array.from(this._popups).find((i) => i.keyword === e);
302
302
  }
@@ -322,32 +322,40 @@ let C = class extends Y {
322
322
  };
323
323
  }
324
324
  showPopup(e) {
325
+ var a, d, p;
325
326
  const { popup: i, index: n, unitId: r } = e;
326
- this.closePopup(), this._inputPlaceholderRenderRoot = this._createInputPlaceholderRenderRoot(() => {
327
- var x;
328
- const a = (x = this._renderManagerService.getRenderById(r)) == null ? void 0 : x.with(ze), d = this._docSelectionManagerService.getActiveTextRange();
329
- if (!a || !d)
330
- return le;
331
- const c = a.getSkeleton().findNodeByCharIndex(d.startOffset, d.segmentId, d.segmentPage);
332
- if (!((c == null ? void 0 : c.content) === "\r"))
333
- return le;
334
- const p = this._docCanvasPopupManagerService.attachPopupToRange(
327
+ this.closePopup();
328
+ const s = this._univerInstanceService.getUnit(r), c = (d = (a = s == null ? void 0 : s.getBody()) == null ? void 0 : a.paragraphs) == null ? void 0 : d.find((I) => I.startIndex > n);
329
+ if (!c)
330
+ return;
331
+ const u = (p = this.getDocEventManagerService(r)) == null ? void 0 : p.paragraphBounds.get(c.startIndex);
332
+ if (!u)
333
+ return;
334
+ this._inputPlaceholderRenderRoot = this._createInputPlaceholderRenderRoot(() => {
335
+ var D;
336
+ const I = (D = this._renderManagerService.getRenderById(r)) == null ? void 0 : D.with(ht), P = this._docSelectionManagerService.getActiveTextRange();
337
+ if (!I || !P)
338
+ return _e;
339
+ const k = I.getSkeleton().findNodeByCharIndex(P.startOffset, P.segmentId, P.segmentPage);
340
+ if (!((k == null ? void 0 : k.content) === "\r"))
341
+ return _e;
342
+ const x = this._docCanvasPopupManagerService.attachPopupToRange(
335
343
  { startOffset: n + 1, endOffset: n + 1, collapsed: !1 },
336
344
  {
337
- componentKey: U.componentKey,
345
+ componentKey: B.componentKey,
338
346
  onClickOutside: () => {
339
- p.dispose();
347
+ x.dispose();
340
348
  },
341
349
  direction: "horizontal"
342
350
  },
343
351
  r
344
352
  );
345
- return p;
353
+ return x;
346
354
  }), this._inputPlaceholderRenderRoot.mount();
347
- const s = this._docCanvasPopupManagerService.attachPopupToRange(
348
- { startOffset: n, endOffset: n, collapsed: !0 },
355
+ const o = this._docCanvasPopupManagerService.attachPopupToRect(
356
+ u.firstLine,
349
357
  {
350
- componentKey: H.componentKey,
358
+ componentKey: V.componentKey,
351
359
  onClickOutside: () => {
352
360
  this.closePopup();
353
361
  },
@@ -355,7 +363,7 @@ let C = class extends Y {
355
363
  },
356
364
  r
357
365
  );
358
- this._editPopup$.next({ disposable: s, popup: i, anchor: n, unitId: r });
366
+ this._editPopup$.next({ disposable: o, popup: i, anchor: n, unitId: r });
359
367
  }
360
368
  closePopup() {
361
369
  this.editPopup && (this.editPopup.disposable.dispose(), this._editPopup$.next(null));
@@ -367,7 +375,7 @@ let C = class extends Y {
367
375
  }
368
376
  emitMenuSelected(e) {
369
377
  const { start: i, end: n } = this.inputOffset;
370
- this._commandService.syncExecuteCommand(ve.id, {
378
+ this._commandService.syncExecuteCommand(Me.id, {
371
379
  start: i,
372
380
  end: n
373
381
  }), setTimeout(() => {
@@ -375,86 +383,217 @@ let C = class extends Y {
375
383
  }, 0);
376
384
  }
377
385
  };
378
- C = gt([
379
- w(0, g(Fe)),
380
- w(1, g(pe)),
381
- w(2, g(D)),
382
- w(3, g(rt)),
383
- w(4, g(me))
386
+ C = yt([
387
+ N(0, f(Pe)),
388
+ N(1, f(pe)),
389
+ N(2, f(T)),
390
+ N(3, f(le)),
391
+ N(4, f(Oe))
384
392
  ], C);
385
- const _e = {
386
- type: b.OPERATION,
387
- id: "doc.operation.show-quick-insert-popup",
388
- handler(t, e) {
389
- const i = t.get(C);
390
- return e ? (i.showPopup(e), !0) : !1;
393
+ var _ = function() {
394
+ return _ = Object.assign || function(t) {
395
+ for (var e, i = 1, n = arguments.length; i < n; i++) {
396
+ e = arguments[i];
397
+ for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
398
+ }
399
+ return t;
400
+ }, _.apply(this, arguments);
401
+ }, Ot = function(t, e) {
402
+ var i = {};
403
+ for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
404
+ if (t != null && typeof Object.getOwnPropertySymbols == "function")
405
+ for (var r = 0, n = Object.getOwnPropertySymbols(t); r < n.length; r++)
406
+ e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[r]) && (i[n[r]] = t[n[r]]);
407
+ return i;
408
+ }, Y = J(function(t, e) {
409
+ var i = t.icon, n = t.id, r = t.className, s = t.extend, c = Ot(t, ["icon", "id", "className", "extend"]), u = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), o = L("_".concat(bt()));
410
+ return we(i, "".concat(n), { defIds: i.defIds, idSuffix: o.current }, _({ ref: e, className: u }, c), s);
411
+ });
412
+ function we(t, e, i, n, r) {
413
+ return X(t.tag, _(_({ key: e }, Mt(t, i, r)), n), (xt(t, i).children || []).map(function(s, c) {
414
+ return we(s, "".concat(e, "-").concat(t.tag, "-").concat(c), i, void 0, r);
415
+ }));
416
+ }
417
+ function Mt(t, e, i) {
418
+ var n = _({}, t.attrs);
419
+ i != null && i.colorChannel1 && n.fill === "colorChannel1" && (n.fill = i.colorChannel1), t.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(s) {
420
+ var c = s[0], u = s[1];
421
+ c === "mask" && typeof u == "string" && (n[c] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
422
+ });
423
+ var r = e.defIds;
424
+ return !r || r.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(s) {
425
+ var c = s[0], u = s[1];
426
+ typeof u == "string" && (n[c] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
427
+ })), n;
428
+ }
429
+ function xt(t, e) {
430
+ var i, n = e.defIds;
431
+ return !n || n.length === 0 ? t : t.tag === "defs" && (!((i = t.children) === null || i === void 0) && i.length) ? _(_({}, t), { children: t.children.map(function(r) {
432
+ return typeof r.attrs.id == "string" && n && n.indexOf(r.attrs.id) > -1 ? _(_({}, r), { attrs: _(_({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
433
+ }) }) : t;
434
+ }
435
+ function bt() {
436
+ return Math.random().toString(36).substring(2, 8);
437
+ }
438
+ Y.displayName = "UniverIcon";
439
+ var wt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.01953 3.13985C1.01953 2.77258 1.31726 2.47485 1.68453 2.47485H2.73713C3.1044 2.47485 3.40213 2.77258 3.40213 3.13985 3.40213 3.50712 3.1044 3.80485 2.73713 3.80485H1.68453C1.31726 3.80485 1.01953 3.50712 1.01953 3.13985zM4.17734 3.13985C4.17734 2.77258 4.47507 2.47485 4.84234 2.47485H6.94754C7.31481 2.47485 7.61254 2.77258 7.61254 3.13985 7.61254 3.50712 7.31481 3.80485 6.94754 3.80485H4.84234C4.47507 3.80485 4.17734 3.50712 4.17734 3.13985zM8.38775 3.13985C8.38775 2.77258 8.68548 2.47485 9.05275 2.47485H11.158C11.5252 2.47485 11.823 2.77258 11.823 3.13985 11.823 3.50712 11.5252 3.80485 11.158 3.80485H9.05275C8.68548 3.80485 8.38775 3.50712 8.38775 3.13985zM12.5982 3.13985C12.5982 2.77258 12.8959 2.47485 13.2632 2.47485H14.3158C14.683 2.47485 14.9808 2.77258 14.9808 3.13985 14.9808 3.50712 14.683 3.80485 14.3158 3.80485H13.2632C12.8959 3.80485 12.5982 3.50712 12.5982 3.13985zM1.01953 7.99972C1.01953 7.63245 1.31726 7.33472 1.68453 7.33472H14.3158C14.683 7.33472 14.9808 7.63245 14.9808 7.99972 14.9808 8.36699 14.683 8.66472 14.3158 8.66472H1.68453C1.31726 8.66472 1.01953 8.36699 1.01953 7.99972zM1.68453 12.1951C1.31726 12.1951 1.01953 12.4928 1.01953 12.8601 1.01953 13.2273 1.31726 13.5251 1.68453 13.5251H2.73713C3.1044 13.5251 3.40213 13.2273 3.40213 12.8601 3.40213 12.4928 3.1044 12.1951 2.73713 12.1951H1.68453zM4.84234 12.1951C4.47507 12.1951 4.17734 12.4928 4.17734 12.8601 4.17734 13.2273 4.47507 13.5251 4.84234 13.5251H6.94754C7.31481 13.5251 7.61254 13.2273 7.61254 12.8601 7.61254 12.4928 7.31481 12.1951 6.94754 12.1951H4.84234zM9.05275 12.1951C8.68548 12.1951 8.38775 12.4928 8.38775 12.8601 8.38775 13.2273 8.68548 13.5251 9.05275 13.5251H11.158C11.5252 13.5251 11.823 13.2273 11.823 12.8601 11.823 12.4928 11.5252 12.1951 11.158 12.1951H9.05275zM13.2632 12.1951C12.8959 12.1951 12.5982 12.4928 12.5982 12.8601 12.5982 13.2273 12.8959 13.5251 13.2632 13.5251H14.3158C14.683 13.5251 14.9808 13.2273 14.9808 12.8601 14.9808 12.4928 14.683 12.1951 14.3158 12.1951H13.2632z" } }] }, ce = J(function(t, e) {
440
+ return X(Y, Object.assign({}, t, {
441
+ id: "divider-single",
442
+ ref: e,
443
+ icon: wt
444
+ }));
445
+ });
446
+ ce.displayName = "DividerSingle";
447
+ var Rt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.00033 2.66699C8.36852 2.66699 8.66699 2.96547 8.66699 3.33366V7.33366H12.667C13.0352 7.33366 13.3337 7.63214 13.3337 8.00033C13.3337 8.36852 13.0352 8.66699 12.667 8.66699H8.66699V12.667C8.66699 13.0352 8.36852 13.3337 8.00033 13.3337C7.63214 13.3337 7.33366 13.0352 7.33366 12.667V8.66699H3.33366C2.96547 8.66699 2.66699 8.36852 2.66699 8.00033C2.66699 7.63214 2.96547 7.33366 3.33366 7.33366H7.33366V3.33366C7.33366 2.96547 7.63214 2.66699 8.00033 2.66699Z", fillRule: "evenodd", clipRule: "evenodd" } }] }, Re = J(function(t, e) {
448
+ return X(Y, Object.assign({}, t, {
449
+ id: "plus-single",
450
+ ref: e,
451
+ icon: Rt
452
+ }));
453
+ });
454
+ Re.displayName = "PlusSingle";
455
+ var kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.66695 1.33496C2.29968 1.33496 2.00195 1.63269 2.00195 1.99996V3.64439C2.00195 4.01166 2.29968 4.30939 2.66695 4.30939C3.03422 4.30939 3.33195 4.01166 3.33195 3.64439V2.66496H7.33521V13.335H5.3337C4.96643 13.335 4.6687 13.6327 4.6687 14C4.6687 14.3672 4.96643 14.665 5.3337 14.665H10.667C11.0343 14.665 11.332 14.3672 11.332 14C11.332 13.6327 11.0343 13.335 10.667 13.335H8.66521V2.66496H12.6686V3.64439C12.6686 4.01166 12.9664 4.30939 13.3336 4.30939C13.7009 4.30939 13.9986 4.01166 13.9986 3.64439V1.99996C13.9986 1.63269 13.7009 1.33496 13.3336 1.33496H2.66695Z" } }] }, ae = J(function(t, e) {
456
+ return X(Y, Object.assign({}, t, {
457
+ id: "text-single",
458
+ ref: e,
459
+ icon: kt
460
+ }));
461
+ });
462
+ ae.displayName = "TextSingle";
463
+ const q = ({
464
+ className: t = ""
465
+ }) => {
466
+ const e = S(C), i = S(pe), n = S(le), r = R(se(() => i.getCurrentTypeOfUnit$(Q.UNIVER_DOC), [i])), s = r && n.getRenderById(r.getUnitId()), c = s == null ? void 0 : s.with(he), u = R(c == null ? void 0 : c.hoverParagraph$), o = R(c == null ? void 0 : c.hoverParagraphLeft$), a = () => {
467
+ var I;
468
+ const d = u != null ? u : o;
469
+ if (!d)
470
+ return;
471
+ const p = e.resolvePopup("/");
472
+ p && e.showPopup({
473
+ popup: p,
474
+ index: d.startIndex - 1,
475
+ unitId: (I = r == null ? void 0 : r.getUnitId()) != null ? I : ""
476
+ });
477
+ };
478
+ return /* @__PURE__ */ h(
479
+ "div",
480
+ {
481
+ className: `
482
+ univer-mr-1 univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-full
483
+ univer-border univer-border-gray-200 univer-bg-white univer-p-1.5 univer-shadow-sm
484
+ hover:univer-bg-gray-100
485
+ ${t}
486
+ `,
487
+ onClick: a,
488
+ role: "button",
489
+ tabIndex: 0,
490
+ children: /* @__PURE__ */ h(Re, { className: "univer-text-gray-800" })
491
+ }
492
+ );
493
+ };
494
+ q.componentKey = "doc.quick-insert.button";
495
+ var Dt = Object.getOwnPropertyDescriptor, $t = (t, e, i, n) => {
496
+ for (var r = n > 1 ? void 0 : n ? Dt(e, i) : e, s = t.length - 1, c; s >= 0; s--)
497
+ (c = t[s]) && (r = c(r) || r);
498
+ return r;
499
+ }, ie = (t, e) => (i, n) => e(i, n, t);
500
+ let de = class extends Z {
501
+ constructor(e, i, n, r) {
502
+ super();
503
+ g(this, "_popup", null);
504
+ this._context = e, this._docEventManagerService = i, this._docQuickInsertPopupService = n, this._docCanvasPopManagerService = r, this._init();
391
505
  }
392
- }, k = {
393
- type: b.OPERATION,
394
- id: "doc.operation.close-quick-insert-popup",
395
- handler(t) {
396
- return t.get(C).closePopup(), !0;
506
+ _init() {
507
+ this.disposeWithMe(ye([this._docEventManagerService.hoverParagraphLeft$, this._docEventManagerService.hoverParagraph$]).subscribe(([e, i]) => {
508
+ var r;
509
+ const n = e != null ? e : i;
510
+ if (!n) {
511
+ this._hideMenu(!0);
512
+ return;
513
+ }
514
+ if (n.paragraphStart === n.paragraphEnd && n.startIndex !== ((r = this._popup) == null ? void 0 : r.startIndex)) {
515
+ this._hideMenu(!0);
516
+ const s = this._docCanvasPopManagerService.attachPopupToRect(n.firstLine, {
517
+ componentKey: q.componentKey,
518
+ direction: "left-center"
519
+ }, this._context.unit.getUnitId());
520
+ this._popup = {
521
+ startIndex: n.startIndex,
522
+ disposable: s
523
+ };
524
+ } else
525
+ this._hideMenu(!0);
526
+ }));
527
+ }
528
+ _hideMenu(e) {
529
+ this._popup && (e || this._popup.disposable.canDispose()) && (this._popup.disposable.dispose(), this._popup = null);
397
530
  }
398
- }, Ce = {
531
+ };
532
+ de = $t([
533
+ ie(1, f(he)),
534
+ ie(2, f(C)),
535
+ ie(3, f(Pe))
536
+ ], de);
537
+ const ke = {
399
538
  id: "quick-insert.text.menu",
400
539
  title: "docQuickInsert.menu.text",
401
540
  icon: "TextSingle",
402
541
  keywords: ["text"]
403
- }, Ie = {
404
- id: Ge.id,
542
+ }, De = {
543
+ id: tt.id,
405
544
  title: "docQuickInsert.menu.numberedList",
406
545
  icon: "OrderSingle",
407
546
  keywords: ["numbered", "list", "ordered"]
408
- }, Se = {
409
- id: Ze.id,
547
+ }, $e = {
548
+ id: nt.id,
410
549
  title: "docQuickInsert.menu.bulletedList",
411
550
  icon: "UnorderSingle",
412
551
  keywords: ["bulleted", "list", "unordered"]
413
- }, ye = {
414
- id: Je.id,
552
+ }, Ne = {
553
+ id: it.id,
415
554
  title: "docQuickInsert.menu.divider",
416
555
  icon: "DividerSingle",
417
556
  keywords: ["divider", "line", "separate"]
418
- }, Oe = {
419
- id: Xe.id,
557
+ }, Ee = {
558
+ id: rt.id,
420
559
  title: "docQuickInsert.menu.table",
421
560
  icon: "GridSingle",
422
561
  keywords: ["table", "grid", "spreadsheet"]
423
- }, Pe = {
424
- id: je.id,
562
+ }, Ue = {
563
+ id: Ge.id,
425
564
  title: "docQuickInsert.menu.image",
426
565
  icon: "addition-and-subtraction-single",
427
566
  keywords: ["image", "picture", "photo"]
428
- }, _t = [
567
+ }, Nt = [
429
568
  {
430
569
  title: "docQuickInsert.group.basics",
431
570
  id: "quick.insert.group.basic",
432
571
  children: [
433
- Ce,
434
- Ie,
435
- Se,
436
- ye,
437
- Oe,
438
- Pe
572
+ ke,
573
+ De,
574
+ $e,
575
+ Ne,
576
+ Ee,
577
+ Ue
439
578
  ]
440
579
  }
441
- ], Ct = /* @__PURE__ */ new Set([
442
- Ie.id,
443
- Se.id,
444
- ye.id,
445
- Oe.id,
446
- Pe.id
580
+ ], Et = /* @__PURE__ */ new Set([
581
+ De.id,
582
+ $e.id,
583
+ Ne.id,
584
+ Ee.id,
585
+ Ue.id
447
586
  ]);
448
- var It = Object.getOwnPropertyDescriptor, St = (t, e, i, n) => {
449
- for (var r = n > 1 ? void 0 : n ? It(e, i) : e, s = t.length - 1, a; s >= 0; s--)
450
- (a = t[s]) && (r = a(r) || r);
587
+ var Ut = Object.getOwnPropertyDescriptor, Tt = (t, e, i, n) => {
588
+ for (var r = n > 1 ? void 0 : n ? Ut(e, i) : e, s = t.length - 1, c; s >= 0; s--)
589
+ (c = t[s]) && (r = c(r) || r);
451
590
  return r;
452
- }, R = (t, e) => (i, n) => e(i, n, t);
453
- let K = class extends Y {
591
+ }, E = (t, e) => (i, n) => e(i, n, t);
592
+ let z = class extends Z {
454
593
  constructor(t, e, i, n, r) {
455
594
  super(), this._commandService = t, this._textSelectionManagerService = e, this._docQuickInsertPopupService = i, this._shortcutService = n, this._univerInstanceService = r, this.disposeWithMe(this._shortcutService.registerShortcut({
456
- id: k.id,
457
- binding: O.ESC,
595
+ id: U.id,
596
+ binding: M.ESC,
458
597
  preconditions: () => !!this._docQuickInsertPopupService.editPopup,
459
598
  priority: 1e3
460
599
  })), this._initTrigger(), this._initMenuHandler();
@@ -464,10 +603,10 @@ let K = class extends Y {
464
603
  this.disposeWithMe(
465
604
  // eslint-disable-next-line complexity, max-lines-per-function
466
605
  this._commandService.onCommandExecuted((t) => {
467
- var s, a, d;
468
- const { _docQuickInsertPopupService: e, _textSelectionManagerService: i, _commandService: n } = this, r = this._univerInstanceService.getCurrentUnitOfType(ee.UNIVER_DOC);
606
+ var s, c, u;
607
+ const { _docQuickInsertPopupService: e, _textSelectionManagerService: i, _commandService: n } = this, r = this._univerInstanceService.getCurrentUnitOfType(Q.UNIVER_DOC);
469
608
  if (!(r != null && r.getDisabled())) {
470
- if (t.id === Ye.id) {
609
+ if (t.id === st.id) {
471
610
  const o = t.params;
472
611
  if (e.editPopup) {
473
612
  e.setInputOffset({
@@ -476,47 +615,47 @@ let K = class extends Y {
476
615
  });
477
616
  return;
478
617
  }
479
- const c = i.getActiveTextRange();
480
- if (!c)
618
+ const a = i.getActiveTextRange();
619
+ if (!a)
481
620
  return;
482
- const u = e.resolvePopup(o.body.dataStream);
483
- if (!u || !(u.preconditions ? u.preconditions(o) : !0))
621
+ const d = e.resolvePopup(o.body.dataStream);
622
+ if (!d || !(d.preconditions ? d.preconditions(o) : !0))
484
623
  return;
485
- e.setInputOffset({ start: c.startOffset - 1, end: c.startOffset }), setTimeout(() => {
486
- n.executeCommand(_e.id, {
487
- index: c.startOffset - 1,
624
+ e.setInputOffset({ start: a.startOffset - 1, end: a.startOffset }), setTimeout(() => {
625
+ n.executeCommand(xe.id, {
626
+ index: a.startOffset - 1,
488
627
  unitId: o.unitId,
489
- popup: u
628
+ popup: d
490
629
  });
491
630
  }, 100);
492
631
  }
493
- if (t.id === et.id) {
632
+ if (t.id === ot.id) {
494
633
  const o = t.params;
495
634
  !e.isComposing && o.isCompositionStart && e.setIsComposing(!0), e.isComposing && o.isCompositionEnd && e.setIsComposing(!1);
496
635
  }
497
- if (t.id === Be.id) {
636
+ if (t.id === ft.id) {
498
637
  const o = t.params;
499
638
  if (o.isCompositionEnd) {
500
- const c = (a = (s = o.textRanges) == null ? void 0 : s[0]) == null ? void 0 : a.endOffset;
501
- c && e.setInputOffset({ start: e.inputOffset.start, end: c });
639
+ const a = (c = (s = o.textRanges) == null ? void 0 : s[0]) == null ? void 0 : c.endOffset;
640
+ a && e.setInputOffset({ start: e.inputOffset.start, end: a });
502
641
  }
503
642
  }
504
- if (t.id === tt.id) {
643
+ if (t.id === ct.id) {
505
644
  const o = t.params;
506
- if (e.editPopup && o.direction === Te.LEFT) {
507
- const c = (d = o.len) != null ? d : 0;
508
- e.setInputOffset({ start: e.inputOffset.start, end: o.range.endOffset - c });
645
+ if (e.editPopup && o.direction === We.LEFT) {
646
+ const a = (u = o.len) != null ? u : 0;
647
+ e.setInputOffset({ start: e.inputOffset.start, end: o.range.endOffset - a });
509
648
  }
510
649
  }
511
- if (t.id === nt.id) {
650
+ if (t.id === at.id) {
512
651
  const o = t.params;
513
- (o.direction === T.LEFT || o.direction === T.RIGHT) && e.editPopup && n.executeCommand(k.id);
652
+ (o.direction === A.LEFT || o.direction === A.RIGHT) && e.editPopup && n.executeCommand(U.id);
514
653
  }
515
- if (t.id === it.id) {
654
+ if (t.id === dt.id) {
516
655
  const o = i.getActiveTextRange();
517
656
  if (!e.editPopup || !o)
518
657
  return;
519
- o.endOffset <= e.editPopup.anchor && n.executeCommand(k.id);
658
+ o.endOffset <= e.editPopup.anchor && n.executeCommand(U.id);
520
659
  }
521
660
  }
522
661
  })
@@ -524,110 +663,49 @@ let K = class extends Y {
524
663
  }
525
664
  _initMenuHandler() {
526
665
  this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected((t) => {
527
- t.id !== Ce.id && Ct.has(t.id) && this._commandService.executeCommand(t.id);
666
+ t.id !== ke.id && Et.has(t.id) && this._commandService.executeCommand(t.id);
528
667
  }));
529
668
  }
530
669
  };
531
- K = St([
532
- R(0, D),
533
- R(1, g(me)),
534
- R(2, g(C)),
535
- R(3, g(he)),
536
- R(4, g(pe))
537
- ], K);
538
- var v = function() {
539
- return v = Object.assign || function(t) {
540
- for (var e, i = 1, n = arguments.length; i < n; i++) {
541
- e = arguments[i];
542
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
543
- }
544
- return t;
545
- }, v.apply(this, arguments);
546
- }, yt = function(t, e) {
547
- var i = {};
548
- for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
549
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
550
- for (var r = 0, n = Object.getOwnPropertySymbols(t); r < n.length; r++)
551
- e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[r]) && (i[n[r]] = t[n[r]]);
552
- return i;
553
- }, ie = te(function(t, e) {
554
- var i = t.icon, n = t.id, r = t.className, s = t.extend, a = yt(t, ["icon", "id", "className", "extend"]), d = "univerjs-icon univerjs-icon-".concat(n, " ").concat(r || "").trim(), o = $("_".concat(bt()));
555
- return be(i, "".concat(n), { defIds: i.defIds, idSuffix: o.current }, v({ ref: e, className: d }, a), s);
556
- });
557
- function be(t, e, i, n, r) {
558
- return ne(t.tag, v(v({ key: e }, Ot(t, i, r)), n), (Pt(t, i).children || []).map(function(s, a) {
559
- return be(s, "".concat(e, "-").concat(t.tag, "-").concat(a), i, void 0, r);
560
- }));
561
- }
562
- function Ot(t, e, i) {
563
- var n = v({}, t.attrs);
564
- i != null && i.colorChannel1 && n.fill === "colorChannel1" && (n.fill = i.colorChannel1), t.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(s) {
565
- var a = s[0], d = s[1];
566
- a === "mask" && typeof d == "string" && (n[a] = d.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
567
- });
568
- var r = e.defIds;
569
- return !r || r.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(s) {
570
- var a = s[0], d = s[1];
571
- typeof d == "string" && (n[a] = d.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
572
- })), n;
573
- }
574
- function Pt(t, e) {
575
- var i, n = e.defIds;
576
- return !n || n.length === 0 ? t : t.tag === "defs" && (!((i = t.children) === null || i === void 0) && i.length) ? v(v({}, t), { children: t.children.map(function(r) {
577
- return typeof r.attrs.id == "string" && n && n.indexOf(r.attrs.id) > -1 ? v(v({}, r), { attrs: v(v({}, r.attrs), { id: r.attrs.id + e.idSuffix }) }) : r;
578
- }) }) : t;
579
- }
580
- function bt() {
581
- return Math.random().toString(36).substring(2, 8);
582
- }
583
- ie.displayName = "UniverIcon";
584
- var xt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.01953 3.13985C1.01953 2.77258 1.31726 2.47485 1.68453 2.47485H2.73713C3.1044 2.47485 3.40213 2.77258 3.40213 3.13985 3.40213 3.50712 3.1044 3.80485 2.73713 3.80485H1.68453C1.31726 3.80485 1.01953 3.50712 1.01953 3.13985zM4.17734 3.13985C4.17734 2.77258 4.47507 2.47485 4.84234 2.47485H6.94754C7.31481 2.47485 7.61254 2.77258 7.61254 3.13985 7.61254 3.50712 7.31481 3.80485 6.94754 3.80485H4.84234C4.47507 3.80485 4.17734 3.50712 4.17734 3.13985zM8.38775 3.13985C8.38775 2.77258 8.68548 2.47485 9.05275 2.47485H11.158C11.5252 2.47485 11.823 2.77258 11.823 3.13985 11.823 3.50712 11.5252 3.80485 11.158 3.80485H9.05275C8.68548 3.80485 8.38775 3.50712 8.38775 3.13985zM12.5982 3.13985C12.5982 2.77258 12.8959 2.47485 13.2632 2.47485H14.3158C14.683 2.47485 14.9808 2.77258 14.9808 3.13985 14.9808 3.50712 14.683 3.80485 14.3158 3.80485H13.2632C12.8959 3.80485 12.5982 3.50712 12.5982 3.13985zM1.01953 7.99972C1.01953 7.63245 1.31726 7.33472 1.68453 7.33472H14.3158C14.683 7.33472 14.9808 7.63245 14.9808 7.99972 14.9808 8.36699 14.683 8.66472 14.3158 8.66472H1.68453C1.31726 8.66472 1.01953 8.36699 1.01953 7.99972zM1.68453 12.1951C1.31726 12.1951 1.01953 12.4928 1.01953 12.8601 1.01953 13.2273 1.31726 13.5251 1.68453 13.5251H2.73713C3.1044 13.5251 3.40213 13.2273 3.40213 12.8601 3.40213 12.4928 3.1044 12.1951 2.73713 12.1951H1.68453zM4.84234 12.1951C4.47507 12.1951 4.17734 12.4928 4.17734 12.8601 4.17734 13.2273 4.47507 13.5251 4.84234 13.5251H6.94754C7.31481 13.5251 7.61254 13.2273 7.61254 12.8601 7.61254 12.4928 7.31481 12.1951 6.94754 12.1951H4.84234zM9.05275 12.1951C8.68548 12.1951 8.38775 12.4928 8.38775 12.8601 8.38775 13.2273 8.68548 13.5251 9.05275 13.5251H11.158C11.5252 13.5251 11.823 13.2273 11.823 12.8601 11.823 12.4928 11.5252 12.1951 11.158 12.1951H9.05275zM13.2632 12.1951C12.8959 12.1951 12.5982 12.4928 12.5982 12.8601 12.5982 13.2273 12.8959 13.5251 13.2632 13.5251H14.3158C14.683 13.5251 14.9808 13.2273 14.9808 12.8601 14.9808 12.4928 14.683 12.1951 14.3158 12.1951H13.2632z" } }] }, Z = te(function(t, e) {
585
- return ne(ie, Object.assign({}, t, {
586
- id: "divider-single",
587
- ref: e,
588
- icon: xt
589
- }));
590
- });
591
- Z.displayName = "DividerSingle";
592
- var Mt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.66695 1.33496C2.29968 1.33496 2.00195 1.63269 2.00195 1.99996V3.64439C2.00195 4.01166 2.29968 4.30939 2.66695 4.30939C3.03422 4.30939 3.33195 4.01166 3.33195 3.64439V2.66496H7.33521V13.335H5.3337C4.96643 13.335 4.6687 13.6327 4.6687 14C4.6687 14.3672 4.96643 14.665 5.3337 14.665H10.667C11.0343 14.665 11.332 14.3672 11.332 14C11.332 13.6327 11.0343 13.335 10.667 13.335H8.66521V2.66496H12.6686V3.64439C12.6686 4.01166 12.9664 4.30939 13.3336 4.30939C13.7009 4.30939 13.9986 4.01166 13.9986 3.64439V1.99996C13.9986 1.63269 13.7009 1.33496 13.3336 1.33496H2.66695Z" } }] }, J = te(function(t, e) {
593
- return ne(ie, Object.assign({}, t, {
594
- id: "text-single",
595
- ref: e,
596
- icon: Mt
597
- }));
598
- });
599
- J.displayName = "TextSingle";
600
- var wt = Object.getOwnPropertyDescriptor, Rt = (t, e, i, n) => {
601
- for (var r = n > 1 ? void 0 : n ? wt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
602
- (a = t[s]) && (r = a(r) || r);
670
+ z = Tt([
671
+ E(0, T),
672
+ E(1, f(Oe)),
673
+ E(2, f(C)),
674
+ E(3, f(Se)),
675
+ E(4, f(pe))
676
+ ], z);
677
+ var Qt = Object.getOwnPropertyDescriptor, Ht = (t, e, i, n) => {
678
+ for (var r = n > 1 ? void 0 : n ? Qt(e, i) : e, s = t.length - 1, c; s >= 0; s--)
679
+ (c = t[s]) && (r = c(r) || r);
603
680
  return r;
604
- }, F = (t, e) => (i, n) => e(i, n, t);
605
- let j = class extends Y {
681
+ }, re = (t, e) => (i, n) => e(i, n, t);
682
+ let F = class extends Z {
606
683
  constructor(t, e, i) {
607
684
  super(), this._commandService = t, this._docQuickInsertPopupService = e, this._componentManager = i, this._initCommands(), this._initComponents(), this._initMenus();
608
685
  }
609
686
  _initCommands() {
610
687
  [
611
- ve,
612
- _e,
613
- k
688
+ Me,
689
+ xe,
690
+ U
614
691
  ].forEach((t) => {
615
692
  this.disposeWithMe(this._commandService.registerCommand(t));
616
693
  });
617
694
  }
618
695
  _initComponents() {
619
696
  [
620
- [H.componentKey, H],
621
- [U.componentKey, U],
622
- [Q.componentKey, Q],
623
- [Z.displayName, Z],
624
- [J.displayName, J]
697
+ [V.componentKey, V],
698
+ [B.componentKey, B],
699
+ [W.componentKey, W],
700
+ [ce.displayName, ce],
701
+ [ae.displayName, ae],
702
+ [q.componentKey, q]
625
703
  ].forEach(([e, i]) => {
626
704
  e && this.disposeWithMe(this._componentManager.register(e, i));
627
705
  }), [
628
706
  {
629
707
  keyword: "/",
630
- menus$: at(_t),
708
+ menus$: lt(Nt),
631
709
  // only show when the cursor is at the beginning of a line
632
710
  preconditions: (e) => {
633
711
  var i;
@@ -641,43 +719,48 @@ let j = class extends Y {
641
719
  _initMenus() {
642
720
  }
643
721
  };
644
- j = Rt([
645
- F(0, D),
646
- F(1, g(C)),
647
- F(2, g(fe))
648
- ], j);
649
- var kt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, Nt = (t, e, i) => e in t ? kt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, Et = (t, e, i, n) => {
650
- for (var r = n > 1 ? void 0 : n ? Dt(e, i) : e, s = t.length - 1, a; s >= 0; s--)
651
- (a = t[s]) && (r = a(r) || r);
722
+ F = Ht([
723
+ re(0, T),
724
+ re(1, f(C)),
725
+ re(2, f(Ie))
726
+ ], F);
727
+ var Kt = Object.defineProperty, jt = Object.getOwnPropertyDescriptor, Lt = (t, e, i) => e in t ? Kt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, At = (t, e, i, n) => {
728
+ for (var r = n > 1 ? void 0 : n ? jt(e, i) : e, s = t.length - 1, c; s >= 0; s--)
729
+ (c = t[s]) && (r = c(r) || r);
652
730
  return r;
653
- }, $t = (t, e) => (i, n) => e(i, n, t), xe = (t, e, i) => Nt(t, typeof e != "symbol" ? e + "" : e, i);
654
- const Tt = "DOC_QUICK_INSERT_UI_PLUGIN";
655
- let A = class extends He {
656
- constructor(t) {
657
- super(), this._injector = t;
731
+ }, Ce = (t, e) => (i, n) => e(i, n, t), Te = (t, e, i) => Lt(t, typeof e != "symbol" ? e + "" : e, i);
732
+ const Bt = "DOC_QUICK_INSERT_UI_PLUGIN";
733
+ let G = class extends ze {
734
+ constructor(t, e) {
735
+ super(), this._injector = t, this._renderManagerSrv = e;
658
736
  }
659
737
  onStarting() {
660
738
  [
661
- [j],
662
- [K],
739
+ [F],
740
+ [z],
663
741
  [C]
664
- ].forEach((e) => this._injector.add(e)), this._injector.get(j);
742
+ ].forEach((e) => this._injector.add(e)), this._injector.get(F);
665
743
  }
666
744
  onRendered() {
667
- this._injector.get(K), this._injector.get(C);
745
+ this._injector.get(z), this._injector.get(C), [
746
+ [de]
747
+ ].forEach((t) => {
748
+ this._renderManagerSrv.registerRenderModule(Q.UNIVER_DOC, t);
749
+ });
668
750
  }
669
751
  };
670
- xe(A, "type", ee.UNIVER_DOC);
671
- xe(A, "pluginName", Tt);
672
- A = Et([
673
- Ue(We, Le, Ae, Ke, qe),
674
- $t(0, g(Qe))
675
- ], A);
752
+ Te(G, "type", Q.UNIVER_DOC);
753
+ Te(G, "pluginName", Bt);
754
+ G = At([
755
+ Ve(Xe, Je, Ze, Fe, Ye),
756
+ Ce(0, f(qe)),
757
+ Ce(1, f(le))
758
+ ], G);
676
759
  export {
677
760
  C as DocQuickInsertPopupService,
678
- K as DocQuickInsertTriggerController,
679
- j as DocQuickInsertUIController,
680
- ft as KeywordInputPlaceholderComponentKey,
681
- ht as QuickInsertPlaceholderComponentKey,
682
- A as UniverDocsQuickInsertUIPlugin
761
+ z as DocQuickInsertTriggerController,
762
+ F as DocQuickInsertUIController,
763
+ Ct as KeywordInputPlaceholderComponentKey,
764
+ It as QuickInsertPlaceholderComponentKey,
765
+ G as UniverDocsQuickInsertUIPlugin
683
766
  };