@haklex/rich-plugin-floating-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 +582 -542
- package/dist/rich-plugin-floating-toolbar.css +1 -2
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,572 +1,612 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
1
2
|
import { $createRubyNode, $isRubyNode } from "@haklex/rich-editor/nodes";
|
|
2
3
|
import { ColorPicker } from "@haklex/rich-editor-ui";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { usePortalTheme, usePortalContainer, vars } from "@haklex/rich-style-token";
|
|
5
|
+
import { TOGGLE_LINK_COMMAND, $isLinkNode, $isAutoLinkNode } from "@lexical/link";
|
|
5
6
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
6
|
-
import { $
|
|
7
|
-
import { $
|
|
8
|
-
import { Bold,
|
|
9
|
-
import {
|
|
7
|
+
import { $patchStyleText, $getSelectionStyleValueForProperty } from "@lexical/selection";
|
|
8
|
+
import { $getSelection, $isRangeSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND, $createTextNode, $getNodeByKey } from "lexical";
|
|
9
|
+
import { Bold, Italic, Underline, Strikethrough, Superscript, Subscript, Code, Highlighter, Link, Languages, Check, X, Trash2 } from "lucide-react";
|
|
10
|
+
import { useRef, useState, useCallback, useEffect } from "react";
|
|
10
11
|
import { createPortal } from "react-dom";
|
|
11
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
//#region src/styles.css.ts
|
|
13
12
|
var toolbar = "_1m6axz71";
|
|
14
13
|
var btn = "_1m6axz72";
|
|
15
14
|
var btnActive = "_1m6axz73";
|
|
15
|
+
var btnIndicator = "_1m6axz74";
|
|
16
16
|
var rubyEditor = "_1m6axz75";
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var rubyPreview = "_1m6axz76";
|
|
18
|
+
var rubyPreviewReading = "_1m6axz77";
|
|
19
|
+
var rubyPreviewBase = "_1m6axz78";
|
|
20
|
+
var rubyInputRow = "_1m6axz79";
|
|
21
|
+
var rubyInput = "_1m6axz7a";
|
|
22
|
+
var rubyActionBtn = "_1m6axz7b";
|
|
23
|
+
var rubyHint = "_1m6axz7c";
|
|
24
|
+
var separator = "_1m6axz7d";
|
|
19
25
|
function isEffectiveLinkNode(node) {
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
if (!$isLinkNode(node)) return false;
|
|
27
|
+
return !$isAutoLinkNode(node) || !node.getIsUnlinked();
|
|
22
28
|
}
|
|
23
29
|
function isRegularLinkNode(node) {
|
|
24
|
-
|
|
30
|
+
return $isLinkNode(node) && !$isAutoLinkNode(node);
|
|
25
31
|
}
|
|
26
32
|
function collectSelectedActiveAutoLinkNodes(selection) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const autoLinkNodes = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const node of selection.getNodes()) {
|
|
35
|
+
if ($isAutoLinkNode(node) && !node.getIsUnlinked()) {
|
|
36
|
+
autoLinkNodes.set(node.getKey(), node);
|
|
37
|
+
}
|
|
38
|
+
const parent = node.getParent();
|
|
39
|
+
if ($isAutoLinkNode(parent) && !parent.getIsUnlinked()) {
|
|
40
|
+
autoLinkNodes.set(parent.getKey(), parent);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Array.from(autoLinkNodes.values());
|
|
34
44
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const INITIAL_STATE = {
|
|
46
|
+
isBold: false,
|
|
47
|
+
isItalic: false,
|
|
48
|
+
isUnderline: false,
|
|
49
|
+
isStrikethrough: false,
|
|
50
|
+
isSuperscript: false,
|
|
51
|
+
isSubscript: false,
|
|
52
|
+
isCode: false,
|
|
53
|
+
isHighlight: false,
|
|
54
|
+
isLink: false,
|
|
55
|
+
isRuby: false,
|
|
56
|
+
fontColor: ""
|
|
47
57
|
};
|
|
48
58
|
function findRubyAncestor(node) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
let current = node;
|
|
60
|
+
while (current) {
|
|
61
|
+
if ($isRubyNode(current)) {
|
|
62
|
+
return current;
|
|
63
|
+
}
|
|
64
|
+
current = current.getParent();
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
55
67
|
}
|
|
56
68
|
function getSelectedRubyNodes(nodes) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
const rubyNodes = /* @__PURE__ */ new Map();
|
|
70
|
+
for (const node of nodes) {
|
|
71
|
+
const rubyNode = findRubyAncestor(node);
|
|
72
|
+
if (rubyNode) {
|
|
73
|
+
rubyNodes.set(rubyNode.getKey(), rubyNode);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return Array.from(rubyNodes.values());
|
|
63
77
|
}
|
|
64
78
|
function getSelectionState(selection) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
const nodes = selection.getNodes();
|
|
80
|
+
const hasLink = nodes.some((node) => {
|
|
81
|
+
const parent = node.getParent();
|
|
82
|
+
return isEffectiveLinkNode(parent) || isEffectiveLinkNode(node);
|
|
83
|
+
});
|
|
84
|
+
const hasRuby = getSelectedRubyNodes(nodes).length > 0;
|
|
85
|
+
return {
|
|
86
|
+
isBold: selection.hasFormat("bold"),
|
|
87
|
+
isItalic: selection.hasFormat("italic"),
|
|
88
|
+
isUnderline: selection.hasFormat("underline"),
|
|
89
|
+
isStrikethrough: selection.hasFormat("strikethrough"),
|
|
90
|
+
isSuperscript: selection.hasFormat("superscript"),
|
|
91
|
+
isSubscript: selection.hasFormat("subscript"),
|
|
92
|
+
isCode: selection.hasFormat("code"),
|
|
93
|
+
isHighlight: selection.hasFormat("highlight"),
|
|
94
|
+
isLink: hasLink,
|
|
95
|
+
isRuby: hasRuby,
|
|
96
|
+
fontColor: $getSelectionStyleValueForProperty(selection, "color", "")
|
|
97
|
+
};
|
|
83
98
|
}
|
|
84
|
-
function computePosition(nativeSelection,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
function computePosition(nativeSelection, toolbar2, container) {
|
|
100
|
+
const range = nativeSelection.getRangeAt(0);
|
|
101
|
+
const rect = range.getBoundingClientRect();
|
|
102
|
+
if (rect.width === 0 && rect.height === 0) return null;
|
|
103
|
+
const toolbarWidth = toolbar2.offsetWidth;
|
|
104
|
+
const toolbarHeight = toolbar2.offsetHeight;
|
|
105
|
+
const isBody = container === document.body;
|
|
106
|
+
const containerRect = isBody ? void 0 : container.getBoundingClientRect();
|
|
107
|
+
const offsetX = containerRect?.left ?? 0;
|
|
108
|
+
const offsetY = containerRect?.top ?? 0;
|
|
109
|
+
const availableWidth = containerRect?.width ?? window.innerWidth;
|
|
110
|
+
const rawLeft = rect.left - offsetX + rect.width / 2 - toolbarWidth / 2;
|
|
111
|
+
const clampedLeft = Math.max(8, Math.min(rawLeft, availableWidth - toolbarWidth - 8));
|
|
112
|
+
return {
|
|
113
|
+
top: rect.top - offsetY - toolbarHeight - 10,
|
|
114
|
+
left: clampedLeft
|
|
115
|
+
};
|
|
99
116
|
}
|
|
100
117
|
function ToolbarButton({ active, onClick, ariaLabel, children }) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
118
|
+
return /* @__PURE__ */ jsxs(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
"aria-label": ariaLabel,
|
|
122
|
+
"aria-pressed": active,
|
|
123
|
+
className: `${btn}${active ? ` ${btnActive}` : ""}`,
|
|
124
|
+
type: "button",
|
|
125
|
+
onMouseDown: (e) => {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
onClick();
|
|
128
|
+
},
|
|
129
|
+
children: [
|
|
130
|
+
children,
|
|
131
|
+
active && /* @__PURE__ */ jsx("span", { className: btnIndicator })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
);
|
|
112
135
|
}
|
|
113
|
-
|
|
114
|
-
|
|
136
|
+
const ICON_SIZE = 15;
|
|
137
|
+
const ICON_STROKE = 2;
|
|
115
138
|
function extractCssVarName(value) {
|
|
116
|
-
|
|
139
|
+
const match = value.match(/^var\((--[^\s),]+)(?:,[^)]+)?\)$/);
|
|
140
|
+
return match?.[1] ?? null;
|
|
117
141
|
}
|
|
118
142
|
function collectThemeVarNames(contract, output) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
143
|
+
if (typeof contract === "string") {
|
|
144
|
+
const cssVarName = extractCssVarName(contract);
|
|
145
|
+
if (cssVarName) output.add(cssVarName);
|
|
146
|
+
return output;
|
|
147
|
+
}
|
|
148
|
+
if (contract && typeof contract === "object") {
|
|
149
|
+
for (const value of Object.values(contract)) {
|
|
150
|
+
collectThemeVarNames(value, output);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return output;
|
|
126
154
|
}
|
|
127
|
-
|
|
155
|
+
const THEME_VAR_NAMES = Array.from(collectThemeVarNames(vars, /* @__PURE__ */ new Set()));
|
|
128
156
|
function FloatingToolbarPlugin() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
157
|
+
const [editor] = useLexicalComposerContext();
|
|
158
|
+
const { className: portalClassName } = usePortalTheme();
|
|
159
|
+
const portalContainer = usePortalContainer();
|
|
160
|
+
const toolbarRef = useRef(null);
|
|
161
|
+
const [visible, setVisible] = useState(false);
|
|
162
|
+
const [state, setState] = useState(INITIAL_STATE);
|
|
163
|
+
const [rubyEdit, setRubyEdit] = useState(null);
|
|
164
|
+
const rubyEditorRef = useRef(null);
|
|
165
|
+
const rubyInputRef = useRef(null);
|
|
166
|
+
const rubyEditRef = useRef(rubyEdit);
|
|
167
|
+
rubyEditRef.current = rubyEdit;
|
|
168
|
+
const updateToolbar = useCallback(() => {
|
|
169
|
+
const selection = $getSelection();
|
|
170
|
+
if (!$isRangeSelection(selection) || selection.isCollapsed()) {
|
|
171
|
+
setVisible(false);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
setState(getSelectionState(selection));
|
|
175
|
+
setVisible(true);
|
|
176
|
+
}, []);
|
|
177
|
+
const applyThemeVars = useCallback(
|
|
178
|
+
(toolbar2) => {
|
|
179
|
+
const rootElement = editor.getRootElement();
|
|
180
|
+
if (!rootElement) return;
|
|
181
|
+
const computed = window.getComputedStyle(rootElement);
|
|
182
|
+
for (const name of THEME_VAR_NAMES) {
|
|
183
|
+
const value = computed.getPropertyValue(name).trim();
|
|
184
|
+
if (value) {
|
|
185
|
+
toolbar2.style.setProperty(name, value);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
[editor]
|
|
190
|
+
);
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
const unregisterCommand = editor.registerCommand(
|
|
193
|
+
SELECTION_CHANGE_COMMAND,
|
|
194
|
+
() => {
|
|
195
|
+
updateToolbar();
|
|
196
|
+
return false;
|
|
197
|
+
},
|
|
198
|
+
COMMAND_PRIORITY_LOW
|
|
199
|
+
);
|
|
200
|
+
const unregisterUpdate = editor.registerUpdateListener(({ editorState }) => {
|
|
201
|
+
editorState.read(() => {
|
|
202
|
+
updateToolbar();
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
return () => {
|
|
206
|
+
unregisterCommand();
|
|
207
|
+
unregisterUpdate();
|
|
208
|
+
};
|
|
209
|
+
}, [editor, updateToolbar]);
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
if (!visible || !toolbarRef.current) return;
|
|
212
|
+
const positionToolbar = () => {
|
|
213
|
+
const toolbar2 = toolbarRef.current;
|
|
214
|
+
if (!toolbar2) return;
|
|
215
|
+
applyThemeVars(toolbar2);
|
|
216
|
+
const nativeSelection = window.getSelection();
|
|
217
|
+
if (!nativeSelection || nativeSelection.rangeCount === 0) {
|
|
218
|
+
setVisible(false);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const pos = computePosition(nativeSelection, toolbar2, portalContainer);
|
|
222
|
+
if (!pos) {
|
|
223
|
+
setVisible(false);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
toolbar2.style.top = `${pos.top}px`;
|
|
227
|
+
toolbar2.style.left = `${pos.left}px`;
|
|
228
|
+
};
|
|
229
|
+
requestAnimationFrame(positionToolbar);
|
|
230
|
+
const rootElement = editor.getRootElement();
|
|
231
|
+
if (!rootElement) return;
|
|
232
|
+
let scrollParent = window;
|
|
233
|
+
let el = rootElement.parentElement;
|
|
234
|
+
while (el) {
|
|
235
|
+
const { overflowY } = window.getComputedStyle(el);
|
|
236
|
+
if (overflowY === "auto" || overflowY === "scroll") {
|
|
237
|
+
scrollParent = el;
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
el = el.parentElement;
|
|
241
|
+
}
|
|
242
|
+
const onScroll = () => requestAnimationFrame(positionToolbar);
|
|
243
|
+
scrollParent.addEventListener("scroll", onScroll, { passive: true });
|
|
244
|
+
return () => scrollParent.removeEventListener("scroll", onScroll);
|
|
245
|
+
}, [applyThemeVars, editor, visible, state]);
|
|
246
|
+
const handleFormat = useCallback(
|
|
247
|
+
(format) => {
|
|
248
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, format);
|
|
249
|
+
},
|
|
250
|
+
[editor]
|
|
251
|
+
);
|
|
252
|
+
const handleLink = useCallback(() => {
|
|
253
|
+
editor.update(() => {
|
|
254
|
+
const selection = $getSelection();
|
|
255
|
+
if (!$isRangeSelection(selection)) return;
|
|
256
|
+
const nodes = selection.getNodes();
|
|
257
|
+
const hasLink = nodes.some((node) => {
|
|
258
|
+
const parent = node.getParent();
|
|
259
|
+
return isEffectiveLinkNode(parent) || isEffectiveLinkNode(node);
|
|
260
|
+
});
|
|
261
|
+
if (hasLink) {
|
|
262
|
+
for (const autoLinkNode of collectSelectedActiveAutoLinkNodes(selection)) {
|
|
263
|
+
autoLinkNode.setIsUnlinked(true);
|
|
264
|
+
autoLinkNode.markDirty();
|
|
265
|
+
}
|
|
266
|
+
const hasRegularLink = nodes.some((node) => {
|
|
267
|
+
const parent = node.getParent();
|
|
268
|
+
return isRegularLinkNode(parent) || isRegularLinkNode(node);
|
|
269
|
+
});
|
|
270
|
+
if (hasRegularLink) {
|
|
271
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
const text = selection.getTextContent();
|
|
275
|
+
const url = /^https?:\/\//.test(text) ? text : "";
|
|
276
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, url || "https://");
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}, [editor]);
|
|
280
|
+
const handleColor = useCallback(
|
|
281
|
+
(value) => {
|
|
282
|
+
editor.update(() => {
|
|
283
|
+
const sel = $getSelection();
|
|
284
|
+
if ($isRangeSelection(sel)) {
|
|
285
|
+
$patchStyleText(sel, { color: value === "inherit" ? null : value });
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
[editor]
|
|
290
|
+
);
|
|
291
|
+
const handleRuby = useCallback(() => {
|
|
292
|
+
editor.update(() => {
|
|
293
|
+
const selection = $getSelection();
|
|
294
|
+
if (!$isRangeSelection(selection)) return;
|
|
295
|
+
const nodes = selection.getNodes();
|
|
296
|
+
const rubyNodes = getSelectedRubyNodes(nodes);
|
|
297
|
+
if (rubyNodes.length > 0) {
|
|
298
|
+
const rubyNode = rubyNodes[0];
|
|
299
|
+
if (!rubyNode) return;
|
|
300
|
+
setRubyEdit({
|
|
301
|
+
nodeKey: rubyNode.getKey(),
|
|
302
|
+
reading: rubyNode.getReading(),
|
|
303
|
+
baseText: rubyNode.getTextContent(),
|
|
304
|
+
isNew: false
|
|
305
|
+
});
|
|
306
|
+
} else {
|
|
307
|
+
const text = selection.getTextContent();
|
|
308
|
+
if (!text.trim()) return;
|
|
309
|
+
selection.removeText();
|
|
310
|
+
const rubyNode = $createRubyNode("");
|
|
311
|
+
rubyNode.append($createTextNode(text));
|
|
312
|
+
const freshSelection = $getSelection();
|
|
313
|
+
if ($isRangeSelection(freshSelection)) {
|
|
314
|
+
freshSelection.insertNodes([rubyNode]);
|
|
315
|
+
}
|
|
316
|
+
setRubyEdit({
|
|
317
|
+
nodeKey: rubyNode.getKey(),
|
|
318
|
+
reading: "",
|
|
319
|
+
baseText: text,
|
|
320
|
+
isNew: true
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}, [editor]);
|
|
325
|
+
const handleRubyConfirm = useCallback(() => {
|
|
326
|
+
const edit = rubyEditRef.current;
|
|
327
|
+
if (!edit) return;
|
|
328
|
+
editor.update(() => {
|
|
329
|
+
const node = $getNodeByKey(edit.nodeKey);
|
|
330
|
+
if ($isRubyNode(node)) {
|
|
331
|
+
node.setReading(edit.reading);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
setRubyEdit(null);
|
|
335
|
+
}, [editor]);
|
|
336
|
+
const handleRubyCancel = useCallback(() => {
|
|
337
|
+
const edit = rubyEditRef.current;
|
|
338
|
+
if (!edit) return;
|
|
339
|
+
if (edit.isNew) {
|
|
340
|
+
editor.update(() => {
|
|
341
|
+
const node = $getNodeByKey(edit.nodeKey);
|
|
342
|
+
if ($isRubyNode(node)) {
|
|
343
|
+
const children = node.getChildren();
|
|
344
|
+
for (const child of children) {
|
|
345
|
+
node.insertBefore(child);
|
|
346
|
+
}
|
|
347
|
+
node.remove();
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
setRubyEdit(null);
|
|
352
|
+
}, [editor]);
|
|
353
|
+
const handleRubyDelete = useCallback(() => {
|
|
354
|
+
const edit = rubyEditRef.current;
|
|
355
|
+
if (!edit) return;
|
|
356
|
+
editor.update(() => {
|
|
357
|
+
const node = $getNodeByKey(edit.nodeKey);
|
|
358
|
+
if ($isRubyNode(node)) {
|
|
359
|
+
const children = node.getChildren();
|
|
360
|
+
for (const child of children) {
|
|
361
|
+
node.insertBefore(child);
|
|
362
|
+
}
|
|
363
|
+
node.remove();
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
setRubyEdit(null);
|
|
367
|
+
}, [editor]);
|
|
368
|
+
const isRubyEditing = rubyEdit !== null;
|
|
369
|
+
useEffect(() => {
|
|
370
|
+
if (!isRubyEditing) return;
|
|
371
|
+
const handleClickOutside = (e) => {
|
|
372
|
+
const currentEdit = rubyEditRef.current;
|
|
373
|
+
if (!currentEdit) return;
|
|
374
|
+
if (rubyEditorRef.current && !rubyEditorRef.current.contains(e.target)) {
|
|
375
|
+
if (currentEdit.reading.trim()) {
|
|
376
|
+
editor.update(() => {
|
|
377
|
+
const node = $getNodeByKey(currentEdit.nodeKey);
|
|
378
|
+
if ($isRubyNode(node)) {
|
|
379
|
+
node.setReading(currentEdit.reading);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
} else if (currentEdit.isNew) {
|
|
383
|
+
editor.update(() => {
|
|
384
|
+
const node = $getNodeByKey(currentEdit.nodeKey);
|
|
385
|
+
if ($isRubyNode(node)) {
|
|
386
|
+
const children = node.getChildren();
|
|
387
|
+
for (const child of children) {
|
|
388
|
+
node.insertBefore(child);
|
|
389
|
+
}
|
|
390
|
+
node.remove();
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
setRubyEdit(null);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
const timer = setTimeout(() => {
|
|
398
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
399
|
+
}, 0);
|
|
400
|
+
return () => {
|
|
401
|
+
clearTimeout(timer);
|
|
402
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
403
|
+
};
|
|
404
|
+
}, [editor, isRubyEditing]);
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
if (!rubyEdit || !rubyEditorRef.current) return;
|
|
407
|
+
const positionEditor = () => {
|
|
408
|
+
const editorEl = rubyEditorRef.current;
|
|
409
|
+
if (!editorEl) return;
|
|
410
|
+
applyThemeVars(editorEl);
|
|
411
|
+
const rubyDom = editor.getElementByKey(rubyEdit.nodeKey);
|
|
412
|
+
if (!rubyDom) return;
|
|
413
|
+
const rect = rubyDom.getBoundingClientRect();
|
|
414
|
+
const isBody = portalContainer === document.body;
|
|
415
|
+
const containerRect = isBody ? void 0 : portalContainer.getBoundingClientRect();
|
|
416
|
+
const oX = containerRect?.left ?? 0;
|
|
417
|
+
const oY = containerRect?.top ?? 0;
|
|
418
|
+
const availW = containerRect?.width ?? window.innerWidth;
|
|
419
|
+
const editorWidth = editorEl.offsetWidth;
|
|
420
|
+
const rawLeft = rect.left - oX + rect.width / 2 - editorWidth / 2;
|
|
421
|
+
const clampedLeft = Math.max(8, Math.min(rawLeft, availW - editorWidth - 8));
|
|
422
|
+
editorEl.style.top = `${rect.bottom - oY + 8}px`;
|
|
423
|
+
editorEl.style.left = `${clampedLeft}px`;
|
|
424
|
+
};
|
|
425
|
+
requestAnimationFrame(positionEditor);
|
|
426
|
+
requestAnimationFrame(() => {
|
|
427
|
+
rubyInputRef.current?.focus();
|
|
428
|
+
});
|
|
429
|
+
}, [applyThemeVars, editor, rubyEdit]);
|
|
430
|
+
if (!visible && !rubyEdit) return null;
|
|
431
|
+
const toolbarClassName = portalClassName ? `${toolbar} ${portalClassName}` : toolbar;
|
|
432
|
+
const rubyEditorClassName = portalClassName ? `${rubyEditor} ${portalClassName}` : rubyEditor;
|
|
433
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
434
|
+
visible && !rubyEdit && createPortal(
|
|
435
|
+
/* @__PURE__ */ jsxs(
|
|
436
|
+
"div",
|
|
437
|
+
{
|
|
438
|
+
"aria-label": "Text formatting",
|
|
439
|
+
className: toolbarClassName,
|
|
440
|
+
ref: toolbarRef,
|
|
441
|
+
role: "toolbar",
|
|
442
|
+
style: { position: "fixed", zIndex: 50 },
|
|
443
|
+
children: [
|
|
444
|
+
/* @__PURE__ */ jsx(
|
|
445
|
+
ToolbarButton,
|
|
446
|
+
{
|
|
447
|
+
active: state.isBold,
|
|
448
|
+
ariaLabel: "Bold",
|
|
449
|
+
onClick: () => handleFormat("bold"),
|
|
450
|
+
children: /* @__PURE__ */ jsx(Bold, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
451
|
+
}
|
|
452
|
+
),
|
|
453
|
+
/* @__PURE__ */ jsx(
|
|
454
|
+
ToolbarButton,
|
|
455
|
+
{
|
|
456
|
+
active: state.isItalic,
|
|
457
|
+
ariaLabel: "Italic",
|
|
458
|
+
onClick: () => handleFormat("italic"),
|
|
459
|
+
children: /* @__PURE__ */ jsx(Italic, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
/* @__PURE__ */ jsx(
|
|
463
|
+
ToolbarButton,
|
|
464
|
+
{
|
|
465
|
+
active: state.isUnderline,
|
|
466
|
+
ariaLabel: "Underline",
|
|
467
|
+
onClick: () => handleFormat("underline"),
|
|
468
|
+
children: /* @__PURE__ */ jsx(Underline, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
469
|
+
}
|
|
470
|
+
),
|
|
471
|
+
/* @__PURE__ */ jsx(
|
|
472
|
+
ToolbarButton,
|
|
473
|
+
{
|
|
474
|
+
active: state.isStrikethrough,
|
|
475
|
+
ariaLabel: "Strikethrough",
|
|
476
|
+
onClick: () => handleFormat("strikethrough"),
|
|
477
|
+
children: /* @__PURE__ */ jsx(Strikethrough, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
478
|
+
}
|
|
479
|
+
),
|
|
480
|
+
/* @__PURE__ */ jsx(
|
|
481
|
+
ToolbarButton,
|
|
482
|
+
{
|
|
483
|
+
active: state.isSuperscript,
|
|
484
|
+
ariaLabel: "Superscript",
|
|
485
|
+
onClick: () => handleFormat("superscript"),
|
|
486
|
+
children: /* @__PURE__ */ jsx(Superscript, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ jsx(
|
|
490
|
+
ToolbarButton,
|
|
491
|
+
{
|
|
492
|
+
active: state.isSubscript,
|
|
493
|
+
ariaLabel: "Subscript",
|
|
494
|
+
onClick: () => handleFormat("subscript"),
|
|
495
|
+
children: /* @__PURE__ */ jsx(Subscript, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
/* @__PURE__ */ jsx("span", { className: separator }),
|
|
499
|
+
/* @__PURE__ */ jsx(
|
|
500
|
+
ToolbarButton,
|
|
501
|
+
{
|
|
502
|
+
active: state.isCode,
|
|
503
|
+
ariaLabel: "Code",
|
|
504
|
+
onClick: () => handleFormat("code"),
|
|
505
|
+
children: /* @__PURE__ */ jsx(Code, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
506
|
+
}
|
|
507
|
+
),
|
|
508
|
+
/* @__PURE__ */ jsx(
|
|
509
|
+
ToolbarButton,
|
|
510
|
+
{
|
|
511
|
+
active: state.isHighlight,
|
|
512
|
+
ariaLabel: "Highlight",
|
|
513
|
+
onClick: () => handleFormat("highlight"),
|
|
514
|
+
children: /* @__PURE__ */ jsx(Highlighter, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
/* @__PURE__ */ jsx(ToolbarButton, { active: state.isLink, ariaLabel: "Link", onClick: handleLink, children: /* @__PURE__ */ jsx(Link, { size: ICON_SIZE, strokeWidth: ICON_STROKE }) }),
|
|
518
|
+
/* @__PURE__ */ jsx(ToolbarButton, { active: state.isRuby, ariaLabel: "Ruby annotation", onClick: handleRuby, children: /* @__PURE__ */ jsx(Languages, { size: ICON_SIZE, strokeWidth: ICON_STROKE }) }),
|
|
519
|
+
/* @__PURE__ */ jsx("span", { className: separator }),
|
|
520
|
+
/* @__PURE__ */ jsx(ColorPicker, { currentColor: state.fontColor || "inherit", onSelect: handleColor })
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
),
|
|
524
|
+
portalContainer
|
|
525
|
+
),
|
|
526
|
+
rubyEdit && createPortal(
|
|
527
|
+
/* @__PURE__ */ jsxs(
|
|
528
|
+
"div",
|
|
529
|
+
{
|
|
530
|
+
className: rubyEditorClassName,
|
|
531
|
+
ref: rubyEditorRef,
|
|
532
|
+
style: { position: "fixed", zIndex: 51 },
|
|
533
|
+
children: [
|
|
534
|
+
/* @__PURE__ */ jsxs("div", { className: rubyPreview, children: [
|
|
535
|
+
/* @__PURE__ */ jsx("span", { className: rubyPreviewReading, children: rubyEdit.reading || " " }),
|
|
536
|
+
/* @__PURE__ */ jsx("span", { className: rubyPreviewBase, children: rubyEdit.baseText })
|
|
537
|
+
] }),
|
|
538
|
+
/* @__PURE__ */ jsxs("div", { className: rubyInputRow, children: [
|
|
539
|
+
/* @__PURE__ */ jsx(
|
|
540
|
+
"input",
|
|
541
|
+
{
|
|
542
|
+
className: rubyInput,
|
|
543
|
+
placeholder: "读音",
|
|
544
|
+
ref: rubyInputRef,
|
|
545
|
+
value: rubyEdit.reading,
|
|
546
|
+
onChange: (e) => setRubyEdit((prev) => prev ? { ...prev, reading: e.target.value } : null),
|
|
547
|
+
onKeyDown: (e) => {
|
|
548
|
+
if (e.key === "Enter") {
|
|
549
|
+
e.preventDefault();
|
|
550
|
+
handleRubyConfirm();
|
|
551
|
+
}
|
|
552
|
+
if (e.key === "Escape") {
|
|
553
|
+
e.preventDefault();
|
|
554
|
+
handleRubyCancel();
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
/* @__PURE__ */ jsx(
|
|
560
|
+
"button",
|
|
561
|
+
{
|
|
562
|
+
"aria-label": "Confirm",
|
|
563
|
+
className: rubyActionBtn,
|
|
564
|
+
style: { color: "#22c55e" },
|
|
565
|
+
type: "button",
|
|
566
|
+
onMouseDown: (e) => {
|
|
567
|
+
e.preventDefault();
|
|
568
|
+
handleRubyConfirm();
|
|
569
|
+
},
|
|
570
|
+
children: /* @__PURE__ */ jsx(Check, { size: 14, strokeWidth: ICON_STROKE })
|
|
571
|
+
}
|
|
572
|
+
),
|
|
573
|
+
/* @__PURE__ */ jsx(
|
|
574
|
+
"button",
|
|
575
|
+
{
|
|
576
|
+
"aria-label": "Cancel",
|
|
577
|
+
className: rubyActionBtn,
|
|
578
|
+
type: "button",
|
|
579
|
+
onMouseDown: (e) => {
|
|
580
|
+
e.preventDefault();
|
|
581
|
+
handleRubyCancel();
|
|
582
|
+
},
|
|
583
|
+
children: /* @__PURE__ */ jsx(X, { size: 14, strokeWidth: ICON_STROKE })
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
/* @__PURE__ */ jsx("span", { className: separator }),
|
|
587
|
+
/* @__PURE__ */ jsx(
|
|
588
|
+
"button",
|
|
589
|
+
{
|
|
590
|
+
"aria-label": "Delete ruby",
|
|
591
|
+
className: rubyActionBtn,
|
|
592
|
+
style: { color: "#ef4444" },
|
|
593
|
+
type: "button",
|
|
594
|
+
onMouseDown: (e) => {
|
|
595
|
+
e.preventDefault();
|
|
596
|
+
handleRubyDelete();
|
|
597
|
+
},
|
|
598
|
+
children: /* @__PURE__ */ jsx(Trash2, { size: 14, strokeWidth: ICON_STROKE })
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
] }),
|
|
602
|
+
/* @__PURE__ */ jsx("span", { className: rubyHint, children: "Enter 保存 / Esc 取消" })
|
|
603
|
+
]
|
|
604
|
+
}
|
|
605
|
+
),
|
|
606
|
+
portalContainer
|
|
607
|
+
)
|
|
608
|
+
] });
|
|
570
609
|
}
|
|
571
|
-
|
|
572
|
-
|
|
610
|
+
export {
|
|
611
|
+
FloatingToolbarPlugin
|
|
612
|
+
};
|
|
@@ -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}._11h7prk0{--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}._11h7prk1{--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}._11h7prk2{--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 ._11h7prk0,[data-theme=dark] ._11h7prk0,.dark._11h7prk0,[data-theme=dark]._11h7prk0,.dark ._11h7prk1,[data-theme=dark] ._11h7prk1,.dark._11h7prk1,[data-theme=dark]._11h7prk1,.dark ._11h7prk2,[data-theme=dark] ._11h7prk2,.dark._11h7prk2,[data-theme=dark]._11h7prk2{--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}@keyframes _1m6axz70{0%{opacity:0;transform:translateY(4px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}._1m6axz71{border:1px solid var(--rc-border);background-color:color-mix(in srgb, var(--rc-bg) 95%, transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:var(--rc-shadow-top-bar);border-radius:12px;align-items:center;gap:2px;padding:4px 6px;animation:.15s ease-out _1m6axz70;display:flex}._1m6axz72{width:32px;height:32px;color:var(--rc-text-secondary);cursor:pointer;background:0 0;border:none;border-radius:8px;justify-content:center;align-items:center;padding:0;transition:color .1s,background-color .1s;display:flex;position:relative}._1m6axz72:hover{color:var(--rc-text);background-color:color-mix(in srgb, var(--rc-text) 4%, transparent)}._1m6axz73{color:var(--rc-text);background-color:color-mix(in srgb, var(--rc-text) 6%, transparent)}._1m6axz74{background-color:var(--rc-text);border-radius:1px;width:14px;height:2px;position:absolute;bottom:2px;left:50%;transform:translate(-50%)}._1m6axz75{border:1px solid var(--rc-border);background-color:color-mix(in srgb, var(--rc-bg) 95%, transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:var(--rc-shadow-top-bar);border-radius:12px;flex-direction:column;align-items:center;gap:8px;min-width:240px;padding:12px 16px;animation:.15s ease-out _1m6axz70;display:flex}._1m6axz76{flex-direction:column;align-items:center;gap:2px;padding:4px 16px 8px;display:flex}._1m6axz77{color:var(--rc-text-secondary);font-size:12px;line-height:1.2}._1m6axz78{font-size:20px;font-weight:600;line-height:1.3}._1m6axz79{align-items:center;gap:6px;width:100%;display:flex}._1m6axz7a{border:1.5px solid var(--rc-border);color:var(--rc-text);background-color:#0000;border-radius:8px;outline:none;flex:1;padding:6px 10px;font-size:14px;line-height:1.4}._1m6axz7a:focus{border-color:var(--rc-text)}._1m6axz7b{width:28px;height:28px;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 .1s,background-color .1s;display:flex}._1m6axz7b:hover{background-color:color-mix(in srgb, var(--rc-text) 6%, transparent)}._1m6axz7c{color:var(--rc-text-secondary);opacity:.7;font-size:11px}._1m6axz7d{background-color:var(--rc-border);flex-shrink:0;width:1px;height:20px;margin-inline-start:2px;margin-inline-end:2px}
|
|
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}._11h7prk0{--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}._11h7prk1{--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}._11h7prk2{--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 ._11h7prk0,[data-theme=dark] ._11h7prk0,.dark._11h7prk0,[data-theme=dark]._11h7prk0,.dark ._11h7prk1,[data-theme=dark] ._11h7prk1,.dark._11h7prk1,[data-theme=dark]._11h7prk1,.dark ._11h7prk2,[data-theme=dark] ._11h7prk2,.dark._11h7prk2,[data-theme=dark]._11h7prk2{--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)}@keyframes _1m6axz70{0%{opacity:0;transform:translateY(4px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}._1m6axz71{display:flex;align-items:center;gap:2px;padding:4px 6px;border-radius:12px;border:1px solid var(--rc-border);background-color:color-mix(in srgb,var(--rc-bg) 95%,transparent);backdrop-filter:blur(8px);box-shadow:var(--rc-shadow-top-bar);animation:_1m6axz70 .15s ease-out}._1m6axz72{position:relative;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:none;border-radius:8px;color:var(--rc-text-secondary);cursor:pointer;padding:0;transition:color .1s,background-color .1s}._1m6axz72:hover{color:var(--rc-text);background-color:color-mix(in srgb,var(--rc-text) 4%,transparent)}._1m6axz73{color:var(--rc-text);background-color:color-mix(in srgb,var(--rc-text) 6%,transparent)}._1m6axz74{position:absolute;bottom:2px;left:50%;transform:translate(-50%);height:2px;width:14px;border-radius:1px;background-color:var(--rc-text)}._1m6axz75{display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 16px;border-radius:12px;border:1px solid var(--rc-border);background-color:color-mix(in srgb,var(--rc-bg) 95%,transparent);backdrop-filter:blur(8px);box-shadow:var(--rc-shadow-top-bar);animation:_1m6axz70 .15s ease-out;min-width:240px}._1m6axz76{display:flex;flex-direction:column;align-items:center;gap:2px;padding:4px 16px 8px}._1m6axz77{font-size:12px;color:var(--rc-text-secondary);line-height:1.2}._1m6axz78{font-size:20px;font-weight:600;line-height:1.3}._1m6axz79{display:flex;align-items:center;gap:6px;width:100%}._1m6axz7a{flex:1;padding:6px 10px;border-radius:8px;border:1.5px solid var(--rc-border);background-color:transparent;color:var(--rc-text);font-size:14px;outline:none;line-height:1.4}._1m6axz7a:focus{border-color:var(--rc-text)}._1m6axz7b{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:none;background:none;border-radius:6px;color:var(--rc-text-secondary);cursor:pointer;padding:0;transition:color .1s,background-color .1s}._1m6axz7b:hover{background-color:color-mix(in srgb,var(--rc-text) 6%,transparent)}._1m6axz7c{font-size:11px;color:var(--rc-text-secondary);opacity:.7}._1m6axz7d{width:1px;height:20px;background-color:var(--rc-border);margin-inline:2px;flex-shrink:0}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-plugin-floating-toolbar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.83",
|
|
4
4
|
"description": "Floating toolbar plugin",
|
|
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-style-token": "0.0.
|
|
26
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
24
|
+
"@haklex/rich-editor": "0.0.83",
|
|
25
|
+
"@haklex/rich-style-token": "0.0.83",
|
|
26
|
+
"@haklex/rich-editor-ui": "0.0.83"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@lexical/link": "^0.41.0",
|