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