@univerjs/docs-quick-insert-ui 0.8.2 → 0.8.3-nightly.202506271607

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/index.js CHANGED
@@ -1,25 +1,25 @@
1
- var Le = Object.defineProperty;
2
- var je = (t, e, r) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var C = (t, e, r) => je(t, typeof e != "symbol" ? e + "" : e, r);
4
- import { CommandType as D, ICommandService as H, RANGE_DIRECTION as Ae, LocaleService as pe, generateRandomId as Be, DisposableCollection as We, toDisposable as qe, Direction as W, Inject as f, IUniverInstanceService as le, Disposable as X, UniverInstanceType as K, DeleteDirection as Ze, DependentOn as Ve, Injector as Fe, Plugin as Ge } from "@univerjs/core";
5
- import { UniverDocsDrawingPlugin as ze } from "@univerjs/docs-drawing";
6
- import { InsertDocImageCommand as Je, UniverDocsDrawingUIPlugin as Xe } from "@univerjs/docs-drawing-ui";
7
- import { UniverDrawingPlugin as Ye } from "@univerjs/drawing";
8
- import { UniverDrawingUIPlugin as et } from "@univerjs/drawing-ui";
9
- import { IRenderManagerService as he } from "@univerjs/engine-render";
10
- import { useDependency as I, KeyCode as M, ComponentManager as ye, IShortcutService as Se, useObservable as U, ILayoutService as tt, useEvent as nt, UniverUIPlugin as rt } from "@univerjs/ui";
11
- import { CutContentCommand as it, DocCanvasPopManagerService as Pe, DocEventManagerService as xe, OrderListCommand as st, BulletListCommand as ot, HorizontalLineCommand as ct, DocCreateTableOperation as at, InsertCommand as dt, IMEInputCommand as ut, DeleteCommand as pt, MoveCursorOperation as lt, DeleteLeftCommand as ht } from "@univerjs/docs-ui";
12
- import { map as Oe, distinctUntilChanged as ft, tap as L, combineLatest as fe, BehaviorSubject as A, of as vt } from "rxjs";
13
- import { DocSelectionManagerService as ve, DocSkeletonManagerService as mt, RichTextEditingMutation as gt } from "@univerjs/docs";
14
- import { jsx as h, jsxs as ge } from "react/jsx-runtime";
15
- import { Menu as Ct, clsx as se, scrollbarClassName as _t, MenuItemGroup as It, MenuItem as yt, Tooltip as St, borderClassName as Pt } from "@univerjs/design";
16
- import { useMemo as oe, useState as Ce, useRef as B, useEffect as j, forwardRef as Y, createElement as ee } from "react";
17
- const be = {
1
+ var je = Object.defineProperty;
2
+ var Ae = (t, e, r) => e in t ? je(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
+ var _ = (t, e, r) => Ae(t, typeof e != "symbol" ? e + "" : e, r);
4
+ import { CommandType as D, ICommandService as H, RANGE_DIRECTION as Be, LocaleService as le, generateRandomId as We, DisposableCollection as qe, toDisposable as Ze, Direction as W, Inject as f, IUniverInstanceService as he, Disposable as J, UniverInstanceType as K, DeleteDirection as Ve, DependentOn as Fe, Injector as Ge, IConfigService as ze, Plugin as Ye, merge as Je } from "@univerjs/core";
5
+ import { DocSelectionManagerService as fe, DocSkeletonManagerService as Xe, RichTextEditingMutation as et } from "@univerjs/docs";
6
+ import { CutContentCommand as tt, DocCanvasPopManagerService as ye, DocEventManagerService as Pe, OrderListCommand as nt, BulletListCommand as rt, HorizontalLineCommand as it, DocCreateTableOperation as ot, InsertCommand as st, IMEInputCommand as ct, DeleteCommand as at, MoveCursorOperation as dt, DeleteLeftCommand as ut } from "@univerjs/docs-ui";
7
+ import { useDependency as I, KeyCode as M, ComponentManager as xe, IShortcutService as Oe, useObservable as T, ILayoutService as pt, useEvent as lt, UniverUIPlugin as ht } from "@univerjs/ui";
8
+ import { IRenderManagerService as ve } from "@univerjs/engine-render";
9
+ import { map as be, distinctUntilChanged as ft, tap as L, combineLatest as ge, BehaviorSubject as A, of as vt } from "rxjs";
10
+ import { jsx as h, jsxs as _e } from "react/jsx-runtime";
11
+ import { Menu as gt, clsx as se, scrollbarClassName as mt, MenuItemGroup as _t, MenuItem as Ct, Tooltip as It, borderClassName as St } from "@univerjs/design";
12
+ import { useMemo as ce, useState as Ce, useRef as B, useEffect as j, forwardRef as X, createElement as ee } from "react";
13
+ import { InsertDocImageCommand as yt, UniverDocsDrawingUIPlugin as Pt } from "@univerjs/docs-drawing-ui";
14
+ import { UniverDocsDrawingPlugin as xt } from "@univerjs/docs-drawing";
15
+ import { UniverDrawingPlugin as Ot } from "@univerjs/drawing";
16
+ import { UniverDrawingUIPlugin as bt } from "@univerjs/drawing-ui";
17
+ const Me = {
18
18
  id: "doc.command.delete-search-key",
19
19
  type: D.COMMAND,
20
20
  handler: (t, e) => {
21
21
  const r = t.get(H), { start: n, end: i } = e;
22
- return r.syncExecuteCommand(it.id, {
22
+ return r.syncExecuteCommand(tt.id, {
23
23
  segmentId: "",
24
24
  textRanges: [{
25
25
  startOffset: n,
@@ -30,30 +30,17 @@ const be = {
30
30
  startOffset: n,
31
31
  endOffset: i,
32
32
  collapsed: !1,
33
- direction: Ae.FORWARD
33
+ direction: Be.FORWARD
34
34
  }]
35
35
  });
36
36
  }
37
- }, xt = "docs.quick.insert.keyword-input-placeholder", q = () => {
38
- const t = I(pe);
37
+ }, Mt = "docs.quick.insert.keyword-input-placeholder", q = () => {
38
+ const t = I(le);
39
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
- q.componentKey = xt;
42
- const Me = {
43
- type: D.OPERATION,
44
- id: "doc.operation.show-quick-insert-popup",
45
- handler(t, e) {
46
- const r = t.get(y);
47
- return e ? (r.showPopup(e), !0) : !1;
48
- }
49
- }, Q = {
50
- type: D.OPERATION,
51
- id: "doc.operation.close-quick-insert-popup",
52
- handler(t) {
53
- return t.get(y).closePopup(), !0;
54
- }
55
- }, Ot = "docs.quick.insert.placeholder", Z = () => {
56
- const t = I(pe);
41
+ q.componentKey = Mt;
42
+ const wt = "docs.quick.insert.placeholder", Z = () => {
43
+ const t = I(le);
57
44
  return /* @__PURE__ */ h(
58
45
  "div",
59
46
  {
@@ -62,11 +49,11 @@ const Me = {
62
49
  }
63
50
  );
64
51
  };
65
- Z.componentKey = Ot;
66
- function ce(t, e) {
52
+ Z.componentKey = wt;
53
+ function ae(t, e) {
67
54
  return t.map((r) => ({ ...r })).filter((r) => {
68
55
  if ("children" in r)
69
- return r.children = ce(r.children, e), r.children.length > 0;
56
+ return r.children = ae(r.children, e), r.children.length > 0;
70
57
  const n = r.keywords;
71
58
  return n ? n.some((i) => i.includes(e)) : r.title.toLowerCase().includes(e);
72
59
  });
@@ -77,38 +64,38 @@ function we(t, e) {
77
64
  return "children" in n && (n.children = we(n.children, e)), n.title = e.t(n.title), "keywords" in n && (n.keywords = n.keywords.concat(n.title).map((i) => i.toLowerCase())), n;
78
65
  });
79
66
  }
80
- const bt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
81
- const t = I(pe), e = I(y), r = I(ye), n = I(Se), i = I(H), s = oe(() => Be(), []), [c, u] = Ce(0), o = B(null), a = B(0);
67
+ const kt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
68
+ const t = I(le), e = I(S), r = I(xe), n = I(Oe), i = I(H), o = ce(() => We(), []), [c, u] = Ce(0), s = B(null), a = B(0);
82
69
  a.current = 0;
83
- const d = U(e.filterKeyword$, ""), p = U(e.editPopup$), v = U(p == null ? void 0 : p.popup.menus$, []), S = oe(() => we(v, t), [v]), [w, P] = Ce(() => ce(S, d.toLowerCase()));
70
+ const d = T(e.filterKeyword$, ""), p = T(e.editPopup$), v = T(p == null ? void 0 : p.popup.menus$, []), y = ce(() => we(v, t), [v]), [w, P] = Ce(() => ae(y, d.toLowerCase()));
84
71
  j(() => {
85
- const m = requestIdleCallback(() => {
86
- P(ce(S, d.toLowerCase()));
72
+ const g = requestIdleCallback(() => {
73
+ P(ae(y, d.toLowerCase()));
87
74
  });
88
75
  return () => {
89
- cancelIdleCallback(m);
76
+ cancelIdleCallback(g);
90
77
  };
91
- }, [S, d]);
92
- const x = (m) => {
93
- e.emitMenuSelected(m), i.executeCommand(Q.id);
78
+ }, [y, d]);
79
+ const x = (g) => {
80
+ e.emitMenuSelected(g), i.executeCommand(Q.id);
94
81
  };
95
82
  j(() => {
96
- const m = new We();
97
- n.getAllShortcuts().filter((l) => l.binding && bt.includes(l.binding)).forEach((l) => {
83
+ const g = new qe();
84
+ n.getAllShortcuts().filter((l) => l.binding && kt.includes(l.binding)).forEach((l) => {
98
85
  const b = l.preconditions;
99
- l.preconditions = () => !1, m.add(qe(() => {
86
+ l.preconditions = () => !1, g.add(Ze(() => {
100
87
  l.preconditions = b;
101
88
  }));
102
89
  });
103
90
  const O = {
104
- id: `quick.insert.popup.enter.${s}`,
91
+ id: `quick.insert.popup.enter.${o}`,
105
92
  type: D.OPERATION,
106
93
  handler: () => {
107
- const l = o.current;
94
+ const l = s.current;
108
95
  l && x(l);
109
96
  }
110
97
  }, N = {
111
- id: `quick.insert.popup.move.cursor.up.${s}`,
98
+ id: `quick.insert.popup.move.cursor.up.${o}`,
112
99
  type: D.OPERATION,
113
100
  handler: () => {
114
101
  u((l) => {
@@ -117,7 +104,7 @@ const bt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
117
104
  });
118
105
  }
119
106
  }, R = {
120
- id: `quick.insert.popup.move.cursor.down.${s}`,
107
+ id: `quick.insert.popup.move.cursor.down.${o}`,
121
108
  type: D.OPERATION,
122
109
  handler: () => {
123
110
  u((l) => {
@@ -126,7 +113,7 @@ const bt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
126
113
  });
127
114
  }
128
115
  };
129
- return m.add(i.registerCommand(N)), m.add(i.registerCommand(R)), m.add(i.registerCommand(O)), m.add(n.registerShortcut({
116
+ return g.add(i.registerCommand(N)), g.add(i.registerCommand(R)), g.add(i.registerCommand(O)), g.add(n.registerShortcut({
130
117
  priority: 1e3,
131
118
  id: N.id,
132
119
  binding: M.ARROW_UP,
@@ -134,7 +121,7 @@ const bt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
134
121
  staticParameters: {
135
122
  direction: W.UP
136
123
  }
137
- })), m.add(n.registerShortcut({
124
+ })), g.add(n.registerShortcut({
138
125
  priority: 1e3,
139
126
  id: R.id,
140
127
  binding: M.ARROW_DOWN,
@@ -142,13 +129,13 @@ const bt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
142
129
  staticParameters: {
143
130
  direction: W.DOWN
144
131
  }
145
- })), m.add(n.registerShortcut({
132
+ })), g.add(n.registerShortcut({
146
133
  priority: 1e3,
147
134
  id: O.id,
148
135
  binding: M.ENTER,
149
136
  preconditions: () => !0
150
137
  })), () => {
151
- m.dispose();
138
+ g.dispose();
152
139
  };
153
140
  }, []), j(() => {
154
141
  u(0);
@@ -157,40 +144,40 @@ const bt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
157
144
  j(() => () => {
158
145
  k.current.clear();
159
146
  }, []);
160
- function $(m) {
161
- return m.map((g) => {
162
- const ne = g.icon, O = ne ? r.get(ne) : null;
163
- if ("children" in g)
147
+ function $(g) {
148
+ return g.map((m) => {
149
+ const ne = m.icon, O = ne ? r.get(ne) : null;
150
+ if ("children" in m)
164
151
  return /* @__PURE__ */ h(
165
- It,
152
+ _t,
166
153
  {
167
- title: /* @__PURE__ */ ge(
154
+ title: /* @__PURE__ */ _e(
168
155
  "div",
169
156
  {
170
157
  className: "univer-mb-2 univer-flex univer-items-center univer-text-xs univer-text-gray-400",
171
158
  children: [
172
159
  O && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(O, {}) }),
173
- /* @__PURE__ */ h("span", { children: g.title })
160
+ /* @__PURE__ */ h("span", { children: m.title })
174
161
  ]
175
162
  }
176
163
  ),
177
- children: $(g.children)
164
+ children: $(m.children)
178
165
  },
179
- g.id
166
+ m.id
180
167
  );
181
168
  const N = a.current, R = c === N;
182
169
  if (R) {
183
- o.current = g;
184
- const l = k.current.get(g.id);
170
+ s.current = m;
171
+ const l = k.current.get(m.id);
185
172
  l == null || l.scrollIntoView({
186
173
  block: "nearest"
187
174
  });
188
175
  }
189
176
  return a.current++, /* @__PURE__ */ h(
190
- yt,
177
+ Ct,
191
178
  {
192
179
  ref: (l) => {
193
- l && k.current.set(g.id, l);
180
+ l && k.current.set(m.id, l);
194
181
  },
195
182
  onMouseEnter: () => u(N),
196
183
  onMouseLeave: () => u(Number.NaN),
@@ -199,83 +186,83 @@ const bt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], V = () => {
199
186
  "univer-bg-gray-100 dark:!univer-bg-gray-500": R
200
187
  }),
201
188
  onClick: () => {
202
- x(g);
189
+ x(m);
203
190
  },
204
- children: /* @__PURE__ */ ge(
191
+ children: /* @__PURE__ */ _e(
205
192
  "div",
206
193
  {
207
194
  className: "univer-flex univer-w-full univer-items-center univer-px-1",
208
195
  children: [
209
196
  O && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(O, {}) }),
210
- /* @__PURE__ */ h(St, { showIfEllipsis: !0, title: g.title, placement: "right", children: /* @__PURE__ */ h("span", { className: "univer-truncate", children: g.title }) })
197
+ /* @__PURE__ */ h(It, { showIfEllipsis: !0, title: m.title, placement: "right", children: /* @__PURE__ */ h("span", { className: "univer-truncate", children: m.title }) })
211
198
  ]
212
199
  }
213
200
  )
214
201
  },
215
- g.id
202
+ m.id
216
203
  );
217
204
  });
218
205
  }
219
- const Ke = w.length > 0, me = (p == null ? void 0 : p.popup.Placeholder) || r.get(Z.componentKey);
220
- return /* @__PURE__ */ h("div", { className: "univer-mt-2", children: Ke ? /* @__PURE__ */ h(
221
- Ct,
206
+ const Le = w.length > 0, me = (p == null ? void 0 : p.popup.Placeholder) || r.get(Z.componentKey);
207
+ return /* @__PURE__ */ h("div", { className: "univer-mt-2", children: Le ? /* @__PURE__ */ h(
208
+ gt,
222
209
  {
223
- wrapperClass: se("univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto univer-overflow-x-hidden", _t),
210
+ wrapperClass: se("univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto univer-overflow-x-hidden", mt),
224
211
  children: $(w)
225
212
  }
226
213
  ) : me && /* @__PURE__ */ h(me, {}) });
227
214
  };
228
215
  V.componentKey = "docs.quick.insert.popup";
229
- var Mt = Object.getOwnPropertyDescriptor, wt = (t, e, r, n) => {
230
- for (var i = n > 1 ? void 0 : n ? Mt(e, r) : e, s = t.length - 1, c; s >= 0; s--)
231
- (c = t[s]) && (i = c(i) || i);
216
+ var Rt = Object.getOwnPropertyDescriptor, Dt = (t, e, r, n) => {
217
+ for (var i = n > 1 ? void 0 : n ? Rt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
218
+ (c = t[o]) && (i = c(i) || i);
232
219
  return i;
233
220
  }, E = (t, e) => (r, n) => e(r, n, t);
234
- const _e = {
221
+ const Ie = {
235
222
  dispose: () => {
236
223
  }
237
224
  };
238
- let y = class extends X {
239
- constructor(e, r, n, i, s) {
225
+ let S = class extends J {
226
+ constructor(e, r, n, i, o) {
240
227
  super();
241
- C(this, "_popups", /* @__PURE__ */ new Set());
242
- C(this, "_editPopup$", new A(void 0));
243
- C(this, "editPopup$", this._editPopup$.asObservable());
244
- C(this, "_isComposing$", new A(!1));
245
- C(this, "isComposing$", this._isComposing$.asObservable());
246
- C(this, "_inputOffset$", new A({ start: 0, end: 0 }));
247
- C(this, "inputOffset$", this._inputOffset$.asObservable());
248
- C(this, "filterKeyword$");
249
- C(this, "_menuSelectedCallbacks", /* @__PURE__ */ new Set());
250
- C(this, "_inputPlaceholderRenderRoot", null);
251
- this._docCanvasPopupManagerService = e, this._univerInstanceService = r, this._commandService = n, this._renderManagerService = i, this._docSelectionManagerService = s, this.disposeWithMe(this._editPopup$);
252
- const c = (o, a) => {
228
+ _(this, "_popups", /* @__PURE__ */ new Set());
229
+ _(this, "_editPopup$", new A(void 0));
230
+ _(this, "editPopup$", this._editPopup$.asObservable());
231
+ _(this, "_isComposing$", new A(!1));
232
+ _(this, "isComposing$", this._isComposing$.asObservable());
233
+ _(this, "_inputOffset$", new A({ start: 0, end: 0 }));
234
+ _(this, "inputOffset$", this._inputOffset$.asObservable());
235
+ _(this, "filterKeyword$");
236
+ _(this, "_menuSelectedCallbacks", /* @__PURE__ */ new Set());
237
+ _(this, "_inputPlaceholderRenderRoot", null);
238
+ this._docCanvasPopupManagerService = e, this._univerInstanceService = r, this._commandService = n, this._renderManagerService = i, this._docSelectionManagerService = o, this.disposeWithMe(this._editPopup$);
239
+ const c = (s, a) => {
253
240
  var d, p;
254
- return (p = (d = this._univerInstanceService.getCurrentUnitOfType(K.UNIVER_DOC)) == null ? void 0 : d.getBody()) == null ? void 0 : p.dataStream.slice(o, a);
241
+ return (p = (d = this._univerInstanceService.getCurrentUnitOfType(K.UNIVER_DOC)) == null ? void 0 : d.getBody()) == null ? void 0 : p.dataStream.slice(s, a);
255
242
  };
256
243
  let u = "";
257
244
  this.filterKeyword$ = this._inputOffset$.pipe(
258
- Oe((o) => {
245
+ be((s) => {
259
246
  var d;
260
- const a = c(o.start, o.end);
247
+ const a = c(s.start, s.end);
261
248
  return (d = a == null ? void 0 : a.slice(1)) != null ? d : "";
262
249
  }),
263
250
  ft(),
264
- L((o) => {
265
- u = o;
251
+ L((s) => {
252
+ u = s;
266
253
  })
267
- ), this.disposeWithMe(fe([
268
- this.filterKeyword$.pipe(L((o) => {
254
+ ), this.disposeWithMe(ge([
255
+ this.filterKeyword$.pipe(L((s) => {
269
256
  var a, d, p;
270
- o.length > 0 ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : (p = this._inputPlaceholderRenderRoot) == null || p.mount();
257
+ s.length > 0 ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : (p = this._inputPlaceholderRenderRoot) == null || p.mount();
271
258
  })),
272
- this.isComposing$.pipe(L((o) => {
259
+ this.isComposing$.pipe(L((s) => {
273
260
  var a, d, p;
274
- o ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : u.length <= 0 && ((p = this._inputPlaceholderRenderRoot) == null || p.mount());
261
+ s ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : u.length <= 0 && ((p = this._inputPlaceholderRenderRoot) == null || p.mount());
275
262
  })),
276
- this.editPopup$.pipe(L((o) => {
263
+ this.editPopup$.pipe(L((s) => {
277
264
  var a, d;
278
- o || ((d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose(), this._inputPlaceholderRenderRoot = null);
265
+ s || ((d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose(), this._inputPlaceholderRenderRoot = null);
279
266
  }))
280
267
  ]).subscribe());
281
268
  }
@@ -299,7 +286,7 @@ let y = class extends X {
299
286
  }
300
287
  getDocEventManagerService(e) {
301
288
  var r;
302
- return (r = this._renderManagerService.getRenderById(e)) == null ? void 0 : r.with(xe);
289
+ return (r = this._renderManagerService.getRenderById(e)) == null ? void 0 : r.with(Pe);
303
290
  }
304
291
  resolvePopup(e) {
305
292
  return Array.from(this._popups).find((r) => r.keyword === e);
@@ -329,20 +316,20 @@ let y = class extends X {
329
316
  var d, p;
330
317
  const { popup: r, index: n, unitId: i } = e;
331
318
  this.closePopup();
332
- const s = this._univerInstanceService.getUnit(i), c = (p = (d = s == null ? void 0 : s.getBody()) == null ? void 0 : d.paragraphs) == null ? void 0 : p.find((v) => v.startIndex > n);
319
+ const o = this._univerInstanceService.getUnit(i), c = (p = (d = o == null ? void 0 : o.getBody()) == null ? void 0 : d.paragraphs) == null ? void 0 : p.find((v) => v.startIndex > n);
333
320
  if (!c)
334
321
  return;
335
- const u = this.getDocEventManagerService(i), o = u == null ? void 0 : u.findParagraphBoundByIndex(c.startIndex);
336
- if (!o)
322
+ const u = this.getDocEventManagerService(i), s = u == null ? void 0 : u.findParagraphBoundByIndex(c.startIndex);
323
+ if (!s)
337
324
  return;
338
325
  this._inputPlaceholderRenderRoot = this._createInputPlaceholderRenderRoot(() => {
339
326
  var $;
340
- const v = ($ = this._renderManagerService.getRenderById(i)) == null ? void 0 : $.with(mt), S = this._docSelectionManagerService.getActiveTextRange();
341
- if (!v || !S)
342
- return _e;
343
- const P = v.getSkeleton().findNodeByCharIndex(S.startOffset, S.segmentId, S.segmentPage);
327
+ const v = ($ = this._renderManagerService.getRenderById(i)) == null ? void 0 : $.with(Xe), y = this._docSelectionManagerService.getActiveTextRange();
328
+ if (!v || !y)
329
+ return Ie;
330
+ const P = v.getSkeleton().findNodeByCharIndex(y.startOffset, y.segmentId, y.segmentPage);
344
331
  if (!((P == null ? void 0 : P.content) === "\r"))
345
- return _e;
332
+ return Ie;
346
333
  const k = this._docCanvasPopupManagerService.attachPopupToRange(
347
334
  { startOffset: n + 1, endOffset: n + 1, collapsed: !1 },
348
335
  {
@@ -357,7 +344,7 @@ let y = class extends X {
357
344
  return k;
358
345
  }), this._inputPlaceholderRenderRoot.mount();
359
346
  const a = this._docCanvasPopupManagerService.attachPopupToRect(
360
- o.firstLine,
347
+ s.firstLine,
361
348
  {
362
349
  componentKey: V.componentKey,
363
350
  onClickOutside: () => {
@@ -379,7 +366,7 @@ let y = class extends X {
379
366
  }
380
367
  emitMenuSelected(e) {
381
368
  const { start: r, end: n } = this.inputOffset;
382
- this._commandService.syncExecuteCommand(be.id, {
369
+ this._commandService.syncExecuteCommand(Me.id, {
383
370
  start: r,
384
371
  end: n
385
372
  }), setTimeout(() => {
@@ -387,92 +374,57 @@ let y = class extends X {
387
374
  }, 0);
388
375
  }
389
376
  };
390
- y = wt([
391
- E(0, f(Pe)),
392
- E(1, f(le)),
377
+ S = Dt([
378
+ E(0, f(ye)),
379
+ E(1, f(he)),
393
380
  E(2, f(H)),
394
- E(3, f(he)),
395
- E(4, f(ve))
396
- ], y);
397
- const ke = "doc.quick-insert.button";
398
- var kt = Object.getOwnPropertyDescriptor, Rt = (t, e, r, n) => {
399
- for (var i = n > 1 ? void 0 : n ? kt(e, r) : e, s = t.length - 1, c; s >= 0; s--)
400
- (c = t[s]) && (i = c(i) || i);
401
- return i;
402
- }, re = (t, e) => (r, n) => e(r, n, t);
403
- let F = class extends X {
404
- constructor(e, r, n, i) {
405
- super();
406
- C(this, "_popup$", new A(null));
407
- C(this, "popup$", this._popup$.asObservable());
408
- this._context = e, this._docEventManagerService = r, this._docQuickInsertPopupService = n, this._docCanvasPopManagerService = i, this._init();
409
- }
410
- get popup() {
411
- return this._popup$.value;
412
- }
413
- _init() {
414
- this.disposeWithMe(fe([this._docEventManagerService.hoverParagraphLeftRealTime$, this._docEventManagerService.hoverParagraphRealTime$]).subscribe(([e, r]) => {
415
- var s;
416
- const n = e != null ? e : r, i = this._context.unit.getDisabled();
417
- if (!n || i) {
418
- this._hideMenu(!0);
419
- return;
420
- }
421
- if (n.paragraphStart === n.paragraphEnd) {
422
- if (this._docQuickInsertPopupService.editPopup || n.startIndex === ((s = this.popup) == null ? void 0 : s.startIndex)) return;
423
- this._hideMenu(!0);
424
- const c = this._docCanvasPopManagerService.attachPopupToRect(n.firstLine, {
425
- componentKey: ke,
426
- direction: "left-center"
427
- }, this._context.unit.getUnitId());
428
- this._popup$.next({
429
- startIndex: n.startIndex,
430
- disposable: c
431
- });
432
- } else
433
- this._hideMenu(!0);
434
- }));
381
+ E(3, f(ve)),
382
+ E(4, f(fe))
383
+ ], S);
384
+ const ke = {
385
+ type: D.OPERATION,
386
+ id: "doc.operation.show-quick-insert-popup",
387
+ handler(t, e) {
388
+ const r = t.get(S);
389
+ return e ? (r.showPopup(e), !0) : !1;
435
390
  }
436
- _hideMenu(e) {
437
- this._docQuickInsertPopupService.editPopup || this.popup && (e || this.popup.disposable.canDispose()) && (this.popup.disposable.dispose(), this._popup$.next(null));
391
+ }, Q = {
392
+ type: D.OPERATION,
393
+ id: "doc.operation.close-quick-insert-popup",
394
+ handler(t) {
395
+ return t.get(S).closePopup(), !0;
438
396
  }
439
- };
440
- F = Rt([
441
- re(1, f(xe)),
442
- re(2, f(y)),
443
- re(3, f(Pe))
444
- ], F);
445
- const Re = {
397
+ }, Re = {
446
398
  id: "quick-insert.text.menu",
447
399
  title: "docQuickInsert.menu.text",
448
400
  icon: "TextIcon",
449
401
  keywords: ["text"]
450
402
  }, De = {
451
- id: st.id,
403
+ id: nt.id,
452
404
  title: "docQuickInsert.menu.numberedList",
453
405
  icon: "OrderIcon",
454
406
  keywords: ["numbered", "list", "ordered"]
455
407
  }, $e = {
456
- id: ot.id,
408
+ id: rt.id,
457
409
  title: "docQuickInsert.menu.bulletedList",
458
410
  icon: "UnorderIcon",
459
411
  keywords: ["bulleted", "list", "unordered"]
460
412
  }, Ne = {
461
- id: ct.id,
413
+ id: it.id,
462
414
  title: "docQuickInsert.menu.divider",
463
415
  icon: "DividerIcon",
464
416
  keywords: ["divider", "line", "separate"]
465
417
  }, Ee = {
466
- id: at.id,
418
+ id: ot.id,
467
419
  title: "docQuickInsert.menu.table",
468
420
  icon: "GridIcon",
469
421
  keywords: ["table", "grid", "spreadsheet"]
470
- }, Te = {
471
- id: Je.id,
422
+ }, Ue = {
423
+ id: yt.id,
472
424
  title: "docQuickInsert.menu.image",
473
425
  icon: "AdditionAndSubtractionIcon",
474
426
  keywords: ["image", "picture", "photo"]
475
- }, Dt = [
427
+ }, $t = [
476
428
  {
477
429
  title: "docQuickInsert.group.basics",
478
430
  id: "quick.insert.group.basic",
@@ -482,22 +434,22 @@ const Re = {
482
434
  $e,
483
435
  Ne,
484
436
  Ee,
485
- Te
437
+ Ue
486
438
  ]
487
439
  }
488
- ], $t = /* @__PURE__ */ new Set([
440
+ ], Nt = /* @__PURE__ */ new Set([
489
441
  De.id,
490
442
  $e.id,
491
443
  Ne.id,
492
444
  Ee.id,
493
- Te.id
445
+ Ue.id
494
446
  ]);
495
- var Nt = Object.getOwnPropertyDescriptor, Et = (t, e, r, n) => {
496
- for (var i = n > 1 ? void 0 : n ? Nt(e, r) : e, s = t.length - 1, c; s >= 0; s--)
497
- (c = t[s]) && (i = c(i) || i);
447
+ var Et = Object.getOwnPropertyDescriptor, Ut = (t, e, r, n) => {
448
+ for (var i = n > 1 ? void 0 : n ? Et(e, r) : e, o = t.length - 1, c; o >= 0; o--)
449
+ (c = t[o]) && (i = c(i) || i);
498
450
  return i;
499
- }, T = (t, e) => (r, n) => e(r, n, t);
500
- let G = class extends X {
451
+ }, U = (t, e) => (r, n) => e(r, n, t);
452
+ let F = class extends J {
501
453
  constructor(t, e, r, n, i) {
502
454
  super(), this._commandService = t, this._textSelectionManagerService = e, this._docQuickInsertPopupService = r, this._shortcutService = n, this._univerInstanceService = i, this.disposeWithMe(this._shortcutService.registerShortcut({
503
455
  id: Q.id,
@@ -511,59 +463,59 @@ let G = class extends X {
511
463
  this.disposeWithMe(
512
464
  // eslint-disable-next-line complexity, max-lines-per-function
513
465
  this._commandService.onCommandExecuted((t) => {
514
- var s, c, u;
466
+ var o, c, u;
515
467
  const { _docQuickInsertPopupService: e, _textSelectionManagerService: r, _commandService: n } = this, i = this._univerInstanceService.getCurrentUnitOfType(K.UNIVER_DOC);
516
468
  if (!(i != null && i.getDisabled())) {
517
- if (t.id === dt.id) {
518
- const o = t.params;
469
+ if (t.id === st.id) {
470
+ const s = t.params;
519
471
  if (e.editPopup) {
520
472
  e.setInputOffset({
521
473
  start: e.inputOffset.start,
522
- end: o.range.endOffset + 1
474
+ end: s.range.endOffset + 1
523
475
  });
524
476
  return;
525
477
  }
526
478
  const a = r.getActiveTextRange();
527
479
  if (!a)
528
480
  return;
529
- const d = e.resolvePopup(o.body.dataStream);
530
- if (!d || !(d.preconditions ? d.preconditions(o) : !0))
481
+ const d = e.resolvePopup(s.body.dataStream);
482
+ if (!d || !(d.preconditions ? d.preconditions(s) : !0))
531
483
  return;
532
484
  e.setInputOffset({ start: a.startOffset - 1, end: a.startOffset }), setTimeout(() => {
533
- n.executeCommand(Me.id, {
485
+ n.executeCommand(ke.id, {
534
486
  index: a.startOffset - 1,
535
- unitId: o.unitId,
487
+ unitId: s.unitId,
536
488
  popup: d
537
489
  });
538
490
  }, 100);
539
491
  }
540
- if (t.id === ut.id) {
541
- const o = t.params;
542
- !e.isComposing && o.isCompositionStart && e.setIsComposing(!0), e.isComposing && o.isCompositionEnd && e.setIsComposing(!1);
492
+ if (t.id === ct.id) {
493
+ const s = t.params;
494
+ !e.isComposing && s.isCompositionStart && e.setIsComposing(!0), e.isComposing && s.isCompositionEnd && e.setIsComposing(!1);
543
495
  }
544
- if (t.id === gt.id) {
545
- const o = t.params;
546
- if (o.isCompositionEnd) {
547
- const a = (c = (s = o.textRanges) == null ? void 0 : s[0]) == null ? void 0 : c.endOffset;
496
+ if (t.id === et.id) {
497
+ const s = t.params;
498
+ if (s.isCompositionEnd) {
499
+ const a = (c = (o = s.textRanges) == null ? void 0 : o[0]) == null ? void 0 : c.endOffset;
548
500
  a && e.setInputOffset({ start: e.inputOffset.start, end: a });
549
501
  }
550
502
  }
551
- if (t.id === pt.id) {
552
- const o = t.params;
553
- if (e.editPopup && o.direction === Ze.LEFT) {
554
- const a = (u = o.len) != null ? u : 0;
555
- e.setInputOffset({ start: e.inputOffset.start, end: o.range.endOffset - a });
503
+ if (t.id === at.id) {
504
+ const s = t.params;
505
+ if (e.editPopup && s.direction === Ve.LEFT) {
506
+ const a = (u = s.len) != null ? u : 0;
507
+ e.setInputOffset({ start: e.inputOffset.start, end: s.range.endOffset - a });
556
508
  }
557
509
  }
558
- if (t.id === lt.id) {
559
- const o = t.params;
560
- (o.direction === W.LEFT || o.direction === W.RIGHT) && e.editPopup && n.executeCommand(Q.id);
510
+ if (t.id === dt.id) {
511
+ const s = t.params;
512
+ (s.direction === W.LEFT || s.direction === W.RIGHT) && e.editPopup && n.executeCommand(Q.id);
561
513
  }
562
- if (t.id === ht.id) {
563
- const o = r.getActiveTextRange();
564
- if (!e.editPopup || !o)
514
+ if (t.id === ut.id) {
515
+ const s = r.getActiveTextRange();
516
+ if (!e.editPopup || !s)
565
517
  return;
566
- o.endOffset <= e.editPopup.anchor && n.executeCommand(Q.id);
518
+ s.endOffset <= e.editPopup.anchor && n.executeCommand(Q.id);
567
519
  }
568
520
  }
569
521
  })
@@ -571,25 +523,25 @@ let G = class extends X {
571
523
  }
572
524
  _initMenuHandler() {
573
525
  this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected((t) => {
574
- t.id !== Re.id && $t.has(t.id) && this._commandService.executeCommand(t.id);
526
+ t.id !== Re.id && Nt.has(t.id) && this._commandService.executeCommand(t.id);
575
527
  }));
576
528
  }
577
529
  };
578
- G = Et([
579
- T(0, H),
580
- T(1, f(ve)),
581
- T(2, f(y)),
582
- T(3, f(Se)),
583
- T(4, f(le))
584
- ], G);
585
- var _ = function() {
586
- return _ = Object.assign || function(t) {
530
+ F = Ut([
531
+ U(0, H),
532
+ U(1, f(fe)),
533
+ U(2, f(S)),
534
+ U(3, f(Oe)),
535
+ U(4, f(he))
536
+ ], F);
537
+ var C = function() {
538
+ return C = Object.assign || function(t) {
587
539
  for (var e, r = 1, n = arguments.length; r < n; r++) {
588
540
  e = arguments[r];
589
541
  for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
590
542
  }
591
543
  return t;
592
- }, _.apply(this, arguments);
544
+ }, C.apply(this, arguments);
593
545
  }, Tt = function(t, e) {
594
546
  var r = {};
595
547
  for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
@@ -597,74 +549,122 @@ var _ = function() {
597
549
  for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++)
598
550
  e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]);
599
551
  return r;
600
- }, te = Y(function(t, e) {
601
- var r = t.icon, n = t.id, i = t.className, s = t.extend, c = Tt(t, ["icon", "id", "className", "extend"]), u = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), o = B("_".concat(Ht()));
602
- return Ue(r, "".concat(n), { defIds: r.defIds, idSuffix: o.current }, _({ ref: e, className: u }, c), s);
552
+ }, te = X(function(t, e) {
553
+ var r = t.icon, n = t.id, i = t.className, o = t.extend, c = Tt(t, ["icon", "id", "className", "extend"]), u = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), s = B("_".concat(Kt()));
554
+ return Te(r, "".concat(n), { defIds: r.defIds, idSuffix: s.current }, C({ ref: e, className: u }, c), o);
603
555
  });
604
- function Ue(t, e, r, n, i) {
605
- return ee(t.tag, _(_({ key: e }, Ut(t, r, i)), n), (Qt(t, r).children || []).map(function(s, c) {
606
- return Ue(s, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i);
556
+ function Te(t, e, r, n, i) {
557
+ return ee(t.tag, C(C({ key: e }, Qt(t, r, i)), n), (Ht(t, r).children || []).map(function(o, c) {
558
+ return Te(o, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i);
607
559
  }));
608
560
  }
609
- function Ut(t, e, r) {
610
- var n = _({}, t.attrs);
611
- r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), t.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(s) {
612
- var c = s[0], u = s[1];
561
+ function Qt(t, e, r) {
562
+ var n = C({}, t.attrs);
563
+ r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1), t.tag === "mask" && n.id && (n.id = n.id + e.idSuffix), Object.entries(n).forEach(function(o) {
564
+ var c = o[0], u = o[1];
613
565
  c === "mask" && typeof u == "string" && (n[c] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
614
566
  });
615
567
  var i = e.defIds;
616
- return !i || i.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(s) {
617
- var c = s[0], u = s[1];
568
+ return !i || i.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(o) {
569
+ var c = o[0], u = o[1];
618
570
  typeof u == "string" && (n[c] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
619
571
  })), n;
620
572
  }
621
- function Qt(t, e) {
573
+ function Ht(t, e) {
622
574
  var r, n = e.defIds;
623
- return !n || n.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? _(_({}, t), { children: t.children.map(function(i) {
624
- return typeof i.attrs.id == "string" && n && n.includes(i.attrs.id) ? _(_({}, i), { attrs: _(_({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
575
+ return !n || n.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? C(C({}, t), { children: t.children.map(function(i) {
576
+ return typeof i.attrs.id == "string" && n && n.includes(i.attrs.id) ? C(C({}, i), { attrs: C(C({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
625
577
  }) }) : t;
626
578
  }
627
- function Ht() {
579
+ function Kt() {
628
580
  return Math.random().toString(36).substring(2, 8);
629
581
  }
630
582
  te.displayName = "UniverIcon";
631
- var Kt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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.13985C3.40213 3.50712 3.1044 3.80485 2.73713 3.80485H1.68453C1.31726 3.80485 1.01953 3.50712 1.01953 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.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.13985C7.61254 3.50712 7.31481 3.80485 6.94754 3.80485H4.84234C4.47507 3.80485 4.17734 3.50712 4.17734 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.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.13985C11.823 3.50712 11.5252 3.80485 11.158 3.80485H9.05275C8.68548 3.80485 8.38775 3.50712 8.38775 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.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.13985C14.9808 3.50712 14.683 3.80485 14.3158 3.80485H13.2632C12.8959 3.80485 12.5982 3.50712 12.5982 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.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.99972C14.9808 8.36699 14.683 8.66472 14.3158 8.66472H1.68453C1.31726 8.66472 1.01953 8.36699 1.01953 7.99972Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.68453 12.1951C1.31726 12.1951 1.01953 12.4928 1.01953 12.8601C1.01953 13.2273 1.31726 13.5251 1.68453 13.5251H2.73713C3.1044 13.5251 3.40213 13.2273 3.40213 12.8601C3.40213 12.4928 3.1044 12.1951 2.73713 12.1951H1.68453Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.84234 12.1951C4.47507 12.1951 4.17734 12.4928 4.17734 12.8601C4.17734 13.2273 4.47507 13.5251 4.84234 13.5251H6.94754C7.31481 13.5251 7.61254 13.2273 7.61254 12.8601C7.61254 12.4928 7.31481 12.1951 6.94754 12.1951H4.84234Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M9.05275 12.1951C8.68548 12.1951 8.38775 12.4928 8.38775 12.8601C8.38775 13.2273 8.68548 13.5251 9.05275 13.5251H11.158C11.5252 13.5251 11.823 13.2273 11.823 12.8601C11.823 12.4928 11.5252 12.1951 11.158 12.1951H9.05275Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M13.2632 12.1951C12.8959 12.1951 12.5982 12.4928 12.5982 12.8601C12.5982 13.2273 12.8959 13.5251 13.2632 13.5251H14.3158C14.683 13.5251 14.9808 13.2273 14.9808 12.8601C14.9808 12.4928 14.683 12.1951 14.3158 12.1951H13.2632Z" } }] }, ae = Y(function(t, e) {
583
+ var Lt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", 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.13985C3.40213 3.50712 3.1044 3.80485 2.73713 3.80485H1.68453C1.31726 3.80485 1.01953 3.50712 1.01953 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.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.13985C7.61254 3.50712 7.31481 3.80485 6.94754 3.80485H4.84234C4.47507 3.80485 4.17734 3.50712 4.17734 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M8.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.13985C11.823 3.50712 11.5252 3.80485 11.158 3.80485H9.05275C8.68548 3.80485 8.38775 3.50712 8.38775 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.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.13985C14.9808 3.50712 14.683 3.80485 14.3158 3.80485H13.2632C12.8959 3.80485 12.5982 3.50712 12.5982 3.13985Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.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.99972C14.9808 8.36699 14.683 8.66472 14.3158 8.66472H1.68453C1.31726 8.66472 1.01953 8.36699 1.01953 7.99972Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.68453 12.1951C1.31726 12.1951 1.01953 12.4928 1.01953 12.8601C1.01953 13.2273 1.31726 13.5251 1.68453 13.5251H2.73713C3.1044 13.5251 3.40213 13.2273 3.40213 12.8601C3.40213 12.4928 3.1044 12.1951 2.73713 12.1951H1.68453Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.84234 12.1951C4.47507 12.1951 4.17734 12.4928 4.17734 12.8601C4.17734 13.2273 4.47507 13.5251 4.84234 13.5251H6.94754C7.31481 13.5251 7.61254 13.2273 7.61254 12.8601C7.61254 12.4928 7.31481 12.1951 6.94754 12.1951H4.84234Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M9.05275 12.1951C8.68548 12.1951 8.38775 12.4928 8.38775 12.8601C8.38775 13.2273 8.68548 13.5251 9.05275 13.5251H11.158C11.5252 13.5251 11.823 13.2273 11.823 12.8601C11.823 12.4928 11.5252 12.1951 11.158 12.1951H9.05275Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M13.2632 12.1951C12.8959 12.1951 12.5982 12.4928 12.5982 12.8601C12.5982 13.2273 12.8959 13.5251 13.2632 13.5251H14.3158C14.683 13.5251 14.9808 13.2273 14.9808 12.8601C14.9808 12.4928 14.683 12.1951 14.3158 12.1951H13.2632Z" } }] }, de = X(function(t, e) {
632
584
  return ee(te, Object.assign({}, t, {
633
585
  id: "divider-icon",
634
586
  ref: e,
635
- icon: Kt
587
+ icon: Lt
636
588
  }));
637
589
  });
638
- ae.displayName = "DividerIcon";
639
- var Lt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, Qe = Y(function(t, e) {
590
+ de.displayName = "DividerIcon";
591
+ var jt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] }, Qe = X(function(t, e) {
640
592
  return ee(te, Object.assign({}, t, {
641
593
  id: "increase-icon",
642
594
  ref: e,
643
- icon: Lt
595
+ icon: jt
644
596
  }));
645
597
  });
646
598
  Qe.displayName = "IncreaseIcon";
647
- var jt = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#text-icon_clip0_1293_26)" }, children: [{ tag: "path", attrs: { d: "M2.22891 2.07227C1.89754 2.07227 1.62891 2.34089 1.62891 2.67227C1.62891 3.00364 1.89754 3.27227 2.22891 3.27227H6.29541V14.0056C6.29541 14.337 6.56404 14.6056 6.89541 14.6056C7.22678 14.6056 7.49541 14.337 7.49541 14.0056V3.27227H11.5622C11.8936 3.27227 12.1622 3.00364 12.1622 2.67227C12.1622 2.34089 11.8936 2.07227 11.5622 2.07227H2.22891Z" } }, { tag: "path", attrs: { d: "M10.2289 6.40552C9.89754 6.40552 9.62891 6.67415 9.62891 7.00552C9.62891 7.33689 9.89754 7.60552 10.2289 7.60552H12.2954V14.0055C12.2954 14.3369 12.564 14.6055 12.8954 14.6055C13.2268 14.6055 13.4954 14.3369 13.4954 14.0055V7.60552H15.5622C15.8936 7.60552 16.1622 7.33689 16.1622 7.00552C16.1622 6.67415 15.8936 6.40552 15.5622 6.40552H10.2289Z" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "text-icon_clip0_1293_26" }, children: [{ tag: "path", attrs: { fill: "white", d: "M0 0H16V16H0z", transform: "translate(.9)" } }] }] }], defIds: ["text-icon_clip0_1293_26"] }, de = Y(function(t, e) {
599
+ var At = { tag: "svg", attrs: { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "g", attrs: { fill: "currentColor", clipPath: "url(#text-icon_clip0_1293_26)" }, children: [{ tag: "path", attrs: { d: "M2.22891 2.07227C1.89754 2.07227 1.62891 2.34089 1.62891 2.67227C1.62891 3.00364 1.89754 3.27227 2.22891 3.27227H6.29541V14.0056C6.29541 14.337 6.56404 14.6056 6.89541 14.6056C7.22678 14.6056 7.49541 14.337 7.49541 14.0056V3.27227H11.5622C11.8936 3.27227 12.1622 3.00364 12.1622 2.67227C12.1622 2.34089 11.8936 2.07227 11.5622 2.07227H2.22891Z" } }, { tag: "path", attrs: { d: "M10.2289 6.40552C9.89754 6.40552 9.62891 6.67415 9.62891 7.00552C9.62891 7.33689 9.89754 7.60552 10.2289 7.60552H12.2954V14.0055C12.2954 14.3369 12.564 14.6055 12.8954 14.6055C13.2268 14.6055 13.4954 14.3369 13.4954 14.0055V7.60552H15.5622C15.8936 7.60552 16.1622 7.33689 16.1622 7.00552C16.1622 6.67415 15.8936 6.40552 15.5622 6.40552H10.2289Z" } }] }, { tag: "defs", attrs: {}, children: [{ tag: "clipPath", attrs: { id: "text-icon_clip0_1293_26" }, children: [{ tag: "path", attrs: { fill: "white", d: "M0 0H16V16H0z", transform: "translate(.9)" } }] }] }], defIds: ["text-icon_clip0_1293_26"] }, ue = X(function(t, e) {
648
600
  return ee(te, Object.assign({}, t, {
649
601
  id: "text-icon",
650
602
  ref: e,
651
- icon: jt
603
+ icon: At
652
604
  }));
653
605
  });
654
- de.displayName = "TextIcon";
655
- const ue = ({ className: t = "" }) => {
656
- const e = I(y), r = I(le), n = I(he), i = U(oe(() => r.getCurrentTypeOfUnit$(K.UNIVER_DOC), [r])), s = i && n.getRenderById(i.getUnitId()), c = s == null ? void 0 : s.with(F), u = I(tt), o = I(ve), a = U(e.editPopup$), d = nt((p) => {
606
+ ue.displayName = "TextIcon";
607
+ const He = "doc.quick-insert.button";
608
+ var Bt = Object.getOwnPropertyDescriptor, Wt = (t, e, r, n) => {
609
+ for (var i = n > 1 ? void 0 : n ? Bt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
610
+ (c = t[o]) && (i = c(i) || i);
611
+ return i;
612
+ }, re = (t, e) => (r, n) => e(r, n, t);
613
+ let G = class extends J {
614
+ constructor(e, r, n, i) {
615
+ super();
616
+ _(this, "_popup$", new A(null));
617
+ _(this, "popup$", this._popup$.asObservable());
618
+ this._context = e, this._docEventManagerService = r, this._docQuickInsertPopupService = n, this._docCanvasPopManagerService = i, this._init();
619
+ }
620
+ get popup() {
621
+ return this._popup$.value;
622
+ }
623
+ _init() {
624
+ this.disposeWithMe(ge([this._docEventManagerService.hoverParagraphLeftRealTime$, this._docEventManagerService.hoverParagraphRealTime$]).subscribe(([e, r]) => {
625
+ var o;
626
+ const n = e != null ? e : r, i = this._context.unit.getDisabled();
627
+ if (!n || i) {
628
+ this._hideMenu(!0);
629
+ return;
630
+ }
631
+ if (n.paragraphStart === n.paragraphEnd) {
632
+ if (this._docQuickInsertPopupService.editPopup || n.startIndex === ((o = this.popup) == null ? void 0 : o.startIndex)) return;
633
+ this._hideMenu(!0);
634
+ const c = this._docCanvasPopManagerService.attachPopupToRect(n.firstLine, {
635
+ componentKey: He,
636
+ direction: "left-center"
637
+ }, this._context.unit.getUnitId());
638
+ this._popup$.next({
639
+ startIndex: n.startIndex,
640
+ disposable: c
641
+ });
642
+ } else
643
+ this._hideMenu(!0);
644
+ }));
645
+ }
646
+ _hideMenu(e) {
647
+ this._docQuickInsertPopupService.editPopup || this.popup && (e || this.popup.disposable.canDispose()) && (this.popup.disposable.dispose(), this._popup$.next(null));
648
+ }
649
+ };
650
+ G = Wt([
651
+ re(1, f(Pe)),
652
+ re(2, f(S)),
653
+ re(3, f(ye))
654
+ ], G);
655
+ const pe = ({ className: t = "" }) => {
656
+ const e = I(S), r = I(he), n = I(ve), i = T(ce(() => r.getCurrentTypeOfUnit$(K.UNIVER_DOC), [r])), o = i && n.getRenderById(i.getUnitId()), c = o == null ? void 0 : o.with(G), u = I(pt), s = I(fe), a = T(e.editPopup$), d = lt((p) => {
657
657
  var P;
658
658
  const v = c == null ? void 0 : c.popup;
659
659
  if (!v)
660
660
  return;
661
- const S = e.popups, w = {
661
+ const y = e.popups, w = {
662
662
  keyword: "",
663
- menus$: fe(S.map((x) => x.menus$)).pipe(
664
- Oe((x) => x.flat())
663
+ menus$: ge(y.map((x) => x.menus$)).pipe(
664
+ be((x) => x.flat())
665
665
  )
666
666
  };
667
- o.replaceDocRanges([{
667
+ s.replaceDocRanges([{
668
668
  startOffset: v.startIndex,
669
669
  endOffset: v.startIndex
670
670
  }]), e.setInputOffset({ start: v.startIndex - 1, end: v.startIndex - 1 }), e.showPopup({
@@ -678,7 +678,7 @@ const ue = ({ className: t = "" }) => {
678
678
  return /* @__PURE__ */ h(
679
679
  "div",
680
680
  {
681
- className: se("univer-mr-1 univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-full univer-p-1.5 univer-shadow-sm hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700", Pt, {
681
+ className: se("univer-mr-1 univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-full univer-p-1.5 univer-shadow-sm hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700", St, {
682
682
  "univer-bg-gray-100 dark:!univer-bg-gray-700": a,
683
683
  "univer-bg-white dark:!univer-bg-gray-900": !a
684
684
  }, t),
@@ -694,20 +694,20 @@ const ue = ({ className: t = "" }) => {
694
694
  }
695
695
  );
696
696
  };
697
- ue.componentKey = ke;
698
- var At = Object.getOwnPropertyDescriptor, Bt = (t, e, r, n) => {
699
- for (var i = n > 1 ? void 0 : n ? At(e, r) : e, s = t.length - 1, c; s >= 0; s--)
700
- (c = t[s]) && (i = c(i) || i);
697
+ pe.componentKey = He;
698
+ var qt = Object.getOwnPropertyDescriptor, Zt = (t, e, r, n) => {
699
+ for (var i = n > 1 ? void 0 : n ? qt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
700
+ (c = t[o]) && (i = c(i) || i);
701
701
  return i;
702
702
  }, ie = (t, e) => (r, n) => e(r, n, t);
703
- let z = class extends X {
703
+ let z = class extends J {
704
704
  constructor(t, e, r) {
705
705
  super(), this._commandService = t, this._docQuickInsertPopupService = e, this._componentManager = r, this._initCommands(), this._initComponents(), this._initMenus();
706
706
  }
707
707
  _initCommands() {
708
708
  [
709
- be,
710
709
  Me,
710
+ ke,
711
711
  Q
712
712
  ].forEach((t) => {
713
713
  this.disposeWithMe(this._commandService.registerCommand(t));
@@ -718,15 +718,15 @@ let z = class extends X {
718
718
  [V.componentKey, V],
719
719
  [q.componentKey, q],
720
720
  [Z.componentKey, Z],
721
- [ae.displayName, ae],
722
721
  [de.displayName, de],
723
- [ue.componentKey, ue]
722
+ [ue.displayName, ue],
723
+ [pe.componentKey, pe]
724
724
  ].forEach(([e, r]) => {
725
725
  e && this.disposeWithMe(this._componentManager.register(e, r));
726
726
  }), [
727
727
  {
728
728
  keyword: "/",
729
- menus$: vt(Dt),
729
+ menus$: vt($t),
730
730
  // only show when the cursor is at the beginning of a line
731
731
  preconditions: (e) => {
732
732
  var r;
@@ -740,48 +740,56 @@ let z = class extends X {
740
740
  _initMenus() {
741
741
  }
742
742
  };
743
- z = Bt([
743
+ z = Zt([
744
744
  ie(0, H),
745
- ie(1, f(y)),
746
- ie(2, f(ye))
745
+ ie(1, f(S)),
746
+ ie(2, f(xe))
747
747
  ], z);
748
- var Wt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Zt = (t, e, r) => e in t ? Wt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Vt = (t, e, r, n) => {
749
- for (var i = n > 1 ? void 0 : n ? qt(e, r) : e, s = t.length - 1, c; s >= 0; s--)
750
- (c = t[s]) && (i = c(i) || i);
748
+ const Vt = "docs-quick-insert-ui.config", Se = {};
749
+ var Ft = Object.defineProperty, Gt = Object.getOwnPropertyDescriptor, zt = (t, e, r) => e in t ? Ft(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Yt = (t, e, r, n) => {
750
+ for (var i = n > 1 ? void 0 : n ? Gt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
751
+ (c = t[o]) && (i = c(i) || i);
751
752
  return i;
752
- }, Ie = (t, e) => (r, n) => e(r, n, t), He = (t, e, r) => Zt(t, typeof e != "symbol" ? e + "" : e, r);
753
- const Ft = "DOC_QUICK_INSERT_UI_PLUGIN";
754
- let J = class extends Ge {
755
- constructor(t, e) {
756
- super(), this._injector = t, this._renderManagerSrv = e;
753
+ }, oe = (t, e) => (r, n) => e(r, n, t), Ke = (t, e, r) => zt(t, typeof e != "symbol" ? e + "" : e, r);
754
+ const Jt = "DOC_QUICK_INSERT_UI_PLUGIN";
755
+ let Y = class extends Ye {
756
+ constructor(t = Se, e, r, n) {
757
+ super(), this._config = t, this._injector = e, this._renderManagerSrv = r, this._configService = n;
758
+ const { menu: i, ...o } = Je(
759
+ {},
760
+ Se,
761
+ this._config
762
+ );
763
+ i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Vt, o);
757
764
  }
758
765
  onStarting() {
759
766
  [
760
767
  [z],
761
- [G],
762
- [y]
768
+ [F],
769
+ [S]
763
770
  ].forEach((e) => this._injector.add(e)), this._injector.get(z);
764
771
  }
765
772
  onRendered() {
766
- this._injector.get(G), this._injector.get(y), [
767
- [F]
773
+ this._injector.get(F), this._injector.get(S), [
774
+ [G]
768
775
  ].forEach((t) => {
769
776
  this._renderManagerSrv.registerRenderModule(K.UNIVER_DOC, t);
770
777
  });
771
778
  }
772
779
  };
773
- He(J, "type", K.UNIVER_DOC);
774
- He(J, "pluginName", Ft);
775
- J = Vt([
776
- Ve(et, Ye, Xe, ze, rt),
777
- Ie(0, f(Fe)),
778
- Ie(1, f(he))
779
- ], J);
780
+ Ke(Y, "type", K.UNIVER_DOC);
781
+ Ke(Y, "pluginName", Jt);
782
+ Y = Yt([
783
+ Fe(bt, Ot, Pt, xt, ht),
784
+ oe(1, f(Ge)),
785
+ oe(2, f(ve)),
786
+ oe(3, ze)
787
+ ], Y);
780
788
  export {
781
- y as DocQuickInsertPopupService,
782
- G as DocQuickInsertTriggerController,
789
+ S as DocQuickInsertPopupService,
790
+ F as DocQuickInsertTriggerController,
783
791
  z as DocQuickInsertUIController,
784
- xt as KeywordInputPlaceholderComponentKey,
785
- Ot as QuickInsertPlaceholderComponentKey,
786
- J as UniverDocsQuickInsertUIPlugin
792
+ Mt as KeywordInputPlaceholderComponentKey,
793
+ wt as QuickInsertPlaceholderComponentKey,
794
+ Y as UniverDocsQuickInsertUIPlugin
787
795
  };