@univerjs/docs-quick-insert-ui 0.8.0-beta.0 → 0.8.0-nightly.202505271607
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +248 -248
- package/lib/index.js +248 -248
- package/lib/umd/index.js +1 -1
- package/package.json +12 -12
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as D, ICommandService as H, RANGE_DIRECTION as Ae, LocaleService as pe, generateRandomId as Be, DisposableCollection as We, toDisposable as
|
|
5
|
-
import { UniverDocsDrawingPlugin as
|
|
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
6
|
import { InsertDocImageCommand as Je, UniverDocsDrawingUIPlugin as Xe } from "@univerjs/docs-drawing-ui";
|
|
7
7
|
import { UniverDrawingPlugin as Ye } from "@univerjs/drawing";
|
|
8
8
|
import { UniverDrawingUIPlugin as et } from "@univerjs/drawing-ui";
|
|
9
9
|
import { IRenderManagerService as he } from "@univerjs/engine-render";
|
|
10
|
-
import { useDependency as I, KeyCode as M, ComponentManager as
|
|
11
|
-
import { CutContentCommand as
|
|
12
|
-
import { map as
|
|
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 ot, BulletListCommand as st, 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
13
|
import { DocSelectionManagerService as ve, DocSkeletonManagerService as mt, RichTextEditingMutation as gt } from "@univerjs/docs";
|
|
14
14
|
import { jsx as h, jsxs as ge } from "react/jsx-runtime";
|
|
15
|
-
import { clsx as
|
|
16
|
-
import { useMemo as
|
|
15
|
+
import { clsx as oe, Menu as Ct, MenuItemGroup as _t, MenuItem as It, Tooltip as yt, borderClassName as St } from "@univerjs/design";
|
|
16
|
+
import { useMemo as se, useState as Ce, useRef as B, useEffect as j, forwardRef as Y, createElement as ee } from "react";
|
|
17
17
|
const be = {
|
|
18
18
|
id: "doc.command.delete-search-key",
|
|
19
19
|
type: D.COMMAND,
|
|
20
20
|
handler: (t, e) => {
|
|
21
|
-
const
|
|
22
|
-
return
|
|
21
|
+
const r = t.get(H), { start: n, end: i } = e;
|
|
22
|
+
return r.syncExecuteCommand(it.id, {
|
|
23
23
|
segmentId: "",
|
|
24
24
|
textRanges: [{
|
|
25
25
|
startOffset: n,
|
|
@@ -28,31 +28,31 @@ const be = {
|
|
|
28
28
|
}],
|
|
29
29
|
selections: [{
|
|
30
30
|
startOffset: n,
|
|
31
|
-
endOffset:
|
|
31
|
+
endOffset: i,
|
|
32
32
|
collapsed: !1,
|
|
33
33
|
direction: Ae.FORWARD
|
|
34
34
|
}]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
}, Pt = "docs.quick.insert.keyword-input-placeholder",
|
|
37
|
+
}, Pt = "docs.quick.insert.keyword-input-placeholder", q = () => {
|
|
38
38
|
const t = I(pe);
|
|
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
|
-
|
|
41
|
+
q.componentKey = Pt;
|
|
42
42
|
const Me = {
|
|
43
43
|
type: D.OPERATION,
|
|
44
44
|
id: "doc.operation.show-quick-insert-popup",
|
|
45
45
|
handler(t, e) {
|
|
46
|
-
const
|
|
47
|
-
return e ? (
|
|
46
|
+
const r = t.get(y);
|
|
47
|
+
return e ? (r.showPopup(e), !0) : !1;
|
|
48
48
|
}
|
|
49
49
|
}, Q = {
|
|
50
50
|
type: D.OPERATION,
|
|
51
51
|
id: "doc.operation.close-quick-insert-popup",
|
|
52
52
|
handler(t) {
|
|
53
|
-
return t.get(
|
|
53
|
+
return t.get(y).closePopup(), !0;
|
|
54
54
|
}
|
|
55
|
-
},
|
|
55
|
+
}, xt = "docs.quick.insert.placeholder", Z = () => {
|
|
56
56
|
const t = I(pe);
|
|
57
57
|
return /* @__PURE__ */ h(
|
|
58
58
|
"div",
|
|
@@ -62,53 +62,53 @@ const Me = {
|
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
Z.componentKey = xt;
|
|
66
66
|
function ce(t, e) {
|
|
67
|
-
return t.map((
|
|
68
|
-
if ("children" in
|
|
69
|
-
return
|
|
70
|
-
const n =
|
|
71
|
-
return n ? n.some((
|
|
67
|
+
return t.map((r) => ({ ...r })).filter((r) => {
|
|
68
|
+
if ("children" in r)
|
|
69
|
+
return r.children = ce(r.children, e), r.children.length > 0;
|
|
70
|
+
const n = r.keywords;
|
|
71
|
+
return n ? n.some((i) => i.includes(e)) : r.title.toLowerCase().includes(e);
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
function we(t, e) {
|
|
75
|
-
return t.map((
|
|
76
|
-
const n = { ...
|
|
77
|
-
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((
|
|
75
|
+
return t.map((r) => {
|
|
76
|
+
const n = { ...r };
|
|
77
|
+
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
78
|
});
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
const t = I(pe), e = I(
|
|
80
|
+
const Ot = [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), o = se(() => Be(), []), [c, u] = Ce(0), s = B(null), a = B(0);
|
|
82
82
|
a.current = 0;
|
|
83
|
-
const d = U(e.filterKeyword$, ""), p = U(e.editPopup$), v = U(p == null ? void 0 : p.popup.menus$, []),
|
|
84
|
-
|
|
83
|
+
const d = U(e.filterKeyword$, ""), p = U(e.editPopup$), v = U(p == null ? void 0 : p.popup.menus$, []), S = se(() => we(v, t), [v]), [w, P] = Ce(() => ce(S, d.toLowerCase()));
|
|
84
|
+
j(() => {
|
|
85
85
|
const m = requestIdleCallback(() => {
|
|
86
|
-
P(ce(
|
|
86
|
+
P(ce(S, d.toLowerCase()));
|
|
87
87
|
});
|
|
88
88
|
return () => {
|
|
89
89
|
cancelIdleCallback(m);
|
|
90
90
|
};
|
|
91
|
-
}, [
|
|
92
|
-
const
|
|
93
|
-
e.emitMenuSelected(m),
|
|
91
|
+
}, [S, d]);
|
|
92
|
+
const x = (m) => {
|
|
93
|
+
e.emitMenuSelected(m), i.executeCommand(Q.id);
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
j(() => {
|
|
96
96
|
const m = new We();
|
|
97
|
-
n.getAllShortcuts().filter((l) => l.binding &&
|
|
97
|
+
n.getAllShortcuts().filter((l) => l.binding && Ot.includes(l.binding)).forEach((l) => {
|
|
98
98
|
const b = l.preconditions;
|
|
99
|
-
l.preconditions = () => !1, m.add(
|
|
99
|
+
l.preconditions = () => !1, m.add(qe(() => {
|
|
100
100
|
l.preconditions = b;
|
|
101
101
|
}));
|
|
102
102
|
});
|
|
103
|
-
const
|
|
104
|
-
id: `quick.insert.popup.enter.${
|
|
103
|
+
const O = {
|
|
104
|
+
id: `quick.insert.popup.enter.${o}`,
|
|
105
105
|
type: D.OPERATION,
|
|
106
106
|
handler: () => {
|
|
107
|
-
const l =
|
|
108
|
-
l &&
|
|
107
|
+
const l = s.current;
|
|
108
|
+
l && x(l);
|
|
109
109
|
}
|
|
110
110
|
}, E = {
|
|
111
|
-
id: `quick.insert.popup.move.cursor.up.${
|
|
111
|
+
id: `quick.insert.popup.move.cursor.up.${o}`,
|
|
112
112
|
type: D.OPERATION,
|
|
113
113
|
handler: () => {
|
|
114
114
|
u((l) => {
|
|
@@ -117,7 +117,7 @@ const xt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], z = () => {
|
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
}, R = {
|
|
120
|
-
id: `quick.insert.popup.move.cursor.down.${
|
|
120
|
+
id: `quick.insert.popup.move.cursor.down.${o}`,
|
|
121
121
|
type: D.OPERATION,
|
|
122
122
|
handler: () => {
|
|
123
123
|
u((l) => {
|
|
@@ -126,7 +126,7 @@ const xt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], z = () => {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
return m.add(
|
|
129
|
+
return m.add(i.registerCommand(E)), m.add(i.registerCommand(R)), m.add(i.registerCommand(O)), m.add(n.registerShortcut({
|
|
130
130
|
priority: 1e3,
|
|
131
131
|
id: E.id,
|
|
132
132
|
binding: M.ARROW_UP,
|
|
@@ -144,32 +144,32 @@ const xt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], z = () => {
|
|
|
144
144
|
}
|
|
145
145
|
})), m.add(n.registerShortcut({
|
|
146
146
|
priority: 1e3,
|
|
147
|
-
id:
|
|
147
|
+
id: O.id,
|
|
148
148
|
binding: M.ENTER,
|
|
149
149
|
preconditions: () => !0
|
|
150
150
|
})), () => {
|
|
151
151
|
m.dispose();
|
|
152
152
|
};
|
|
153
|
-
}, []),
|
|
153
|
+
}, []), j(() => {
|
|
154
154
|
u(0);
|
|
155
155
|
}, [w]);
|
|
156
156
|
const k = B(/* @__PURE__ */ new Map());
|
|
157
|
-
|
|
157
|
+
j(() => () => {
|
|
158
158
|
k.current.clear();
|
|
159
159
|
}, []);
|
|
160
160
|
function $(m) {
|
|
161
161
|
return m.map((g) => {
|
|
162
|
-
const ne = g.icon,
|
|
162
|
+
const ne = g.icon, O = ne ? r.get(ne) : null;
|
|
163
163
|
if ("children" in g)
|
|
164
164
|
return /* @__PURE__ */ h(
|
|
165
|
-
|
|
165
|
+
_t,
|
|
166
166
|
{
|
|
167
167
|
title: /* @__PURE__ */ ge(
|
|
168
168
|
"div",
|
|
169
169
|
{
|
|
170
170
|
className: "univer-mb-2 univer-flex univer-items-center univer-text-xs univer-text-gray-400",
|
|
171
171
|
children: [
|
|
172
|
-
|
|
172
|
+
O && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(O, {}) }),
|
|
173
173
|
/* @__PURE__ */ h("span", { children: g.title })
|
|
174
174
|
]
|
|
175
175
|
}
|
|
@@ -180,7 +180,7 @@ const xt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], z = () => {
|
|
|
180
180
|
);
|
|
181
181
|
const E = a.current, R = c === E;
|
|
182
182
|
if (R) {
|
|
183
|
-
|
|
183
|
+
s.current = g;
|
|
184
184
|
const l = k.current.get(g.id);
|
|
185
185
|
l == null || l.scrollIntoView({
|
|
186
186
|
block: "nearest"
|
|
@@ -194,20 +194,20 @@ const xt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], z = () => {
|
|
|
194
194
|
},
|
|
195
195
|
onMouseEnter: () => u(E),
|
|
196
196
|
onMouseLeave: () => u(Number.NaN),
|
|
197
|
-
className:
|
|
197
|
+
className: oe("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm", {
|
|
198
198
|
"hover:univer-bg-transparent": !R,
|
|
199
199
|
"univer-bg-gray-100 dark:!univer-bg-gray-500": R
|
|
200
200
|
}),
|
|
201
201
|
onClick: () => {
|
|
202
|
-
|
|
202
|
+
x(g);
|
|
203
203
|
},
|
|
204
204
|
children: /* @__PURE__ */ ge(
|
|
205
205
|
"div",
|
|
206
206
|
{
|
|
207
207
|
className: "univer-flex univer-w-full univer-items-center univer-px-1",
|
|
208
208
|
children: [
|
|
209
|
-
|
|
210
|
-
/* @__PURE__ */ h(
|
|
209
|
+
O && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(O, {}) }),
|
|
210
|
+
/* @__PURE__ */ h(yt, { showIfEllipsis: !0, title: g.title, placement: "right", children: /* @__PURE__ */ h("span", { className: "univer-truncate", children: g.title }) })
|
|
211
211
|
]
|
|
212
212
|
}
|
|
213
213
|
)
|
|
@@ -216,60 +216,60 @@ const xt = [M.ARROW_UP, M.ARROW_DOWN, M.ENTER], z = () => {
|
|
|
216
216
|
);
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
const Ke = w.length > 0, me = (p == null ? void 0 : p.popup.Placeholder) ||
|
|
220
|
-
return /* @__PURE__ */ h("div", { className:
|
|
219
|
+
const Ke = w.length > 0, me = (p == null ? void 0 : p.popup.Placeholder) || r.get(Z.componentKey);
|
|
220
|
+
return /* @__PURE__ */ h("div", { className: oe("univer-mt-2"), children: Ke ? /* @__PURE__ */ h(Ct, { wrapperClass: "univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto univer-overflow-x-hidden", children: $(w) }) : me && /* @__PURE__ */ h(me, {}) });
|
|
221
221
|
};
|
|
222
|
-
|
|
223
|
-
var bt = Object.getOwnPropertyDescriptor, Mt = (t, e,
|
|
224
|
-
for (var
|
|
225
|
-
(c = t[
|
|
226
|
-
return
|
|
227
|
-
}, N = (t, e) => (
|
|
228
|
-
const
|
|
222
|
+
V.componentKey = "docs.quick.insert.popup";
|
|
223
|
+
var bt = Object.getOwnPropertyDescriptor, Mt = (t, e, r, n) => {
|
|
224
|
+
for (var i = n > 1 ? void 0 : n ? bt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
|
|
225
|
+
(c = t[o]) && (i = c(i) || i);
|
|
226
|
+
return i;
|
|
227
|
+
}, N = (t, e) => (r, n) => e(r, n, t);
|
|
228
|
+
const _e = {
|
|
229
229
|
dispose: () => {
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
|
-
let
|
|
233
|
-
constructor(e,
|
|
232
|
+
let y = class extends X {
|
|
233
|
+
constructor(e, r, n, i, o) {
|
|
234
234
|
super();
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
this._docCanvasPopupManagerService = e, this._univerInstanceService =
|
|
246
|
-
const c = (
|
|
235
|
+
C(this, "_popups", /* @__PURE__ */ new Set());
|
|
236
|
+
C(this, "_editPopup$", new A(void 0));
|
|
237
|
+
C(this, "editPopup$", this._editPopup$.asObservable());
|
|
238
|
+
C(this, "_isComposing$", new A(!1));
|
|
239
|
+
C(this, "isComposing$", this._isComposing$.asObservable());
|
|
240
|
+
C(this, "_inputOffset$", new A({ start: 0, end: 0 }));
|
|
241
|
+
C(this, "inputOffset$", this._inputOffset$.asObservable());
|
|
242
|
+
C(this, "filterKeyword$");
|
|
243
|
+
C(this, "_menuSelectedCallbacks", /* @__PURE__ */ new Set());
|
|
244
|
+
C(this, "_inputPlaceholderRenderRoot", null);
|
|
245
|
+
this._docCanvasPopupManagerService = e, this._univerInstanceService = r, this._commandService = n, this._renderManagerService = i, this._docSelectionManagerService = o, this.disposeWithMe(this._editPopup$);
|
|
246
|
+
const c = (s, a) => {
|
|
247
247
|
var d, p;
|
|
248
|
-
return (p = (d = this._univerInstanceService.getCurrentUnitOfType(K.UNIVER_DOC)) == null ? void 0 : d.getBody()) == null ? void 0 : p.dataStream.slice(
|
|
248
|
+
return (p = (d = this._univerInstanceService.getCurrentUnitOfType(K.UNIVER_DOC)) == null ? void 0 : d.getBody()) == null ? void 0 : p.dataStream.slice(s, a);
|
|
249
249
|
};
|
|
250
250
|
let u = "";
|
|
251
251
|
this.filterKeyword$ = this._inputOffset$.pipe(
|
|
252
|
-
|
|
252
|
+
Oe((s) => {
|
|
253
253
|
var d;
|
|
254
|
-
const a = c(
|
|
254
|
+
const a = c(s.start, s.end);
|
|
255
255
|
return (d = a == null ? void 0 : a.slice(1)) != null ? d : "";
|
|
256
256
|
}),
|
|
257
257
|
ft(),
|
|
258
|
-
|
|
259
|
-
u =
|
|
258
|
+
L((s) => {
|
|
259
|
+
u = s;
|
|
260
260
|
})
|
|
261
261
|
), this.disposeWithMe(fe([
|
|
262
|
-
this.filterKeyword$.pipe(
|
|
262
|
+
this.filterKeyword$.pipe(L((s) => {
|
|
263
263
|
var a, d, p;
|
|
264
|
-
|
|
264
|
+
s.length > 0 ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : (p = this._inputPlaceholderRenderRoot) == null || p.mount();
|
|
265
265
|
})),
|
|
266
|
-
this.isComposing$.pipe(
|
|
266
|
+
this.isComposing$.pipe(L((s) => {
|
|
267
267
|
var a, d, p;
|
|
268
|
-
|
|
268
|
+
s ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : u.length <= 0 && ((p = this._inputPlaceholderRenderRoot) == null || p.mount());
|
|
269
269
|
})),
|
|
270
|
-
this.editPopup$.pipe(
|
|
270
|
+
this.editPopup$.pipe(L((s) => {
|
|
271
271
|
var a, d;
|
|
272
|
-
|
|
272
|
+
s || ((d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose(), this._inputPlaceholderRenderRoot = null);
|
|
273
273
|
}))
|
|
274
274
|
]).subscribe());
|
|
275
275
|
}
|
|
@@ -292,11 +292,11 @@ let S = class extends X {
|
|
|
292
292
|
this._inputOffset$.next(e);
|
|
293
293
|
}
|
|
294
294
|
getDocEventManagerService(e) {
|
|
295
|
-
var
|
|
296
|
-
return (
|
|
295
|
+
var r;
|
|
296
|
+
return (r = this._renderManagerService.getRenderById(e)) == null ? void 0 : r.with(xe);
|
|
297
297
|
}
|
|
298
298
|
resolvePopup(e) {
|
|
299
|
-
return Array.from(this._popups).find((
|
|
299
|
+
return Array.from(this._popups).find((r) => r.keyword === e);
|
|
300
300
|
}
|
|
301
301
|
registerPopup(e) {
|
|
302
302
|
return this._popups.add(e), () => {
|
|
@@ -321,47 +321,47 @@ let S = class extends X {
|
|
|
321
321
|
}
|
|
322
322
|
showPopup(e) {
|
|
323
323
|
var d, p;
|
|
324
|
-
const { popup:
|
|
324
|
+
const { popup: r, index: n, unitId: i } = e;
|
|
325
325
|
this.closePopup();
|
|
326
|
-
const
|
|
326
|
+
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);
|
|
327
327
|
if (!c)
|
|
328
328
|
return;
|
|
329
|
-
const u = this.getDocEventManagerService(
|
|
330
|
-
if (!
|
|
329
|
+
const u = this.getDocEventManagerService(i), s = u == null ? void 0 : u.findParagraphBoundByIndex(c.startIndex);
|
|
330
|
+
if (!s)
|
|
331
331
|
return;
|
|
332
332
|
this._inputPlaceholderRenderRoot = this._createInputPlaceholderRenderRoot(() => {
|
|
333
333
|
var $;
|
|
334
|
-
const v = ($ = this._renderManagerService.getRenderById(
|
|
335
|
-
if (!v || !
|
|
336
|
-
return
|
|
337
|
-
const P = v.getSkeleton().findNodeByCharIndex(
|
|
334
|
+
const v = ($ = this._renderManagerService.getRenderById(i)) == null ? void 0 : $.with(mt), S = this._docSelectionManagerService.getActiveTextRange();
|
|
335
|
+
if (!v || !S)
|
|
336
|
+
return _e;
|
|
337
|
+
const P = v.getSkeleton().findNodeByCharIndex(S.startOffset, S.segmentId, S.segmentPage);
|
|
338
338
|
if (!((P == null ? void 0 : P.content) === "\r"))
|
|
339
|
-
return
|
|
339
|
+
return _e;
|
|
340
340
|
const k = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
341
341
|
{ startOffset: n + 1, endOffset: n + 1, collapsed: !1 },
|
|
342
342
|
{
|
|
343
|
-
componentKey:
|
|
343
|
+
componentKey: q.componentKey,
|
|
344
344
|
onClickOutside: () => {
|
|
345
345
|
k.dispose();
|
|
346
346
|
},
|
|
347
347
|
direction: "horizontal"
|
|
348
348
|
},
|
|
349
|
-
|
|
349
|
+
i
|
|
350
350
|
);
|
|
351
351
|
return k;
|
|
352
352
|
}), this._inputPlaceholderRenderRoot.mount();
|
|
353
353
|
const a = this._docCanvasPopupManagerService.attachPopupToRect(
|
|
354
|
-
|
|
354
|
+
s.firstLine,
|
|
355
355
|
{
|
|
356
|
-
componentKey:
|
|
356
|
+
componentKey: V.componentKey,
|
|
357
357
|
onClickOutside: () => {
|
|
358
358
|
this.closePopup();
|
|
359
359
|
},
|
|
360
360
|
direction: "bottom"
|
|
361
361
|
},
|
|
362
|
-
|
|
362
|
+
i
|
|
363
363
|
);
|
|
364
|
-
this._editPopup$.next({ disposable: a, popup:
|
|
364
|
+
this._editPopup$.next({ disposable: a, popup: r, anchor: n, unitId: i });
|
|
365
365
|
}
|
|
366
366
|
closePopup() {
|
|
367
367
|
this.editPopup && (this.editPopup.disposable.dispose(), this._editPopup$.next(null));
|
|
@@ -372,48 +372,48 @@ let S = class extends X {
|
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
emitMenuSelected(e) {
|
|
375
|
-
const { start:
|
|
375
|
+
const { start: r, end: n } = this.inputOffset;
|
|
376
376
|
this._commandService.syncExecuteCommand(be.id, {
|
|
377
|
-
start:
|
|
377
|
+
start: r,
|
|
378
378
|
end: n
|
|
379
379
|
}), setTimeout(() => {
|
|
380
|
-
this._menuSelectedCallbacks.forEach((
|
|
380
|
+
this._menuSelectedCallbacks.forEach((i) => i(e));
|
|
381
381
|
}, 0);
|
|
382
382
|
}
|
|
383
383
|
};
|
|
384
|
-
|
|
384
|
+
y = Mt([
|
|
385
385
|
N(0, f(Pe)),
|
|
386
386
|
N(1, f(le)),
|
|
387
387
|
N(2, f(H)),
|
|
388
388
|
N(3, f(he)),
|
|
389
389
|
N(4, f(ve))
|
|
390
|
-
],
|
|
390
|
+
], y);
|
|
391
391
|
const ke = "doc.quick-insert.button";
|
|
392
|
-
var wt = Object.getOwnPropertyDescriptor, kt = (t, e,
|
|
393
|
-
for (var
|
|
394
|
-
(c = t[
|
|
395
|
-
return
|
|
396
|
-
},
|
|
392
|
+
var wt = Object.getOwnPropertyDescriptor, kt = (t, e, r, n) => {
|
|
393
|
+
for (var i = n > 1 ? void 0 : n ? wt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
|
|
394
|
+
(c = t[o]) && (i = c(i) || i);
|
|
395
|
+
return i;
|
|
396
|
+
}, re = (t, e) => (r, n) => e(r, n, t);
|
|
397
397
|
let F = class extends X {
|
|
398
|
-
constructor(e,
|
|
398
|
+
constructor(e, r, n, i) {
|
|
399
399
|
super();
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
this._context = e, this._docEventManagerService =
|
|
400
|
+
C(this, "_popup$", new A(null));
|
|
401
|
+
C(this, "popup$", this._popup$.asObservable());
|
|
402
|
+
this._context = e, this._docEventManagerService = r, this._docQuickInsertPopupService = n, this._docCanvasPopManagerService = i, this._init();
|
|
403
403
|
}
|
|
404
404
|
get popup() {
|
|
405
405
|
return this._popup$.value;
|
|
406
406
|
}
|
|
407
407
|
_init() {
|
|
408
|
-
this.disposeWithMe(fe([this._docEventManagerService.hoverParagraphLeftRealTime$, this._docEventManagerService.hoverParagraphRealTime$]).subscribe(([e,
|
|
409
|
-
var
|
|
410
|
-
const n = e != null ? e :
|
|
411
|
-
if (!n ||
|
|
408
|
+
this.disposeWithMe(fe([this._docEventManagerService.hoverParagraphLeftRealTime$, this._docEventManagerService.hoverParagraphRealTime$]).subscribe(([e, r]) => {
|
|
409
|
+
var o;
|
|
410
|
+
const n = e != null ? e : r, i = this._context.unit.getDisabled();
|
|
411
|
+
if (!n || i) {
|
|
412
412
|
this._hideMenu(!0);
|
|
413
413
|
return;
|
|
414
414
|
}
|
|
415
415
|
if (n.paragraphStart === n.paragraphEnd) {
|
|
416
|
-
if (this._docQuickInsertPopupService.editPopup || n.startIndex === ((
|
|
416
|
+
if (this._docQuickInsertPopupService.editPopup || n.startIndex === ((o = this.popup) == null ? void 0 : o.startIndex)) return;
|
|
417
417
|
this._hideMenu(!0);
|
|
418
418
|
const c = this._docCanvasPopManagerService.attachPopupToRect(n.firstLine, {
|
|
419
419
|
componentKey: ke,
|
|
@@ -432,39 +432,39 @@ let F = class extends X {
|
|
|
432
432
|
}
|
|
433
433
|
};
|
|
434
434
|
F = kt([
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
re(1, f(xe)),
|
|
436
|
+
re(2, f(y)),
|
|
437
|
+
re(3, f(Pe))
|
|
438
438
|
], F);
|
|
439
439
|
const Re = {
|
|
440
440
|
id: "quick-insert.text.menu",
|
|
441
441
|
title: "docQuickInsert.menu.text",
|
|
442
|
-
icon: "
|
|
442
|
+
icon: "TextIcon",
|
|
443
443
|
keywords: ["text"]
|
|
444
444
|
}, De = {
|
|
445
|
-
id:
|
|
445
|
+
id: ot.id,
|
|
446
446
|
title: "docQuickInsert.menu.numberedList",
|
|
447
|
-
icon: "
|
|
447
|
+
icon: "OrderIcon",
|
|
448
448
|
keywords: ["numbered", "list", "ordered"]
|
|
449
449
|
}, $e = {
|
|
450
|
-
id:
|
|
450
|
+
id: st.id,
|
|
451
451
|
title: "docQuickInsert.menu.bulletedList",
|
|
452
|
-
icon: "
|
|
452
|
+
icon: "UnorderIcon",
|
|
453
453
|
keywords: ["bulleted", "list", "unordered"]
|
|
454
454
|
}, Ee = {
|
|
455
455
|
id: ct.id,
|
|
456
456
|
title: "docQuickInsert.menu.divider",
|
|
457
|
-
icon: "
|
|
457
|
+
icon: "DividerIcon",
|
|
458
458
|
keywords: ["divider", "line", "separate"]
|
|
459
459
|
}, Ne = {
|
|
460
460
|
id: at.id,
|
|
461
461
|
title: "docQuickInsert.menu.table",
|
|
462
|
-
icon: "
|
|
462
|
+
icon: "GridIcon",
|
|
463
463
|
keywords: ["table", "grid", "spreadsheet"]
|
|
464
464
|
}, Te = {
|
|
465
465
|
id: Je.id,
|
|
466
466
|
title: "docQuickInsert.menu.image",
|
|
467
|
-
icon: "
|
|
467
|
+
icon: "AdditionAndSubtractionIcon",
|
|
468
468
|
keywords: ["image", "picture", "photo"]
|
|
469
469
|
}, Rt = [
|
|
470
470
|
{
|
|
@@ -486,14 +486,14 @@ const Re = {
|
|
|
486
486
|
Ne.id,
|
|
487
487
|
Te.id
|
|
488
488
|
]);
|
|
489
|
-
var $t = Object.getOwnPropertyDescriptor, Et = (t, e,
|
|
490
|
-
for (var
|
|
491
|
-
(c = t[
|
|
492
|
-
return
|
|
493
|
-
}, T = (t, e) => (
|
|
489
|
+
var $t = Object.getOwnPropertyDescriptor, Et = (t, e, r, n) => {
|
|
490
|
+
for (var i = n > 1 ? void 0 : n ? $t(e, r) : e, o = t.length - 1, c; o >= 0; o--)
|
|
491
|
+
(c = t[o]) && (i = c(i) || i);
|
|
492
|
+
return i;
|
|
493
|
+
}, T = (t, e) => (r, n) => e(r, n, t);
|
|
494
494
|
let G = class extends X {
|
|
495
|
-
constructor(t, e,
|
|
496
|
-
super(), this._commandService = t, this._textSelectionManagerService = e, this._docQuickInsertPopupService =
|
|
495
|
+
constructor(t, e, r, n, i) {
|
|
496
|
+
super(), this._commandService = t, this._textSelectionManagerService = e, this._docQuickInsertPopupService = r, this._shortcutService = n, this._univerInstanceService = i, this.disposeWithMe(this._shortcutService.registerShortcut({
|
|
497
497
|
id: Q.id,
|
|
498
498
|
binding: M.ESC,
|
|
499
499
|
preconditions: () => !!this._docQuickInsertPopupService.editPopup,
|
|
@@ -505,59 +505,59 @@ let G = class extends X {
|
|
|
505
505
|
this.disposeWithMe(
|
|
506
506
|
// eslint-disable-next-line complexity, max-lines-per-function
|
|
507
507
|
this._commandService.onCommandExecuted((t) => {
|
|
508
|
-
var
|
|
509
|
-
const { _docQuickInsertPopupService: e, _textSelectionManagerService:
|
|
510
|
-
if (!(
|
|
508
|
+
var o, c, u;
|
|
509
|
+
const { _docQuickInsertPopupService: e, _textSelectionManagerService: r, _commandService: n } = this, i = this._univerInstanceService.getCurrentUnitOfType(K.UNIVER_DOC);
|
|
510
|
+
if (!(i != null && i.getDisabled())) {
|
|
511
511
|
if (t.id === dt.id) {
|
|
512
|
-
const
|
|
512
|
+
const s = t.params;
|
|
513
513
|
if (e.editPopup) {
|
|
514
514
|
e.setInputOffset({
|
|
515
515
|
start: e.inputOffset.start,
|
|
516
|
-
end:
|
|
516
|
+
end: s.range.endOffset + 1
|
|
517
517
|
});
|
|
518
518
|
return;
|
|
519
519
|
}
|
|
520
|
-
const a =
|
|
520
|
+
const a = r.getActiveTextRange();
|
|
521
521
|
if (!a)
|
|
522
522
|
return;
|
|
523
|
-
const d = e.resolvePopup(
|
|
524
|
-
if (!d || !(d.preconditions ? d.preconditions(
|
|
523
|
+
const d = e.resolvePopup(s.body.dataStream);
|
|
524
|
+
if (!d || !(d.preconditions ? d.preconditions(s) : !0))
|
|
525
525
|
return;
|
|
526
526
|
e.setInputOffset({ start: a.startOffset - 1, end: a.startOffset }), setTimeout(() => {
|
|
527
527
|
n.executeCommand(Me.id, {
|
|
528
528
|
index: a.startOffset - 1,
|
|
529
|
-
unitId:
|
|
529
|
+
unitId: s.unitId,
|
|
530
530
|
popup: d
|
|
531
531
|
});
|
|
532
532
|
}, 100);
|
|
533
533
|
}
|
|
534
534
|
if (t.id === ut.id) {
|
|
535
|
-
const
|
|
536
|
-
!e.isComposing &&
|
|
535
|
+
const s = t.params;
|
|
536
|
+
!e.isComposing && s.isCompositionStart && e.setIsComposing(!0), e.isComposing && s.isCompositionEnd && e.setIsComposing(!1);
|
|
537
537
|
}
|
|
538
538
|
if (t.id === gt.id) {
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
541
|
-
const a = (c = (
|
|
539
|
+
const s = t.params;
|
|
540
|
+
if (s.isCompositionEnd) {
|
|
541
|
+
const a = (c = (o = s.textRanges) == null ? void 0 : o[0]) == null ? void 0 : c.endOffset;
|
|
542
542
|
a && e.setInputOffset({ start: e.inputOffset.start, end: a });
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
if (t.id === pt.id) {
|
|
546
|
-
const
|
|
547
|
-
if (e.editPopup &&
|
|
548
|
-
const a = (u =
|
|
549
|
-
e.setInputOffset({ start: e.inputOffset.start, end:
|
|
546
|
+
const s = t.params;
|
|
547
|
+
if (e.editPopup && s.direction === Ze.LEFT) {
|
|
548
|
+
const a = (u = s.len) != null ? u : 0;
|
|
549
|
+
e.setInputOffset({ start: e.inputOffset.start, end: s.range.endOffset - a });
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
if (t.id === lt.id) {
|
|
553
|
-
const
|
|
554
|
-
(
|
|
553
|
+
const s = t.params;
|
|
554
|
+
(s.direction === W.LEFT || s.direction === W.RIGHT) && e.editPopup && n.executeCommand(Q.id);
|
|
555
555
|
}
|
|
556
556
|
if (t.id === ht.id) {
|
|
557
|
-
const
|
|
558
|
-
if (!e.editPopup || !
|
|
557
|
+
const s = r.getActiveTextRange();
|
|
558
|
+
if (!e.editPopup || !s)
|
|
559
559
|
return;
|
|
560
|
-
|
|
560
|
+
s.endOffset <= e.editPopup.anchor && n.executeCommand(Q.id);
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
563
|
})
|
|
@@ -572,99 +572,99 @@ let G = class extends X {
|
|
|
572
572
|
G = Et([
|
|
573
573
|
T(0, H),
|
|
574
574
|
T(1, f(ve)),
|
|
575
|
-
T(2, f(
|
|
576
|
-
T(3, f(
|
|
575
|
+
T(2, f(y)),
|
|
576
|
+
T(3, f(Se)),
|
|
577
577
|
T(4, f(le))
|
|
578
578
|
], G);
|
|
579
|
-
var
|
|
580
|
-
return
|
|
581
|
-
for (var e,
|
|
582
|
-
e = arguments[
|
|
583
|
-
for (var
|
|
579
|
+
var _ = function() {
|
|
580
|
+
return _ = Object.assign || function(t) {
|
|
581
|
+
for (var e, r = 1, n = arguments.length; r < n; r++) {
|
|
582
|
+
e = arguments[r];
|
|
583
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
|
|
584
584
|
}
|
|
585
585
|
return t;
|
|
586
|
-
},
|
|
586
|
+
}, _.apply(this, arguments);
|
|
587
587
|
}, Nt = function(t, e) {
|
|
588
|
-
var
|
|
589
|
-
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (
|
|
588
|
+
var r = {};
|
|
589
|
+
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
|
|
590
590
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
591
|
-
for (var
|
|
592
|
-
e.indexOf(n[
|
|
593
|
-
return
|
|
591
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++)
|
|
592
|
+
e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]);
|
|
593
|
+
return r;
|
|
594
594
|
}, te = Y(function(t, e) {
|
|
595
|
-
var
|
|
596
|
-
return Ue(
|
|
595
|
+
var r = t.icon, n = t.id, i = t.className, o = t.extend, c = Nt(t, ["icon", "id", "className", "extend"]), u = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), s = B("_".concat(Qt()));
|
|
596
|
+
return Ue(r, "".concat(n), { defIds: r.defIds, idSuffix: s.current }, _({ ref: e, className: u }, c), o);
|
|
597
597
|
});
|
|
598
|
-
function Ue(t, e,
|
|
599
|
-
return ee(t.tag,
|
|
600
|
-
return Ue(
|
|
598
|
+
function Ue(t, e, r, n, i) {
|
|
599
|
+
return ee(t.tag, _(_({ key: e }, Tt(t, r, i)), n), (Ut(t, r).children || []).map(function(o, c) {
|
|
600
|
+
return Ue(o, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i);
|
|
601
601
|
}));
|
|
602
602
|
}
|
|
603
|
-
function Tt(t, e,
|
|
604
|
-
var n =
|
|
605
|
-
|
|
606
|
-
var c =
|
|
603
|
+
function Tt(t, e, r) {
|
|
604
|
+
var n = _({}, t.attrs);
|
|
605
|
+
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) {
|
|
606
|
+
var c = o[0], u = o[1];
|
|
607
607
|
c === "mask" && typeof u == "string" && (n[c] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
608
608
|
});
|
|
609
|
-
var
|
|
610
|
-
return !
|
|
611
|
-
var c =
|
|
609
|
+
var i = e.defIds;
|
|
610
|
+
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) {
|
|
611
|
+
var c = o[0], u = o[1];
|
|
612
612
|
typeof u == "string" && (n[c] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
613
613
|
})), n;
|
|
614
614
|
}
|
|
615
615
|
function Ut(t, e) {
|
|
616
|
-
var
|
|
617
|
-
return !n || n.length === 0 ? t : t.tag === "defs" && (!((
|
|
618
|
-
return typeof
|
|
616
|
+
var r, n = e.defIds;
|
|
617
|
+
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) {
|
|
618
|
+
return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? _(_({}, i), { attrs: _(_({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
|
|
619
619
|
}) }) : t;
|
|
620
620
|
}
|
|
621
621
|
function Qt() {
|
|
622
622
|
return Math.random().toString(36).substring(2, 8);
|
|
623
623
|
}
|
|
624
624
|
te.displayName = "UniverIcon";
|
|
625
|
-
var Ht = { 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.
|
|
625
|
+
var Ht = { 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) {
|
|
626
626
|
return ee(te, Object.assign({}, t, {
|
|
627
|
-
id: "divider-
|
|
627
|
+
id: "divider-icon",
|
|
628
628
|
ref: e,
|
|
629
629
|
icon: Ht
|
|
630
630
|
}));
|
|
631
631
|
});
|
|
632
|
-
ae.displayName = "
|
|
633
|
-
var Kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.
|
|
632
|
+
ae.displayName = "DividerIcon";
|
|
633
|
+
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: "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) {
|
|
634
634
|
return ee(te, Object.assign({}, t, {
|
|
635
|
-
id: "
|
|
635
|
+
id: "increase-icon",
|
|
636
636
|
ref: e,
|
|
637
637
|
icon: Kt
|
|
638
638
|
}));
|
|
639
639
|
});
|
|
640
|
-
Qe.displayName = "
|
|
641
|
-
var
|
|
640
|
+
Qe.displayName = "IncreaseIcon";
|
|
641
|
+
var Lt = { 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) {
|
|
642
642
|
return ee(te, Object.assign({}, t, {
|
|
643
|
-
id: "text-
|
|
643
|
+
id: "text-icon",
|
|
644
644
|
ref: e,
|
|
645
|
-
icon:
|
|
645
|
+
icon: Lt
|
|
646
646
|
}));
|
|
647
647
|
});
|
|
648
|
-
de.displayName = "
|
|
648
|
+
de.displayName = "TextIcon";
|
|
649
649
|
const ue = ({ className: t = "" }) => {
|
|
650
|
-
const e = I(
|
|
650
|
+
const e = I(y), r = I(le), n = I(he), i = U(se(() => r.getCurrentTypeOfUnit$(K.UNIVER_DOC), [r])), o = i && n.getRenderById(i.getUnitId()), c = o == null ? void 0 : o.with(F), u = I(tt), s = I(ve), a = U(e.editPopup$), d = nt((p) => {
|
|
651
651
|
var P;
|
|
652
652
|
const v = c == null ? void 0 : c.popup;
|
|
653
653
|
if (!v)
|
|
654
654
|
return;
|
|
655
|
-
const
|
|
655
|
+
const S = e.popups, w = {
|
|
656
656
|
keyword: "",
|
|
657
|
-
menus$: fe(
|
|
658
|
-
|
|
657
|
+
menus$: fe(S.map((x) => x.menus$)).pipe(
|
|
658
|
+
Oe((x) => x.flat())
|
|
659
659
|
)
|
|
660
660
|
};
|
|
661
|
-
|
|
661
|
+
s.replaceDocRanges([{
|
|
662
662
|
startOffset: v.startIndex,
|
|
663
663
|
endOffset: v.startIndex
|
|
664
664
|
}]), e.setInputOffset({ start: v.startIndex - 1, end: v.startIndex - 1 }), e.showPopup({
|
|
665
665
|
popup: w,
|
|
666
666
|
index: v.startIndex - 1,
|
|
667
|
-
unitId: (P =
|
|
667
|
+
unitId: (P = i == null ? void 0 : i.getUnitId()) != null ? P : ""
|
|
668
668
|
}), setTimeout(() => {
|
|
669
669
|
u.focus();
|
|
670
670
|
});
|
|
@@ -672,7 +672,7 @@ const ue = ({ className: t = "" }) => {
|
|
|
672
672
|
return /* @__PURE__ */ h(
|
|
673
673
|
"div",
|
|
674
674
|
{
|
|
675
|
-
className:
|
|
675
|
+
className: oe("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 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700 hover:univer-bg-gray-100", St, {
|
|
676
676
|
"univer-bg-gray-100 dark:!univer-bg-gray-700": a,
|
|
677
677
|
"univer-bg-white dark:!univer-bg-gray-900": !a
|
|
678
678
|
}, t),
|
|
@@ -689,14 +689,14 @@ const ue = ({ className: t = "" }) => {
|
|
|
689
689
|
);
|
|
690
690
|
};
|
|
691
691
|
ue.componentKey = ke;
|
|
692
|
-
var
|
|
693
|
-
for (var
|
|
694
|
-
(c = t[
|
|
695
|
-
return
|
|
696
|
-
},
|
|
697
|
-
let
|
|
698
|
-
constructor(t, e,
|
|
699
|
-
super(), this._commandService = t, this._docQuickInsertPopupService = e, this._componentManager =
|
|
692
|
+
var jt = Object.getOwnPropertyDescriptor, At = (t, e, r, n) => {
|
|
693
|
+
for (var i = n > 1 ? void 0 : n ? jt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
|
|
694
|
+
(c = t[o]) && (i = c(i) || i);
|
|
695
|
+
return i;
|
|
696
|
+
}, ie = (t, e) => (r, n) => e(r, n, t);
|
|
697
|
+
let z = class extends X {
|
|
698
|
+
constructor(t, e, r) {
|
|
699
|
+
super(), this._commandService = t, this._docQuickInsertPopupService = e, this._componentManager = r, this._initCommands(), this._initComponents(), this._initMenus();
|
|
700
700
|
}
|
|
701
701
|
_initCommands() {
|
|
702
702
|
[
|
|
@@ -709,22 +709,22 @@ let Z = class extends X {
|
|
|
709
709
|
}
|
|
710
710
|
_initComponents() {
|
|
711
711
|
[
|
|
712
|
-
[z.componentKey, z],
|
|
713
712
|
[V.componentKey, V],
|
|
714
713
|
[q.componentKey, q],
|
|
714
|
+
[Z.componentKey, Z],
|
|
715
715
|
[ae.displayName, ae],
|
|
716
716
|
[de.displayName, de],
|
|
717
717
|
[ue.componentKey, ue]
|
|
718
|
-
].forEach(([e,
|
|
719
|
-
e && this.disposeWithMe(this._componentManager.register(e,
|
|
718
|
+
].forEach(([e, r]) => {
|
|
719
|
+
e && this.disposeWithMe(this._componentManager.register(e, r));
|
|
720
720
|
}), [
|
|
721
721
|
{
|
|
722
722
|
keyword: "/",
|
|
723
723
|
menus$: vt(Rt),
|
|
724
724
|
// only show when the cursor is at the beginning of a line
|
|
725
725
|
preconditions: (e) => {
|
|
726
|
-
var
|
|
727
|
-
return ((
|
|
726
|
+
var r;
|
|
727
|
+
return ((r = e.range.startNodePosition) == null ? void 0 : r.glyph) === 0;
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
730
|
].forEach((e) => {
|
|
@@ -734,30 +734,30 @@ let Z = class extends X {
|
|
|
734
734
|
_initMenus() {
|
|
735
735
|
}
|
|
736
736
|
};
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
],
|
|
742
|
-
var Bt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor,
|
|
743
|
-
for (var
|
|
744
|
-
(c = t[
|
|
745
|
-
return
|
|
746
|
-
}, Ie = (t, e) => (
|
|
747
|
-
const
|
|
737
|
+
z = At([
|
|
738
|
+
ie(0, H),
|
|
739
|
+
ie(1, f(y)),
|
|
740
|
+
ie(2, f(ye))
|
|
741
|
+
], z);
|
|
742
|
+
var Bt = Object.defineProperty, Wt = Object.getOwnPropertyDescriptor, qt = (t, e, r) => e in t ? Bt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Zt = (t, e, r, n) => {
|
|
743
|
+
for (var i = n > 1 ? void 0 : n ? Wt(e, r) : e, o = t.length - 1, c; o >= 0; o--)
|
|
744
|
+
(c = t[o]) && (i = c(i) || i);
|
|
745
|
+
return i;
|
|
746
|
+
}, Ie = (t, e) => (r, n) => e(r, n, t), He = (t, e, r) => qt(t, typeof e != "symbol" ? e + "" : e, r);
|
|
747
|
+
const Vt = "DOC_QUICK_INSERT_UI_PLUGIN";
|
|
748
748
|
let J = class extends Ge {
|
|
749
749
|
constructor(t, e) {
|
|
750
750
|
super(), this._injector = t, this._renderManagerSrv = e;
|
|
751
751
|
}
|
|
752
752
|
onStarting() {
|
|
753
753
|
[
|
|
754
|
-
[
|
|
754
|
+
[z],
|
|
755
755
|
[G],
|
|
756
|
-
[
|
|
757
|
-
].forEach((e) => this._injector.add(e)), this._injector.get(
|
|
756
|
+
[y]
|
|
757
|
+
].forEach((e) => this._injector.add(e)), this._injector.get(z);
|
|
758
758
|
}
|
|
759
759
|
onRendered() {
|
|
760
|
-
this._injector.get(G), this._injector.get(
|
|
760
|
+
this._injector.get(G), this._injector.get(y), [
|
|
761
761
|
[F]
|
|
762
762
|
].forEach((t) => {
|
|
763
763
|
this._renderManagerSrv.registerRenderModule(K.UNIVER_DOC, t);
|
|
@@ -765,17 +765,17 @@ let J = class extends Ge {
|
|
|
765
765
|
}
|
|
766
766
|
};
|
|
767
767
|
He(J, "type", K.UNIVER_DOC);
|
|
768
|
-
He(J, "pluginName",
|
|
769
|
-
J =
|
|
770
|
-
|
|
768
|
+
He(J, "pluginName", Vt);
|
|
769
|
+
J = Zt([
|
|
770
|
+
Ve(et, Ye, Xe, ze, rt),
|
|
771
771
|
Ie(0, f(Fe)),
|
|
772
772
|
Ie(1, f(he))
|
|
773
773
|
], J);
|
|
774
774
|
export {
|
|
775
|
-
|
|
775
|
+
y as DocQuickInsertPopupService,
|
|
776
776
|
G as DocQuickInsertTriggerController,
|
|
777
|
-
|
|
777
|
+
z as DocQuickInsertUIController,
|
|
778
778
|
Pt as KeywordInputPlaceholderComponentKey,
|
|
779
|
-
|
|
779
|
+
xt as QuickInsertPlaceholderComponentKey,
|
|
780
780
|
J as UniverDocsQuickInsertUIPlugin
|
|
781
781
|
};
|