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