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