@haklex/rich-plugin-slash-menu 0.0.82 → 0.0.83
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/dist/index.mjs +297 -357
- package/dist/rich-plugin-slash-menu.css +1 -2
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,387 +1,327 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { INSERT_UNORDERED_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND } from "@lexical/list";
|
|
2
5
|
import { INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
3
6
|
import { $createHeadingNode, $createQuoteNode } from "@lexical/rich-text";
|
|
4
7
|
import { $setBlocksType } from "@lexical/selection";
|
|
5
8
|
import { INSERT_TABLE_COMMAND } from "@lexical/table";
|
|
6
|
-
import { $
|
|
7
|
-
import { Heading1, Heading2, Heading3,
|
|
8
|
-
import { createElement,
|
|
9
|
-
import {
|
|
10
|
-
import { autoUpdate, flip, offset, shift, useFloating } from "@floating-ui/react-dom";
|
|
9
|
+
import { $getSelection, $isRangeSelection, $createParagraphNode } from "lexical";
|
|
10
|
+
import { Type, Heading1, Heading2, Heading3, TextQuote, Minus, Table, List, ListOrdered, ListChecks } from "lucide-react";
|
|
11
|
+
import { createElement, useEffect, useMemo, useState, useCallback } from "react";
|
|
12
|
+
import { MenuOption, useBasicTypeaheadTriggerMatch, LexicalTypeaheadMenuPlugin } from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
11
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { useFloating, autoUpdate, offset, flip, shift } from "@floating-ui/react-dom";
|
|
12
15
|
import { collectCommandItems } from "@haklex/rich-editor/commands";
|
|
13
16
|
import { PortalThemeWrapper } from "@haklex/rich-style-token";
|
|
14
17
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
15
18
|
import { createPortal } from "react-dom";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
class SlashMenuItem extends MenuOption {
|
|
20
|
+
constructor(title, options) {
|
|
21
|
+
super(title);
|
|
22
|
+
__publicField(this, "title");
|
|
23
|
+
__publicField(this, "icon");
|
|
24
|
+
__publicField(this, "description");
|
|
25
|
+
__publicField(this, "keywords");
|
|
26
|
+
__publicField(this, "section");
|
|
27
|
+
__publicField(this, "onSelect");
|
|
28
|
+
this.title = title;
|
|
29
|
+
this.icon = options.icon ?? "";
|
|
30
|
+
this.description = options.description ?? "";
|
|
31
|
+
this.keywords = options.keywords ?? [];
|
|
32
|
+
this.section = options.section ?? "BASIC BLOCKS";
|
|
33
|
+
this.onSelect = options.onSelect;
|
|
34
|
+
}
|
|
24
35
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
29
|
-
var e = t[Symbol.toPrimitive];
|
|
30
|
-
if (void 0 !== e) {
|
|
31
|
-
var i = e.call(t, r || "default");
|
|
32
|
-
if ("object" != _typeof(i)) return i;
|
|
33
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
34
|
-
}
|
|
35
|
-
return ("string" === r ? String : Number)(t);
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/toPropertyKey.js
|
|
39
|
-
function toPropertyKey(t) {
|
|
40
|
-
var i = toPrimitive(t, "string");
|
|
41
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region \0@oxc-project+runtime@0.115.0/helpers/defineProperty.js
|
|
45
|
-
function _defineProperty(e, r, t) {
|
|
46
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
47
|
-
value: t,
|
|
48
|
-
enumerable: !0,
|
|
49
|
-
configurable: !0,
|
|
50
|
-
writable: !0
|
|
51
|
-
}) : e[r] = t, e;
|
|
52
|
-
}
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/SlashMenuItem.ts
|
|
55
|
-
var SlashMenuItem = class extends MenuOption {
|
|
56
|
-
constructor(title, options) {
|
|
57
|
-
super(title);
|
|
58
|
-
_defineProperty(this, "title", void 0);
|
|
59
|
-
_defineProperty(this, "icon", void 0);
|
|
60
|
-
_defineProperty(this, "description", void 0);
|
|
61
|
-
_defineProperty(this, "keywords", void 0);
|
|
62
|
-
_defineProperty(this, "section", void 0);
|
|
63
|
-
_defineProperty(this, "onSelect", void 0);
|
|
64
|
-
this.title = title;
|
|
65
|
-
this.icon = options.icon ?? "";
|
|
66
|
-
this.description = options.description ?? "";
|
|
67
|
-
this.keywords = options.keywords ?? [];
|
|
68
|
-
this.section = options.section ?? "BASIC BLOCKS";
|
|
69
|
-
this.onSelect = options.onSelect;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/builtinItems.ts
|
|
74
|
-
var SECTION_BASIC = "BASIC BLOCKS";
|
|
75
|
-
var SECTION_LIST = "LISTS";
|
|
76
|
-
var ICON_SIZE = 20;
|
|
36
|
+
const SECTION_BASIC = "BASIC BLOCKS";
|
|
37
|
+
const SECTION_LIST = "LISTS";
|
|
38
|
+
const ICON_SIZE = 20;
|
|
77
39
|
function getBuiltinItems() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
],
|
|
206
|
-
section: SECTION_LIST,
|
|
207
|
-
onSelect: (editor) => {
|
|
208
|
-
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
209
|
-
}
|
|
210
|
-
}),
|
|
211
|
-
new SlashMenuItem("To-do List", {
|
|
212
|
-
icon: createElement(ListChecks, { size: ICON_SIZE }),
|
|
213
|
-
description: "Track tasks with checkboxes",
|
|
214
|
-
keywords: [
|
|
215
|
-
"task",
|
|
216
|
-
"todo",
|
|
217
|
-
"checkbox",
|
|
218
|
-
"checklist"
|
|
219
|
-
],
|
|
220
|
-
section: SECTION_LIST,
|
|
221
|
-
onSelect: (editor) => {
|
|
222
|
-
editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, void 0);
|
|
223
|
-
}
|
|
224
|
-
})
|
|
225
|
-
];
|
|
40
|
+
return [
|
|
41
|
+
new SlashMenuItem("Text", {
|
|
42
|
+
icon: createElement(Type, { size: ICON_SIZE }),
|
|
43
|
+
description: "Plain text block",
|
|
44
|
+
keywords: ["paragraph", "text", "plain"],
|
|
45
|
+
section: SECTION_BASIC,
|
|
46
|
+
onSelect: (editor) => {
|
|
47
|
+
editor.update(() => {
|
|
48
|
+
const selection = $getSelection();
|
|
49
|
+
if ($isRangeSelection(selection)) {
|
|
50
|
+
$setBlocksType(selection, () => $createParagraphNode());
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
new SlashMenuItem("Heading 1", {
|
|
56
|
+
icon: createElement(Heading1, { size: ICON_SIZE }),
|
|
57
|
+
description: "Large section heading",
|
|
58
|
+
keywords: ["heading", "h1", "title"],
|
|
59
|
+
section: SECTION_BASIC,
|
|
60
|
+
onSelect: (editor) => {
|
|
61
|
+
editor.update(() => {
|
|
62
|
+
const selection = $getSelection();
|
|
63
|
+
if ($isRangeSelection(selection)) {
|
|
64
|
+
$setBlocksType(selection, () => $createHeadingNode("h1"));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
new SlashMenuItem("Heading 2", {
|
|
70
|
+
icon: createElement(Heading2, { size: ICON_SIZE }),
|
|
71
|
+
description: "Medium section heading",
|
|
72
|
+
keywords: ["heading", "h2", "subtitle"],
|
|
73
|
+
section: SECTION_BASIC,
|
|
74
|
+
onSelect: (editor) => {
|
|
75
|
+
editor.update(() => {
|
|
76
|
+
const selection = $getSelection();
|
|
77
|
+
if ($isRangeSelection(selection)) {
|
|
78
|
+
$setBlocksType(selection, () => $createHeadingNode("h2"));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
new SlashMenuItem("Heading 3", {
|
|
84
|
+
icon: createElement(Heading3, { size: ICON_SIZE }),
|
|
85
|
+
description: "Small section heading",
|
|
86
|
+
keywords: ["heading", "h3"],
|
|
87
|
+
section: SECTION_BASIC,
|
|
88
|
+
onSelect: (editor) => {
|
|
89
|
+
editor.update(() => {
|
|
90
|
+
const selection = $getSelection();
|
|
91
|
+
if ($isRangeSelection(selection)) {
|
|
92
|
+
$setBlocksType(selection, () => $createHeadingNode("h3"));
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
new SlashMenuItem("Quote", {
|
|
98
|
+
icon: createElement(TextQuote, { size: ICON_SIZE }),
|
|
99
|
+
description: "Capture a quote",
|
|
100
|
+
keywords: ["quote", "blockquote"],
|
|
101
|
+
section: SECTION_BASIC,
|
|
102
|
+
onSelect: (editor) => {
|
|
103
|
+
editor.update(() => {
|
|
104
|
+
const selection = $getSelection();
|
|
105
|
+
if (!$isRangeSelection(selection)) return;
|
|
106
|
+
const anchorNode = selection.anchor.getNode();
|
|
107
|
+
const element = anchorNode.getTopLevelElementOrThrow();
|
|
108
|
+
const quoteNode = $createQuoteNode();
|
|
109
|
+
const paragraph = $createParagraphNode();
|
|
110
|
+
paragraph.append(...element.getChildren());
|
|
111
|
+
quoteNode.append(paragraph);
|
|
112
|
+
element.replace(quoteNode);
|
|
113
|
+
paragraph.selectEnd();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
new SlashMenuItem("Divider", {
|
|
118
|
+
icon: createElement(Minus, { size: ICON_SIZE }),
|
|
119
|
+
description: "Visual separator",
|
|
120
|
+
keywords: ["divider", "hr", "rule", "separator"],
|
|
121
|
+
section: SECTION_BASIC,
|
|
122
|
+
onSelect: (editor) => {
|
|
123
|
+
editor.dispatchCommand(INSERT_HORIZONTAL_RULE_COMMAND, void 0);
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
new SlashMenuItem("Table", {
|
|
127
|
+
icon: createElement(Table, { size: ICON_SIZE }),
|
|
128
|
+
description: "Add a table",
|
|
129
|
+
keywords: ["table", "grid"],
|
|
130
|
+
section: SECTION_BASIC,
|
|
131
|
+
onSelect: (editor) => {
|
|
132
|
+
editor.dispatchCommand(INSERT_TABLE_COMMAND, {
|
|
133
|
+
columns: "3",
|
|
134
|
+
rows: "3",
|
|
135
|
+
includeHeaders: true
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
new SlashMenuItem("Bulleted List", {
|
|
140
|
+
icon: createElement(List, { size: ICON_SIZE }),
|
|
141
|
+
description: "Unordered list",
|
|
142
|
+
keywords: ["list", "bullet", "unordered"],
|
|
143
|
+
section: SECTION_LIST,
|
|
144
|
+
onSelect: (editor) => {
|
|
145
|
+
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, void 0);
|
|
146
|
+
}
|
|
147
|
+
}),
|
|
148
|
+
new SlashMenuItem("Numbered List", {
|
|
149
|
+
icon: createElement(ListOrdered, { size: ICON_SIZE }),
|
|
150
|
+
description: "Ordered list with numbers",
|
|
151
|
+
keywords: ["list", "ordered", "number"],
|
|
152
|
+
section: SECTION_LIST,
|
|
153
|
+
onSelect: (editor) => {
|
|
154
|
+
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
155
|
+
}
|
|
156
|
+
}),
|
|
157
|
+
new SlashMenuItem("To-do List", {
|
|
158
|
+
icon: createElement(ListChecks, { size: ICON_SIZE }),
|
|
159
|
+
description: "Track tasks with checkboxes",
|
|
160
|
+
keywords: ["task", "todo", "checkbox", "checklist"],
|
|
161
|
+
section: SECTION_LIST,
|
|
162
|
+
onSelect: (editor) => {
|
|
163
|
+
editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, void 0);
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
];
|
|
226
167
|
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/styles.css.ts
|
|
229
168
|
var slashMenu = "qolrkf0";
|
|
230
169
|
var slashMenuSectionWrapper = "qolrkf1";
|
|
170
|
+
var slashMenuSectionDivider = "qolrkf2";
|
|
231
171
|
var slashMenuSection = "qolrkf3";
|
|
232
172
|
var slashMenuItems = "qolrkf4";
|
|
233
173
|
var slashMenuItem = "qolrkf5";
|
|
234
174
|
var slashMenuItemIcon = "qolrkf6";
|
|
235
175
|
var slashMenuItemText = "qolrkf7";
|
|
236
176
|
var slashMenuItemTitle = "qolrkf8";
|
|
177
|
+
var slashMenuItemDescription = "qolrkf9";
|
|
237
178
|
var slashMenuEmpty = "qolrkfa";
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region src/SlashMenuList.tsx
|
|
240
179
|
function groupBySection(options) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
group.items.push({
|
|
255
|
-
item,
|
|
256
|
-
globalIndex: index
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
return groups;
|
|
180
|
+
const groups = [];
|
|
181
|
+
const seen = /* @__PURE__ */ new Map();
|
|
182
|
+
options.forEach((item, index) => {
|
|
183
|
+
const label = item.section;
|
|
184
|
+
let group = seen.get(label);
|
|
185
|
+
if (!group) {
|
|
186
|
+
group = { label, items: [] };
|
|
187
|
+
seen.set(label, group);
|
|
188
|
+
groups.push(group);
|
|
189
|
+
}
|
|
190
|
+
group.items.push({ item, globalIndex: index });
|
|
191
|
+
});
|
|
192
|
+
return groups;
|
|
260
193
|
}
|
|
261
|
-
function SlashMenuList({
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
className: slashMenuItemIcon,
|
|
315
|
-
children: item.icon
|
|
316
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
317
|
-
className: slashMenuItemText,
|
|
318
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
319
|
-
className: slashMenuItemTitle,
|
|
320
|
-
children: item.title
|
|
321
|
-
}), item.description && /* @__PURE__ */ jsx("span", {
|
|
322
|
-
className: "qolrkf9",
|
|
323
|
-
children: item.description
|
|
324
|
-
})]
|
|
325
|
-
})]
|
|
326
|
-
}, item.key))
|
|
327
|
-
})
|
|
328
|
-
]
|
|
329
|
-
}, section.label))
|
|
330
|
-
});
|
|
194
|
+
function SlashMenuList({
|
|
195
|
+
anchorElement,
|
|
196
|
+
options,
|
|
197
|
+
selectedIndex,
|
|
198
|
+
selectOptionAndCleanUp,
|
|
199
|
+
setHighlightedIndex
|
|
200
|
+
}) {
|
|
201
|
+
const { refs, floatingStyles } = useFloating({
|
|
202
|
+
placement: "bottom-start",
|
|
203
|
+
strategy: "absolute",
|
|
204
|
+
middleware: [
|
|
205
|
+
offset(8),
|
|
206
|
+
flip({
|
|
207
|
+
fallbackPlacements: ["top-start"],
|
|
208
|
+
padding: 8
|
|
209
|
+
}),
|
|
210
|
+
shift({
|
|
211
|
+
padding: 8
|
|
212
|
+
})
|
|
213
|
+
],
|
|
214
|
+
whileElementsMounted: autoUpdate
|
|
215
|
+
});
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
refs.setReference(anchorElement);
|
|
218
|
+
}, [anchorElement, refs]);
|
|
219
|
+
const sections = useMemo(() => groupBySection(options), [options]);
|
|
220
|
+
if (options.length === 0) {
|
|
221
|
+
return /* @__PURE__ */ jsx("div", { className: slashMenu, ref: refs.setFloating, style: floatingStyles, children: /* @__PURE__ */ jsx("div", { className: slashMenuEmpty, children: "No matching commands" }) });
|
|
222
|
+
}
|
|
223
|
+
return /* @__PURE__ */ jsx("ul", { className: slashMenu, ref: refs.setFloating, role: "listbox", style: floatingStyles, children: sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("li", { className: slashMenuSectionWrapper, role: "presentation", children: [
|
|
224
|
+
sectionIndex > 0 && /* @__PURE__ */ jsx("div", { className: slashMenuSectionDivider }),
|
|
225
|
+
/* @__PURE__ */ jsx("div", { className: slashMenuSection, children: section.label }),
|
|
226
|
+
/* @__PURE__ */ jsx("ul", { className: slashMenuItems, role: "group", children: section.items.map(({ item, globalIndex }) => /* @__PURE__ */ jsxs(
|
|
227
|
+
"li",
|
|
228
|
+
{
|
|
229
|
+
"aria-selected": globalIndex === selectedIndex,
|
|
230
|
+
className: slashMenuItem,
|
|
231
|
+
ref: item.setRefElement,
|
|
232
|
+
role: "option",
|
|
233
|
+
tabIndex: -1,
|
|
234
|
+
onClick: () => selectOptionAndCleanUp(item),
|
|
235
|
+
onMouseEnter: () => setHighlightedIndex(globalIndex),
|
|
236
|
+
children: [
|
|
237
|
+
/* @__PURE__ */ jsx("span", { className: slashMenuItemIcon, children: item.icon }),
|
|
238
|
+
/* @__PURE__ */ jsxs("span", { className: slashMenuItemText, children: [
|
|
239
|
+
/* @__PURE__ */ jsx("span", { className: slashMenuItemTitle, children: item.title }),
|
|
240
|
+
item.description && /* @__PURE__ */ jsx("span", { className: slashMenuItemDescription, children: item.description })
|
|
241
|
+
] })
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
item.key
|
|
245
|
+
)) })
|
|
246
|
+
] }, section.label)) });
|
|
331
247
|
}
|
|
332
|
-
//#endregion
|
|
333
|
-
//#region src/SlashMenuPlugin.tsx
|
|
334
248
|
function collectNodeSlashItems(editor) {
|
|
335
|
-
|
|
249
|
+
const configs = collectCommandItems(editor);
|
|
250
|
+
return configs.filter((c) => !c.placement || c.placement.includes("slash")).map((c) => new SlashMenuItem(c.title, c));
|
|
336
251
|
}
|
|
337
252
|
function filterItems(query, items) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
253
|
+
if (!query) return items;
|
|
254
|
+
const lower = query.toLowerCase();
|
|
255
|
+
return items.filter((item) => {
|
|
256
|
+
if (item.title.toLowerCase().includes(lower)) return true;
|
|
257
|
+
return item.keywords.some((kw) => kw.toLowerCase().includes(lower));
|
|
258
|
+
});
|
|
344
259
|
}
|
|
345
260
|
function SlashMenuPlugin({ items, extraItems, triggerChar = "/" }) {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
261
|
+
const [editor] = useLexicalComposerContext();
|
|
262
|
+
const [queryString, setQueryString] = useState(null);
|
|
263
|
+
const allItems = useMemo(() => {
|
|
264
|
+
if (items) return items;
|
|
265
|
+
const builtins = getBuiltinItems();
|
|
266
|
+
const nodeItems = collectNodeSlashItems(editor);
|
|
267
|
+
const combined = [...builtins, ...nodeItems];
|
|
268
|
+
return extraItems ? [...combined, ...extraItems] : combined;
|
|
269
|
+
}, [items, extraItems, editor]);
|
|
270
|
+
const filteredItems = useMemo(
|
|
271
|
+
() => filterItems(queryString ?? "", allItems),
|
|
272
|
+
[queryString, allItems]
|
|
273
|
+
);
|
|
274
|
+
const checkForTriggerMatch = useBasicTypeaheadTriggerMatch(triggerChar, {
|
|
275
|
+
minLength: 0
|
|
276
|
+
});
|
|
277
|
+
const onSelectOption = useCallback(
|
|
278
|
+
(option, textNodeContainingQuery, closeMenu, matchingString) => {
|
|
279
|
+
editor.update(() => {
|
|
280
|
+
if (textNodeContainingQuery) {
|
|
281
|
+
const selection = $getSelection();
|
|
282
|
+
if ($isRangeSelection(selection)) {
|
|
283
|
+
textNodeContainingQuery.remove();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
closeMenu();
|
|
288
|
+
option.onSelect(editor, matchingString);
|
|
289
|
+
},
|
|
290
|
+
[editor]
|
|
291
|
+
);
|
|
292
|
+
return /* @__PURE__ */ jsx(
|
|
293
|
+
LexicalTypeaheadMenuPlugin,
|
|
294
|
+
{
|
|
295
|
+
options: filteredItems,
|
|
296
|
+
triggerFn: checkForTriggerMatch,
|
|
297
|
+
menuRenderFn: (anchorElementRef, { selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => {
|
|
298
|
+
const anchorElement = anchorElementRef.current;
|
|
299
|
+
if (!anchorElement || filteredItems.length === 0) {
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
return createPortal(
|
|
303
|
+
/* @__PURE__ */ jsx(PortalThemeWrapper, { children: /* @__PURE__ */ jsx(
|
|
304
|
+
SlashMenuList,
|
|
305
|
+
{
|
|
306
|
+
anchorElement,
|
|
307
|
+
options: filteredItems,
|
|
308
|
+
selectOptionAndCleanUp,
|
|
309
|
+
selectedIndex,
|
|
310
|
+
setHighlightedIndex
|
|
311
|
+
}
|
|
312
|
+
) }),
|
|
313
|
+
anchorElement
|
|
314
|
+
);
|
|
315
|
+
},
|
|
316
|
+
onQueryChange: setQueryString,
|
|
317
|
+
onSelectOption
|
|
318
|
+
}
|
|
319
|
+
);
|
|
385
320
|
}
|
|
386
|
-
|
|
387
|
-
|
|
321
|
+
export {
|
|
322
|
+
SlashMenuItem,
|
|
323
|
+
SlashMenuList,
|
|
324
|
+
SlashMenuPlugin,
|
|
325
|
+
collectNodeSlashItems,
|
|
326
|
+
getBuiltinItems
|
|
327
|
+
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
:root{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#2563eb;--rc-quote-bg:#eff6ff;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.7;--rc-line-height-tight:1.4;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}:root.dark{--rc-text:#fafafa;--rc-text-secondary:#a1a1aa;--rc-text-tertiary:#71717a;--rc-text-quaternary:#52525b;--rc-bg:#09090b;--rc-bg-secondary:#18181b;--rc-bg-tertiary:#27272a;--rc-fill:#2a2a2f;--rc-fill-secondary:#222226;--rc-fill-tertiary:#1b1b1f;--rc-fill-quaternary:#131316;--rc-border:#27272a;--rc-accent:#60a5fa;--rc-accent-light:#60a5fa20;--rc-link:#60a5fa;--rc-code-text:#e4e4e7;--rc-code-bg:#27272a;--rc-hr-border:#27272a;--rc-quote-border:#60a5fa;--rc-quote-bg:#1e3a5f;--rc-alert-info:#7db9e5;--rc-alert-warning:#da864a;--rc-alert-tip:#54da48;--rc-alert-caution:#e16973;--rc-alert-important:#9966e0;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #00000073, 0 2px 8px #0000004d;--rc-shadow-modal:0 10px 15px -3px #0006, 0 4px 6px -4px #00000059;--rc-shadow-menu:0 1px 4px #00000040, 0 4px 16px #0006;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.7;--rc-line-height-tight:1.4;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}._1m14pjb0{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#2563eb;--rc-quote-bg:#eff6ff;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.7;--rc-line-height-tight:1.4;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}._1m14pjb1{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#2563eb;--rc-quote-bg:#eff6ff;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:700px;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:4px;--rc-space-sm:8px;--rc-space-md:16px;--rc-space-lg:24px;--rc-space-xl:32px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:16px;--rc-font-size-small:14px;--rc-line-height:1.8;--rc-line-height-tight:1.4;--rc-font-family:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm:4px;--rc-radius-md:8px;--rc-radius-lg:12px}._1m14pjb2{--rc-text:#000;--rc-text-secondary:#27272a;--rc-text-tertiary:#71717a;--rc-text-quaternary:#a1a1aa;--rc-bg:#fff;--rc-bg-secondary:#fafafa;--rc-bg-tertiary:#f4f4f5;--rc-fill:#e8e8ec;--rc-fill-secondary:#eeeeef;--rc-fill-tertiary:#f4f4f6;--rc-fill-quaternary:#f9f9fa;--rc-border:#f4f4f5;--rc-accent:#2563eb;--rc-accent-light:#2563eb20;--rc-link:#2563eb;--rc-code-text:#3f3f46;--rc-code-bg:#f4f4f5;--rc-hr-border:#e4e4e7;--rc-quote-border:#a1a1aa;--rc-quote-bg:#fafafa;--rc-alert-info:#006bb7;--rc-alert-warning:#c50;--rc-alert-tip:#1c0;--rc-alert-caution:#c01;--rc-alert-important:#50c;--rc-max-width:none;--rc-shadow-top-bar:0 8px 30px #0000001f, 0 2px 8px #0000000f;--rc-shadow-modal:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--rc-shadow-menu:0 1px 4px #0000000a, 0 4px 16px #00000014;--rc-space-xs:2px;--rc-space-sm:4px;--rc-space-md:10px;--rc-space-lg:16px;--rc-space-xl:20px;--rc-font-family-sans:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif:"Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono:"SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs:.625em;--rc-font-size-xs:.75em;--rc-font-size-sm:.8125em;--rc-font-size-md:.875em;--rc-font-size-lg:1.25em;--rc-font-size-base:14px;--rc-font-size-small:12px;--rc-line-height:1.5;--rc-line-height-tight:1.3;--rc-font-family:"PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm:3px;--rc-radius-md:6px;--rc-radius-lg:12px}.dark ._1m14pjb0,[data-theme=dark] ._1m14pjb0,.dark._1m14pjb0,[data-theme=dark]._1m14pjb0,.dark ._1m14pjb1,[data-theme=dark] ._1m14pjb1,.dark._1m14pjb1,[data-theme=dark]._1m14pjb1,.dark ._1m14pjb2,[data-theme=dark] ._1m14pjb2,.dark._1m14pjb2,[data-theme=dark]._1m14pjb2{--rc-text:#fafafa;--rc-text-secondary:#a1a1aa;--rc-text-tertiary:#71717a;--rc-text-quaternary:#52525b;--rc-bg:#09090b;--rc-bg-secondary:#18181b;--rc-bg-tertiary:#27272a;--rc-fill:#2a2a2f;--rc-fill-secondary:#222226;--rc-fill-tertiary:#1b1b1f;--rc-fill-quaternary:#131316;--rc-border:#27272a;--rc-accent:#60a5fa;--rc-accent-light:#60a5fa20;--rc-link:#60a5fa;--rc-code-text:#e4e4e7;--rc-code-bg:#27272a;--rc-hr-border:#27272a;--rc-quote-border:#60a5fa;--rc-quote-bg:#1e3a5f;--rc-alert-info:#7db9e5;--rc-alert-warning:#da864a;--rc-alert-tip:#54da48;--rc-alert-caution:#e16973;--rc-alert-important:#9966e0;--rc-shadow-top-bar:0 8px 30px #00000073, 0 2px 8px #0000004d;--rc-shadow-modal:0 10px 15px -3px #0006, 0 4px 6px -4px #00000059;--rc-shadow-menu:0 1px 4px #00000040, 0 4px 16px #0006}.qolrkf0{width:288px;max-height:384px;font-family:var(--rc-font-family-sans);background:var(--rc-bg);border:1px solid var(--rc-border);border-radius:var(--rc-radius-lg);box-shadow:var(--rc-shadow-menu);margin:0;padding:0;list-style:none;position:absolute;top:0;left:0;overflow:hidden auto}.qolrkf0::-webkit-scrollbar{width:5px}.qolrkf0::-webkit-scrollbar-track{background:0 0}.qolrkf0::-webkit-scrollbar-thumb{background:var(--rc-text-quaternary);border-radius:3px}.qolrkf2{background:var(--rc-border);opacity:.5;height:1px}.qolrkf3{z-index:10;letter-spacing:.05em;text-transform:uppercase;color:var(--rc-text-tertiary);-webkit-user-select:none;user-select:none;background:var(--rc-bg);padding:8px 12px;font-size:11px;font-weight:500;position:sticky;top:0}.qolrkf4{margin:0;padding:4px 0;list-style:none}.qolrkf5{border-radius:var(--rc-radius-md);cursor:pointer;color:var(--rc-text);align-items:center;gap:12px;margin:0 4px;padding:8px 12px;transition:background 75ms;display:flex}.qolrkf5:hover,.qolrkf5[aria-selected=true]{background:var(--rc-fill)}.qolrkf6{background:var(--rc-bg-tertiary);width:36px;height:36px;color:var(--rc-text-tertiary);border:1px solid #0000;border-radius:6px;flex-shrink:0;justify-content:center;align-items:center;font-size:16px;line-height:1;transition:background 75ms,border-color 75ms;display:flex}.qolrkf5[aria-selected=true] .qolrkf6{background:var(--rc-bg);border-color:var(--rc-border)}.qolrkf7{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.qolrkf8{color:var(--rc-text);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:1.3;overflow:hidden}.qolrkf9{color:var(--rc-text-tertiary);white-space:nowrap;text-overflow:ellipsis;font-size:12px;line-height:1.3;overflow:hidden}.qolrkfa{color:var(--rc-text-quaternary);text-align:center;padding:32px 12px;font-size:13px}@supports ((-webkit-backdrop-filter:blur(8px)) or (backdrop-filter:blur(8px))){.qolrkf3{background:color-mix(in srgb, var(--rc-bg) 92%, transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}}
|
|
2
|
-
/*$vite$:1*/
|
|
1
|
+
:root{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}:root.dark{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1m14pjb0{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1m14pjb1{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.8;--rc-line-height-tight: 1.4;--rc-font-family: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1m14pjb2{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #a1a1aa;--rc-quote-bg: #fafafa;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: none;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 2px;--rc-space-sm: 4px;--rc-space-md: 10px;--rc-space-lg: 16px;--rc-space-xl: 20px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 14px;--rc-font-size-small: 12px;--rc-line-height: 1.5;--rc-line-height-tight: 1.3;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 3px;--rc-radius-md: 6px;--rc-radius-lg: 12px}.dark ._1m14pjb0,[data-theme=dark] ._1m14pjb0,.dark._1m14pjb0,[data-theme=dark]._1m14pjb0,.dark ._1m14pjb1,[data-theme=dark] ._1m14pjb1,.dark._1m14pjb1,[data-theme=dark]._1m14pjb1,.dark ._1m14pjb2,[data-theme=dark] ._1m14pjb2,.dark._1m14pjb2,[data-theme=dark]._1m14pjb2{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4)}.qolrkf0{position:absolute;top:0;left:0;width:288px;max-height:384px;overflow-y:auto;overflow-x:hidden;font-family:var(--rc-font-family-sans);background:var(--rc-bg);border:1px solid var(--rc-border);border-radius:var(--rc-radius-lg);box-shadow:var(--rc-shadow-menu);list-style:none;margin:0;padding:0}.qolrkf0::-webkit-scrollbar{width:5px}.qolrkf0::-webkit-scrollbar-track{background:transparent}.qolrkf0::-webkit-scrollbar-thumb{background:var(--rc-text-quaternary);border-radius:3px}.qolrkf2{height:1px;background:var(--rc-border);opacity:.5}.qolrkf3{position:sticky;top:0;z-index:10;padding:8px 12px;font-size:11px;font-weight:500;letter-spacing:.05em;text-transform:uppercase;color:var(--rc-text-tertiary);user-select:none;background:var(--rc-bg)}.qolrkf4{padding:4px 0;list-style:none;margin:0}.qolrkf5{display:flex;align-items:center;gap:12px;padding:8px 12px;margin:0 4px;border-radius:var(--rc-radius-md);cursor:pointer;transition:background 75ms ease;color:var(--rc-text)}.qolrkf5:hover,.qolrkf5[aria-selected=true]{background:var(--rc-fill)}.qolrkf6{width:36px;height:36px;display:flex;align-items:center;justify-content:center;font-size:16px;flex-shrink:0;border-radius:6px;background:var(--rc-bg-tertiary);border:1px solid transparent;color:var(--rc-text-tertiary);line-height:1;transition:background 75ms ease,border-color 75ms ease}.qolrkf5[aria-selected=true] .qolrkf6{background:var(--rc-bg);border-color:var(--rc-border)}.qolrkf7{display:flex;flex-direction:column;min-width:0;flex:1;gap:2px}.qolrkf8{font-size:14px;font-weight:500;line-height:1.3;color:var(--rc-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.qolrkf9{font-size:12px;line-height:1.3;color:var(--rc-text-tertiary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.qolrkfa{padding:32px 12px;color:var(--rc-text-quaternary);font-size:13px;text-align:center}@supports (backdrop-filter: blur(8px)){.qolrkf3{background:color-mix(in srgb,var(--rc-bg) 92%,transparent);backdrop-filter:blur(8px)}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-plugin-slash-menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"description": "Slash command menu plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@floating-ui/react-dom": "^2.1.8",
|
|
25
|
-
"@haklex/rich-
|
|
26
|
-
"@haklex/rich-
|
|
25
|
+
"@haklex/rich-style-token": "0.0.83",
|
|
26
|
+
"@haklex/rich-editor": "0.0.83"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@lexical/list": "^0.41.0",
|