@haklex/rich-plugin-toolbar 0.0.81 → 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 +570 -541
- package/dist/rich-plugin-toolbar.css +1 -2
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
1
2
|
import { collectCommandItems } from "@haklex/rich-editor/commands";
|
|
2
|
-
import {
|
|
3
|
-
import { $isListNode,
|
|
3
|
+
import { TooltipTrigger, TooltipRoot, TooltipContent, DropdownMenuContent, DropdownMenuItem, DropdownMenu, DropdownMenuTrigger, createTooltipHandle, TooltipProvider } from "@haklex/rich-editor-ui";
|
|
4
|
+
import { $isListNode, INSERT_UNORDERED_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND } from "@lexical/list";
|
|
4
5
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
5
6
|
import { $createHeadingNode, $isHeadingNode } from "@lexical/rich-text";
|
|
6
7
|
import { $getSelectionStyleValueForProperty, $patchStyleText, $setBlocksType } from "@lexical/selection";
|
|
7
8
|
import { $findMatchingParent } from "@lexical/utils";
|
|
8
|
-
import { $
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
//#region src/styles.css.ts
|
|
9
|
+
import { $getSelection, $isRangeSelection, $isRootOrShadowRoot, $isElementNode, CAN_UNDO_COMMAND, COMMAND_PRIORITY_LOW, CAN_REDO_COMMAND, $createParagraphNode, UNDO_COMMAND, REDO_COMMAND, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND } from "lexical";
|
|
10
|
+
import { ChevronDown, Pilcrow, Heading1, Heading2, Heading3, Undo, Redo, Bold, Italic, Underline, Strikethrough, Code, Highlighter, List, ListOrdered, ListChecks, AlignLeft, AlignCenter, AlignRight, AlignJustify, Ellipsis } from "lucide-react";
|
|
11
|
+
import { useState, useMemo, useCallback, useEffect } from "react";
|
|
13
12
|
var toolbarContainer = "_1e1ersc0";
|
|
14
13
|
var toolbarRow = "_1e1ersc1";
|
|
15
14
|
var toolbarButton = "_1e1ersc2";
|
|
@@ -18,549 +17,579 @@ var toolbarDropdownTrigger = "_1e1ersc4";
|
|
|
18
17
|
var toolbarDropdownTriggerChevron = "_1e1ersc5";
|
|
19
18
|
var toolbarSeparator = "_1e1ersc6";
|
|
20
19
|
var toolbarDropdownItemActive = "_1e1ersc7";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
20
|
+
var tooltipShortcut = "_1e1ersc8";
|
|
21
|
+
function ToolbarButton({
|
|
22
|
+
icon,
|
|
23
|
+
title,
|
|
24
|
+
shortcut,
|
|
25
|
+
active,
|
|
26
|
+
disabled,
|
|
27
|
+
onClick,
|
|
28
|
+
tooltipHandle
|
|
29
|
+
}) {
|
|
30
|
+
const button = /* @__PURE__ */ jsx(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
"aria-label": title,
|
|
34
|
+
"aria-pressed": active,
|
|
35
|
+
className: `${toolbarButton}${active ? ` ${toolbarButtonActive}` : ""}`,
|
|
36
|
+
disabled,
|
|
37
|
+
type: "button",
|
|
38
|
+
onMouseDown: (e) => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
onClick();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
if (tooltipHandle) {
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
TooltipTrigger,
|
|
47
|
+
{
|
|
48
|
+
handle: tooltipHandle,
|
|
49
|
+
payload: { title, shortcut },
|
|
50
|
+
render: button,
|
|
51
|
+
children: icon
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return /* @__PURE__ */ jsxs(TooltipRoot, { children: [
|
|
56
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { render: button, children: icon }),
|
|
57
|
+
/* @__PURE__ */ jsxs(TooltipContent, { side: "bottom", sideOffset: 4, children: [
|
|
58
|
+
title,
|
|
59
|
+
shortcut && /* @__PURE__ */ jsx("span", { className: tooltipShortcut, children: shortcut })
|
|
60
|
+
] })
|
|
61
|
+
] });
|
|
55
62
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
63
|
+
function ToolbarDropdown({
|
|
64
|
+
label,
|
|
65
|
+
title,
|
|
66
|
+
items,
|
|
67
|
+
triggerWidth,
|
|
68
|
+
tooltipHandle
|
|
69
|
+
}) {
|
|
70
|
+
const triggerStyle = triggerWidth ? { width: triggerWidth } : void 0;
|
|
71
|
+
const trigger = /* @__PURE__ */ jsx(
|
|
72
|
+
DropdownMenuTrigger,
|
|
73
|
+
{
|
|
74
|
+
className: toolbarDropdownTrigger,
|
|
75
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" }),
|
|
76
|
+
style: triggerStyle
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
const triggerContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80
|
+
label,
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: toolbarDropdownTriggerChevron, children: /* @__PURE__ */ jsx(ChevronDown, { size: 12 }) })
|
|
82
|
+
] });
|
|
83
|
+
const menu = /* @__PURE__ */ jsx(DropdownMenuContent, { sideOffset: 4, children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
84
|
+
DropdownMenuItem,
|
|
85
|
+
{
|
|
86
|
+
className: item.active ? toolbarDropdownItemActive : void 0,
|
|
87
|
+
style: item.style,
|
|
88
|
+
onClick: item.onSelect,
|
|
89
|
+
children: [
|
|
90
|
+
item.icon && /* @__PURE__ */ jsx(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
style: {
|
|
94
|
+
marginRight: 8,
|
|
95
|
+
display: "inline-flex",
|
|
96
|
+
transform: "scale(0.8)",
|
|
97
|
+
transformOrigin: "left center"
|
|
98
|
+
},
|
|
99
|
+
children: item.icon
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
item.label
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
item.label
|
|
106
|
+
)) });
|
|
107
|
+
if (tooltipHandle) {
|
|
108
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
110
|
+
TooltipTrigger,
|
|
111
|
+
{
|
|
112
|
+
handle: tooltipHandle,
|
|
113
|
+
payload: { title },
|
|
114
|
+
render: trigger,
|
|
115
|
+
children: triggerContent
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
menu
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
122
|
+
/* @__PURE__ */ jsxs(TooltipRoot, { children: [
|
|
123
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { render: trigger, children: triggerContent }),
|
|
124
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", sideOffset: 4, children: title })
|
|
125
|
+
] }),
|
|
126
|
+
menu
|
|
127
|
+
] });
|
|
99
128
|
}
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/ToolbarSeparator.tsx
|
|
102
129
|
function ToolbarSeparator() {
|
|
103
|
-
|
|
130
|
+
return /* @__PURE__ */ jsx("div", { className: toolbarSeparator });
|
|
104
131
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
label: "楷体",
|
|
124
|
-
value: "KaiTi, STKaiti, serif"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
label: "Sans",
|
|
128
|
-
value: "system-ui, -apple-system, sans-serif"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
label: "Serif",
|
|
132
|
-
value: "Georgia, \"Times New Roman\", serif"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
label: "Mono",
|
|
136
|
-
value: "ui-monospace, \"SF Mono\", \"Fira Code\", monospace"
|
|
137
|
-
}
|
|
132
|
+
const ICON_SIZE = 15;
|
|
133
|
+
const ICON_STROKE = 2;
|
|
134
|
+
const FONT_FAMILIES = [
|
|
135
|
+
{ label: "默认", value: "" },
|
|
136
|
+
{
|
|
137
|
+
label: "宋体",
|
|
138
|
+
value: '"Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: "黑体",
|
|
142
|
+
value: '"Noto Sans CJK SC", "Source Han Sans SC", SimHei, sans-serif'
|
|
143
|
+
},
|
|
144
|
+
{ label: "楷体", value: "KaiTi, STKaiti, serif" },
|
|
145
|
+
{ label: "Sans", value: "system-ui, -apple-system, sans-serif" },
|
|
146
|
+
{ label: "Serif", value: 'Georgia, "Times New Roman", serif' },
|
|
147
|
+
{ label: "Mono", value: 'ui-monospace, "SF Mono", "Fira Code", monospace' }
|
|
138
148
|
];
|
|
139
149
|
function getFontLabel(fontFamily) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
150
|
+
if (!fontFamily) return "默认";
|
|
151
|
+
const match = FONT_FAMILIES.find((f) => f.value === fontFamily);
|
|
152
|
+
if (match) return match.label;
|
|
153
|
+
for (const def of FONT_FAMILIES) {
|
|
154
|
+
if (def.value && fontFamily.startsWith(def.value.split(",")[0])) {
|
|
155
|
+
return def.label;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return "默认";
|
|
145
159
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
160
|
+
const BLOCK_TYPE_LABELS = {
|
|
161
|
+
paragraph: "Text",
|
|
162
|
+
h1: "Heading 1",
|
|
163
|
+
h2: "Heading 2",
|
|
164
|
+
h3: "Heading 3",
|
|
165
|
+
bullet: "Bulleted List",
|
|
166
|
+
number: "Numbered List",
|
|
167
|
+
check: "To-do List",
|
|
168
|
+
other: "Other"
|
|
155
169
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
const INITIAL_STATE = {
|
|
171
|
+
canUndo: false,
|
|
172
|
+
canRedo: false,
|
|
173
|
+
blockType: "paragraph",
|
|
174
|
+
fontFamily: "",
|
|
175
|
+
elementFormat: "left",
|
|
176
|
+
isBold: false,
|
|
177
|
+
isItalic: false,
|
|
178
|
+
isUnderline: false,
|
|
179
|
+
isStrikethrough: false,
|
|
180
|
+
isCode: false,
|
|
181
|
+
isHighlight: false
|
|
168
182
|
};
|
|
169
183
|
function getBlockType(anchorNode) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
if ($isHeadingNode(anchorNode)) {
|
|
185
|
+
const tag = anchorNode.getTag();
|
|
186
|
+
if (tag === "h1" || tag === "h2" || tag === "h3") return tag;
|
|
187
|
+
return "other";
|
|
188
|
+
}
|
|
189
|
+
if ($isListNode(anchorNode)) {
|
|
190
|
+
const listType = anchorNode.getListType();
|
|
191
|
+
if (listType === "bullet") return "bullet";
|
|
192
|
+
if (listType === "number") return "number";
|
|
193
|
+
if (listType === "check") return "check";
|
|
194
|
+
return "other";
|
|
195
|
+
}
|
|
196
|
+
const type = anchorNode.getType();
|
|
197
|
+
if (type === "paragraph") return "paragraph";
|
|
198
|
+
return "other";
|
|
184
199
|
}
|
|
185
|
-
|
|
186
|
-
function ToolbarPlugin({
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
200
|
+
const DEFAULT_MAX_VISIBLE_INSERT_ITEMS = 5;
|
|
201
|
+
function ToolbarPlugin({
|
|
202
|
+
className,
|
|
203
|
+
maxVisibleInsertItems = DEFAULT_MAX_VISIBLE_INSERT_ITEMS,
|
|
204
|
+
insertItemOrder
|
|
205
|
+
}) {
|
|
206
|
+
const [editor] = useLexicalComposerContext();
|
|
207
|
+
const [state, setState] = useState(INITIAL_STATE);
|
|
208
|
+
const [tooltipHandle] = useState(() => createTooltipHandle());
|
|
209
|
+
const toolbarItems = useMemo(() => {
|
|
210
|
+
const items = collectCommandItems(editor).filter(
|
|
211
|
+
(item) => item.placement?.includes("toolbar") && item.group === "insert"
|
|
212
|
+
);
|
|
213
|
+
if (!insertItemOrder || insertItemOrder.length === 0) return items;
|
|
214
|
+
return items.sort((a, b) => {
|
|
215
|
+
const ai = insertItemOrder.indexOf(a.title);
|
|
216
|
+
const bi = insertItemOrder.indexOf(b.title);
|
|
217
|
+
return (ai === -1 ? Infinity : ai) - (bi === -1 ? Infinity : bi);
|
|
218
|
+
});
|
|
219
|
+
}, [editor, insertItemOrder]);
|
|
220
|
+
const updateToolbar = useCallback(() => {
|
|
221
|
+
const selection = $getSelection();
|
|
222
|
+
if (!$isRangeSelection(selection)) return;
|
|
223
|
+
const anchorNode = selection.anchor.getNode();
|
|
224
|
+
let element = anchorNode.getKey() === "root" ? anchorNode : $findMatchingParent(anchorNode, (e) => {
|
|
225
|
+
const parent = e.getParent();
|
|
226
|
+
return parent !== null && $isRootOrShadowRoot(parent);
|
|
227
|
+
}) ?? anchorNode.getTopLevelElementOrThrow();
|
|
228
|
+
if ($isListNode(element)) {
|
|
229
|
+
const parentList = $findMatchingParent(anchorNode, (node) => $isListNode(node));
|
|
230
|
+
if (parentList) {
|
|
231
|
+
element = parentList;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const blockType = getBlockType(element);
|
|
235
|
+
const fontFamily = $getSelectionStyleValueForProperty(selection, "font-family", "");
|
|
236
|
+
const elementFormat = $isElementNode(element) ? element.getFormatType() : "left";
|
|
237
|
+
setState((prev) => ({
|
|
238
|
+
...prev,
|
|
239
|
+
blockType,
|
|
240
|
+
fontFamily,
|
|
241
|
+
elementFormat,
|
|
242
|
+
isBold: selection.hasFormat("bold"),
|
|
243
|
+
isItalic: selection.hasFormat("italic"),
|
|
244
|
+
isUnderline: selection.hasFormat("underline"),
|
|
245
|
+
isStrikethrough: selection.hasFormat("strikethrough"),
|
|
246
|
+
isCode: selection.hasFormat("code"),
|
|
247
|
+
isHighlight: selection.hasFormat("highlight")
|
|
248
|
+
}));
|
|
249
|
+
}, []);
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
const unregisterUndo = editor.registerCommand(
|
|
252
|
+
CAN_UNDO_COMMAND,
|
|
253
|
+
(payload) => {
|
|
254
|
+
setState((prev) => ({ ...prev, canUndo: payload }));
|
|
255
|
+
return false;
|
|
256
|
+
},
|
|
257
|
+
COMMAND_PRIORITY_LOW
|
|
258
|
+
);
|
|
259
|
+
const unregisterRedo = editor.registerCommand(
|
|
260
|
+
CAN_REDO_COMMAND,
|
|
261
|
+
(payload) => {
|
|
262
|
+
setState((prev) => ({ ...prev, canRedo: payload }));
|
|
263
|
+
return false;
|
|
264
|
+
},
|
|
265
|
+
COMMAND_PRIORITY_LOW
|
|
266
|
+
);
|
|
267
|
+
const unregisterUpdate = editor.registerUpdateListener(({ editorState }) => {
|
|
268
|
+
editorState.read(() => {
|
|
269
|
+
updateToolbar();
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
return () => {
|
|
273
|
+
unregisterUndo();
|
|
274
|
+
unregisterRedo();
|
|
275
|
+
unregisterUpdate();
|
|
276
|
+
};
|
|
277
|
+
}, [editor, updateToolbar]);
|
|
278
|
+
const applyFontFamily = useCallback(
|
|
279
|
+
(value) => {
|
|
280
|
+
editor.update(() => {
|
|
281
|
+
const selection = $getSelection();
|
|
282
|
+
if ($isRangeSelection(selection)) {
|
|
283
|
+
$patchStyleText(selection, { "font-family": value || "" });
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
},
|
|
287
|
+
[editor]
|
|
288
|
+
);
|
|
289
|
+
const fontFamilyItems = useMemo(
|
|
290
|
+
() => FONT_FAMILIES.map((def) => ({
|
|
291
|
+
label: def.label,
|
|
292
|
+
active: state.fontFamily === def.value,
|
|
293
|
+
style: def.value ? { fontFamily: def.value } : void 0,
|
|
294
|
+
onSelect: () => applyFontFamily(def.value)
|
|
295
|
+
})),
|
|
296
|
+
[state.fontFamily, applyFontFamily]
|
|
297
|
+
);
|
|
298
|
+
const headingItems = useMemo(
|
|
299
|
+
() => [
|
|
300
|
+
{
|
|
301
|
+
label: "Text",
|
|
302
|
+
icon: /* @__PURE__ */ jsx(Pilcrow, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
303
|
+
active: state.blockType === "paragraph",
|
|
304
|
+
onSelect: () => {
|
|
305
|
+
editor.update(() => {
|
|
306
|
+
const selection = $getSelection();
|
|
307
|
+
if ($isRangeSelection(selection)) {
|
|
308
|
+
$setBlocksType(selection, () => $createParagraphNode());
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
label: "Heading 1",
|
|
315
|
+
icon: /* @__PURE__ */ jsx(Heading1, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
316
|
+
active: state.blockType === "h1",
|
|
317
|
+
onSelect: () => {
|
|
318
|
+
editor.update(() => {
|
|
319
|
+
const selection = $getSelection();
|
|
320
|
+
if ($isRangeSelection(selection)) {
|
|
321
|
+
$setBlocksType(selection, () => $createHeadingNode("h1"));
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
label: "Heading 2",
|
|
328
|
+
icon: /* @__PURE__ */ jsx(Heading2, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
329
|
+
active: state.blockType === "h2",
|
|
330
|
+
onSelect: () => {
|
|
331
|
+
editor.update(() => {
|
|
332
|
+
const selection = $getSelection();
|
|
333
|
+
if ($isRangeSelection(selection)) {
|
|
334
|
+
$setBlocksType(selection, () => $createHeadingNode("h2"));
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
label: "Heading 3",
|
|
341
|
+
icon: /* @__PURE__ */ jsx(Heading3, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
342
|
+
active: state.blockType === "h3",
|
|
343
|
+
onSelect: () => {
|
|
344
|
+
editor.update(() => {
|
|
345
|
+
const selection = $getSelection();
|
|
346
|
+
if ($isRangeSelection(selection)) {
|
|
347
|
+
$setBlocksType(selection, () => $createHeadingNode("h3"));
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
],
|
|
353
|
+
[editor, state.blockType]
|
|
354
|
+
);
|
|
355
|
+
const containerClassName = className ? `${toolbarContainer} ${className}` : toolbarContainer;
|
|
356
|
+
const h = tooltipHandle;
|
|
357
|
+
return /* @__PURE__ */ jsxs(TooltipProvider, { delay: 300, children: [
|
|
358
|
+
/* @__PURE__ */ jsx(TooltipRoot, { disableHoverablePopup: true, handle: tooltipHandle, children: ((props) => props.payload !== void 0 ? /* @__PURE__ */ jsxs(TooltipContent, { side: "bottom", sideOffset: 4, children: [
|
|
359
|
+
props.payload.title,
|
|
360
|
+
props.payload.shortcut && /* @__PURE__ */ jsx("span", { className: tooltipShortcut, children: props.payload.shortcut })
|
|
361
|
+
] }) : null) }),
|
|
362
|
+
/* @__PURE__ */ jsx("div", { "aria-label": "Editor toolbar", className: containerClassName, role: "toolbar", children: /* @__PURE__ */ jsxs("div", { className: toolbarRow, children: [
|
|
363
|
+
/* @__PURE__ */ jsx(
|
|
364
|
+
ToolbarDropdown,
|
|
365
|
+
{
|
|
366
|
+
items: fontFamilyItems,
|
|
367
|
+
label: getFontLabel(state.fontFamily),
|
|
368
|
+
title: "Font family",
|
|
369
|
+
tooltipHandle: h,
|
|
370
|
+
triggerWidth: 76
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
374
|
+
/* @__PURE__ */ jsx(
|
|
375
|
+
ToolbarDropdown,
|
|
376
|
+
{
|
|
377
|
+
items: headingItems,
|
|
378
|
+
label: BLOCK_TYPE_LABELS[state.blockType] ?? "Text",
|
|
379
|
+
title: "Block type",
|
|
380
|
+
tooltipHandle: h,
|
|
381
|
+
triggerWidth: 120
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
385
|
+
/* @__PURE__ */ jsx(
|
|
386
|
+
ToolbarButton,
|
|
387
|
+
{
|
|
388
|
+
disabled: !state.canUndo,
|
|
389
|
+
icon: /* @__PURE__ */ jsx(Undo, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
390
|
+
shortcut: "Ctrl+Z",
|
|
391
|
+
title: "Undo",
|
|
392
|
+
tooltipHandle: h,
|
|
393
|
+
onClick: () => editor.dispatchCommand(UNDO_COMMAND, void 0)
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
/* @__PURE__ */ jsx(
|
|
397
|
+
ToolbarButton,
|
|
398
|
+
{
|
|
399
|
+
disabled: !state.canRedo,
|
|
400
|
+
icon: /* @__PURE__ */ jsx(Redo, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
401
|
+
shortcut: "Ctrl+Y",
|
|
402
|
+
title: "Redo",
|
|
403
|
+
tooltipHandle: h,
|
|
404
|
+
onClick: () => editor.dispatchCommand(REDO_COMMAND, void 0)
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
408
|
+
/* @__PURE__ */ jsx(
|
|
409
|
+
ToolbarButton,
|
|
410
|
+
{
|
|
411
|
+
active: state.isBold,
|
|
412
|
+
icon: /* @__PURE__ */ jsx(Bold, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
413
|
+
shortcut: "Ctrl+B",
|
|
414
|
+
title: "Bold",
|
|
415
|
+
tooltipHandle: h,
|
|
416
|
+
onClick: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold")
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
/* @__PURE__ */ jsx(
|
|
420
|
+
ToolbarButton,
|
|
421
|
+
{
|
|
422
|
+
active: state.isItalic,
|
|
423
|
+
icon: /* @__PURE__ */ jsx(Italic, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
424
|
+
shortcut: "Ctrl+I",
|
|
425
|
+
title: "Italic",
|
|
426
|
+
tooltipHandle: h,
|
|
427
|
+
onClick: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic")
|
|
428
|
+
}
|
|
429
|
+
),
|
|
430
|
+
/* @__PURE__ */ jsx(
|
|
431
|
+
ToolbarButton,
|
|
432
|
+
{
|
|
433
|
+
active: state.isUnderline,
|
|
434
|
+
icon: /* @__PURE__ */ jsx(Underline, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
435
|
+
shortcut: "Ctrl+U",
|
|
436
|
+
title: "Underline",
|
|
437
|
+
tooltipHandle: h,
|
|
438
|
+
onClick: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline")
|
|
439
|
+
}
|
|
440
|
+
),
|
|
441
|
+
/* @__PURE__ */ jsx(
|
|
442
|
+
ToolbarButton,
|
|
443
|
+
{
|
|
444
|
+
active: state.isStrikethrough,
|
|
445
|
+
icon: /* @__PURE__ */ jsx(Strikethrough, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
446
|
+
title: "Strikethrough",
|
|
447
|
+
tooltipHandle: h,
|
|
448
|
+
onClick: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough")
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
/* @__PURE__ */ jsx(
|
|
452
|
+
ToolbarButton,
|
|
453
|
+
{
|
|
454
|
+
active: state.isCode,
|
|
455
|
+
icon: /* @__PURE__ */ jsx(Code, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
456
|
+
title: "Inline Code",
|
|
457
|
+
tooltipHandle: h,
|
|
458
|
+
onClick: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code")
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
462
|
+
/* @__PURE__ */ jsx(
|
|
463
|
+
ToolbarButton,
|
|
464
|
+
{
|
|
465
|
+
active: state.isHighlight,
|
|
466
|
+
icon: /* @__PURE__ */ jsx(Highlighter, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
467
|
+
title: "Highlight",
|
|
468
|
+
tooltipHandle: h,
|
|
469
|
+
onClick: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "highlight")
|
|
470
|
+
}
|
|
471
|
+
),
|
|
472
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
473
|
+
/* @__PURE__ */ jsx(
|
|
474
|
+
ToolbarButton,
|
|
475
|
+
{
|
|
476
|
+
active: state.blockType === "bullet",
|
|
477
|
+
icon: /* @__PURE__ */ jsx(List, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
478
|
+
title: "Bulleted List",
|
|
479
|
+
tooltipHandle: h,
|
|
480
|
+
onClick: () => editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, void 0)
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
/* @__PURE__ */ jsx(
|
|
484
|
+
ToolbarButton,
|
|
485
|
+
{
|
|
486
|
+
active: state.blockType === "number",
|
|
487
|
+
icon: /* @__PURE__ */ jsx(ListOrdered, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
488
|
+
title: "Numbered List",
|
|
489
|
+
tooltipHandle: h,
|
|
490
|
+
onClick: () => editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0)
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
/* @__PURE__ */ jsx(
|
|
494
|
+
ToolbarButton,
|
|
495
|
+
{
|
|
496
|
+
active: state.blockType === "check",
|
|
497
|
+
icon: /* @__PURE__ */ jsx(ListChecks, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
498
|
+
title: "Checklist",
|
|
499
|
+
tooltipHandle: h,
|
|
500
|
+
onClick: () => editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, void 0)
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
504
|
+
/* @__PURE__ */ jsx(
|
|
505
|
+
ToolbarButton,
|
|
506
|
+
{
|
|
507
|
+
active: state.elementFormat === "left" || state.elementFormat === "",
|
|
508
|
+
icon: /* @__PURE__ */ jsx(AlignLeft, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
509
|
+
title: "Align Left",
|
|
510
|
+
tooltipHandle: h,
|
|
511
|
+
onClick: () => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "left")
|
|
512
|
+
}
|
|
513
|
+
),
|
|
514
|
+
/* @__PURE__ */ jsx(
|
|
515
|
+
ToolbarButton,
|
|
516
|
+
{
|
|
517
|
+
active: state.elementFormat === "center",
|
|
518
|
+
icon: /* @__PURE__ */ jsx(AlignCenter, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
519
|
+
title: "Align Center",
|
|
520
|
+
tooltipHandle: h,
|
|
521
|
+
onClick: () => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "center")
|
|
522
|
+
}
|
|
523
|
+
),
|
|
524
|
+
/* @__PURE__ */ jsx(
|
|
525
|
+
ToolbarButton,
|
|
526
|
+
{
|
|
527
|
+
active: state.elementFormat === "right",
|
|
528
|
+
icon: /* @__PURE__ */ jsx(AlignRight, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
529
|
+
title: "Align Right",
|
|
530
|
+
tooltipHandle: h,
|
|
531
|
+
onClick: () => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "right")
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ jsx(
|
|
535
|
+
ToolbarButton,
|
|
536
|
+
{
|
|
537
|
+
active: state.elementFormat === "justify",
|
|
538
|
+
icon: /* @__PURE__ */ jsx(AlignJustify, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
|
|
539
|
+
title: "Justify",
|
|
540
|
+
tooltipHandle: h,
|
|
541
|
+
onClick: () => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "justify")
|
|
542
|
+
}
|
|
543
|
+
),
|
|
544
|
+
toolbarItems.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
545
|
+
/* @__PURE__ */ jsx(ToolbarSeparator, {}),
|
|
546
|
+
toolbarItems.slice(0, maxVisibleInsertItems).map((item) => /* @__PURE__ */ jsx(
|
|
547
|
+
ToolbarButton,
|
|
548
|
+
{
|
|
549
|
+
icon: item.icon,
|
|
550
|
+
shortcut: item.shortcut,
|
|
551
|
+
title: item.title,
|
|
552
|
+
tooltipHandle: h,
|
|
553
|
+
onClick: () => item.onSelect(editor, "")
|
|
554
|
+
},
|
|
555
|
+
item.title
|
|
556
|
+
)),
|
|
557
|
+
toolbarItems.length > maxVisibleInsertItems && /* @__PURE__ */ jsxs(DropdownMenu, { modal: false, children: [
|
|
558
|
+
/* @__PURE__ */ jsx(
|
|
559
|
+
TooltipTrigger,
|
|
560
|
+
{
|
|
561
|
+
handle: h,
|
|
562
|
+
payload: { title: "More" },
|
|
563
|
+
render: /* @__PURE__ */ jsx(
|
|
564
|
+
DropdownMenuTrigger,
|
|
565
|
+
{
|
|
566
|
+
className: toolbarButton,
|
|
567
|
+
render: /* @__PURE__ */ jsx("button", { type: "button" })
|
|
568
|
+
}
|
|
569
|
+
),
|
|
570
|
+
children: /* @__PURE__ */ jsx(Ellipsis, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
571
|
+
}
|
|
572
|
+
),
|
|
573
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { positionMethod: "fixed", sideOffset: 4, children: toolbarItems.slice(maxVisibleInsertItems).map((item) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => item.onSelect(editor, ""), children: [
|
|
574
|
+
item.icon && /* @__PURE__ */ jsx(
|
|
575
|
+
"span",
|
|
576
|
+
{
|
|
577
|
+
style: {
|
|
578
|
+
marginRight: 8,
|
|
579
|
+
display: "inline-flex",
|
|
580
|
+
transform: "scale(0.8)",
|
|
581
|
+
transformOrigin: "left center"
|
|
582
|
+
},
|
|
583
|
+
children: item.icon
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
item.title
|
|
587
|
+
] }, item.title)) })
|
|
588
|
+
] })
|
|
589
|
+
] })
|
|
590
|
+
] }) })
|
|
591
|
+
] });
|
|
564
592
|
}
|
|
565
|
-
|
|
566
|
-
|
|
593
|
+
export {
|
|
594
|
+
ToolbarPlugin
|
|
595
|
+
};
|
|
@@ -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}._88yfio0{--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}._88yfio1{--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}._88yfio2{--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 ._88yfio0,[data-theme=dark] ._88yfio0,.dark._88yfio0,[data-theme=dark]._88yfio0,.dark ._88yfio1,[data-theme=dark] ._88yfio1,.dark._88yfio1,[data-theme=dark]._88yfio1,.dark ._88yfio2,[data-theme=dark] ._88yfio2,.dark._88yfio2,[data-theme=dark]._88yfio2{--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}._1e1ersc0{border:1px solid var(--rc-border);background-color:color-mix(in srgb, var(--rc-bg) 90%, transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:var(--rc-shadow-top-bar);font-family:var(--rc-font-family-sans);z-index:2;max-width:var(--rc-max-width);border-radius:12px;flex-direction:column;gap:4px;margin:12px auto 0;display:flex;position:sticky;top:0}._1e1ersc1{flex-flow:wrap;align-items:center;gap:4px;min-height:36px;padding:6px 16px;display:flex}._1e1ersc2{width:32px;height:32px;color:var(--rc-text-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0;transition:color .15s,background-color .15s;display:flex;position:relative}._1e1ersc2:hover{background-color:var(--rc-fill-quaternary);color:var(--rc-text)}._1e1ersc2:active{background-color:var(--rc-fill-tertiary)}._1e1ersc2[data-popup-open]{background-color:var(--rc-fill-tertiary);color:var(--rc-text)}._1e1ersc2:disabled{opacity:.35;cursor:default;color:var(--rc-text-quaternary);background-color:#0000}._1e1ersc2 svg{stroke-width:2px;width:15px;height:15px}._1e1ersc3,._1e1ersc3:hover{color:var(--rc-text);background-color:var(--rc-fill-tertiary)}._1e1ersc4{height:32px;color:var(--rc-text-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;align-items:center;gap:4px;padding:0 10px;font-size:13px;font-weight:500;line-height:1;transition:color .15s,background-color .15s;display:inline-flex}._1e1ersc4:hover{background-color:var(--rc-fill-quaternary);color:var(--rc-text)}._1e1ersc5{flex-shrink:0;margin-left:auto;display:inline-flex}._1e1ersc6{background-color:var(--rc-border);flex-shrink:0;width:1px;height:24px;margin-inline-start:6px;margin-inline-end:6px}._1e1ersc7{background-color:var(--rc-fill-tertiary);color:var(--rc-text)}._1e1ersc8{opacity:.7;margin-left:6px;font-size:11px}
|
|
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}._88yfio0{--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}._88yfio1{--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}._88yfio2{--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 ._88yfio0,[data-theme=dark] ._88yfio0,.dark._88yfio0,[data-theme=dark]._88yfio0,.dark ._88yfio1,[data-theme=dark] ._88yfio1,.dark._88yfio1,[data-theme=dark]._88yfio1,.dark ._88yfio2,[data-theme=dark] ._88yfio2,.dark._88yfio2,[data-theme=dark]._88yfio2{--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)}._1e1ersc0{display:flex;flex-direction:column;gap:4px;border:1px solid var(--rc-border);border-radius:12px;background-color:color-mix(in srgb,var(--rc-bg) 90%,transparent);backdrop-filter:blur(8px);box-shadow:var(--rc-shadow-top-bar);font-family:var(--rc-font-family-sans);position:sticky;top:0;z-index:2;margin:12px auto 0;max-width:var(--rc-max-width)}._1e1ersc1{display:flex;flex-direction:row;align-items:center;gap:4px;flex-wrap:wrap;min-height:36px;padding:6px 16px}._1e1ersc2{position:relative;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:6px;color:var(--rc-text-secondary);cursor:pointer;padding:0;transition:color .15s,background-color .15s}._1e1ersc2:hover{background-color:var(--rc-fill-quaternary);color:var(--rc-text)}._1e1ersc2:active{background-color:var(--rc-fill-tertiary)}._1e1ersc2[data-popup-open]{background-color:var(--rc-fill-tertiary);color:var(--rc-text)}._1e1ersc2:disabled{opacity:.35;cursor:default;background-color:transparent;color:var(--rc-text-quaternary)}._1e1ersc2 svg{width:15px;height:15px;stroke-width:2}._1e1ersc3,._1e1ersc3:hover{color:var(--rc-text);background-color:var(--rc-fill-tertiary)}._1e1ersc4{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 10px;border:none;background:transparent;border-radius:6px;color:var(--rc-text-secondary);cursor:pointer;font-size:13px;font-weight:500;line-height:1;transition:color .15s,background-color .15s}._1e1ersc4:hover{background-color:var(--rc-fill-quaternary);color:var(--rc-text)}._1e1ersc5{margin-left:auto;display:inline-flex;flex-shrink:0}._1e1ersc6{width:1px;height:24px;background-color:var(--rc-border);margin-inline:6px;flex-shrink:0}._1e1ersc7{background-color:var(--rc-fill-tertiary);color:var(--rc-text)}._1e1ersc8{font-size:11px;opacity:.7;margin-left:6px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-plugin-toolbar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"description": "Top toolbar plugin for rich editor",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@haklex/rich-editor": "0.0.
|
|
25
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
26
|
-
"@haklex/rich-style-token": "0.0.
|
|
24
|
+
"@haklex/rich-editor": "0.0.83",
|
|
25
|
+
"@haklex/rich-editor-ui": "0.0.83",
|
|
26
|
+
"@haklex/rich-style-token": "0.0.83"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@lexical/list": "^0.41.0",
|