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