@univerjs/docs-quick-insert-ui 0.10.12 → 0.10.13
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 +549 -420
- package/lib/index.js +549 -420
- package/lib/umd/index.js +1 -1
- package/package.json +13 -13
package/lib/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Ae = (t, e,
|
|
3
|
-
var
|
|
4
|
-
import { CommandType as
|
|
5
|
-
import { DocSelectionManagerService as
|
|
6
|
-
import { CutContentCommand as
|
|
7
|
-
import { useDependency as
|
|
8
|
-
import { IRenderManagerService as
|
|
9
|
-
import { map as
|
|
10
|
-
import { jsx as h, jsxs as
|
|
11
|
-
import { Menu as gt, clsx as
|
|
12
|
-
import { useMemo as
|
|
13
|
-
import { InsertDocImageCommand as
|
|
14
|
-
import { UniverDocsDrawingPlugin as
|
|
15
|
-
import { UniverDrawingPlugin as
|
|
16
|
-
import { UniverDrawingUIPlugin as
|
|
17
|
-
const
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
|
+
var Ae = (t, e, n) => e in t ? Le(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var C = (t, e, n) => Ae(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { CommandType as k, ICommandService as Q, RANGE_DIRECTION as je, LocaleService as ue, generateRandomId as Be, DisposableCollection as We, toDisposable as qe, Direction as B, Inject as f, IUniverInstanceService as pe, Disposable as Y, UniverInstanceType as H, DeleteDirection as Ze, DependentOn as Ve, Injector as Fe, IConfigService as Ge, Plugin as ze, merge as Ye } from "@univerjs/core";
|
|
5
|
+
import { DocSelectionManagerService as le, DocSkeletonManagerService as Je, RichTextEditingMutation as Xe } from "@univerjs/docs";
|
|
6
|
+
import { CutContentCommand as et, DocCanvasPopManagerService as Se, DocEventManagerService as Pe, 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";
|
|
7
|
+
import { useDependency as _, KeyCode as O, ComponentManager as ye, IShortcutService as xe, useObservable as T, ILayoutService as ut, useEvent as pt, UniverUIPlugin as lt } from "@univerjs/ui";
|
|
8
|
+
import { IRenderManagerService as he } from "@univerjs/engine-render";
|
|
9
|
+
import { map as Me, distinctUntilChanged as ht, tap as K, combineLatest as fe, BehaviorSubject as A, of as ft } from "rxjs";
|
|
10
|
+
import { jsx as h, jsxs as ve } from "react/jsx-runtime";
|
|
11
|
+
import { Menu as gt, clsx as re, scrollbarClassName as mt, MenuItemGroup as vt, MenuItem as Ct, Tooltip as _t, borderClassName as It } from "@univerjs/design";
|
|
12
|
+
import { useMemo as se, useState as Ce, useRef as j, useEffect as L, createElement as J, forwardRef as ge } from "react";
|
|
13
|
+
import { InsertDocImageCommand as St, UniverDocsDrawingUIPlugin as Pt } from "@univerjs/docs-drawing-ui";
|
|
14
|
+
import { UniverDocsDrawingPlugin as yt } from "@univerjs/docs-drawing";
|
|
15
|
+
import { UniverDrawingPlugin as xt } from "@univerjs/drawing";
|
|
16
|
+
import { UniverDrawingUIPlugin as Mt } from "@univerjs/drawing-ui";
|
|
17
|
+
const Oe = {
|
|
18
18
|
id: "doc.command.delete-search-key",
|
|
19
|
-
type:
|
|
19
|
+
type: k.COMMAND,
|
|
20
20
|
handler: (t, e) => {
|
|
21
|
-
const
|
|
22
|
-
return
|
|
21
|
+
const n = t.get(Q), { start: i, end: r } = e;
|
|
22
|
+
return n.syncExecuteCommand(et.id, {
|
|
23
23
|
segmentId: "",
|
|
24
24
|
textRanges: [{
|
|
25
|
-
startOffset:
|
|
26
|
-
endOffset:
|
|
25
|
+
startOffset: i,
|
|
26
|
+
endOffset: i,
|
|
27
27
|
collapsed: !0
|
|
28
28
|
}],
|
|
29
29
|
selections: [{
|
|
30
|
-
startOffset:
|
|
31
|
-
endOffset:
|
|
30
|
+
startOffset: i,
|
|
31
|
+
endOffset: r,
|
|
32
32
|
collapsed: !1,
|
|
33
|
-
direction:
|
|
33
|
+
direction: je.FORWARD
|
|
34
34
|
}]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
},
|
|
38
|
-
const t =
|
|
37
|
+
}, Ot = "docs.quick.insert.keyword-input-placeholder", W = () => {
|
|
38
|
+
const t = _(ue);
|
|
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
|
|
43
|
-
const t =
|
|
41
|
+
W.componentKey = Ot;
|
|
42
|
+
const bt = "docs.quick.insert.placeholder", q = () => {
|
|
43
|
+
const t = _(ue);
|
|
44
44
|
return /* @__PURE__ */ h(
|
|
45
45
|
"div",
|
|
46
46
|
{
|
|
@@ -49,220 +49,220 @@ const wt = "docs.quick.insert.placeholder", Z = () => {
|
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
function
|
|
54
|
-
return t.map((
|
|
55
|
-
if ("children" in
|
|
56
|
-
return
|
|
57
|
-
const
|
|
58
|
-
return
|
|
52
|
+
q.componentKey = bt;
|
|
53
|
+
function oe(t, e) {
|
|
54
|
+
return t.map((n) => ({ ...n })).filter((n) => {
|
|
55
|
+
if ("children" in n)
|
|
56
|
+
return n.children = oe(n.children, e), n.children.length > 0;
|
|
57
|
+
const i = n.keywords;
|
|
58
|
+
return i ? i.some((r) => r.includes(e)) : n.title.toLowerCase().includes(e);
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
return t.map((
|
|
63
|
-
const
|
|
64
|
-
return "children" in
|
|
61
|
+
function be(t, e) {
|
|
62
|
+
return t.map((n) => {
|
|
63
|
+
const i = { ...n };
|
|
64
|
+
return "children" in i && (i.children = be(i.children, e)), i.title = e.t(i.title), "keywords" in i && (i.keywords = i.keywords.concat(i.title).map((r) => r.toLowerCase())), i;
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
const t =
|
|
67
|
+
const wt = [O.ARROW_UP, O.ARROW_DOWN, O.ENTER], Z = () => {
|
|
68
|
+
const t = _(ue), e = _(I), n = _(ye), i = _(xe), r = _(Q), s = se(() => Be(), []), [c, l] = Ce(0), o = j(null), a = j(0);
|
|
69
69
|
a.current = 0;
|
|
70
|
-
const d = T(e.filterKeyword$, ""),
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
P(
|
|
70
|
+
const d = T(e.filterKeyword$, ""), u = T(e.editPopup$), g = T(u == null ? void 0 : u.popup.menus$, []), S = se(() => be(g, t), [g]), [b, P] = Ce(() => oe(S, d.toLowerCase()));
|
|
71
|
+
L(() => {
|
|
72
|
+
const m = requestIdleCallback(() => {
|
|
73
|
+
P(oe(S, d.toLowerCase()));
|
|
74
74
|
});
|
|
75
75
|
return () => {
|
|
76
|
-
cancelIdleCallback(
|
|
76
|
+
cancelIdleCallback(m);
|
|
77
77
|
};
|
|
78
|
-
}, [
|
|
79
|
-
const
|
|
80
|
-
e.emitMenuSelected(
|
|
78
|
+
}, [S, d]);
|
|
79
|
+
const y = (m) => {
|
|
80
|
+
e.emitMenuSelected(m), r.executeCommand(U.id);
|
|
81
81
|
};
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
L(() => {
|
|
83
|
+
const m = new We();
|
|
84
|
+
i.getAllShortcuts().filter((p) => p.binding && wt.includes(p.binding)).forEach((p) => {
|
|
85
|
+
const M = p.preconditions;
|
|
86
|
+
p.preconditions = () => !1, m.add(qe(() => {
|
|
87
|
+
p.preconditions = M;
|
|
88
88
|
}));
|
|
89
89
|
});
|
|
90
|
-
const
|
|
91
|
-
id: `quick.insert.popup.enter.${
|
|
92
|
-
type:
|
|
90
|
+
const x = {
|
|
91
|
+
id: `quick.insert.popup.enter.${s}`,
|
|
92
|
+
type: k.OPERATION,
|
|
93
93
|
handler: () => {
|
|
94
|
-
const
|
|
95
|
-
|
|
94
|
+
const p = o.current;
|
|
95
|
+
p && y(p);
|
|
96
96
|
}
|
|
97
|
-
},
|
|
98
|
-
id: `quick.insert.popup.move.cursor.up.${
|
|
99
|
-
type:
|
|
97
|
+
}, D = {
|
|
98
|
+
id: `quick.insert.popup.move.cursor.up.${s}`,
|
|
99
|
+
type: k.OPERATION,
|
|
100
100
|
handler: () => {
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
return
|
|
101
|
+
l((p) => {
|
|
102
|
+
const M = p - 1;
|
|
103
|
+
return M >= 0 ? M : a.current - 1;
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
}, R = {
|
|
107
|
-
id: `quick.insert.popup.move.cursor.down.${
|
|
108
|
-
type:
|
|
107
|
+
id: `quick.insert.popup.move.cursor.down.${s}`,
|
|
108
|
+
type: k.OPERATION,
|
|
109
109
|
handler: () => {
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
return
|
|
110
|
+
l((p) => {
|
|
111
|
+
const M = p + 1;
|
|
112
|
+
return M <= a.current - 1 ? M : 0;
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
|
-
return
|
|
116
|
+
return m.add(r.registerCommand(D)), m.add(r.registerCommand(R)), m.add(r.registerCommand(x)), m.add(i.registerShortcut({
|
|
117
117
|
priority: 1e3,
|
|
118
|
-
id:
|
|
119
|
-
binding:
|
|
118
|
+
id: D.id,
|
|
119
|
+
binding: O.ARROW_UP,
|
|
120
120
|
preconditions: () => !0,
|
|
121
121
|
staticParameters: {
|
|
122
|
-
direction:
|
|
122
|
+
direction: B.UP
|
|
123
123
|
}
|
|
124
|
-
})),
|
|
124
|
+
})), m.add(i.registerShortcut({
|
|
125
125
|
priority: 1e3,
|
|
126
126
|
id: R.id,
|
|
127
|
-
binding:
|
|
127
|
+
binding: O.ARROW_DOWN,
|
|
128
128
|
preconditions: () => !0,
|
|
129
129
|
staticParameters: {
|
|
130
|
-
direction:
|
|
130
|
+
direction: B.DOWN
|
|
131
131
|
}
|
|
132
|
-
})),
|
|
132
|
+
})), m.add(i.registerShortcut({
|
|
133
133
|
priority: 1e3,
|
|
134
|
-
id:
|
|
135
|
-
binding:
|
|
134
|
+
id: x.id,
|
|
135
|
+
binding: O.ENTER,
|
|
136
136
|
preconditions: () => !0
|
|
137
137
|
})), () => {
|
|
138
|
-
|
|
138
|
+
m.dispose();
|
|
139
139
|
};
|
|
140
|
-
}, []),
|
|
141
|
-
|
|
142
|
-
}, [
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
}, []), L(() => {
|
|
141
|
+
l(0);
|
|
142
|
+
}, [b]);
|
|
143
|
+
const w = j(/* @__PURE__ */ new Map());
|
|
144
|
+
L(() => () => {
|
|
145
|
+
w.current.clear();
|
|
146
146
|
}, []);
|
|
147
|
-
function $(
|
|
148
|
-
return
|
|
149
|
-
const
|
|
150
|
-
if ("children" in
|
|
147
|
+
function $(m) {
|
|
148
|
+
return m.map((v) => {
|
|
149
|
+
const ee = v.icon, x = ee ? n.get(ee) : null;
|
|
150
|
+
if ("children" in v)
|
|
151
151
|
return /* @__PURE__ */ h(
|
|
152
|
-
|
|
152
|
+
vt,
|
|
153
153
|
{
|
|
154
|
-
title: /* @__PURE__ */
|
|
154
|
+
title: /* @__PURE__ */ ve(
|
|
155
155
|
"div",
|
|
156
156
|
{
|
|
157
157
|
className: "univer-mb-2 univer-flex univer-items-center univer-text-xs univer-text-gray-400",
|
|
158
158
|
children: [
|
|
159
|
-
|
|
160
|
-
/* @__PURE__ */ h("span", { children:
|
|
159
|
+
x && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(x, {}) }),
|
|
160
|
+
/* @__PURE__ */ h("span", { children: v.title })
|
|
161
161
|
]
|
|
162
162
|
}
|
|
163
163
|
),
|
|
164
|
-
children: $(
|
|
164
|
+
children: $(v.children)
|
|
165
165
|
},
|
|
166
|
-
|
|
166
|
+
v.id
|
|
167
167
|
);
|
|
168
|
-
const
|
|
168
|
+
const D = a.current, R = c === D;
|
|
169
169
|
if (R) {
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
170
|
+
o.current = v;
|
|
171
|
+
const p = w.current.get(v.id);
|
|
172
|
+
p == null || p.scrollIntoView({
|
|
173
173
|
block: "nearest"
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
return a.current++, /* @__PURE__ */ h(
|
|
177
177
|
Ct,
|
|
178
178
|
{
|
|
179
|
-
ref: (
|
|
180
|
-
|
|
179
|
+
ref: (p) => {
|
|
180
|
+
p && w.current.set(v.id, p);
|
|
181
181
|
},
|
|
182
|
-
onMouseEnter: () =>
|
|
183
|
-
onMouseLeave: () =>
|
|
184
|
-
className:
|
|
182
|
+
onMouseEnter: () => l(D),
|
|
183
|
+
onMouseLeave: () => l(Number.NaN),
|
|
184
|
+
className: re("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm", {
|
|
185
185
|
"hover:univer-bg-transparent": !R,
|
|
186
186
|
"univer-bg-gray-100 dark:!univer-bg-gray-500": R
|
|
187
187
|
}),
|
|
188
188
|
onClick: () => {
|
|
189
|
-
|
|
189
|
+
y(v);
|
|
190
190
|
},
|
|
191
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ ve(
|
|
192
192
|
"div",
|
|
193
193
|
{
|
|
194
194
|
className: "univer-flex univer-w-full univer-items-center univer-px-1",
|
|
195
195
|
children: [
|
|
196
|
-
|
|
197
|
-
/* @__PURE__ */ h(
|
|
196
|
+
x && /* @__PURE__ */ h("span", { className: "univer-mr-2 univer-inline-flex univer-text-base", children: /* @__PURE__ */ h(x, {}) }),
|
|
197
|
+
/* @__PURE__ */ h(_t, { showIfEllipsis: !0, title: v.title, placement: "right", children: /* @__PURE__ */ h("span", { className: "univer-truncate", children: v.title }) })
|
|
198
198
|
]
|
|
199
199
|
}
|
|
200
200
|
)
|
|
201
201
|
},
|
|
202
|
-
|
|
202
|
+
v.id
|
|
203
203
|
);
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
const
|
|
207
|
-
return /* @__PURE__ */ h("div", { className: "univer-mt-2", children:
|
|
206
|
+
const Ke = b.length > 0, me = (u == null ? void 0 : u.popup.Placeholder) || n.get(q.componentKey);
|
|
207
|
+
return /* @__PURE__ */ h("div", { className: "univer-mt-2", children: Ke ? /* @__PURE__ */ h(
|
|
208
208
|
gt,
|
|
209
209
|
{
|
|
210
|
-
wrapperClass:
|
|
211
|
-
children: $(
|
|
210
|
+
wrapperClass: re("univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto univer-overflow-x-hidden", mt),
|
|
211
|
+
children: $(b)
|
|
212
212
|
}
|
|
213
213
|
) : me && /* @__PURE__ */ h(me, {}) });
|
|
214
214
|
};
|
|
215
|
-
|
|
216
|
-
var Rt = Object.getOwnPropertyDescriptor,
|
|
217
|
-
for (var
|
|
218
|
-
(c = t[
|
|
219
|
-
return
|
|
220
|
-
},
|
|
221
|
-
const
|
|
215
|
+
Z.componentKey = "docs.quick.insert.popup";
|
|
216
|
+
var Rt = Object.getOwnPropertyDescriptor, kt = (t, e, n, i) => {
|
|
217
|
+
for (var r = i > 1 ? void 0 : i ? Rt(e, n) : e, s = t.length - 1, c; s >= 0; s--)
|
|
218
|
+
(c = t[s]) && (r = c(r) || r);
|
|
219
|
+
return r;
|
|
220
|
+
}, N = (t, e) => (n, i) => e(n, i, t);
|
|
221
|
+
const _e = {
|
|
222
222
|
dispose: () => {
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
let
|
|
226
|
-
constructor(e,
|
|
225
|
+
let I = class extends Y {
|
|
226
|
+
constructor(e, n, i, r, s) {
|
|
227
227
|
super();
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this._docCanvasPopupManagerService = e, this._univerInstanceService =
|
|
239
|
-
const c = (
|
|
240
|
-
var d,
|
|
241
|
-
return (
|
|
228
|
+
C(this, "_popups", /* @__PURE__ */ new Set());
|
|
229
|
+
C(this, "_editPopup$", new A(void 0));
|
|
230
|
+
C(this, "editPopup$", this._editPopup$.asObservable());
|
|
231
|
+
C(this, "_isComposing$", new A(!1));
|
|
232
|
+
C(this, "isComposing$", this._isComposing$.asObservable());
|
|
233
|
+
C(this, "_inputOffset$", new A({ start: 0, end: 0 }));
|
|
234
|
+
C(this, "inputOffset$", this._inputOffset$.asObservable());
|
|
235
|
+
C(this, "filterKeyword$");
|
|
236
|
+
C(this, "_menuSelectedCallbacks", /* @__PURE__ */ new Set());
|
|
237
|
+
C(this, "_inputPlaceholderRenderRoot", null);
|
|
238
|
+
this._docCanvasPopupManagerService = e, this._univerInstanceService = n, this._commandService = i, this._renderManagerService = r, this._docSelectionManagerService = s, this.disposeWithMe(this._editPopup$);
|
|
239
|
+
const c = (o, a) => {
|
|
240
|
+
var d, u;
|
|
241
|
+
return (u = (d = this._univerInstanceService.getCurrentUnitOfType(H.UNIVER_DOC)) == null ? void 0 : d.getBody()) == null ? void 0 : u.dataStream.slice(o, a);
|
|
242
242
|
};
|
|
243
|
-
let
|
|
243
|
+
let l = "";
|
|
244
244
|
this.filterKeyword$ = this._inputOffset$.pipe(
|
|
245
|
-
|
|
245
|
+
Me((o) => {
|
|
246
246
|
var d;
|
|
247
|
-
const a = c(
|
|
247
|
+
const a = c(o.start, o.end);
|
|
248
248
|
return (d = a == null ? void 0 : a.slice(1)) != null ? d : "";
|
|
249
249
|
}),
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
ht(),
|
|
251
|
+
K((o) => {
|
|
252
|
+
l = o;
|
|
253
253
|
})
|
|
254
|
-
), this.disposeWithMe(
|
|
255
|
-
this.filterKeyword$.pipe(
|
|
256
|
-
var a, d,
|
|
257
|
-
|
|
254
|
+
), this.disposeWithMe(fe([
|
|
255
|
+
this.filterKeyword$.pipe(K((o) => {
|
|
256
|
+
var a, d, u;
|
|
257
|
+
o.length > 0 ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : (u = this._inputPlaceholderRenderRoot) == null || u.mount();
|
|
258
258
|
})),
|
|
259
|
-
this.isComposing$.pipe(
|
|
260
|
-
var a, d,
|
|
261
|
-
|
|
259
|
+
this.isComposing$.pipe(K((o) => {
|
|
260
|
+
var a, d, u;
|
|
261
|
+
o ? (d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose() : l.length <= 0 && ((u = this._inputPlaceholderRenderRoot) == null || u.mount());
|
|
262
262
|
})),
|
|
263
|
-
this.editPopup$.pipe(
|
|
263
|
+
this.editPopup$.pipe(K((o) => {
|
|
264
264
|
var a, d;
|
|
265
|
-
|
|
265
|
+
o || ((d = (a = this._inputPlaceholderRenderRoot) == null ? void 0 : a.unmount) == null || d.dispose(), this._inputPlaceholderRenderRoot = null);
|
|
266
266
|
}))
|
|
267
267
|
]).subscribe());
|
|
268
268
|
}
|
|
@@ -285,11 +285,11 @@ let S = class extends J {
|
|
|
285
285
|
this._inputOffset$.next(e);
|
|
286
286
|
}
|
|
287
287
|
getDocEventManagerService(e) {
|
|
288
|
-
var
|
|
289
|
-
return (
|
|
288
|
+
var n;
|
|
289
|
+
return (n = this._renderManagerService.getRenderById(e)) == null ? void 0 : n.with(Pe);
|
|
290
290
|
}
|
|
291
291
|
resolvePopup(e) {
|
|
292
|
-
return Array.from(this._popups).find((
|
|
292
|
+
return Array.from(this._popups).find((n) => n.keyword === e);
|
|
293
293
|
}
|
|
294
294
|
registerPopup(e) {
|
|
295
295
|
return this._popups.add(e), () => {
|
|
@@ -303,58 +303,58 @@ let S = class extends J {
|
|
|
303
303
|
if (this.isMounted)
|
|
304
304
|
return;
|
|
305
305
|
this.isMounted = !0;
|
|
306
|
-
const
|
|
306
|
+
const i = e();
|
|
307
307
|
this.unmount = {
|
|
308
308
|
dispose: () => {
|
|
309
|
-
|
|
309
|
+
i.dispose(), this.isMounted = !1;
|
|
310
310
|
}
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
315
|
showPopup(e) {
|
|
316
|
-
var d,
|
|
317
|
-
const { popup:
|
|
316
|
+
var d, u;
|
|
317
|
+
const { popup: n, index: i, unitId: r } = e;
|
|
318
318
|
this.closePopup();
|
|
319
|
-
const
|
|
319
|
+
const s = this._univerInstanceService.getUnit(r), c = (u = (d = s == null ? void 0 : s.getBody()) == null ? void 0 : d.paragraphs) == null ? void 0 : u.find((g) => g.startIndex > i);
|
|
320
320
|
if (!c)
|
|
321
321
|
return;
|
|
322
|
-
const
|
|
323
|
-
if (!
|
|
322
|
+
const l = this.getDocEventManagerService(r), o = l == null ? void 0 : l.findParagraphBoundByIndex(c.startIndex);
|
|
323
|
+
if (!o)
|
|
324
324
|
return;
|
|
325
325
|
this._inputPlaceholderRenderRoot = this._createInputPlaceholderRenderRoot(() => {
|
|
326
326
|
var $;
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
329
|
-
return
|
|
330
|
-
const P =
|
|
327
|
+
const g = ($ = this._renderManagerService.getRenderById(r)) == null ? void 0 : $.with(Je), S = this._docSelectionManagerService.getActiveTextRange();
|
|
328
|
+
if (!g || !S)
|
|
329
|
+
return _e;
|
|
330
|
+
const P = g.getSkeleton().findNodeByCharIndex(S.startOffset, S.segmentId, S.segmentPage);
|
|
331
331
|
if (!((P == null ? void 0 : P.content) === "\r"))
|
|
332
|
-
return
|
|
333
|
-
const
|
|
334
|
-
{ startOffset:
|
|
332
|
+
return _e;
|
|
333
|
+
const w = this._docCanvasPopupManagerService.attachPopupToRange(
|
|
334
|
+
{ startOffset: i + 1, endOffset: i + 1, collapsed: !1 },
|
|
335
335
|
{
|
|
336
|
-
componentKey:
|
|
336
|
+
componentKey: W.componentKey,
|
|
337
337
|
onClickOutside: () => {
|
|
338
|
-
|
|
338
|
+
w.dispose();
|
|
339
339
|
},
|
|
340
340
|
direction: "horizontal"
|
|
341
341
|
},
|
|
342
|
-
|
|
342
|
+
r
|
|
343
343
|
);
|
|
344
|
-
return
|
|
344
|
+
return w;
|
|
345
345
|
}), this._inputPlaceholderRenderRoot.mount();
|
|
346
346
|
const a = this._docCanvasPopupManagerService.attachPopupToRect(
|
|
347
|
-
|
|
347
|
+
o.firstLine,
|
|
348
348
|
{
|
|
349
|
-
componentKey:
|
|
349
|
+
componentKey: Z.componentKey,
|
|
350
350
|
onClickOutside: () => {
|
|
351
351
|
this.closePopup();
|
|
352
352
|
},
|
|
353
353
|
direction: "bottom"
|
|
354
354
|
},
|
|
355
|
-
|
|
355
|
+
r
|
|
356
356
|
);
|
|
357
|
-
this._editPopup$.next({ disposable: a, popup:
|
|
357
|
+
this._editPopup$.next({ disposable: a, popup: n, anchor: i, unitId: r });
|
|
358
358
|
}
|
|
359
359
|
closePopup() {
|
|
360
360
|
this.editPopup && (this.editPopup.disposable.dispose(), this._editPopup$.next(null));
|
|
@@ -365,62 +365,62 @@ let S = class extends J {
|
|
|
365
365
|
};
|
|
366
366
|
}
|
|
367
367
|
emitMenuSelected(e) {
|
|
368
|
-
const { start:
|
|
369
|
-
this._commandService.syncExecuteCommand(
|
|
370
|
-
start:
|
|
371
|
-
end:
|
|
368
|
+
const { start: n, end: i } = this.inputOffset;
|
|
369
|
+
this._commandService.syncExecuteCommand(Oe.id, {
|
|
370
|
+
start: n,
|
|
371
|
+
end: i
|
|
372
372
|
}), setTimeout(() => {
|
|
373
|
-
this._menuSelectedCallbacks.forEach((
|
|
373
|
+
this._menuSelectedCallbacks.forEach((r) => r(e));
|
|
374
374
|
}, 0);
|
|
375
375
|
}
|
|
376
376
|
};
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
],
|
|
384
|
-
const
|
|
385
|
-
type:
|
|
377
|
+
I = kt([
|
|
378
|
+
N(0, f(Se)),
|
|
379
|
+
N(1, f(pe)),
|
|
380
|
+
N(2, f(Q)),
|
|
381
|
+
N(3, f(he)),
|
|
382
|
+
N(4, f(le))
|
|
383
|
+
], I);
|
|
384
|
+
const we = {
|
|
385
|
+
type: k.OPERATION,
|
|
386
386
|
id: "doc.operation.show-quick-insert-popup",
|
|
387
387
|
handler(t, e) {
|
|
388
|
-
const
|
|
389
|
-
return e ? (
|
|
388
|
+
const n = t.get(I);
|
|
389
|
+
return e ? (n.showPopup(e), !0) : !1;
|
|
390
390
|
}
|
|
391
|
-
},
|
|
392
|
-
type:
|
|
391
|
+
}, U = {
|
|
392
|
+
type: k.OPERATION,
|
|
393
393
|
id: "doc.operation.close-quick-insert-popup",
|
|
394
394
|
handler(t) {
|
|
395
|
-
return t.get(
|
|
395
|
+
return t.get(I).closePopup(), !0;
|
|
396
396
|
}
|
|
397
397
|
}, Re = {
|
|
398
398
|
id: "quick-insert.text.menu",
|
|
399
399
|
title: "docQuickInsert.menu.text",
|
|
400
400
|
icon: "TextIcon",
|
|
401
401
|
keywords: ["text"]
|
|
402
|
-
},
|
|
403
|
-
id:
|
|
402
|
+
}, ke = {
|
|
403
|
+
id: tt.id,
|
|
404
404
|
title: "docQuickInsert.menu.numberedList",
|
|
405
405
|
icon: "OrderIcon",
|
|
406
406
|
keywords: ["numbered", "list", "ordered"]
|
|
407
407
|
}, $e = {
|
|
408
|
-
id:
|
|
408
|
+
id: nt.id,
|
|
409
409
|
title: "docQuickInsert.menu.bulletedList",
|
|
410
410
|
icon: "UnorderIcon",
|
|
411
411
|
keywords: ["bulleted", "list", "unordered"]
|
|
412
|
-
},
|
|
412
|
+
}, De = {
|
|
413
413
|
id: it.id,
|
|
414
414
|
title: "docQuickInsert.menu.divider",
|
|
415
415
|
icon: "DividerIcon",
|
|
416
416
|
keywords: ["divider", "line", "separate"]
|
|
417
|
-
},
|
|
418
|
-
id:
|
|
417
|
+
}, Ne = {
|
|
418
|
+
id: rt.id,
|
|
419
419
|
title: "docQuickInsert.menu.table",
|
|
420
420
|
icon: "GridIcon",
|
|
421
421
|
keywords: ["table", "grid", "spreadsheet"]
|
|
422
|
-
},
|
|
423
|
-
id:
|
|
422
|
+
}, Ee = {
|
|
423
|
+
id: St.id,
|
|
424
424
|
title: "docQuickInsert.menu.image",
|
|
425
425
|
icon: "AdditionAndSubtractionIcon",
|
|
426
426
|
keywords: ["image", "picture", "photo"]
|
|
@@ -430,30 +430,30 @@ const ke = {
|
|
|
430
430
|
id: "quick.insert.group.basic",
|
|
431
431
|
children: [
|
|
432
432
|
Re,
|
|
433
|
-
|
|
433
|
+
ke,
|
|
434
434
|
$e,
|
|
435
|
+
De,
|
|
435
436
|
Ne,
|
|
436
|
-
Ee
|
|
437
|
-
Ue
|
|
437
|
+
Ee
|
|
438
438
|
]
|
|
439
439
|
}
|
|
440
|
-
],
|
|
441
|
-
|
|
440
|
+
], Dt = /* @__PURE__ */ new Set([
|
|
441
|
+
ke.id,
|
|
442
442
|
$e.id,
|
|
443
|
+
De.id,
|
|
443
444
|
Ne.id,
|
|
444
|
-
Ee.id
|
|
445
|
-
Ue.id
|
|
445
|
+
Ee.id
|
|
446
446
|
]);
|
|
447
|
-
var
|
|
448
|
-
for (var
|
|
449
|
-
(c = t[
|
|
450
|
-
return
|
|
451
|
-
},
|
|
452
|
-
let
|
|
453
|
-
constructor(t, e,
|
|
454
|
-
super(), this._commandService = t, this._textSelectionManagerService = e, this._docQuickInsertPopupService =
|
|
455
|
-
id:
|
|
456
|
-
binding:
|
|
447
|
+
var Nt = Object.getOwnPropertyDescriptor, Et = (t, e, n, i) => {
|
|
448
|
+
for (var r = i > 1 ? void 0 : i ? Nt(e, n) : e, s = t.length - 1, c; s >= 0; s--)
|
|
449
|
+
(c = t[s]) && (r = c(r) || r);
|
|
450
|
+
return r;
|
|
451
|
+
}, E = (t, e) => (n, i) => e(n, i, t);
|
|
452
|
+
let V = class extends Y {
|
|
453
|
+
constructor(t, e, n, i, r) {
|
|
454
|
+
super(), this._commandService = t, this._textSelectionManagerService = e, this._docQuickInsertPopupService = n, this._shortcutService = i, this._univerInstanceService = r, this.disposeWithMe(this._shortcutService.registerShortcut({
|
|
455
|
+
id: U.id,
|
|
456
|
+
binding: O.ESC,
|
|
457
457
|
preconditions: () => !!this._docQuickInsertPopupService.editPopup,
|
|
458
458
|
priority: 1e3
|
|
459
459
|
})), this._initTrigger(), this._initMenuHandler();
|
|
@@ -463,59 +463,59 @@ let F = class extends J {
|
|
|
463
463
|
this.disposeWithMe(
|
|
464
464
|
// eslint-disable-next-line complexity, max-lines-per-function
|
|
465
465
|
this._commandService.onCommandExecuted((t) => {
|
|
466
|
-
var
|
|
467
|
-
const { _docQuickInsertPopupService: e, _textSelectionManagerService:
|
|
468
|
-
if (!(
|
|
466
|
+
var s, c, l;
|
|
467
|
+
const { _docQuickInsertPopupService: e, _textSelectionManagerService: n, _commandService: i } = this, r = this._univerInstanceService.getCurrentUnitOfType(H.UNIVER_DOC);
|
|
468
|
+
if (!(r != null && r.getDisabled())) {
|
|
469
469
|
if (t.id === st.id) {
|
|
470
|
-
const
|
|
470
|
+
const o = t.params;
|
|
471
471
|
if (e.editPopup) {
|
|
472
472
|
e.setInputOffset({
|
|
473
473
|
start: e.inputOffset.start,
|
|
474
|
-
end:
|
|
474
|
+
end: o.range.endOffset + 1
|
|
475
475
|
});
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
|
-
const a =
|
|
478
|
+
const a = n.getActiveTextRange();
|
|
479
479
|
if (!a)
|
|
480
480
|
return;
|
|
481
|
-
const d = e.resolvePopup(
|
|
482
|
-
if (!d || !(d.preconditions ? d.preconditions(
|
|
481
|
+
const d = e.resolvePopup(o.body.dataStream);
|
|
482
|
+
if (!d || !(d.preconditions ? d.preconditions(o) : !0))
|
|
483
483
|
return;
|
|
484
484
|
e.setInputOffset({ start: a.startOffset - 1, end: a.startOffset }), setTimeout(() => {
|
|
485
|
-
|
|
485
|
+
i.executeCommand(we.id, {
|
|
486
486
|
index: a.startOffset - 1,
|
|
487
|
-
unitId:
|
|
487
|
+
unitId: o.unitId,
|
|
488
488
|
popup: d
|
|
489
489
|
});
|
|
490
490
|
}, 100);
|
|
491
491
|
}
|
|
492
|
-
if (t.id ===
|
|
493
|
-
const
|
|
494
|
-
!e.isComposing &&
|
|
492
|
+
if (t.id === ot.id) {
|
|
493
|
+
const o = t.params;
|
|
494
|
+
!e.isComposing && o.isCompositionStart && e.setIsComposing(!0), e.isComposing && o.isCompositionEnd && e.setIsComposing(!1);
|
|
495
495
|
}
|
|
496
|
-
if (t.id ===
|
|
497
|
-
const
|
|
498
|
-
if (
|
|
499
|
-
const a = (c = (
|
|
496
|
+
if (t.id === Xe.id) {
|
|
497
|
+
const o = t.params;
|
|
498
|
+
if (o.isCompositionEnd) {
|
|
499
|
+
const a = (c = (s = o.textRanges) == null ? void 0 : s[0]) == null ? void 0 : c.endOffset;
|
|
500
500
|
a && e.setInputOffset({ start: e.inputOffset.start, end: a });
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
if (t.id ===
|
|
504
|
-
const
|
|
505
|
-
if (e.editPopup &&
|
|
506
|
-
const a = (
|
|
507
|
-
e.setInputOffset({ start: e.inputOffset.start, end:
|
|
503
|
+
if (t.id === ct.id) {
|
|
504
|
+
const o = t.params;
|
|
505
|
+
if (e.editPopup && o.direction === Ze.LEFT) {
|
|
506
|
+
const a = (l = o.len) != null ? l : 0;
|
|
507
|
+
e.setInputOffset({ start: e.inputOffset.start, end: o.range.endOffset - a });
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
if (t.id ===
|
|
511
|
-
const
|
|
512
|
-
(
|
|
510
|
+
if (t.id === at.id) {
|
|
511
|
+
const o = t.params;
|
|
512
|
+
(o.direction === B.LEFT || o.direction === B.RIGHT) && e.editPopup && i.executeCommand(U.id);
|
|
513
513
|
}
|
|
514
|
-
if (t.id ===
|
|
515
|
-
const
|
|
516
|
-
if (!e.editPopup || !
|
|
514
|
+
if (t.id === dt.id) {
|
|
515
|
+
const o = n.getActiveTextRange();
|
|
516
|
+
if (!e.editPopup || !o)
|
|
517
517
|
return;
|
|
518
|
-
|
|
518
|
+
o.endOffset <= e.editPopup.anchor && i.executeCommand(U.id);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
521
|
})
|
|
@@ -523,120 +523,249 @@ let F = class extends J {
|
|
|
523
523
|
}
|
|
524
524
|
_initMenuHandler() {
|
|
525
525
|
this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected((t) => {
|
|
526
|
-
t.id !== Re.id &&
|
|
526
|
+
t.id !== Re.id && Dt.has(t.id) && this._commandService.executeCommand(t.id);
|
|
527
527
|
}));
|
|
528
528
|
}
|
|
529
529
|
};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
],
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return Te(r, "".concat(n), { defIds: r.defIds, idSuffix: s.current }, C({ ref: e, className: u }, c), o);
|
|
555
|
-
});
|
|
556
|
-
function Te(t, e, r, n, i) {
|
|
557
|
-
return ee(t.tag, C(C({ key: e }, Qt(t, r, i)), n), (Ht(t, r).children || []).map(function(o, c) {
|
|
558
|
-
return Te(o, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i);
|
|
559
|
-
}));
|
|
530
|
+
V = Et([
|
|
531
|
+
E(0, Q),
|
|
532
|
+
E(1, f(le)),
|
|
533
|
+
E(2, f(I)),
|
|
534
|
+
E(3, f(xe)),
|
|
535
|
+
E(4, f(pe))
|
|
536
|
+
], V);
|
|
537
|
+
function X({ ref: t, ...e }) {
|
|
538
|
+
const { icon: n, id: i, className: r, extend: s, ...c } = e, l = `univerjs-icon univerjs-icon-${i} ${r || ""}`.trim(), o = j(`_${Qt()}`);
|
|
539
|
+
return Te(n, `${i}`, {
|
|
540
|
+
defIds: n.defIds,
|
|
541
|
+
idSuffix: o.current
|
|
542
|
+
}, {
|
|
543
|
+
ref: t,
|
|
544
|
+
className: l,
|
|
545
|
+
...c
|
|
546
|
+
}, s);
|
|
547
|
+
}
|
|
548
|
+
function Te(t, e, n, i, r) {
|
|
549
|
+
return J(t.tag, {
|
|
550
|
+
key: e,
|
|
551
|
+
...Tt(t, n, r),
|
|
552
|
+
...i
|
|
553
|
+
}, (Ut(t, n).children || []).map((s, c) => Te(s, `${e}-${t.tag}-${c}`, n, void 0, r)));
|
|
560
554
|
}
|
|
561
|
-
function
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
c === "mask" && typeof u == "string" && (n[c] = u.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
555
|
+
function Tt(t, e, n) {
|
|
556
|
+
const i = { ...t.attrs };
|
|
557
|
+
n != null && n.colorChannel1 && i.fill === "colorChannel1" && (i.fill = n.colorChannel1), t.tag === "mask" && i.id && (i.id = i.id + e.idSuffix), Object.entries(i).forEach(([s, c]) => {
|
|
558
|
+
s === "mask" && typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
566
559
|
});
|
|
567
|
-
|
|
568
|
-
return !
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
})), n;
|
|
560
|
+
const { defIds: r } = e;
|
|
561
|
+
return !r || r.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(([s, c]) => {
|
|
562
|
+
typeof c == "string" && (i[s] = c.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
563
|
+
})), i;
|
|
572
564
|
}
|
|
573
|
-
function
|
|
574
|
-
var
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
565
|
+
function Ut(t, e) {
|
|
566
|
+
var i;
|
|
567
|
+
const { defIds: n } = e;
|
|
568
|
+
return !n || n.length === 0 ? t : t.tag === "defs" && ((i = t.children) != null && i.length) ? {
|
|
569
|
+
...t,
|
|
570
|
+
children: t.children.map((r) => typeof r.attrs.id == "string" && n && n.includes(r.attrs.id) ? {
|
|
571
|
+
...r,
|
|
572
|
+
attrs: {
|
|
573
|
+
...r.attrs,
|
|
574
|
+
id: r.attrs.id + e.idSuffix
|
|
575
|
+
}
|
|
576
|
+
} : r)
|
|
577
|
+
} : t;
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function Qt() {
|
|
580
580
|
return Math.random().toString(36).substring(2, 8);
|
|
581
581
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
582
|
+
X.displayName = "UniverIcon";
|
|
583
|
+
const Ht = {
|
|
584
|
+
tag: "svg",
|
|
585
|
+
attrs: {
|
|
586
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
587
|
+
fill: "none",
|
|
588
|
+
viewBox: "0 0 16 16",
|
|
589
|
+
width: "1em",
|
|
590
|
+
height: "1em"
|
|
591
|
+
},
|
|
592
|
+
children: [
|
|
593
|
+
{
|
|
594
|
+
tag: "path",
|
|
595
|
+
attrs: {
|
|
596
|
+
fill: "currentColor",
|
|
597
|
+
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"
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
tag: "path",
|
|
602
|
+
attrs: {
|
|
603
|
+
fill: "currentColor",
|
|
604
|
+
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"
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
tag: "path",
|
|
609
|
+
attrs: {
|
|
610
|
+
fill: "currentColor",
|
|
611
|
+
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"
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
tag: "path",
|
|
616
|
+
attrs: {
|
|
617
|
+
fill: "currentColor",
|
|
618
|
+
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"
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
tag: "path",
|
|
623
|
+
attrs: {
|
|
624
|
+
fill: "currentColor",
|
|
625
|
+
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"
|
|
626
|
+
}
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
tag: "path",
|
|
630
|
+
attrs: {
|
|
631
|
+
fill: "currentColor",
|
|
632
|
+
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"
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
tag: "path",
|
|
637
|
+
attrs: {
|
|
638
|
+
fill: "currentColor",
|
|
639
|
+
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"
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
tag: "path",
|
|
644
|
+
attrs: {
|
|
645
|
+
fill: "currentColor",
|
|
646
|
+
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"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
tag: "path",
|
|
651
|
+
attrs: {
|
|
652
|
+
fill: "currentColor",
|
|
653
|
+
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"
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
]
|
|
657
|
+
}, ce = ge(function(e, n) {
|
|
658
|
+
return J(X, Object.assign({}, e, {
|
|
585
659
|
id: "divider-icon",
|
|
586
|
-
ref:
|
|
587
|
-
icon:
|
|
660
|
+
ref: n,
|
|
661
|
+
icon: Ht
|
|
588
662
|
}));
|
|
589
663
|
});
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
664
|
+
ce.displayName = "DividerIcon";
|
|
665
|
+
const Kt = {
|
|
666
|
+
tag: "svg",
|
|
667
|
+
attrs: {
|
|
668
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
669
|
+
fill: "none",
|
|
670
|
+
viewBox: "0 0 16 16",
|
|
671
|
+
width: "1em",
|
|
672
|
+
height: "1em"
|
|
673
|
+
},
|
|
674
|
+
children: [{
|
|
675
|
+
tag: "path",
|
|
676
|
+
attrs: {
|
|
677
|
+
fill: "currentColor",
|
|
678
|
+
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"
|
|
679
|
+
}
|
|
680
|
+
}]
|
|
681
|
+
}, Ue = ge(function(e, n) {
|
|
682
|
+
return J(X, Object.assign({}, e, {
|
|
593
683
|
id: "increase-icon",
|
|
594
|
-
ref:
|
|
595
|
-
icon:
|
|
684
|
+
ref: n,
|
|
685
|
+
icon: Kt
|
|
596
686
|
}));
|
|
597
687
|
});
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
688
|
+
Ue.displayName = "IncreaseIcon";
|
|
689
|
+
const Lt = {
|
|
690
|
+
tag: "svg",
|
|
691
|
+
attrs: {
|
|
692
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
693
|
+
fill: "none",
|
|
694
|
+
viewBox: "0 0 17 16",
|
|
695
|
+
width: "1em",
|
|
696
|
+
height: "1em"
|
|
697
|
+
},
|
|
698
|
+
children: [{
|
|
699
|
+
tag: "g",
|
|
700
|
+
attrs: {
|
|
701
|
+
fill: "currentColor",
|
|
702
|
+
clipPath: "url(#text-icon_clip0_1293_26)"
|
|
703
|
+
},
|
|
704
|
+
children: [{
|
|
705
|
+
tag: "path",
|
|
706
|
+
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" }
|
|
707
|
+
}, {
|
|
708
|
+
tag: "path",
|
|
709
|
+
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" }
|
|
710
|
+
}]
|
|
711
|
+
}, {
|
|
712
|
+
tag: "defs",
|
|
713
|
+
attrs: {},
|
|
714
|
+
children: [{
|
|
715
|
+
tag: "clipPath",
|
|
716
|
+
attrs: { id: "text-icon_clip0_1293_26" },
|
|
717
|
+
children: [{
|
|
718
|
+
tag: "path",
|
|
719
|
+
attrs: {
|
|
720
|
+
fill: "white",
|
|
721
|
+
d: "M0 0H16V16H0z",
|
|
722
|
+
transform: "translate(.9)"
|
|
723
|
+
}
|
|
724
|
+
}]
|
|
725
|
+
}]
|
|
726
|
+
}],
|
|
727
|
+
defIds: ["text-icon_clip0_1293_26"]
|
|
728
|
+
}, ae = ge(function(e, n) {
|
|
729
|
+
return J(X, Object.assign({}, e, {
|
|
601
730
|
id: "text-icon",
|
|
602
|
-
ref:
|
|
603
|
-
icon:
|
|
731
|
+
ref: n,
|
|
732
|
+
icon: Lt
|
|
604
733
|
}));
|
|
605
734
|
});
|
|
606
|
-
|
|
607
|
-
const
|
|
608
|
-
var
|
|
609
|
-
for (var
|
|
610
|
-
(c = t[
|
|
611
|
-
return
|
|
612
|
-
},
|
|
613
|
-
let
|
|
614
|
-
constructor(e,
|
|
735
|
+
ae.displayName = "TextIcon";
|
|
736
|
+
const Qe = "doc.quick-insert.button";
|
|
737
|
+
var At = Object.getOwnPropertyDescriptor, jt = (t, e, n, i) => {
|
|
738
|
+
for (var r = i > 1 ? void 0 : i ? At(e, n) : e, s = t.length - 1, c; s >= 0; s--)
|
|
739
|
+
(c = t[s]) && (r = c(r) || r);
|
|
740
|
+
return r;
|
|
741
|
+
}, te = (t, e) => (n, i) => e(n, i, t);
|
|
742
|
+
let F = class extends Y {
|
|
743
|
+
constructor(e, n, i, r) {
|
|
615
744
|
super();
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
this._context = e, this._docEventManagerService =
|
|
745
|
+
C(this, "_popup$", new A(null));
|
|
746
|
+
C(this, "popup$", this._popup$.asObservable());
|
|
747
|
+
this._context = e, this._docEventManagerService = n, this._docQuickInsertPopupService = i, this._docCanvasPopManagerService = r, this._init();
|
|
619
748
|
}
|
|
620
749
|
get popup() {
|
|
621
750
|
return this._popup$.value;
|
|
622
751
|
}
|
|
623
752
|
_init() {
|
|
624
|
-
this.disposeWithMe(
|
|
625
|
-
var
|
|
626
|
-
const
|
|
627
|
-
if (!
|
|
753
|
+
this.disposeWithMe(fe([this._docEventManagerService.hoverParagraphLeftRealTime$, this._docEventManagerService.hoverParagraphRealTime$]).subscribe(([e, n]) => {
|
|
754
|
+
var s;
|
|
755
|
+
const i = e != null ? e : n, r = this._context.unit.getDisabled();
|
|
756
|
+
if (!i || r) {
|
|
628
757
|
this._hideMenu(!0);
|
|
629
758
|
return;
|
|
630
759
|
}
|
|
631
|
-
if (
|
|
632
|
-
if (this._docQuickInsertPopupService.editPopup ||
|
|
760
|
+
if (i.paragraphStart === i.paragraphEnd) {
|
|
761
|
+
if (this._docQuickInsertPopupService.editPopup || i.startIndex === ((s = this.popup) == null ? void 0 : s.startIndex)) return;
|
|
633
762
|
this._hideMenu(!0);
|
|
634
|
-
const c = this._docCanvasPopManagerService.attachPopupToRect(
|
|
635
|
-
componentKey:
|
|
763
|
+
const c = this._docCanvasPopManagerService.attachPopupToRect(i.firstLine, {
|
|
764
|
+
componentKey: Qe,
|
|
636
765
|
direction: "left-center"
|
|
637
766
|
}, this._context.unit.getUnitId());
|
|
638
767
|
this._popup$.next({
|
|
639
|
-
startIndex:
|
|
768
|
+
startIndex: i.startIndex,
|
|
640
769
|
disposable: c
|
|
641
770
|
});
|
|
642
771
|
} else
|
|
@@ -647,38 +776,38 @@ let G = class extends J {
|
|
|
647
776
|
this._docQuickInsertPopupService.editPopup || this.popup && (e || this.popup.disposable.canDispose()) && (this.popup.disposable.dispose(), this._popup$.next(null));
|
|
648
777
|
}
|
|
649
778
|
};
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
],
|
|
655
|
-
const
|
|
656
|
-
const e = I
|
|
779
|
+
F = jt([
|
|
780
|
+
te(1, f(Pe)),
|
|
781
|
+
te(2, f(I)),
|
|
782
|
+
te(3, f(Se))
|
|
783
|
+
], F);
|
|
784
|
+
const de = ({ className: t = "" }) => {
|
|
785
|
+
const e = _(I), n = _(pe), i = _(he), r = T(se(() => n.getCurrentTypeOfUnit$(H.UNIVER_DOC), [n])), s = r && i.getRenderById(r.getUnitId()), c = s == null ? void 0 : s.with(F), l = _(ut), o = _(le), a = T(e.editPopup$), d = pt((u) => {
|
|
657
786
|
var P;
|
|
658
|
-
const
|
|
659
|
-
if (!
|
|
787
|
+
const g = c == null ? void 0 : c.popup;
|
|
788
|
+
if (!g)
|
|
660
789
|
return;
|
|
661
|
-
const
|
|
790
|
+
const S = e.popups, b = {
|
|
662
791
|
keyword: "",
|
|
663
|
-
menus$:
|
|
664
|
-
|
|
792
|
+
menus$: fe(S.map((y) => y.menus$)).pipe(
|
|
793
|
+
Me((y) => y.flat())
|
|
665
794
|
)
|
|
666
795
|
};
|
|
667
|
-
|
|
668
|
-
startOffset:
|
|
669
|
-
endOffset:
|
|
670
|
-
}]), e.setInputOffset({ start:
|
|
671
|
-
popup:
|
|
672
|
-
index:
|
|
673
|
-
unitId: (P =
|
|
796
|
+
o.replaceDocRanges([{
|
|
797
|
+
startOffset: g.startIndex,
|
|
798
|
+
endOffset: g.startIndex
|
|
799
|
+
}]), e.setInputOffset({ start: g.startIndex - 1, end: g.startIndex - 1 }), e.showPopup({
|
|
800
|
+
popup: b,
|
|
801
|
+
index: g.startIndex - 1,
|
|
802
|
+
unitId: (P = r == null ? void 0 : r.getUnitId()) != null ? P : ""
|
|
674
803
|
}), setTimeout(() => {
|
|
675
|
-
|
|
804
|
+
l.focus();
|
|
676
805
|
});
|
|
677
806
|
});
|
|
678
807
|
return /* @__PURE__ */ h(
|
|
679
808
|
"div",
|
|
680
809
|
{
|
|
681
|
-
className:
|
|
810
|
+
className: re("univer-mr-1 univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-full univer-p-1.5 univer-shadow-sm hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700", It, {
|
|
682
811
|
"univer-bg-gray-100 dark:!univer-bg-gray-700": a,
|
|
683
812
|
"univer-bg-white dark:!univer-bg-gray-900": !a
|
|
684
813
|
}, t),
|
|
@@ -686,7 +815,7 @@ const pe = ({ className: t = "" }) => {
|
|
|
686
815
|
tabIndex: 0,
|
|
687
816
|
onClick: d,
|
|
688
817
|
children: /* @__PURE__ */ h(
|
|
689
|
-
|
|
818
|
+
Ue,
|
|
690
819
|
{
|
|
691
820
|
className: "univer-text-gray-800 dark:!univer-text-gray-200"
|
|
692
821
|
}
|
|
@@ -694,43 +823,43 @@ const pe = ({ className: t = "" }) => {
|
|
|
694
823
|
}
|
|
695
824
|
);
|
|
696
825
|
};
|
|
697
|
-
|
|
698
|
-
var
|
|
699
|
-
for (var
|
|
700
|
-
(c = t[
|
|
701
|
-
return
|
|
702
|
-
},
|
|
703
|
-
let
|
|
704
|
-
constructor(t, e,
|
|
705
|
-
super(), this._commandService = t, this._docQuickInsertPopupService = e, this._componentManager =
|
|
826
|
+
de.componentKey = Qe;
|
|
827
|
+
var Bt = Object.getOwnPropertyDescriptor, Wt = (t, e, n, i) => {
|
|
828
|
+
for (var r = i > 1 ? void 0 : i ? Bt(e, n) : e, s = t.length - 1, c; s >= 0; s--)
|
|
829
|
+
(c = t[s]) && (r = c(r) || r);
|
|
830
|
+
return r;
|
|
831
|
+
}, ne = (t, e) => (n, i) => e(n, i, t);
|
|
832
|
+
let G = class extends Y {
|
|
833
|
+
constructor(t, e, n) {
|
|
834
|
+
super(), this._commandService = t, this._docQuickInsertPopupService = e, this._componentManager = n, this._initCommands(), this._initComponents(), this._initMenus();
|
|
706
835
|
}
|
|
707
836
|
_initCommands() {
|
|
708
837
|
[
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
838
|
+
Oe,
|
|
839
|
+
we,
|
|
840
|
+
U
|
|
712
841
|
].forEach((t) => {
|
|
713
842
|
this.disposeWithMe(this._commandService.registerCommand(t));
|
|
714
843
|
});
|
|
715
844
|
}
|
|
716
845
|
_initComponents() {
|
|
717
846
|
[
|
|
718
|
-
[V.componentKey, V],
|
|
719
|
-
[q.componentKey, q],
|
|
720
847
|
[Z.componentKey, Z],
|
|
721
|
-
[
|
|
722
|
-
[
|
|
723
|
-
[
|
|
724
|
-
|
|
725
|
-
|
|
848
|
+
[W.componentKey, W],
|
|
849
|
+
[q.componentKey, q],
|
|
850
|
+
[ce.displayName, ce],
|
|
851
|
+
[ae.displayName, ae],
|
|
852
|
+
[de.componentKey, de]
|
|
853
|
+
].forEach(([e, n]) => {
|
|
854
|
+
e && this.disposeWithMe(this._componentManager.register(e, n));
|
|
726
855
|
}), [
|
|
727
856
|
{
|
|
728
857
|
keyword: "/",
|
|
729
|
-
menus$:
|
|
858
|
+
menus$: ft($t),
|
|
730
859
|
// only show when the cursor is at the beginning of a line
|
|
731
860
|
preconditions: (e) => {
|
|
732
|
-
var
|
|
733
|
-
return ((
|
|
861
|
+
var n;
|
|
862
|
+
return ((n = e.range.startNodePosition) == null ? void 0 : n.glyph) === 0;
|
|
734
863
|
}
|
|
735
864
|
}
|
|
736
865
|
].forEach((e) => {
|
|
@@ -740,56 +869,56 @@ let z = class extends J {
|
|
|
740
869
|
_initMenus() {
|
|
741
870
|
}
|
|
742
871
|
};
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
],
|
|
748
|
-
const
|
|
749
|
-
var
|
|
750
|
-
for (var
|
|
751
|
-
(c = t[
|
|
752
|
-
return
|
|
753
|
-
},
|
|
754
|
-
const
|
|
755
|
-
let
|
|
756
|
-
constructor(t =
|
|
757
|
-
super(), this._config = t, this._injector = e, this._renderManagerSrv =
|
|
758
|
-
const { menu:
|
|
872
|
+
G = Wt([
|
|
873
|
+
ne(0, Q),
|
|
874
|
+
ne(1, f(I)),
|
|
875
|
+
ne(2, f(ye))
|
|
876
|
+
], G);
|
|
877
|
+
const qt = "docs-quick-insert-ui.config", Ie = {};
|
|
878
|
+
var Zt = Object.defineProperty, Vt = Object.getOwnPropertyDescriptor, Ft = (t, e, n) => e in t ? Zt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Gt = (t, e, n, i) => {
|
|
879
|
+
for (var r = i > 1 ? void 0 : i ? Vt(e, n) : e, s = t.length - 1, c; s >= 0; s--)
|
|
880
|
+
(c = t[s]) && (r = c(r) || r);
|
|
881
|
+
return r;
|
|
882
|
+
}, ie = (t, e) => (n, i) => e(n, i, t), He = (t, e, n) => Ft(t, typeof e != "symbol" ? e + "" : e, n);
|
|
883
|
+
const zt = "DOC_QUICK_INSERT_UI_PLUGIN";
|
|
884
|
+
let z = class extends ze {
|
|
885
|
+
constructor(t = Ie, e, n, i) {
|
|
886
|
+
super(), this._config = t, this._injector = e, this._renderManagerSrv = n, this._configService = i;
|
|
887
|
+
const { menu: r, ...s } = Ye(
|
|
759
888
|
{},
|
|
760
|
-
|
|
889
|
+
Ie,
|
|
761
890
|
this._config
|
|
762
891
|
);
|
|
763
|
-
|
|
892
|
+
r && this._configService.setConfig("menu", r, { merge: !0 }), this._configService.setConfig(qt, s);
|
|
764
893
|
}
|
|
765
894
|
onStarting() {
|
|
766
895
|
[
|
|
767
|
-
[
|
|
768
|
-
[
|
|
769
|
-
[
|
|
770
|
-
].forEach((e) => this._injector.add(e)), this._injector.get(
|
|
896
|
+
[G],
|
|
897
|
+
[V],
|
|
898
|
+
[I]
|
|
899
|
+
].forEach((e) => this._injector.add(e)), this._injector.get(G);
|
|
771
900
|
}
|
|
772
901
|
onRendered() {
|
|
773
|
-
this._injector.get(
|
|
774
|
-
[
|
|
902
|
+
this._injector.get(V), this._injector.get(I), [
|
|
903
|
+
[F]
|
|
775
904
|
].forEach((t) => {
|
|
776
|
-
this._renderManagerSrv.registerRenderModule(
|
|
905
|
+
this._renderManagerSrv.registerRenderModule(H.UNIVER_DOC, t);
|
|
777
906
|
});
|
|
778
907
|
}
|
|
779
908
|
};
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
],
|
|
909
|
+
He(z, "type", H.UNIVER_DOC);
|
|
910
|
+
He(z, "pluginName", zt);
|
|
911
|
+
z = Gt([
|
|
912
|
+
Ve(Mt, xt, Pt, yt, lt),
|
|
913
|
+
ie(1, f(Fe)),
|
|
914
|
+
ie(2, f(he)),
|
|
915
|
+
ie(3, Ge)
|
|
916
|
+
], z);
|
|
788
917
|
export {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
918
|
+
I as DocQuickInsertPopupService,
|
|
919
|
+
V as DocQuickInsertTriggerController,
|
|
920
|
+
G as DocQuickInsertUIController,
|
|
921
|
+
Ot as KeywordInputPlaceholderComponentKey,
|
|
922
|
+
bt as QuickInsertPlaceholderComponentKey,
|
|
923
|
+
z as UniverDocsQuickInsertUIPlugin
|
|
795
924
|
};
|