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