@rufous/ui 0.2.55 → 0.2.56
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/main.cjs +121 -53
- package/dist/main.css +131 -88
- package/dist/main.d.cts +6 -0
- package/dist/main.d.ts +6 -0
- package/dist/main.js +121 -53
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -9118,7 +9118,7 @@ var TranslateModal = ({ editor, onClose, onTranslate, initialSource, initialTarg
|
|
|
9118
9118
|
},
|
|
9119
9119
|
/* @__PURE__ */ React110.createElement("span", { className: "translate-code" }, lang.code),
|
|
9120
9120
|
/* @__PURE__ */ React110.createElement("span", { className: "translate-name" }, lang.name)
|
|
9121
|
-
))))), error && /* @__PURE__ */ React110.createElement("div", { className: "translate-error" }, error)), /* @__PURE__ */ React110.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React110.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React110.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "
|
|
9121
|
+
))))), error && /* @__PURE__ */ React110.createElement("div", { className: "translate-error" }, error)), /* @__PURE__ */ React110.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React110.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React110.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "Cancel")), /* @__PURE__ */ React110.createElement("button", { className: "modal-btn-apply", onClick: handleSave, disabled: translating }, translating ? "Translating..." : "Save"))));
|
|
9122
9122
|
};
|
|
9123
9123
|
var TranslateModal_default = TranslateModal;
|
|
9124
9124
|
|
|
@@ -9737,7 +9737,8 @@ var CustomTaskItem = TaskItem.extend({
|
|
|
9737
9737
|
"border: 2px solid " + colors.border,
|
|
9738
9738
|
`background-image: url("${imageUrl}")`,
|
|
9739
9739
|
"background-repeat: no-repeat",
|
|
9740
|
-
"background-position: center"
|
|
9740
|
+
"background-position: center",
|
|
9741
|
+
"box-sizing: unset !important"
|
|
9741
9742
|
].join("; ");
|
|
9742
9743
|
li.setAttribute("data-status", status);
|
|
9743
9744
|
};
|
|
@@ -9968,12 +9969,24 @@ var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
|
|
|
9968
9969
|
const menu = menuRef.current;
|
|
9969
9970
|
menu.style.left = "0";
|
|
9970
9971
|
menu.style.right = "auto";
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9972
|
+
requestAnimationFrame(() => {
|
|
9973
|
+
if (!menu) return;
|
|
9974
|
+
const rect = menu.getBoundingClientRect();
|
|
9975
|
+
const vw = window.innerWidth;
|
|
9976
|
+
const parentLeft = ref.current?.getBoundingClientRect().left || 0;
|
|
9977
|
+
if (rect.right > vw - 8) {
|
|
9978
|
+
menu.style.left = "auto";
|
|
9979
|
+
menu.style.right = "0";
|
|
9980
|
+
const newRect = menu.getBoundingClientRect();
|
|
9981
|
+
if (newRect.left < 8) {
|
|
9982
|
+
menu.style.left = `${8 - parentLeft}px`;
|
|
9983
|
+
menu.style.right = "auto";
|
|
9984
|
+
}
|
|
9985
|
+
} else if (rect.left < 8) {
|
|
9986
|
+
menu.style.left = `${8 - parentLeft}px`;
|
|
9987
|
+
menu.style.right = "auto";
|
|
9988
|
+
}
|
|
9989
|
+
});
|
|
9977
9990
|
}, [open]);
|
|
9978
9991
|
return /* @__PURE__ */ React112.createElement("div", { className: `dropdown ${className}`, ref }, /* @__PURE__ */ React112.createElement(
|
|
9979
9992
|
"button",
|
|
@@ -10238,10 +10251,11 @@ var ColorPickerPanel = ({ editor, onClose }) => {
|
|
|
10238
10251
|
}
|
|
10239
10252
|
))), /* @__PURE__ */ React112.createElement("div", { className: "color-picker-footer" }, /* @__PURE__ */ React112.createElement("div", { className: "color-picker-preview", style: { background: activeColor || "#000" } }), /* @__PURE__ */ React112.createElement("button", { className: "color-picker-remove", onClick: removeColor, title: "Remove color" }, "\u2713")));
|
|
10240
10253
|
};
|
|
10241
|
-
var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTextToSpeech, onClose, onImageUpload }) => {
|
|
10254
|
+
var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTextToSpeech, onClose, onImageUpload, visibleButtons }) => {
|
|
10242
10255
|
const [, setEditorState] = useState30(0);
|
|
10243
10256
|
const [isFullscreen, setIsFullscreen] = useState30(false);
|
|
10244
10257
|
const [todoEnabled, setTodoEnabled] = useState30(false);
|
|
10258
|
+
const show = (id) => !visibleButtons || visibleButtons.has(id);
|
|
10245
10259
|
useEffect23(() => {
|
|
10246
10260
|
if (!editor) return;
|
|
10247
10261
|
const onTransaction = () => setEditorState((n) => n + 1);
|
|
@@ -10325,7 +10339,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10325
10339
|
setTimeout(() => setTranslateStatus(""), 2e3);
|
|
10326
10340
|
}, [editor, translateSource, translateTarget, onTranslate]);
|
|
10327
10341
|
if (!editor) return null;
|
|
10328
|
-
return /* @__PURE__ */ React112.createElement("div", { className: "toolbar" }, /* @__PURE__ */ React112.createElement("div", { className: `toolbar-row ${onClose ? "with-close" : ""}` }, /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(
|
|
10342
|
+
return /* @__PURE__ */ React112.createElement("div", { className: "toolbar" }, /* @__PURE__ */ React112.createElement("div", { className: `toolbar-row ${onClose ? "with-close" : ""}` }, (show("undo") || show("redo")) && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("undo") && /* @__PURE__ */ React112.createElement(
|
|
10329
10343
|
"button",
|
|
10330
10344
|
{
|
|
10331
10345
|
className: "toolbar-btn",
|
|
@@ -10334,7 +10348,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10334
10348
|
title: "Undo (Ctrl+Z)"
|
|
10335
10349
|
},
|
|
10336
10350
|
/* @__PURE__ */ React112.createElement(IconUndo, null)
|
|
10337
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10351
|
+
), show("redo") && /* @__PURE__ */ React112.createElement(
|
|
10338
10352
|
"button",
|
|
10339
10353
|
{
|
|
10340
10354
|
className: "toolbar-btn",
|
|
@@ -10343,7 +10357,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10343
10357
|
title: "Redo (Ctrl+Y)"
|
|
10344
10358
|
},
|
|
10345
10359
|
/* @__PURE__ */ React112.createElement(IconRedo, null)
|
|
10346
|
-
)), /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(AICommands_default, { editor, onAICommand })), /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(
|
|
10360
|
+
)), show("ai") && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(AICommands_default, { editor, onAICommand })), /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("paragraph") && /* @__PURE__ */ React112.createElement(
|
|
10347
10361
|
Dropdown,
|
|
10348
10362
|
{
|
|
10349
10363
|
trigger: {
|
|
@@ -10410,7 +10424,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10410
10424
|
" Code Block"
|
|
10411
10425
|
),
|
|
10412
10426
|
/* @__PURE__ */ React112.createElement("button", { className: "dropdown-item", onClick: () => editor.chain().focus().setHorizontalRule().run() }, "\u2014 Horizontal Rule")
|
|
10413
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10427
|
+
), show("fontsize") && /* @__PURE__ */ React112.createElement(
|
|
10414
10428
|
Dropdown,
|
|
10415
10429
|
{
|
|
10416
10430
|
trigger: {
|
|
@@ -10437,7 +10451,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10437
10451
|
sizeStr
|
|
10438
10452
|
);
|
|
10439
10453
|
})
|
|
10440
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10454
|
+
), show("font") && /* @__PURE__ */ React112.createElement(
|
|
10441
10455
|
Dropdown,
|
|
10442
10456
|
{
|
|
10443
10457
|
trigger: {
|
|
@@ -10464,7 +10478,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10464
10478
|
font
|
|
10465
10479
|
);
|
|
10466
10480
|
})
|
|
10467
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10481
|
+
), show("color") && /* @__PURE__ */ React112.createElement(
|
|
10468
10482
|
Dropdown,
|
|
10469
10483
|
{
|
|
10470
10484
|
trigger: {
|
|
@@ -10474,7 +10488,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10474
10488
|
keepOpen: true
|
|
10475
10489
|
},
|
|
10476
10490
|
(close) => /* @__PURE__ */ React112.createElement(ColorPickerPanel, { editor, onClose: close })
|
|
10477
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10491
|
+
), show("bold") && /* @__PURE__ */ React112.createElement(
|
|
10478
10492
|
"button",
|
|
10479
10493
|
{
|
|
10480
10494
|
className: `toolbar-btn ${editor.isActive("bold") ? "is-active" : ""}`,
|
|
@@ -10482,7 +10496,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10482
10496
|
title: "Bold (Ctrl+B)"
|
|
10483
10497
|
},
|
|
10484
10498
|
/* @__PURE__ */ React112.createElement(IconBold, null)
|
|
10485
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10499
|
+
), show("italic") && /* @__PURE__ */ React112.createElement(
|
|
10486
10500
|
"button",
|
|
10487
10501
|
{
|
|
10488
10502
|
className: `toolbar-btn ${editor.isActive("italic") ? "is-active" : ""}`,
|
|
@@ -10490,7 +10504,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10490
10504
|
title: "Italic (Ctrl+I)"
|
|
10491
10505
|
},
|
|
10492
10506
|
/* @__PURE__ */ React112.createElement(IconItalic, null)
|
|
10493
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10507
|
+
), show("strike") && /* @__PURE__ */ React112.createElement(
|
|
10494
10508
|
Dropdown,
|
|
10495
10509
|
{
|
|
10496
10510
|
trigger: { label: /* @__PURE__ */ React112.createElement(IconStrike, null), title: "Text decoration", className: editor.isActive("strike") ? "is-active" : "" }
|
|
@@ -10515,7 +10529,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10515
10529
|
c.run();
|
|
10516
10530
|
}
|
|
10517
10531
|
} }, "\u2715 Clear formatting")
|
|
10518
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10532
|
+
), show("link") && /* @__PURE__ */ React112.createElement(
|
|
10519
10533
|
"button",
|
|
10520
10534
|
{
|
|
10521
10535
|
className: `toolbar-btn ${editor.isActive("link") ? "is-active" : ""}`,
|
|
@@ -10523,7 +10537,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10523
10537
|
title: "Insert Link"
|
|
10524
10538
|
},
|
|
10525
10539
|
/* @__PURE__ */ React112.createElement(IconLink, null)
|
|
10526
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10540
|
+
), show("lineheight") && /* @__PURE__ */ React112.createElement(
|
|
10527
10541
|
Dropdown,
|
|
10528
10542
|
{
|
|
10529
10543
|
trigger: {
|
|
@@ -10550,7 +10564,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10550
10564
|
lh
|
|
10551
10565
|
);
|
|
10552
10566
|
})
|
|
10553
|
-
)), /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(
|
|
10567
|
+
)), (show("ul") || show("ol")) && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("ul") && /* @__PURE__ */ React112.createElement(
|
|
10554
10568
|
Dropdown,
|
|
10555
10569
|
{
|
|
10556
10570
|
trigger: {
|
|
@@ -10593,7 +10607,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10593
10607
|
" ",
|
|
10594
10608
|
item.label
|
|
10595
10609
|
))
|
|
10596
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10610
|
+
), show("ol") && /* @__PURE__ */ React112.createElement(
|
|
10597
10611
|
Dropdown,
|
|
10598
10612
|
{
|
|
10599
10613
|
trigger: {
|
|
@@ -10638,7 +10652,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10638
10652
|
" ",
|
|
10639
10653
|
item.label
|
|
10640
10654
|
))
|
|
10641
|
-
)), /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(
|
|
10655
|
+
)), (show("align") || show("indent") || show("outdent")) && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("align") && /* @__PURE__ */ React112.createElement(
|
|
10642
10656
|
Dropdown,
|
|
10643
10657
|
{
|
|
10644
10658
|
trigger: {
|
|
@@ -10663,7 +10677,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10663
10677
|
" ",
|
|
10664
10678
|
item.label
|
|
10665
10679
|
))
|
|
10666
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10680
|
+
), show("indent") && /* @__PURE__ */ React112.createElement(
|
|
10667
10681
|
"button",
|
|
10668
10682
|
{
|
|
10669
10683
|
className: "toolbar-btn",
|
|
@@ -10684,7 +10698,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10684
10698
|
title: "Increase Indent"
|
|
10685
10699
|
},
|
|
10686
10700
|
/* @__PURE__ */ React112.createElement(IconIndentIncrease, null)
|
|
10687
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10701
|
+
), show("outdent") && /* @__PURE__ */ React112.createElement(
|
|
10688
10702
|
"button",
|
|
10689
10703
|
{
|
|
10690
10704
|
className: "toolbar-btn",
|
|
@@ -10705,7 +10719,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10705
10719
|
title: "Decrease Indent"
|
|
10706
10720
|
},
|
|
10707
10721
|
/* @__PURE__ */ React112.createElement(IconIndentDecrease, null)
|
|
10708
|
-
)), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconTable, null), title: "Insert Table" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(TableGridSelector, { editor, onClose: close })), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconImage, null), title: "Insert Image" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(ImagePanel, { editor, onClose: close, onImageUpload })), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconVideo, null), title: "Insert Video" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(InsertPanel, { editor, onClose: close, mode: "video" })), /* @__PURE__ */ React112.createElement(
|
|
10722
|
+
)), show("table") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconTable, null), title: "Insert Table" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(TableGridSelector, { editor, onClose: close })), show("image") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconImage, null), title: "Insert Image" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(ImagePanel, { editor, onClose: close, onImageUpload })), show("video") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconVideo, null), title: "Insert Video" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(InsertPanel, { editor, onClose: close, mode: "video" })), show("cut") && /* @__PURE__ */ React112.createElement(
|
|
10709
10723
|
"button",
|
|
10710
10724
|
{
|
|
10711
10725
|
className: "toolbar-btn",
|
|
@@ -10713,7 +10727,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10713
10727
|
title: "Cut (Ctrl+X)"
|
|
10714
10728
|
},
|
|
10715
10729
|
/* @__PURE__ */ React112.createElement(IconCut, null)
|
|
10716
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10730
|
+
), show("copy") && /* @__PURE__ */ React112.createElement(
|
|
10717
10731
|
"button",
|
|
10718
10732
|
{
|
|
10719
10733
|
className: "toolbar-btn",
|
|
@@ -10721,7 +10735,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10721
10735
|
title: "Copy selected text"
|
|
10722
10736
|
},
|
|
10723
10737
|
copySuccess ? /* @__PURE__ */ React112.createElement(IconCheck, null) : /* @__PURE__ */ React112.createElement(IconCopy, null)
|
|
10724
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10738
|
+
), show("paste") && /* @__PURE__ */ React112.createElement(
|
|
10725
10739
|
"button",
|
|
10726
10740
|
{
|
|
10727
10741
|
className: "toolbar-btn",
|
|
@@ -10729,7 +10743,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10729
10743
|
title: "Paste (Ctrl+V)"
|
|
10730
10744
|
},
|
|
10731
10745
|
/* @__PURE__ */ React112.createElement(IconPaste, null)
|
|
10732
|
-
), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "\u03A9", title: "Special characters", className: "special-characters-btn" } }, /* @__PURE__ */ React112.createElement("div", { className: "char-grid" }, SPECIAL_CHARS.map((char) => /* @__PURE__ */ React112.createElement(
|
|
10746
|
+
), show("specialchars") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "\u03A9", title: "Special characters", className: "special-characters-btn" } }, /* @__PURE__ */ React112.createElement("div", { className: "char-grid" }, SPECIAL_CHARS.map((char) => /* @__PURE__ */ React112.createElement(
|
|
10733
10747
|
"button",
|
|
10734
10748
|
{
|
|
10735
10749
|
key: char,
|
|
@@ -10737,7 +10751,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10737
10751
|
onClick: () => insertSpecialChar(char)
|
|
10738
10752
|
},
|
|
10739
10753
|
char
|
|
10740
|
-
)))), /* @__PURE__ */ React112.createElement(
|
|
10754
|
+
)))), show("code") && /* @__PURE__ */ React112.createElement(
|
|
10741
10755
|
Dropdown,
|
|
10742
10756
|
{
|
|
10743
10757
|
trigger: { label: /* @__PURE__ */ React112.createElement(IconCode, null), title: "Code", className: editor.isActive("code") || editor.isActive("codeBlock") ? "is-active" : "" }
|
|
@@ -10761,7 +10775,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10761
10775
|
}
|
|
10762
10776
|
} }, "</>", " Inline Code"),
|
|
10763
10777
|
/* @__PURE__ */ React112.createElement("button", { className: "dropdown-item", onClick: () => editor.chain().focus().toggleCodeBlock().run() }, "{ }", " Code Block")
|
|
10764
|
-
), /* @__PURE__ */ React112.createElement(
|
|
10778
|
+
), show("fullscreen") && /* @__PURE__ */ React112.createElement(
|
|
10765
10779
|
"button",
|
|
10766
10780
|
{
|
|
10767
10781
|
className: `toolbar-btn ${isFullscreen ? "is-active" : ""}`,
|
|
@@ -10769,7 +10783,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10769
10783
|
title: "Toggle Fullscreen"
|
|
10770
10784
|
},
|
|
10771
10785
|
/* @__PURE__ */ React112.createElement(IconFullscreen, null)
|
|
10772
|
-
), /* @__PURE__ */ React112.createElement(TextToSpeech_default, { editor, onTextToSpeech }), /* @__PURE__ */ React112.createElement(SpeechToText_default, { editor, onSpeechToText }), /* @__PURE__ */ React112.createElement("div", { className: "translate-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10786
|
+
), show("tts") && /* @__PURE__ */ React112.createElement(TextToSpeech_default, { editor, onTextToSpeech }), show("stt") && /* @__PURE__ */ React112.createElement(SpeechToText_default, { editor, onSpeechToText }), show("translate") && /* @__PURE__ */ React112.createElement("div", { className: "translate-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10773
10787
|
"button",
|
|
10774
10788
|
{
|
|
10775
10789
|
className: "toolbar-btn",
|
|
@@ -10777,7 +10791,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10777
10791
|
title: "Translate selected text"
|
|
10778
10792
|
},
|
|
10779
10793
|
/* @__PURE__ */ React112.createElement(IconTranslate, null)
|
|
10780
|
-
), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "Translate options", className: "translate-arrow-btn" } }, /* @__PURE__ */ React112.createElement("button", { className: "dropdown-item", onClick: () => setShowTranslateModal(true) }, "Options")), translateStatus && /* @__PURE__ */ React112.createElement("span", { className: `translate-toast-popup ${translateStatus === "Please select the text" || translateStatus === "Translation failed" ? "error" : ""}` }, translateStatus)), /* @__PURE__ */ React112.createElement("div", { className: "todo-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10794
|
+
), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "Translate options", className: "translate-arrow-btn" } }, /* @__PURE__ */ React112.createElement("button", { className: "dropdown-item", onClick: () => setShowTranslateModal(true) }, "Options")), translateStatus && /* @__PURE__ */ React112.createElement("span", { className: `translate-toast-popup ${translateStatus === "Please select the text" || translateStatus === "Translation failed" ? "error" : ""}` }, translateStatus)), show("todo") && /* @__PURE__ */ React112.createElement("div", { className: "todo-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10781
10795
|
"button",
|
|
10782
10796
|
{
|
|
10783
10797
|
className: `toolbar-btn ${todoEnabled ? "is-active" : ""}`,
|
|
@@ -11020,7 +11034,7 @@ var ImagePropertiesModal = ({ editor, node, onClose }) => {
|
|
|
11020
11034
|
checked: openInNewTab,
|
|
11021
11035
|
onChange: (e) => setOpenInNewTab(e.target.checked)
|
|
11022
11036
|
}
|
|
11023
|
-
), "Open link in new tab")) : /* @__PURE__ */ React113.createElement(React113.Fragment, null, /* @__PURE__ */ React113.createElement("label", { className: "modal-label" }, "CSS Class"), /* @__PURE__ */ React113.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. rounded shadow" }), /* @__PURE__ */ React113.createElement("label", { className: "modal-label" }, "Inline Style"), /* @__PURE__ */ React113.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. border: 1px solid #ccc" }))))), /* @__PURE__ */ React113.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React113.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React113.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "
|
|
11037
|
+
), "Open link in new tab")) : /* @__PURE__ */ React113.createElement(React113.Fragment, null, /* @__PURE__ */ React113.createElement("label", { className: "modal-label" }, "CSS Class"), /* @__PURE__ */ React113.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. rounded shadow" }), /* @__PURE__ */ React113.createElement("label", { className: "modal-label" }, "Inline Style"), /* @__PURE__ */ React113.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. border: 1px solid #ccc" }))))), /* @__PURE__ */ React113.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React113.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React113.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "Cancel"), /* @__PURE__ */ React113.createElement("button", { className: "modal-btn-delete", onClick: handleDelete }, "Delete")), /* @__PURE__ */ React113.createElement("button", { className: "modal-btn-apply", onClick: handleApply }, "Apply"))));
|
|
11024
11038
|
};
|
|
11025
11039
|
var ImageToolbar = ({ editor }) => {
|
|
11026
11040
|
const [showModal, setShowModal] = useState31(false);
|
|
@@ -11273,7 +11287,7 @@ var VideoPropertiesModal = ({ editor, node, nodeType, onClose }) => {
|
|
|
11273
11287
|
value: height,
|
|
11274
11288
|
onChange: (e) => handleHeightChange(e.target.value)
|
|
11275
11289
|
}
|
|
11276
|
-
)))), /* @__PURE__ */ React114.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React114.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React114.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "
|
|
11290
|
+
)))), /* @__PURE__ */ React114.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React114.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React114.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "Cancel"), /* @__PURE__ */ React114.createElement("button", { className: "modal-btn-delete", onClick: handleDelete }, "Delete")), /* @__PURE__ */ React114.createElement("button", { className: "modal-btn-apply", onClick: handleApply }, "Apply"))));
|
|
11277
11291
|
};
|
|
11278
11292
|
var VideoToolbar = ({ editor }) => {
|
|
11279
11293
|
const [showModal, setShowModal] = useState32(false);
|
|
@@ -11406,6 +11420,62 @@ var VideoToolbar = ({ editor }) => {
|
|
|
11406
11420
|
var VideoToolbar_default = VideoToolbar;
|
|
11407
11421
|
|
|
11408
11422
|
// lib/RufousTextEditor/RufousTextEditor.tsx
|
|
11423
|
+
var VARIANT_BUTTONS = {
|
|
11424
|
+
default: [
|
|
11425
|
+
"undo",
|
|
11426
|
+
"redo",
|
|
11427
|
+
"|",
|
|
11428
|
+
"ai",
|
|
11429
|
+
"|",
|
|
11430
|
+
"paragraph",
|
|
11431
|
+
"fontsize",
|
|
11432
|
+
"font",
|
|
11433
|
+
"color",
|
|
11434
|
+
"bold",
|
|
11435
|
+
"italic",
|
|
11436
|
+
"strike",
|
|
11437
|
+
"link",
|
|
11438
|
+
"lineheight",
|
|
11439
|
+
"|",
|
|
11440
|
+
"ul",
|
|
11441
|
+
"ol",
|
|
11442
|
+
"|",
|
|
11443
|
+
"align",
|
|
11444
|
+
"indent",
|
|
11445
|
+
"outdent",
|
|
11446
|
+
"|",
|
|
11447
|
+
"table",
|
|
11448
|
+
"image",
|
|
11449
|
+
"video",
|
|
11450
|
+
"|",
|
|
11451
|
+
"cut",
|
|
11452
|
+
"copy",
|
|
11453
|
+
"paste",
|
|
11454
|
+
"specialchars",
|
|
11455
|
+
"code",
|
|
11456
|
+
"fullscreen",
|
|
11457
|
+
"|",
|
|
11458
|
+
"tts",
|
|
11459
|
+
"stt",
|
|
11460
|
+
"translate",
|
|
11461
|
+
"|",
|
|
11462
|
+
"todo"
|
|
11463
|
+
],
|
|
11464
|
+
basic: [
|
|
11465
|
+
"undo",
|
|
11466
|
+
"redo",
|
|
11467
|
+
"|",
|
|
11468
|
+
"paragraph",
|
|
11469
|
+
"fontsize",
|
|
11470
|
+
"font",
|
|
11471
|
+
"bold",
|
|
11472
|
+
"italic",
|
|
11473
|
+
"link",
|
|
11474
|
+
"|",
|
|
11475
|
+
"ul",
|
|
11476
|
+
"ol"
|
|
11477
|
+
]
|
|
11478
|
+
};
|
|
11409
11479
|
var RufousTextEditor = ({
|
|
11410
11480
|
content: initialContent,
|
|
11411
11481
|
placeholder: customPlaceholder,
|
|
@@ -11421,6 +11491,10 @@ var RufousTextEditor = ({
|
|
|
11421
11491
|
onImageUpload,
|
|
11422
11492
|
onClose,
|
|
11423
11493
|
mentions,
|
|
11494
|
+
variant = "default",
|
|
11495
|
+
buttons,
|
|
11496
|
+
hideButtons,
|
|
11497
|
+
width,
|
|
11424
11498
|
height,
|
|
11425
11499
|
resizable = false,
|
|
11426
11500
|
className,
|
|
@@ -11428,6 +11502,14 @@ var RufousTextEditor = ({
|
|
|
11428
11502
|
sx
|
|
11429
11503
|
}) => {
|
|
11430
11504
|
const sxClass = useSx(sx);
|
|
11505
|
+
const toolbarButtons = useMemo4(() => {
|
|
11506
|
+
const list = buttons || VARIANT_BUTTONS[variant] || VARIANT_BUTTONS.default;
|
|
11507
|
+
const visible = new Set(list.filter((b) => b !== "|"));
|
|
11508
|
+
if (hideButtons) {
|
|
11509
|
+
hideButtons.forEach((b) => visible.delete(b));
|
|
11510
|
+
}
|
|
11511
|
+
return visible;
|
|
11512
|
+
}, [buttons, variant, hideButtons]);
|
|
11431
11513
|
const mentionSuggestion = useMemo4(() => createMentionSuggestion(mentions), [mentions]);
|
|
11432
11514
|
const onChangeRef = useRef29(onChange);
|
|
11433
11515
|
const onBlurRef = useRef29(onBlur);
|
|
@@ -11672,7 +11754,6 @@ var RufousTextEditor = ({
|
|
|
11672
11754
|
setLinkSelection(null);
|
|
11673
11755
|
editor?.chain().focus().run();
|
|
11674
11756
|
}, [editor]);
|
|
11675
|
-
const [saveFormat, setSaveFormat] = useState33("html");
|
|
11676
11757
|
const [saveStatus, setSaveStatus] = useState33("");
|
|
11677
11758
|
const handleSave = useCallback13(() => {
|
|
11678
11759
|
if (!editor || !onSaveProp) return;
|
|
@@ -11684,12 +11765,6 @@ var RufousTextEditor = ({
|
|
|
11684
11765
|
if (!editor || !onExportProp) return;
|
|
11685
11766
|
onExportProp(editor.getHTML(), editor.getJSON());
|
|
11686
11767
|
}, [editor, onExportProp]);
|
|
11687
|
-
const handleClear = useCallback13(() => {
|
|
11688
|
-
if (!editor) return;
|
|
11689
|
-
if (window.confirm("Clear all content? This cannot be undone.")) {
|
|
11690
|
-
editor.commands.clearContent();
|
|
11691
|
-
}
|
|
11692
|
-
}, [editor]);
|
|
11693
11768
|
const providerValue = useMemo4(() => ({ editor }), [editor]);
|
|
11694
11769
|
return /* @__PURE__ */ React115.createElement(
|
|
11695
11770
|
"div",
|
|
@@ -11697,6 +11772,7 @@ var RufousTextEditor = ({
|
|
|
11697
11772
|
className: `rf-rte-wrapper editor-wrapper ${resizable ? "rf-rte-resizable" : ""} ${sxClass} ${className || ""}`,
|
|
11698
11773
|
style: {
|
|
11699
11774
|
...style,
|
|
11775
|
+
...width ? { width: typeof width === "number" ? `${width}px` : width } : {},
|
|
11700
11776
|
...height ? { height: typeof height === "number" ? `${height}px` : height } : {}
|
|
11701
11777
|
}
|
|
11702
11778
|
},
|
|
@@ -11710,7 +11786,8 @@ var RufousTextEditor = ({
|
|
|
11710
11786
|
onSpeechToText,
|
|
11711
11787
|
onTextToSpeech,
|
|
11712
11788
|
onImageUpload,
|
|
11713
|
-
onClose
|
|
11789
|
+
onClose,
|
|
11790
|
+
visibleButtons: toolbarButtons
|
|
11714
11791
|
}
|
|
11715
11792
|
), /* @__PURE__ */ React115.createElement(EditorContent, { editor, className: "editor-content-wrapper" }), /* @__PURE__ */ React115.createElement(ImageToolbar_default, { editor }), /* @__PURE__ */ React115.createElement(VideoToolbar_default, { editor }), editor && /* @__PURE__ */ React115.createElement(
|
|
11716
11793
|
BubbleMenu,
|
|
@@ -11825,16 +11902,7 @@ var RufousTextEditor = ({
|
|
|
11825
11902
|
},
|
|
11826
11903
|
"\u201C Quote"
|
|
11827
11904
|
)
|
|
11828
|
-
), /* @__PURE__ */ React115.createElement("div", { className: "status-bar" }, /* @__PURE__ */ React115.createElement("div", { className: "status-bar-left" }, /* @__PURE__ */ React115.createElement(
|
|
11829
|
-
"select",
|
|
11830
|
-
{
|
|
11831
|
-
value: saveFormat,
|
|
11832
|
-
onChange: (e) => setSaveFormat(e.target.value),
|
|
11833
|
-
className: "format-select"
|
|
11834
|
-
},
|
|
11835
|
-
/* @__PURE__ */ React115.createElement("option", { value: "html" }, "HTML"),
|
|
11836
|
-
/* @__PURE__ */ React115.createElement("option", { value: "json" }, "JSON")
|
|
11837
|
-
), onSaveProp && /* @__PURE__ */ React115.createElement("button", { onClick: handleSave, className: "status-btn save-btn" }, "Save"), onExportProp && /* @__PURE__ */ React115.createElement("button", { onClick: handleExport, className: "status-btn export-btn" }, "Export"), /* @__PURE__ */ React115.createElement("button", { onClick: handleClear, className: "status-btn clear-btn" }, "Clear")), /* @__PURE__ */ React115.createElement("div", { className: "status-bar-right" }, saveStatus && /* @__PURE__ */ React115.createElement("span", { className: "save-status" }, saveStatus), editor && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement("span", { className: "word-count" }, "CHARS: ", editor.storage.characterCount?.characters?.() ?? editor.getText().length), /* @__PURE__ */ React115.createElement("span", { className: "word-count" }, "WORDS: ", editor.storage.characterCount?.words?.() ?? editor.getText().split(/\s+/).filter(Boolean).length)))), linkModalOpen && /* @__PURE__ */ React115.createElement("div", { className: "link-modal-overlay", onClick: handleLinkCancel }, /* @__PURE__ */ React115.createElement("div", { className: "link-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React115.createElement("div", { className: "link-modal-body" }, /* @__PURE__ */ React115.createElement("div", { className: "link-modal-field" }, /* @__PURE__ */ React115.createElement("label", { className: "link-modal-label" }, "URL"), /* @__PURE__ */ React115.createElement(
|
|
11905
|
+
), /* @__PURE__ */ React115.createElement("div", { className: "status-bar" }, /* @__PURE__ */ React115.createElement("div", { className: "status-bar-left" }, onSaveProp && /* @__PURE__ */ React115.createElement("button", { onClick: handleSave, className: "status-btn save-btn" }, "Save"), onExportProp && /* @__PURE__ */ React115.createElement("button", { onClick: handleExport, className: "status-btn export-btn" }, "Export")), /* @__PURE__ */ React115.createElement("div", { className: "status-bar-right" }, saveStatus && /* @__PURE__ */ React115.createElement("span", { className: "save-status" }, saveStatus), editor && /* @__PURE__ */ React115.createElement(React115.Fragment, null, /* @__PURE__ */ React115.createElement("span", { className: "word-count" }, "CHARS: ", editor.storage.characterCount?.characters?.() ?? editor.getText().length), /* @__PURE__ */ React115.createElement("span", { className: "word-count" }, "WORDS: ", editor.storage.characterCount?.words?.() ?? editor.getText().split(/\s+/).filter(Boolean).length)))), linkModalOpen && /* @__PURE__ */ React115.createElement("div", { className: "link-modal-overlay", onClick: handleLinkCancel }, /* @__PURE__ */ React115.createElement("div", { className: "link-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React115.createElement("div", { className: "link-modal-body" }, /* @__PURE__ */ React115.createElement("div", { className: "link-modal-field" }, /* @__PURE__ */ React115.createElement("label", { className: "link-modal-label" }, "URL"), /* @__PURE__ */ React115.createElement(
|
|
11838
11906
|
"input",
|
|
11839
11907
|
{
|
|
11840
11908
|
type: "url",
|