@haklex/rich-plugin-floating-toolbar 0.0.42 → 0.0.44
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAsKzC,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,IAAI,CAkgB3D"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { $createRubyNode, $isRubyNode } from "@haklex/rich-editor";
|
|
2
3
|
import { ColorPicker } from "@haklex/rich-editor-ui";
|
|
3
4
|
import { usePortalTheme, vars } from "@haklex/rich-style-token";
|
|
4
5
|
import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
5
6
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
6
7
|
import { $patchStyleText, $getSelectionStyleValueForProperty } from "@lexical/selection";
|
|
7
|
-
import { $getSelection, $isRangeSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND } from "lexical";
|
|
8
|
-
import { Bold, Italic, Underline, Strikethrough, Superscript, Subscript, Code, Highlighter, Link } from "lucide-react";
|
|
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";
|
|
9
10
|
import { useRef, useState, useCallback, useEffect } from "react";
|
|
10
11
|
import { createPortal } from "react-dom";
|
|
11
12
|
var toolbar = "_1m6axz71";
|
|
12
13
|
var btn = "_1m6axz72";
|
|
13
14
|
var btnActive = "_1m6axz73";
|
|
14
15
|
var btnIndicator = "_1m6axz74";
|
|
15
|
-
var
|
|
16
|
+
var rubyEditor = "_1m6axz75";
|
|
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";
|
|
16
25
|
const INITIAL_STATE = {
|
|
17
26
|
isBold: false,
|
|
18
27
|
isItalic: false,
|
|
@@ -23,14 +32,36 @@ const INITIAL_STATE = {
|
|
|
23
32
|
isCode: false,
|
|
24
33
|
isHighlight: false,
|
|
25
34
|
isLink: false,
|
|
35
|
+
isRuby: false,
|
|
26
36
|
fontColor: ""
|
|
27
37
|
};
|
|
38
|
+
function findRubyAncestor(node) {
|
|
39
|
+
let current = node;
|
|
40
|
+
while (current) {
|
|
41
|
+
if ($isRubyNode(current)) {
|
|
42
|
+
return current;
|
|
43
|
+
}
|
|
44
|
+
current = current.getParent();
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function getSelectedRubyNodes(nodes) {
|
|
49
|
+
const rubyNodes = /* @__PURE__ */ new Map();
|
|
50
|
+
for (const node of nodes) {
|
|
51
|
+
const rubyNode = findRubyAncestor(node);
|
|
52
|
+
if (rubyNode) {
|
|
53
|
+
rubyNodes.set(rubyNode.getKey(), rubyNode);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return Array.from(rubyNodes.values());
|
|
57
|
+
}
|
|
28
58
|
function getSelectionState(selection) {
|
|
29
59
|
const nodes = selection.getNodes();
|
|
30
60
|
const hasLink = nodes.some((node) => {
|
|
31
61
|
const parent = node.getParent();
|
|
32
62
|
return $isLinkNode(parent) || $isLinkNode(node);
|
|
33
63
|
});
|
|
64
|
+
const hasRuby = getSelectedRubyNodes(nodes).length > 0;
|
|
34
65
|
return {
|
|
35
66
|
isBold: selection.hasFormat("bold"),
|
|
36
67
|
isItalic: selection.hasFormat("italic"),
|
|
@@ -41,6 +72,7 @@ function getSelectionState(selection) {
|
|
|
41
72
|
isCode: selection.hasFormat("code"),
|
|
42
73
|
isHighlight: selection.hasFormat("highlight"),
|
|
43
74
|
isLink: hasLink,
|
|
75
|
+
isRuby: hasRuby,
|
|
44
76
|
fontColor: $getSelectionStyleValueForProperty(selection, "color", "")
|
|
45
77
|
};
|
|
46
78
|
}
|
|
@@ -110,6 +142,11 @@ function FloatingToolbarPlugin() {
|
|
|
110
142
|
const toolbarRef = useRef(null);
|
|
111
143
|
const [visible, setVisible] = useState(false);
|
|
112
144
|
const [state, setState] = useState(INITIAL_STATE);
|
|
145
|
+
const [rubyEdit, setRubyEdit] = useState(null);
|
|
146
|
+
const rubyEditorRef = useRef(null);
|
|
147
|
+
const rubyInputRef = useRef(null);
|
|
148
|
+
const rubyEditRef = useRef(rubyEdit);
|
|
149
|
+
rubyEditRef.current = rubyEdit;
|
|
113
150
|
const updateToolbar = useCallback(() => {
|
|
114
151
|
const selection = $getSelection();
|
|
115
152
|
if (!$isRangeSelection(selection) || selection.isCollapsed()) {
|
|
@@ -225,113 +262,346 @@ function FloatingToolbarPlugin() {
|
|
|
225
262
|
},
|
|
226
263
|
[editor]
|
|
227
264
|
);
|
|
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
|
-
onClick: handleLink,
|
|
318
|
-
ariaLabel: "Link",
|
|
319
|
-
children: /* @__PURE__ */ jsx(Link, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
265
|
+
const handleRuby = useCallback(() => {
|
|
266
|
+
editor.update(() => {
|
|
267
|
+
const selection = $getSelection();
|
|
268
|
+
if (!$isRangeSelection(selection)) return;
|
|
269
|
+
const nodes = selection.getNodes();
|
|
270
|
+
const rubyNodes = getSelectedRubyNodes(nodes);
|
|
271
|
+
if (rubyNodes.length > 0) {
|
|
272
|
+
const rubyNode = rubyNodes[0];
|
|
273
|
+
if (!rubyNode) return;
|
|
274
|
+
setRubyEdit({
|
|
275
|
+
nodeKey: rubyNode.getKey(),
|
|
276
|
+
reading: rubyNode.getReading(),
|
|
277
|
+
baseText: rubyNode.getTextContent(),
|
|
278
|
+
isNew: false
|
|
279
|
+
});
|
|
280
|
+
} else {
|
|
281
|
+
const text = selection.getTextContent();
|
|
282
|
+
if (!text.trim()) return;
|
|
283
|
+
selection.removeText();
|
|
284
|
+
const rubyNode = $createRubyNode("");
|
|
285
|
+
rubyNode.append($createTextNode(text));
|
|
286
|
+
const freshSelection = $getSelection();
|
|
287
|
+
if ($isRangeSelection(freshSelection)) {
|
|
288
|
+
freshSelection.insertNodes([rubyNode]);
|
|
289
|
+
}
|
|
290
|
+
setRubyEdit({
|
|
291
|
+
nodeKey: rubyNode.getKey(),
|
|
292
|
+
reading: "",
|
|
293
|
+
baseText: text,
|
|
294
|
+
isNew: true
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}, [editor]);
|
|
299
|
+
const handleRubyConfirm = useCallback(() => {
|
|
300
|
+
const edit = rubyEditRef.current;
|
|
301
|
+
if (!edit) return;
|
|
302
|
+
editor.update(() => {
|
|
303
|
+
const node = $getNodeByKey(edit.nodeKey);
|
|
304
|
+
if ($isRubyNode(node)) {
|
|
305
|
+
node.setReading(edit.reading);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
setRubyEdit(null);
|
|
309
|
+
}, [editor]);
|
|
310
|
+
const handleRubyCancel = useCallback(() => {
|
|
311
|
+
const edit = rubyEditRef.current;
|
|
312
|
+
if (!edit) return;
|
|
313
|
+
if (edit.isNew) {
|
|
314
|
+
editor.update(() => {
|
|
315
|
+
const node = $getNodeByKey(edit.nodeKey);
|
|
316
|
+
if ($isRubyNode(node)) {
|
|
317
|
+
const children = node.getChildren();
|
|
318
|
+
for (const child of children) {
|
|
319
|
+
node.insertBefore(child);
|
|
320
|
+
}
|
|
321
|
+
node.remove();
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
setRubyEdit(null);
|
|
326
|
+
}, [editor]);
|
|
327
|
+
const handleRubyDelete = useCallback(() => {
|
|
328
|
+
const edit = rubyEditRef.current;
|
|
329
|
+
if (!edit) return;
|
|
330
|
+
editor.update(() => {
|
|
331
|
+
const node = $getNodeByKey(edit.nodeKey);
|
|
332
|
+
if ($isRubyNode(node)) {
|
|
333
|
+
const children = node.getChildren();
|
|
334
|
+
for (const child of children) {
|
|
335
|
+
node.insertBefore(child);
|
|
336
|
+
}
|
|
337
|
+
node.remove();
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
setRubyEdit(null);
|
|
341
|
+
}, [editor]);
|
|
342
|
+
const isRubyEditing = rubyEdit !== null;
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
if (!isRubyEditing) return;
|
|
345
|
+
const handleClickOutside = (e) => {
|
|
346
|
+
const currentEdit = rubyEditRef.current;
|
|
347
|
+
if (!currentEdit) return;
|
|
348
|
+
if (rubyEditorRef.current && !rubyEditorRef.current.contains(e.target)) {
|
|
349
|
+
if (currentEdit.reading.trim()) {
|
|
350
|
+
editor.update(() => {
|
|
351
|
+
const node = $getNodeByKey(currentEdit.nodeKey);
|
|
352
|
+
if ($isRubyNode(node)) {
|
|
353
|
+
node.setReading(currentEdit.reading);
|
|
320
354
|
}
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
{
|
|
326
|
-
|
|
327
|
-
|
|
355
|
+
});
|
|
356
|
+
} else if (currentEdit.isNew) {
|
|
357
|
+
editor.update(() => {
|
|
358
|
+
const node = $getNodeByKey(currentEdit.nodeKey);
|
|
359
|
+
if ($isRubyNode(node)) {
|
|
360
|
+
const children = node.getChildren();
|
|
361
|
+
for (const child of children) {
|
|
362
|
+
node.insertBefore(child);
|
|
363
|
+
}
|
|
364
|
+
node.remove();
|
|
328
365
|
}
|
|
329
|
-
)
|
|
330
|
-
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
setRubyEdit(null);
|
|
331
369
|
}
|
|
370
|
+
};
|
|
371
|
+
const timer = setTimeout(() => {
|
|
372
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
373
|
+
}, 0);
|
|
374
|
+
return () => {
|
|
375
|
+
clearTimeout(timer);
|
|
376
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
377
|
+
};
|
|
378
|
+
}, [editor, isRubyEditing]);
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
if (!rubyEdit || !rubyEditorRef.current) return;
|
|
381
|
+
const positionEditor = () => {
|
|
382
|
+
const editorEl = rubyEditorRef.current;
|
|
383
|
+
if (!editorEl) return;
|
|
384
|
+
applyThemeVars(editorEl);
|
|
385
|
+
const rubyDom = editor.getElementByKey(rubyEdit.nodeKey);
|
|
386
|
+
if (!rubyDom) return;
|
|
387
|
+
const rect = rubyDom.getBoundingClientRect();
|
|
388
|
+
const editorWidth = editorEl.offsetWidth;
|
|
389
|
+
const rawLeft = rect.left + rect.width / 2 - editorWidth / 2;
|
|
390
|
+
const clampedLeft = Math.max(
|
|
391
|
+
8,
|
|
392
|
+
Math.min(rawLeft, window.innerWidth - editorWidth - 8)
|
|
393
|
+
);
|
|
394
|
+
editorEl.style.top = `${rect.bottom + 8}px`;
|
|
395
|
+
editorEl.style.left = `${clampedLeft}px`;
|
|
396
|
+
};
|
|
397
|
+
requestAnimationFrame(positionEditor);
|
|
398
|
+
requestAnimationFrame(() => {
|
|
399
|
+
rubyInputRef.current?.focus();
|
|
400
|
+
});
|
|
401
|
+
}, [applyThemeVars, editor, rubyEdit]);
|
|
402
|
+
if (!visible && !rubyEdit) return null;
|
|
403
|
+
const toolbarClassName = portalClassName ? `${toolbar} ${portalClassName}` : toolbar;
|
|
404
|
+
const rubyEditorClassName = portalClassName ? `${rubyEditor} ${portalClassName}` : rubyEditor;
|
|
405
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
406
|
+
visible && !rubyEdit && createPortal(
|
|
407
|
+
/* @__PURE__ */ jsxs(
|
|
408
|
+
"div",
|
|
409
|
+
{
|
|
410
|
+
ref: toolbarRef,
|
|
411
|
+
className: toolbarClassName,
|
|
412
|
+
role: "toolbar",
|
|
413
|
+
"aria-label": "Text formatting",
|
|
414
|
+
style: { position: "fixed", zIndex: 50 },
|
|
415
|
+
children: [
|
|
416
|
+
/* @__PURE__ */ jsx(
|
|
417
|
+
ToolbarButton,
|
|
418
|
+
{
|
|
419
|
+
active: state.isBold,
|
|
420
|
+
onClick: () => handleFormat("bold"),
|
|
421
|
+
ariaLabel: "Bold",
|
|
422
|
+
children: /* @__PURE__ */ jsx(Bold, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
423
|
+
}
|
|
424
|
+
),
|
|
425
|
+
/* @__PURE__ */ jsx(
|
|
426
|
+
ToolbarButton,
|
|
427
|
+
{
|
|
428
|
+
active: state.isItalic,
|
|
429
|
+
onClick: () => handleFormat("italic"),
|
|
430
|
+
ariaLabel: "Italic",
|
|
431
|
+
children: /* @__PURE__ */ jsx(Italic, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
432
|
+
}
|
|
433
|
+
),
|
|
434
|
+
/* @__PURE__ */ jsx(
|
|
435
|
+
ToolbarButton,
|
|
436
|
+
{
|
|
437
|
+
active: state.isUnderline,
|
|
438
|
+
onClick: () => handleFormat("underline"),
|
|
439
|
+
ariaLabel: "Underline",
|
|
440
|
+
children: /* @__PURE__ */ jsx(Underline, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
441
|
+
}
|
|
442
|
+
),
|
|
443
|
+
/* @__PURE__ */ jsx(
|
|
444
|
+
ToolbarButton,
|
|
445
|
+
{
|
|
446
|
+
active: state.isStrikethrough,
|
|
447
|
+
onClick: () => handleFormat("strikethrough"),
|
|
448
|
+
ariaLabel: "Strikethrough",
|
|
449
|
+
children: /* @__PURE__ */ jsx(Strikethrough, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
450
|
+
}
|
|
451
|
+
),
|
|
452
|
+
/* @__PURE__ */ jsx(
|
|
453
|
+
ToolbarButton,
|
|
454
|
+
{
|
|
455
|
+
active: state.isSuperscript,
|
|
456
|
+
onClick: () => handleFormat("superscript"),
|
|
457
|
+
ariaLabel: "Superscript",
|
|
458
|
+
children: /* @__PURE__ */ jsx(Superscript, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
/* @__PURE__ */ jsx(
|
|
462
|
+
ToolbarButton,
|
|
463
|
+
{
|
|
464
|
+
active: state.isSubscript,
|
|
465
|
+
onClick: () => handleFormat("subscript"),
|
|
466
|
+
ariaLabel: "Subscript",
|
|
467
|
+
children: /* @__PURE__ */ jsx(Subscript, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
468
|
+
}
|
|
469
|
+
),
|
|
470
|
+
/* @__PURE__ */ jsx("span", { className: separator }),
|
|
471
|
+
/* @__PURE__ */ jsx(
|
|
472
|
+
ToolbarButton,
|
|
473
|
+
{
|
|
474
|
+
active: state.isCode,
|
|
475
|
+
onClick: () => handleFormat("code"),
|
|
476
|
+
ariaLabel: "Code",
|
|
477
|
+
children: /* @__PURE__ */ jsx(Code, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
478
|
+
}
|
|
479
|
+
),
|
|
480
|
+
/* @__PURE__ */ jsx(
|
|
481
|
+
ToolbarButton,
|
|
482
|
+
{
|
|
483
|
+
active: state.isHighlight,
|
|
484
|
+
onClick: () => handleFormat("highlight"),
|
|
485
|
+
ariaLabel: "Highlight",
|
|
486
|
+
children: /* @__PURE__ */ jsx(Highlighter, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ jsx(
|
|
490
|
+
ToolbarButton,
|
|
491
|
+
{
|
|
492
|
+
active: state.isLink,
|
|
493
|
+
onClick: handleLink,
|
|
494
|
+
ariaLabel: "Link",
|
|
495
|
+
children: /* @__PURE__ */ jsx(Link, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
496
|
+
}
|
|
497
|
+
),
|
|
498
|
+
/* @__PURE__ */ jsx(
|
|
499
|
+
ToolbarButton,
|
|
500
|
+
{
|
|
501
|
+
active: state.isRuby,
|
|
502
|
+
onClick: handleRuby,
|
|
503
|
+
ariaLabel: "Ruby annotation",
|
|
504
|
+
children: /* @__PURE__ */ jsx(Languages, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
505
|
+
}
|
|
506
|
+
),
|
|
507
|
+
/* @__PURE__ */ jsx("span", { className: separator }),
|
|
508
|
+
/* @__PURE__ */ jsx(
|
|
509
|
+
ColorPicker,
|
|
510
|
+
{
|
|
511
|
+
currentColor: state.fontColor || "inherit",
|
|
512
|
+
onSelect: handleColor
|
|
513
|
+
}
|
|
514
|
+
)
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
),
|
|
518
|
+
document.body
|
|
332
519
|
),
|
|
333
|
-
|
|
334
|
-
|
|
520
|
+
rubyEdit && createPortal(
|
|
521
|
+
/* @__PURE__ */ jsxs(
|
|
522
|
+
"div",
|
|
523
|
+
{
|
|
524
|
+
ref: rubyEditorRef,
|
|
525
|
+
className: rubyEditorClassName,
|
|
526
|
+
style: { position: "fixed", zIndex: 51 },
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsxs("div", { className: rubyPreview, children: [
|
|
529
|
+
/* @__PURE__ */ jsx("span", { className: rubyPreviewReading, children: rubyEdit.reading || " " }),
|
|
530
|
+
/* @__PURE__ */ jsx("span", { className: rubyPreviewBase, children: rubyEdit.baseText })
|
|
531
|
+
] }),
|
|
532
|
+
/* @__PURE__ */ jsxs("div", { className: rubyInputRow, children: [
|
|
533
|
+
/* @__PURE__ */ jsx(
|
|
534
|
+
"input",
|
|
535
|
+
{
|
|
536
|
+
ref: rubyInputRef,
|
|
537
|
+
className: rubyInput,
|
|
538
|
+
value: rubyEdit.reading,
|
|
539
|
+
onChange: (e) => setRubyEdit(
|
|
540
|
+
(prev) => prev ? { ...prev, reading: e.target.value } : null
|
|
541
|
+
),
|
|
542
|
+
onKeyDown: (e) => {
|
|
543
|
+
if (e.key === "Enter") {
|
|
544
|
+
e.preventDefault();
|
|
545
|
+
handleRubyConfirm();
|
|
546
|
+
}
|
|
547
|
+
if (e.key === "Escape") {
|
|
548
|
+
e.preventDefault();
|
|
549
|
+
handleRubyCancel();
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
placeholder: "读音"
|
|
553
|
+
}
|
|
554
|
+
),
|
|
555
|
+
/* @__PURE__ */ jsx(
|
|
556
|
+
"button",
|
|
557
|
+
{
|
|
558
|
+
type: "button",
|
|
559
|
+
className: rubyActionBtn,
|
|
560
|
+
onMouseDown: (e) => {
|
|
561
|
+
e.preventDefault();
|
|
562
|
+
handleRubyConfirm();
|
|
563
|
+
},
|
|
564
|
+
style: { color: "#22c55e" },
|
|
565
|
+
"aria-label": "Confirm",
|
|
566
|
+
children: /* @__PURE__ */ jsx(Check, { size: 14, strokeWidth: ICON_STROKE })
|
|
567
|
+
}
|
|
568
|
+
),
|
|
569
|
+
/* @__PURE__ */ jsx(
|
|
570
|
+
"button",
|
|
571
|
+
{
|
|
572
|
+
type: "button",
|
|
573
|
+
className: rubyActionBtn,
|
|
574
|
+
onMouseDown: (e) => {
|
|
575
|
+
e.preventDefault();
|
|
576
|
+
handleRubyCancel();
|
|
577
|
+
},
|
|
578
|
+
"aria-label": "Cancel",
|
|
579
|
+
children: /* @__PURE__ */ jsx(X, { size: 14, strokeWidth: ICON_STROKE })
|
|
580
|
+
}
|
|
581
|
+
),
|
|
582
|
+
/* @__PURE__ */ jsx("span", { className: separator }),
|
|
583
|
+
/* @__PURE__ */ jsx(
|
|
584
|
+
"button",
|
|
585
|
+
{
|
|
586
|
+
type: "button",
|
|
587
|
+
className: rubyActionBtn,
|
|
588
|
+
onMouseDown: (e) => {
|
|
589
|
+
e.preventDefault();
|
|
590
|
+
handleRubyDelete();
|
|
591
|
+
},
|
|
592
|
+
style: { color: "#ef4444" },
|
|
593
|
+
"aria-label": "Delete ruby",
|
|
594
|
+
children: /* @__PURE__ */ jsx(Trash2, { size: 14, strokeWidth: ICON_STROKE })
|
|
595
|
+
}
|
|
596
|
+
)
|
|
597
|
+
] }),
|
|
598
|
+
/* @__PURE__ */ jsx("span", { className: rubyHint, children: "Enter 保存 / Esc 取消" })
|
|
599
|
+
]
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
document.body
|
|
603
|
+
)
|
|
604
|
+
] });
|
|
335
605
|
}
|
|
336
606
|
export {
|
|
337
607
|
FloatingToolbarPlugin
|
|
@@ -1 +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-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-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-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-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-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: 8px}.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-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{width:1px;height:20px;background-color:var(--rc-border);margin-inline:2px;flex-shrink:0}
|
|
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-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-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-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-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-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: 8px}.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-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/dist/styles.css.d.ts
CHANGED
|
@@ -2,5 +2,13 @@ export declare const toolbar: string;
|
|
|
2
2
|
export declare const btn: string;
|
|
3
3
|
export declare const btnActive: string;
|
|
4
4
|
export declare const btnIndicator: string;
|
|
5
|
+
export declare const rubyEditor: string;
|
|
6
|
+
export declare const rubyPreview: string;
|
|
7
|
+
export declare const rubyPreviewReading: string;
|
|
8
|
+
export declare const rubyPreviewBase: string;
|
|
9
|
+
export declare const rubyInputRow: string;
|
|
10
|
+
export declare const rubyInput: string;
|
|
11
|
+
export declare const rubyActionBtn: string;
|
|
12
|
+
export declare const rubyHint: string;
|
|
5
13
|
export declare const separator: string;
|
|
6
14
|
//# sourceMappingURL=styles.css.d.ts.map
|
package/dist/styles.css.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,OAAO,QAWlB,CAAA;AAEF,eAAO,MAAM,GAAG,QAkBd,CAAA;AAEF,eAAO,MAAM,SAAS,QAGpB,CAAA;AAEF,eAAO,MAAM,YAAY,QASvB,CAAA;AAEF,eAAO,MAAM,SAAS,QAMpB,CAAA"}
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,OAAO,QAWlB,CAAA;AAEF,eAAO,MAAM,GAAG,QAkBd,CAAA;AAEF,eAAO,MAAM,SAAS,QAGpB,CAAA;AAEF,eAAO,MAAM,YAAY,QASvB,CAAA;AAEF,eAAO,MAAM,UAAU,QAarB,CAAA;AAEF,eAAO,MAAM,WAAW,QAMtB,CAAA;AAEF,eAAO,MAAM,kBAAkB,QAI7B,CAAA;AAEF,eAAO,MAAM,eAAe,QAI1B,CAAA;AAEF,eAAO,MAAM,YAAY,QAKvB,CAAA;AAEF,eAAO,MAAM,SAAS,QAepB,CAAA;AAEF,eAAO,MAAM,aAAa,QAgBxB,CAAA;AAEF,eAAO,MAAM,QAAQ,QAInB,CAAA;AAEF,eAAO,MAAM,SAAS,QAMpB,CAAA"}
|
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.44",
|
|
4
4
|
"description": "Floating toolbar plugin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@haklex/rich-editor
|
|
20
|
-
"@haklex/rich-
|
|
19
|
+
"@haklex/rich-editor": "0.0.44",
|
|
20
|
+
"@haklex/rich-editor-ui": "0.0.44",
|
|
21
|
+
"@haklex/rich-style-token": "0.0.44"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@lexical/link": "^0.41.0",
|