@editorcn/editor 0.3.7 → 0.3.9
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/README.md +2 -2
- package/dist/index.cjs +441 -337
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +455 -341
- package/dist/index.js.map +1 -1
- package/dist/style.css +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/rte-text-editor.tsx
|
|
2
|
-
import {
|
|
2
|
+
import { Tooltip as TooltipPrimitive2 } from "@base-ui/react/tooltip";
|
|
3
|
+
import { useEffect as useEffect6, useMemo as useMemo2, useState as useState9 } from "react";
|
|
3
4
|
|
|
4
5
|
// src/bubble-menu/index.tsx
|
|
5
6
|
import { isTextSelection } from "@tiptap/core";
|
|
@@ -536,6 +537,56 @@ var Toggle = ({
|
|
|
536
537
|
}
|
|
537
538
|
);
|
|
538
539
|
|
|
540
|
+
// src/ui/tooltip.tsx
|
|
541
|
+
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
542
|
+
import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
543
|
+
var TooltipProvider = ({
|
|
544
|
+
delay = 0,
|
|
545
|
+
...props
|
|
546
|
+
}) => /* @__PURE__ */ jsx16(
|
|
547
|
+
TooltipPrimitive.Provider,
|
|
548
|
+
{
|
|
549
|
+
"data-slot": "tooltip-provider",
|
|
550
|
+
delay,
|
|
551
|
+
...props
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
var Tooltip = ({ ...props }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
555
|
+
var TooltipTrigger = ({ ...props }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
556
|
+
var TooltipContent = ({
|
|
557
|
+
className,
|
|
558
|
+
side = "top",
|
|
559
|
+
sideOffset = 4,
|
|
560
|
+
align = "center",
|
|
561
|
+
alignOffset = 0,
|
|
562
|
+
children,
|
|
563
|
+
...props
|
|
564
|
+
}) => /* @__PURE__ */ jsx16(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx16(
|
|
565
|
+
TooltipPrimitive.Positioner,
|
|
566
|
+
{
|
|
567
|
+
align,
|
|
568
|
+
alignOffset,
|
|
569
|
+
side,
|
|
570
|
+
sideOffset,
|
|
571
|
+
className: "isolate z-50",
|
|
572
|
+
children: /* @__PURE__ */ jsxs4(
|
|
573
|
+
TooltipPrimitive.Popup,
|
|
574
|
+
{
|
|
575
|
+
"data-slot": "tooltip-content",
|
|
576
|
+
className: cn(
|
|
577
|
+
"z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-none bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-none data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
578
|
+
className
|
|
579
|
+
),
|
|
580
|
+
...props,
|
|
581
|
+
children: [
|
|
582
|
+
children,
|
|
583
|
+
/* @__PURE__ */ jsx16(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-none bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
) });
|
|
589
|
+
|
|
539
590
|
// src/bubble-menu/color-selector.tsx
|
|
540
591
|
import { useState as useState2 } from "react";
|
|
541
592
|
|
|
@@ -647,7 +698,7 @@ var CODE_BLOCK_LANGUAGE_LABELS = {
|
|
|
647
698
|
var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
|
|
648
699
|
|
|
649
700
|
// src/bubble-menu/color-selector.tsx
|
|
650
|
-
import { Fragment, jsx as
|
|
701
|
+
import { Fragment, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
651
702
|
var RECENT_KEY = "editorcn-editor-recent-colors";
|
|
652
703
|
var RECENT_LIMIT = 10;
|
|
653
704
|
var readRecentColors = () => {
|
|
@@ -741,15 +792,15 @@ var ColorSelector = ({ editor }) => {
|
|
|
741
792
|
if (!hasColor && !hasHighlight) {
|
|
742
793
|
return null;
|
|
743
794
|
}
|
|
744
|
-
return /* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
795
|
+
return /* @__PURE__ */ jsxs5("div", { style: { position: "relative" }, children: [
|
|
796
|
+
/* @__PURE__ */ jsx17(
|
|
746
797
|
RteButton,
|
|
747
798
|
{
|
|
748
799
|
active: Boolean(textColor || highlightColor),
|
|
749
800
|
onMouseDown: (e) => e.preventDefault(),
|
|
750
801
|
onClick: () => setOpen(!open),
|
|
751
802
|
title: "Text color",
|
|
752
|
-
children: /* @__PURE__ */
|
|
803
|
+
children: /* @__PURE__ */ jsx17(RteIcon, { children: /* @__PURE__ */ jsxs5(
|
|
753
804
|
"svg",
|
|
754
805
|
{
|
|
755
806
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -761,16 +812,16 @@ var ColorSelector = ({ editor }) => {
|
|
|
761
812
|
strokeLinejoin: "round",
|
|
762
813
|
className: "rte-editor-icon",
|
|
763
814
|
children: [
|
|
764
|
-
/* @__PURE__ */
|
|
765
|
-
/* @__PURE__ */
|
|
766
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ jsx17("path", { d: "M4 20h16" }),
|
|
816
|
+
/* @__PURE__ */ jsx17("path", { d: "m6 16 6-12 6 12" }),
|
|
817
|
+
/* @__PURE__ */ jsx17("path", { d: "M8 12h8" })
|
|
767
818
|
]
|
|
768
819
|
}
|
|
769
820
|
) })
|
|
770
821
|
}
|
|
771
822
|
),
|
|
772
|
-
open && /* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
823
|
+
open && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
824
|
+
/* @__PURE__ */ jsx17(
|
|
774
825
|
RteOverlay,
|
|
775
826
|
{
|
|
776
827
|
onClick: () => setOpen(false),
|
|
@@ -781,10 +832,10 @@ var ColorSelector = ({ editor }) => {
|
|
|
781
832
|
}
|
|
782
833
|
}
|
|
783
834
|
),
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
recent.length > 0 ? /* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
/* @__PURE__ */
|
|
835
|
+
/* @__PURE__ */ jsxs5(RteDropdown, { variant: "color", children: [
|
|
836
|
+
recent.length > 0 ? /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
|
|
837
|
+
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
|
|
838
|
+
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ jsx17(
|
|
788
839
|
RteColorSwatch,
|
|
789
840
|
{
|
|
790
841
|
variant: item.type,
|
|
@@ -796,11 +847,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
796
847
|
`${item.type}-${item.color}`
|
|
797
848
|
)) })
|
|
798
849
|
] }) : null,
|
|
799
|
-
hasColor ? /* @__PURE__ */
|
|
800
|
-
recent.length > 0 && /* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
/* @__PURE__ */
|
|
803
|
-
/* @__PURE__ */
|
|
850
|
+
hasColor ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
851
|
+
recent.length > 0 && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
|
|
852
|
+
/* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
|
|
853
|
+
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Text Color" }),
|
|
854
|
+
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ jsx17(
|
|
804
855
|
RteColorSwatch,
|
|
805
856
|
{
|
|
806
857
|
variant: "text",
|
|
@@ -813,11 +864,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
813
864
|
)) })
|
|
814
865
|
] })
|
|
815
866
|
] }) : null,
|
|
816
|
-
hasHighlight ? /* @__PURE__ */
|
|
817
|
-
(recent.length > 0 || hasColor) && /* @__PURE__ */
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
/* @__PURE__ */
|
|
867
|
+
hasHighlight ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
868
|
+
(recent.length > 0 || hasColor) && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
|
|
869
|
+
/* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
|
|
870
|
+
/* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
|
|
871
|
+
/* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ jsx17(
|
|
821
872
|
RteColorSwatch,
|
|
822
873
|
{
|
|
823
874
|
variant: "highlight",
|
|
@@ -852,8 +903,8 @@ var useRichTextEditorContext = () => {
|
|
|
852
903
|
};
|
|
853
904
|
|
|
854
905
|
// src/bubble-menu/language-selector.tsx
|
|
855
|
-
import { Fragment as Fragment2, jsx as
|
|
856
|
-
var FallbackIcon = () => /* @__PURE__ */
|
|
906
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
907
|
+
var FallbackIcon = () => /* @__PURE__ */ jsxs6(
|
|
857
908
|
"svg",
|
|
858
909
|
{
|
|
859
910
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -865,8 +916,8 @@ var FallbackIcon = () => /* @__PURE__ */ jsxs5(
|
|
|
865
916
|
strokeLinejoin: "round",
|
|
866
917
|
className: "rte-editor-icon",
|
|
867
918
|
children: [
|
|
868
|
-
/* @__PURE__ */
|
|
869
|
-
/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ jsx18("polyline", { points: "16 18 22 12 16 6" }),
|
|
920
|
+
/* @__PURE__ */ jsx18("polyline", { points: "8 6 2 12 8 18" })
|
|
870
921
|
]
|
|
871
922
|
}
|
|
872
923
|
);
|
|
@@ -880,17 +931,17 @@ var LanguageSelector = ({ editor }) => {
|
|
|
880
931
|
}),
|
|
881
932
|
shallowEqual
|
|
882
933
|
);
|
|
883
|
-
const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */
|
|
884
|
-
return /* @__PURE__ */
|
|
885
|
-
/* @__PURE__ */
|
|
934
|
+
const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ jsx18(FallbackIcon, {});
|
|
935
|
+
return /* @__PURE__ */ jsxs6("div", { style: { position: "relative" }, children: [
|
|
936
|
+
/* @__PURE__ */ jsxs6(
|
|
886
937
|
RteButton,
|
|
887
938
|
{
|
|
888
939
|
onMouseDown: (e) => e.preventDefault(),
|
|
889
940
|
onClick: () => setOpen(!open),
|
|
890
941
|
children: [
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
893
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsx18(RteIcon, { children: langIcon }),
|
|
943
|
+
/* @__PURE__ */ jsx18("span", { className: "rte-bubble-btn-text", children: getLanguageLabel(currentLanguage) }),
|
|
944
|
+
/* @__PURE__ */ jsx18(RteIcon, { style: { height: 12, width: 12 }, children: /* @__PURE__ */ jsx18(
|
|
894
945
|
"svg",
|
|
895
946
|
{
|
|
896
947
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -900,14 +951,14 @@ var LanguageSelector = ({ editor }) => {
|
|
|
900
951
|
strokeWidth: 2,
|
|
901
952
|
strokeLinecap: "round",
|
|
902
953
|
strokeLinejoin: "round",
|
|
903
|
-
children: /* @__PURE__ */
|
|
954
|
+
children: /* @__PURE__ */ jsx18("path", { d: "m6 9 6 6 6-6" })
|
|
904
955
|
}
|
|
905
956
|
) })
|
|
906
957
|
]
|
|
907
958
|
}
|
|
908
959
|
),
|
|
909
|
-
open && /* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
960
|
+
open && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
961
|
+
/* @__PURE__ */ jsx18(
|
|
911
962
|
RteOverlay,
|
|
912
963
|
{
|
|
913
964
|
onClick: () => setOpen(false),
|
|
@@ -918,7 +969,7 @@ var LanguageSelector = ({ editor }) => {
|
|
|
918
969
|
}
|
|
919
970
|
}
|
|
920
971
|
),
|
|
921
|
-
/* @__PURE__ */
|
|
972
|
+
/* @__PURE__ */ jsx18(RteDropdown, { variant: "language", children: CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ jsxs6(
|
|
922
973
|
RteDropdownItem,
|
|
923
974
|
{
|
|
924
975
|
active: currentLanguage === lang,
|
|
@@ -928,8 +979,8 @@ var LanguageSelector = ({ editor }) => {
|
|
|
928
979
|
setOpen(false);
|
|
929
980
|
},
|
|
930
981
|
children: [
|
|
931
|
-
/* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
982
|
+
/* @__PURE__ */ jsx18(RteDropdownIcon, { children: icons.languageIcons[lang] ?? /* @__PURE__ */ jsx18(FallbackIcon, {}) }),
|
|
983
|
+
/* @__PURE__ */ jsx18("span", { children: getLanguageLabel(lang) })
|
|
933
984
|
]
|
|
934
985
|
},
|
|
935
986
|
lang
|
|
@@ -939,11 +990,11 @@ var LanguageSelector = ({ editor }) => {
|
|
|
939
990
|
};
|
|
940
991
|
|
|
941
992
|
// src/bubble-menu/text-buttons.tsx
|
|
942
|
-
import { jsx as
|
|
993
|
+
import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
943
994
|
var Svg = ({
|
|
944
995
|
children,
|
|
945
996
|
strokeWidth = 2
|
|
946
|
-
}) => /* @__PURE__ */
|
|
997
|
+
}) => /* @__PURE__ */ jsx19(
|
|
947
998
|
"svg",
|
|
948
999
|
{
|
|
949
1000
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -957,47 +1008,47 @@ var Svg = ({
|
|
|
957
1008
|
children
|
|
958
1009
|
}
|
|
959
1010
|
);
|
|
960
|
-
var Icon = ({ children }) => /* @__PURE__ */
|
|
1011
|
+
var Icon = ({ children }) => /* @__PURE__ */ jsx19(RteIcon, { children });
|
|
961
1012
|
var textItems = [
|
|
962
1013
|
{
|
|
963
1014
|
command: (e) => e.chain().focus().toggleBold().run(),
|
|
964
|
-
icon: /* @__PURE__ */
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
1015
|
+
icon: /* @__PURE__ */ jsx19(Icon, { children: /* @__PURE__ */ jsxs7(Svg, { children: [
|
|
1016
|
+
/* @__PURE__ */ jsx19("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
|
|
1017
|
+
/* @__PURE__ */ jsx19("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
|
|
967
1018
|
] }) }),
|
|
968
1019
|
isActive: (s) => s.isBold
|
|
969
1020
|
},
|
|
970
1021
|
{
|
|
971
1022
|
command: (e) => e.chain().focus().toggleItalic().run(),
|
|
972
|
-
icon: /* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
1023
|
+
icon: /* @__PURE__ */ jsx19(Icon, { children: /* @__PURE__ */ jsxs7(Svg, { children: [
|
|
1024
|
+
/* @__PURE__ */ jsx19("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
1025
|
+
/* @__PURE__ */ jsx19("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
1026
|
+
/* @__PURE__ */ jsx19("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
976
1027
|
] }) }),
|
|
977
1028
|
isActive: (s) => s.isItalic
|
|
978
1029
|
},
|
|
979
1030
|
{
|
|
980
1031
|
command: (e) => e.chain().focus().toggleUnderline().run(),
|
|
981
|
-
icon: /* @__PURE__ */
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
1032
|
+
icon: /* @__PURE__ */ jsx19(Icon, { children: /* @__PURE__ */ jsxs7(Svg, { children: [
|
|
1033
|
+
/* @__PURE__ */ jsx19("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
|
|
1034
|
+
/* @__PURE__ */ jsx19("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
|
|
984
1035
|
] }) }),
|
|
985
1036
|
isActive: (s) => s.isUnderline
|
|
986
1037
|
},
|
|
987
1038
|
{
|
|
988
1039
|
command: (e) => e.chain().focus().toggleStrike().run(),
|
|
989
|
-
icon: /* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
992
|
-
/* @__PURE__ */
|
|
1040
|
+
icon: /* @__PURE__ */ jsx19(Icon, { children: /* @__PURE__ */ jsxs7(Svg, { children: [
|
|
1041
|
+
/* @__PURE__ */ jsx19("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
|
|
1042
|
+
/* @__PURE__ */ jsx19("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
|
|
1043
|
+
/* @__PURE__ */ jsx19("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
993
1044
|
] }) }),
|
|
994
1045
|
isActive: (s) => s.isStrike
|
|
995
1046
|
},
|
|
996
1047
|
{
|
|
997
1048
|
command: (e) => e.chain().focus().toggleCode().run(),
|
|
998
|
-
icon: /* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1049
|
+
icon: /* @__PURE__ */ jsx19(Icon, { children: /* @__PURE__ */ jsxs7(Svg, { children: [
|
|
1050
|
+
/* @__PURE__ */ jsx19("polyline", { points: "16 18 22 12 16 6" }),
|
|
1051
|
+
/* @__PURE__ */ jsx19("polyline", { points: "8 6 2 12 8 18" })
|
|
1001
1052
|
] }) }),
|
|
1002
1053
|
isActive: (s) => s.isCode
|
|
1003
1054
|
}
|
|
@@ -1014,7 +1065,7 @@ var TextButtons = ({ editor }) => {
|
|
|
1014
1065
|
}),
|
|
1015
1066
|
shallowEqual
|
|
1016
1067
|
);
|
|
1017
|
-
return /* @__PURE__ */
|
|
1068
|
+
return /* @__PURE__ */ jsx19(RteButtonGroup, { children: textItems.map((item, i) => /* @__PURE__ */ jsx19(
|
|
1018
1069
|
RteButton,
|
|
1019
1070
|
{
|
|
1020
1071
|
active: item.isActive(editorState),
|
|
@@ -1027,7 +1078,7 @@ var TextButtons = ({ editor }) => {
|
|
|
1027
1078
|
};
|
|
1028
1079
|
|
|
1029
1080
|
// src/bubble-menu/index.tsx
|
|
1030
|
-
import { Fragment as Fragment3, jsx as
|
|
1081
|
+
import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1031
1082
|
var BubbleMenu = ({ editor }) => {
|
|
1032
1083
|
const editorState = useEditorState(
|
|
1033
1084
|
editor,
|
|
@@ -1059,16 +1110,16 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1059
1110
|
return null;
|
|
1060
1111
|
}
|
|
1061
1112
|
const isCodeBlockActive = editorState?.isCodeBlock ?? false;
|
|
1062
|
-
return /* @__PURE__ */
|
|
1113
|
+
return /* @__PURE__ */ jsx20(
|
|
1063
1114
|
TiptapBubbleMenu,
|
|
1064
1115
|
{
|
|
1065
1116
|
editor,
|
|
1066
1117
|
options: { offset: 8, placement: "top" },
|
|
1067
1118
|
shouldShow,
|
|
1068
|
-
children: /* @__PURE__ */
|
|
1069
|
-
/* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */
|
|
1119
|
+
children: /* @__PURE__ */ jsx20("div", { className: "rte-bubble-menu", children: isCodeBlockActive ? /* @__PURE__ */ jsx20(LanguageSelector, { editor }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1120
|
+
/* @__PURE__ */ jsx20(TextButtons, { editor }),
|
|
1121
|
+
/* @__PURE__ */ jsx20(RteSeparator, {}),
|
|
1122
|
+
/* @__PURE__ */ jsx20(ColorSelector, { editor })
|
|
1072
1123
|
] }) })
|
|
1073
1124
|
}
|
|
1074
1125
|
);
|
|
@@ -1076,8 +1127,18 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1076
1127
|
|
|
1077
1128
|
// src/controls/rte-control.tsx
|
|
1078
1129
|
import { useEditorState as useEditorState2 } from "@tiptap/react";
|
|
1079
|
-
import "react";
|
|
1080
|
-
import { jsx as
|
|
1130
|
+
import { useContext as useContext2 } from "react";
|
|
1131
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1132
|
+
var RichTextEditorTooltip = ({
|
|
1133
|
+
children,
|
|
1134
|
+
label
|
|
1135
|
+
}) => {
|
|
1136
|
+
const tooltip = useContext2(RichTextEditorContext)?.tooltip;
|
|
1137
|
+
if (!tooltip) {
|
|
1138
|
+
return children;
|
|
1139
|
+
}
|
|
1140
|
+
return /* @__PURE__ */ jsx21(TooltipTrigger, { handle: tooltip, payload: label, render: children });
|
|
1141
|
+
};
|
|
1081
1142
|
var RichTextEditorControl = ({
|
|
1082
1143
|
active = false,
|
|
1083
1144
|
interactive: _interactive = true,
|
|
@@ -1087,23 +1148,25 @@ var RichTextEditorControl = ({
|
|
|
1087
1148
|
onClick,
|
|
1088
1149
|
disabled,
|
|
1089
1150
|
...props
|
|
1090
|
-
}) =>
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
);
|
|
1151
|
+
}) => {
|
|
1152
|
+
const toggle = /* @__PURE__ */ jsx21(
|
|
1153
|
+
Toggle,
|
|
1154
|
+
{
|
|
1155
|
+
size: "sm",
|
|
1156
|
+
pressed: active,
|
|
1157
|
+
disabled,
|
|
1158
|
+
"aria-label": props["aria-label"],
|
|
1159
|
+
className: cn("rte-control-button", className),
|
|
1160
|
+
onMouseDown: (e) => {
|
|
1161
|
+
e.preventDefault();
|
|
1162
|
+
onMouseDown?.(e);
|
|
1163
|
+
},
|
|
1164
|
+
onPressedChange: () => onClick?.({}),
|
|
1165
|
+
children
|
|
1166
|
+
}
|
|
1167
|
+
);
|
|
1168
|
+
return props.title ? /* @__PURE__ */ jsx21(RichTextEditorTooltip, { label: props.title, children: toggle }) : toggle;
|
|
1169
|
+
};
|
|
1107
1170
|
var resolveIsActive = (editor, config) => {
|
|
1108
1171
|
if (!editor || !config) {
|
|
1109
1172
|
return false;
|
|
@@ -1133,7 +1196,7 @@ var createControl = ({
|
|
|
1133
1196
|
const selector = createSelector(isActive, isDisabled);
|
|
1134
1197
|
useEditorState2({ editor: editor ?? null, selector });
|
|
1135
1198
|
const { active, disabled } = selector({ editor: editor ?? null });
|
|
1136
|
-
return /* @__PURE__ */
|
|
1199
|
+
return /* @__PURE__ */ jsx21(
|
|
1137
1200
|
RichTextEditorControl,
|
|
1138
1201
|
{
|
|
1139
1202
|
active,
|
|
@@ -1321,9 +1384,9 @@ var SuperscriptControl = createControl({
|
|
|
1321
1384
|
import { useEditorState as useEditorState3 } from "@tiptap/react";
|
|
1322
1385
|
import * as React15 from "react";
|
|
1323
1386
|
import { useCallback as useCallback4, useState as useState4 } from "react";
|
|
1324
|
-
import { jsx as
|
|
1387
|
+
import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1325
1388
|
var LinkControl = () => {
|
|
1326
|
-
const { editor, labels,
|
|
1389
|
+
const { editor, icons, labels, tooltip } = useRichTextEditorContext();
|
|
1327
1390
|
const [url, setUrl] = useState4("");
|
|
1328
1391
|
const [open, setOpen] = useState4(false);
|
|
1329
1392
|
const active = useEditorState3({
|
|
@@ -1365,26 +1428,32 @@ var LinkControl = () => {
|
|
|
1365
1428
|
window.addEventListener("edit-link", handler);
|
|
1366
1429
|
return () => window.removeEventListener("edit-link", handler);
|
|
1367
1430
|
}, [handleOpen]);
|
|
1368
|
-
return /* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
|
|
1431
|
+
return /* @__PURE__ */ jsxs9(Popover, { open, onOpenChange: handleOpen, children: [
|
|
1432
|
+
/* @__PURE__ */ jsx22(
|
|
1433
|
+
TooltipTrigger,
|
|
1371
1434
|
{
|
|
1372
|
-
|
|
1373
|
-
|
|
1435
|
+
handle: tooltip,
|
|
1436
|
+
payload: labels.linkControlLabel,
|
|
1437
|
+
render: /* @__PURE__ */ jsx22(
|
|
1438
|
+
PopoverTrigger,
|
|
1374
1439
|
{
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1440
|
+
render: /* @__PURE__ */ jsx22(
|
|
1441
|
+
Toggle,
|
|
1442
|
+
{
|
|
1443
|
+
size: "sm",
|
|
1444
|
+
pressed: active ?? false,
|
|
1445
|
+
"aria-label": labels.linkControlLabel,
|
|
1446
|
+
className: "p-0"
|
|
1447
|
+
}
|
|
1448
|
+
),
|
|
1449
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1450
|
+
children: icons.linkControlIcon
|
|
1380
1451
|
}
|
|
1381
|
-
)
|
|
1382
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1383
|
-
children: icons.linkControlIcon
|
|
1452
|
+
)
|
|
1384
1453
|
}
|
|
1385
1454
|
),
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ jsx22(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ jsxs9("div", { className: "rte-link-editor", children: [
|
|
1456
|
+
/* @__PURE__ */ jsx22(
|
|
1388
1457
|
Input,
|
|
1389
1458
|
{
|
|
1390
1459
|
type: "url",
|
|
@@ -1396,7 +1465,7 @@ var LinkControl = () => {
|
|
|
1396
1465
|
className: "rte-link-editor-input h-8 text-sm"
|
|
1397
1466
|
}
|
|
1398
1467
|
),
|
|
1399
|
-
/* @__PURE__ */
|
|
1468
|
+
/* @__PURE__ */ jsx22(
|
|
1400
1469
|
Button,
|
|
1401
1470
|
{
|
|
1402
1471
|
size: "sm",
|
|
@@ -1411,7 +1480,12 @@ var LinkControl = () => {
|
|
|
1411
1480
|
};
|
|
1412
1481
|
|
|
1413
1482
|
// src/controls/rte-twitter-control.tsx
|
|
1414
|
-
import {
|
|
1483
|
+
import {
|
|
1484
|
+
createAtomBlockMarkdownSpec,
|
|
1485
|
+
Node,
|
|
1486
|
+
nodeInputRule,
|
|
1487
|
+
parseAttributes
|
|
1488
|
+
} from "@tiptap/core";
|
|
1415
1489
|
import { ReactNodeViewRenderer, useEditorState as useEditorState4 } from "@tiptap/react";
|
|
1416
1490
|
import { useState as useState6, useCallback as useCallback6, useEffect as useEffect4, useRef as useRef4 } from "react";
|
|
1417
1491
|
|
|
@@ -1454,11 +1528,11 @@ import "react";
|
|
|
1454
1528
|
|
|
1455
1529
|
// src/language-icons.tsx
|
|
1456
1530
|
import "react";
|
|
1457
|
-
import { jsx as
|
|
1531
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1458
1532
|
var LangIcon = ({
|
|
1459
1533
|
children,
|
|
1460
1534
|
className
|
|
1461
|
-
}) => /* @__PURE__ */
|
|
1535
|
+
}) => /* @__PURE__ */ jsx23(
|
|
1462
1536
|
"svg",
|
|
1463
1537
|
{
|
|
1464
1538
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1473,140 +1547,140 @@ var LangIcon = ({
|
|
|
1473
1547
|
}
|
|
1474
1548
|
);
|
|
1475
1549
|
var DEFAULT_LANGUAGE_ICONS = {
|
|
1476
|
-
bash: /* @__PURE__ */
|
|
1477
|
-
/* @__PURE__ */
|
|
1478
|
-
/* @__PURE__ */
|
|
1479
|
-
/* @__PURE__ */
|
|
1550
|
+
bash: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1551
|
+
/* @__PURE__ */ jsx23("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
|
|
1552
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
|
|
1553
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 15.5h5.5" })
|
|
1480
1554
|
] }),
|
|
1481
|
-
c: /* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1555
|
+
c: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1556
|
+
/* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1557
|
+
/* @__PURE__ */ jsx23("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
|
|
1484
1558
|
] }),
|
|
1485
|
-
cpp: /* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
1487
|
-
/* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1559
|
+
cpp: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1560
|
+
/* @__PURE__ */ jsx23("circle", { cx: "9.5", cy: "12", r: "6.5" }),
|
|
1561
|
+
/* @__PURE__ */ jsx23("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
|
|
1562
|
+
/* @__PURE__ */ jsx23("path", { d: "M15.7 10.5v3M14.2 12h3" }),
|
|
1563
|
+
/* @__PURE__ */ jsx23("path", { d: "M19.3 10.5v3M17.8 12h3" })
|
|
1490
1564
|
] }),
|
|
1491
|
-
css: /* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1496
|
-
/* @__PURE__ */
|
|
1565
|
+
css: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1566
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1567
|
+
/* @__PURE__ */ jsx23("path", { d: "M9.7 7.5l-1 9" }),
|
|
1568
|
+
/* @__PURE__ */ jsx23("path", { d: "M15.3 7.5l-1 9" }),
|
|
1569
|
+
/* @__PURE__ */ jsx23("path", { d: "M7 10.3h11" }),
|
|
1570
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 14.3h11" })
|
|
1497
1571
|
] }),
|
|
1498
|
-
go: /* @__PURE__ */
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
1502
|
-
/* @__PURE__ */
|
|
1572
|
+
go: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1573
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1574
|
+
/* @__PURE__ */ jsx23("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
|
|
1575
|
+
/* @__PURE__ */ jsx23("path", { d: "M12.6 12h-1.9" }),
|
|
1576
|
+
/* @__PURE__ */ jsx23("circle", { cx: "17", cy: "12", r: "2.9" })
|
|
1503
1577
|
] }),
|
|
1504
|
-
html: /* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1578
|
+
html: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1579
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1580
|
+
/* @__PURE__ */ jsx23("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
|
|
1581
|
+
/* @__PURE__ */ jsx23("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
|
|
1582
|
+
/* @__PURE__ */ jsx23("path", { d: "M13 7.3l-2 9.4" })
|
|
1509
1583
|
] }),
|
|
1510
|
-
java: /* @__PURE__ */
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */
|
|
1514
|
-
/* @__PURE__ */
|
|
1584
|
+
java: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1585
|
+
/* @__PURE__ */ jsx23("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
|
|
1586
|
+
/* @__PURE__ */ jsx23("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
|
|
1587
|
+
/* @__PURE__ */ jsx23("path", { d: "M9.3 3.8c-.9.8-.9 1.6 0 2.4M13.3 3.8c-.9.8-.9 1.6 0 2.4" }),
|
|
1588
|
+
/* @__PURE__ */ jsx23("path", { d: "M6 19.3h10" })
|
|
1515
1589
|
] }),
|
|
1516
|
-
javascript: /* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1590
|
+
javascript: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1591
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1592
|
+
/* @__PURE__ */ jsx23("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
|
|
1593
|
+
/* @__PURE__ */ jsx23("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
|
|
1520
1594
|
] }),
|
|
1521
|
-
json: /* @__PURE__ */
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */
|
|
1595
|
+
json: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1596
|
+
/* @__PURE__ */ jsx23("path", { d: "M8 3H7a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4a2 2 0 0 0 2 2" }),
|
|
1597
|
+
/* @__PURE__ */ jsx23("path", { d: "M16 3h1a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4a2 2 0 0 1-2 2" })
|
|
1524
1598
|
] }),
|
|
1525
|
-
kotlin: /* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1527
|
-
/* @__PURE__ */
|
|
1528
|
-
/* @__PURE__ */
|
|
1529
|
-
/* @__PURE__ */
|
|
1599
|
+
kotlin: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1600
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1601
|
+
/* @__PURE__ */ jsx23("path", { d: "M9 7.5v9" }),
|
|
1602
|
+
/* @__PURE__ */ jsx23("path", { d: "M9 12l6-4.5" }),
|
|
1603
|
+
/* @__PURE__ */ jsx23("path", { d: "M9 12l6 4.5" })
|
|
1530
1604
|
] }),
|
|
1531
|
-
markdown: /* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1605
|
+
markdown: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1606
|
+
/* @__PURE__ */ jsx23("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1607
|
+
/* @__PURE__ */ jsx23("path", { d: "M6 15V9l3 4 3-4v6" }),
|
|
1608
|
+
/* @__PURE__ */ jsx23("path", { d: "M16.5 9v6" }),
|
|
1609
|
+
/* @__PURE__ */ jsx23("path", { d: "M14.5 13l2 2 2-2" })
|
|
1536
1610
|
] }),
|
|
1537
|
-
php: /* @__PURE__ */
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
/* @__PURE__ */
|
|
1541
|
-
/* @__PURE__ */
|
|
1611
|
+
php: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1612
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1613
|
+
/* @__PURE__ */ jsx23("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
|
|
1614
|
+
/* @__PURE__ */ jsx23("path", { d: "M15.2 8.2c1.1 0 1.9.6 1.9 1.6 0 1.1-.9 1.5-1.8 1.8-.6.2-1 .5-1 1.1" }),
|
|
1615
|
+
/* @__PURE__ */ jsx23("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
|
|
1542
1616
|
] }),
|
|
1543
|
-
plaintext: /* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
/* @__PURE__ */
|
|
1617
|
+
plaintext: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1618
|
+
/* @__PURE__ */ jsx23("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
|
|
1619
|
+
/* @__PURE__ */ jsx23("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
|
|
1620
|
+
/* @__PURE__ */ jsx23("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
|
|
1621
|
+
/* @__PURE__ */ jsx23("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
|
|
1548
1622
|
] }),
|
|
1549
|
-
python: /* @__PURE__ */
|
|
1550
|
-
/* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1552
|
-
/* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1623
|
+
python: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1624
|
+
/* @__PURE__ */ jsx23("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
|
|
1625
|
+
/* @__PURE__ */ jsx23("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
|
|
1626
|
+
/* @__PURE__ */ jsx23("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
|
|
1627
|
+
/* @__PURE__ */ jsx23("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
|
|
1554
1628
|
] }),
|
|
1555
|
-
ruby: /* @__PURE__ */
|
|
1556
|
-
/* @__PURE__ */
|
|
1557
|
-
/* @__PURE__ */
|
|
1558
|
-
/* @__PURE__ */
|
|
1629
|
+
ruby: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1630
|
+
/* @__PURE__ */ jsx23("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
|
|
1631
|
+
/* @__PURE__ */ jsx23("path", { d: "M4.5 8h15" }),
|
|
1632
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 2.5v19" })
|
|
1559
1633
|
] }),
|
|
1560
|
-
rust: /* @__PURE__ */
|
|
1561
|
-
/* @__PURE__ */
|
|
1562
|
-
/* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1634
|
+
rust: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1635
|
+
/* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "7" }),
|
|
1636
|
+
/* @__PURE__ */ jsx23("circle", { cx: "12", cy: "12", r: "2.3" }),
|
|
1637
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
|
|
1638
|
+
/* @__PURE__ */ jsx23("path", { d: "M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M5.6 18.4l2.1-2.1M16.3 7.7l2.1-2.1" })
|
|
1565
1639
|
] }),
|
|
1566
|
-
sql: /* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1640
|
+
sql: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1641
|
+
/* @__PURE__ */ jsx23("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
|
|
1642
|
+
/* @__PURE__ */ jsx23("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
|
|
1643
|
+
/* @__PURE__ */ jsx23("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
|
|
1570
1644
|
] }),
|
|
1571
|
-
swift: /* @__PURE__ */
|
|
1572
|
-
typescript: /* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1645
|
+
swift: /* @__PURE__ */ jsx23(LangIcon, { children: /* @__PURE__ */ jsx23("path", { d: "M19 4.5c-2.6 4-5.5 7-8.3 9 2-.2 3.7-1 4.8-2.6-.7 2.8-2.8 5-5.3 6.1 3 .5 5.6-.5 7.2-2.4.4 2-.4 3.9-1.9 4.9 3.7-1.3 6-4.2 6.6-7.6-1 2.6-2.8 4.6-4.6 5.8" }) }),
|
|
1646
|
+
typescript: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1647
|
+
/* @__PURE__ */ jsx23("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1648
|
+
/* @__PURE__ */ jsx23("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
|
|
1649
|
+
/* @__PURE__ */ jsx23("path", { d: "M17 8.8a2 2 0 0 0-2-.8c-1.1 0-2.2.6-2.2 1.7 0 1 .9 1.4 2.2 1.7 1.3.3 2.3.7 2.3 1.9 0 1.1-1 1.8-2.3 1.8a2.4 2.4 0 0 1-2.3-1.4" })
|
|
1576
1650
|
] }),
|
|
1577
|
-
xml: /* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1651
|
+
xml: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1652
|
+
/* @__PURE__ */ jsx23("path", { d: "M8 7l-4.5 5 4.5 5" }),
|
|
1653
|
+
/* @__PURE__ */ jsx23("path", { d: "M16 7l4.5 5-4.5 5" }),
|
|
1654
|
+
/* @__PURE__ */ jsx23("path", { d: "M12 8v8" })
|
|
1581
1655
|
] }),
|
|
1582
|
-
yaml: /* @__PURE__ */
|
|
1583
|
-
/* @__PURE__ */
|
|
1584
|
-
/* @__PURE__ */
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1656
|
+
yaml: /* @__PURE__ */ jsxs10(LangIcon, { children: [
|
|
1657
|
+
/* @__PURE__ */ jsx23("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
|
|
1658
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 8h2M9.5 8h8" }),
|
|
1659
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 12h2M9.5 12h6" }),
|
|
1660
|
+
/* @__PURE__ */ jsx23("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1587
1661
|
] })
|
|
1588
1662
|
};
|
|
1589
1663
|
|
|
1590
1664
|
// src/icons.tsx
|
|
1591
|
-
import { Fragment as Fragment4, jsx as
|
|
1665
|
+
import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1592
1666
|
var ALIGN_PATHS = {
|
|
1593
|
-
center: /* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1596
|
-
/* @__PURE__ */
|
|
1667
|
+
center: /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1668
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1669
|
+
/* @__PURE__ */ jsx24("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1670
|
+
/* @__PURE__ */ jsx24("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1597
1671
|
] }),
|
|
1598
|
-
left: /* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
/* @__PURE__ */
|
|
1672
|
+
left: /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1673
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1674
|
+
/* @__PURE__ */ jsx24("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1675
|
+
/* @__PURE__ */ jsx24("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1602
1676
|
] }),
|
|
1603
|
-
right: /* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
/* @__PURE__ */
|
|
1606
|
-
/* @__PURE__ */
|
|
1677
|
+
right: /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1678
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1679
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1680
|
+
/* @__PURE__ */ jsx24("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1607
1681
|
] })
|
|
1608
1682
|
};
|
|
1609
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */
|
|
1683
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ jsx24(
|
|
1610
1684
|
"svg",
|
|
1611
1685
|
{
|
|
1612
1686
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1620,7 +1694,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ jsx23(
|
|
|
1620
1694
|
children: ALIGN_PATHS[dir]
|
|
1621
1695
|
}
|
|
1622
1696
|
);
|
|
1623
|
-
var EditUrlIcon = () => /* @__PURE__ */
|
|
1697
|
+
var EditUrlIcon = () => /* @__PURE__ */ jsxs11(
|
|
1624
1698
|
"svg",
|
|
1625
1699
|
{
|
|
1626
1700
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1632,12 +1706,12 @@ var EditUrlIcon = () => /* @__PURE__ */ jsxs10(
|
|
|
1632
1706
|
strokeLinejoin: "round",
|
|
1633
1707
|
className: "rte-editor-icon",
|
|
1634
1708
|
children: [
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
1709
|
+
/* @__PURE__ */ jsx24("path", { d: "M12 20h9" }),
|
|
1710
|
+
/* @__PURE__ */ jsx24("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1637
1711
|
]
|
|
1638
1712
|
}
|
|
1639
1713
|
);
|
|
1640
|
-
var OpenInYouTubeIcon = () => /* @__PURE__ */
|
|
1714
|
+
var OpenInYouTubeIcon = () => /* @__PURE__ */ jsxs11(
|
|
1641
1715
|
"svg",
|
|
1642
1716
|
{
|
|
1643
1717
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1649,13 +1723,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ jsxs10(
|
|
|
1649
1723
|
strokeLinejoin: "round",
|
|
1650
1724
|
className: "rte-editor-icon",
|
|
1651
1725
|
children: [
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1726
|
+
/* @__PURE__ */ jsx24("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1727
|
+
/* @__PURE__ */ jsx24("polyline", { points: "15 3 21 3 21 9" }),
|
|
1728
|
+
/* @__PURE__ */ jsx24("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1655
1729
|
]
|
|
1656
1730
|
}
|
|
1657
1731
|
);
|
|
1658
|
-
var DeleteEmbedIcon = () => /* @__PURE__ */
|
|
1732
|
+
var DeleteEmbedIcon = () => /* @__PURE__ */ jsxs11(
|
|
1659
1733
|
"svg",
|
|
1660
1734
|
{
|
|
1661
1735
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1667,46 +1741,46 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ jsxs10(
|
|
|
1667
1741
|
strokeLinejoin: "round",
|
|
1668
1742
|
className: "rte-editor-icon",
|
|
1669
1743
|
children: [
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1744
|
+
/* @__PURE__ */ jsx24("polyline", { points: "3 6 5 6 21 6" }),
|
|
1745
|
+
/* @__PURE__ */ jsx24("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1672
1746
|
]
|
|
1673
1747
|
}
|
|
1674
1748
|
);
|
|
1675
1749
|
var iconProps = { className: "rte-editor-icon" };
|
|
1676
1750
|
var DEFAULT_ICONS = {
|
|
1677
|
-
alignCenterControlIcon: /* @__PURE__ */
|
|
1678
|
-
alignJustifyControlIcon: /* @__PURE__ */
|
|
1679
|
-
alignLeftControlIcon: /* @__PURE__ */
|
|
1680
|
-
alignRightControlIcon: /* @__PURE__ */
|
|
1681
|
-
blockquoteControlIcon: /* @__PURE__ */
|
|
1682
|
-
boldControlIcon: /* @__PURE__ */
|
|
1683
|
-
bulletListControlIcon: /* @__PURE__ */
|
|
1684
|
-
clearFormattingControlIcon: /* @__PURE__ */
|
|
1685
|
-
codeBlockControlIcon: /* @__PURE__ */
|
|
1686
|
-
codeControlIcon: /* @__PURE__ */
|
|
1687
|
-
h1ControlIcon: /* @__PURE__ */
|
|
1688
|
-
h2ControlIcon: /* @__PURE__ */
|
|
1689
|
-
h3ControlIcon: /* @__PURE__ */
|
|
1690
|
-
h4ControlIcon: /* @__PURE__ */
|
|
1691
|
-
h5ControlIcon: /* @__PURE__ */
|
|
1692
|
-
h6ControlIcon: /* @__PURE__ */
|
|
1693
|
-
highlightControlIcon: /* @__PURE__ */
|
|
1694
|
-
hrControlIcon: /* @__PURE__ */
|
|
1695
|
-
italicControlIcon: /* @__PURE__ */
|
|
1751
|
+
alignCenterControlIcon: /* @__PURE__ */ jsx24(TextAlignCenter, { ...iconProps }),
|
|
1752
|
+
alignJustifyControlIcon: /* @__PURE__ */ jsx24(TextAlignJustify, { ...iconProps }),
|
|
1753
|
+
alignLeftControlIcon: /* @__PURE__ */ jsx24(TextAlignStart, { ...iconProps }),
|
|
1754
|
+
alignRightControlIcon: /* @__PURE__ */ jsx24(TextAlignEnd, { ...iconProps }),
|
|
1755
|
+
blockquoteControlIcon: /* @__PURE__ */ jsx24(TextQuote, { ...iconProps }),
|
|
1756
|
+
boldControlIcon: /* @__PURE__ */ jsx24(Bold, { ...iconProps }),
|
|
1757
|
+
bulletListControlIcon: /* @__PURE__ */ jsx24(List, { ...iconProps }),
|
|
1758
|
+
clearFormattingControlIcon: /* @__PURE__ */ jsx24(RemoveFormatting, { ...iconProps }),
|
|
1759
|
+
codeBlockControlIcon: /* @__PURE__ */ jsx24(SquareCode, { ...iconProps }),
|
|
1760
|
+
codeControlIcon: /* @__PURE__ */ jsx24(Code, { ...iconProps }),
|
|
1761
|
+
h1ControlIcon: /* @__PURE__ */ jsx24(Heading1, { ...iconProps }),
|
|
1762
|
+
h2ControlIcon: /* @__PURE__ */ jsx24(Heading2, { ...iconProps }),
|
|
1763
|
+
h3ControlIcon: /* @__PURE__ */ jsx24(Heading3, { ...iconProps }),
|
|
1764
|
+
h4ControlIcon: /* @__PURE__ */ jsx24(Heading4, { ...iconProps }),
|
|
1765
|
+
h5ControlIcon: /* @__PURE__ */ jsx24(Heading5, { ...iconProps }),
|
|
1766
|
+
h6ControlIcon: /* @__PURE__ */ jsx24(Heading6, { ...iconProps }),
|
|
1767
|
+
highlightControlIcon: /* @__PURE__ */ jsx24(Highlighter, { ...iconProps }),
|
|
1768
|
+
hrControlIcon: /* @__PURE__ */ jsx24(Minus, { ...iconProps }),
|
|
1769
|
+
italicControlIcon: /* @__PURE__ */ jsx24(Italic, { ...iconProps }),
|
|
1696
1770
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1697
|
-
linkControlIcon: /* @__PURE__ */
|
|
1698
|
-
orderedListControlIcon: /* @__PURE__ */
|
|
1699
|
-
redoControlIcon: /* @__PURE__ */
|
|
1700
|
-
strikeControlIcon: /* @__PURE__ */
|
|
1701
|
-
subscriptControlIcon: /* @__PURE__ */
|
|
1702
|
-
superscriptControlIcon: /* @__PURE__ */
|
|
1703
|
-
underlineControlIcon: /* @__PURE__ */
|
|
1704
|
-
undoControlIcon: /* @__PURE__ */
|
|
1705
|
-
unlinkControlIcon: /* @__PURE__ */
|
|
1771
|
+
linkControlIcon: /* @__PURE__ */ jsx24(Link, { ...iconProps }),
|
|
1772
|
+
orderedListControlIcon: /* @__PURE__ */ jsx24(ListOrdered, { ...iconProps }),
|
|
1773
|
+
redoControlIcon: /* @__PURE__ */ jsx24(Redo2, { ...iconProps }),
|
|
1774
|
+
strikeControlIcon: /* @__PURE__ */ jsx24(Strikethrough, { ...iconProps }),
|
|
1775
|
+
subscriptControlIcon: /* @__PURE__ */ jsx24(Subscript, { ...iconProps }),
|
|
1776
|
+
superscriptControlIcon: /* @__PURE__ */ jsx24(Superscript, { ...iconProps }),
|
|
1777
|
+
underlineControlIcon: /* @__PURE__ */ jsx24(Underline, { ...iconProps }),
|
|
1778
|
+
undoControlIcon: /* @__PURE__ */ jsx24(Undo2, { ...iconProps }),
|
|
1779
|
+
unlinkControlIcon: /* @__PURE__ */ jsx24(Link2Off, { ...iconProps })
|
|
1706
1780
|
};
|
|
1707
1781
|
|
|
1708
1782
|
// src/extensions/resizable-node-view.tsx
|
|
1709
|
-
import { Fragment as Fragment5, jsx as
|
|
1783
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1710
1784
|
var EmbedToolbar = ({
|
|
1711
1785
|
align,
|
|
1712
1786
|
videoSrc,
|
|
@@ -1723,8 +1797,8 @@ var EmbedToolbar = ({
|
|
|
1723
1797
|
nodeSrc
|
|
1724
1798
|
}) => {
|
|
1725
1799
|
if (isEditingUrl) {
|
|
1726
|
-
return /* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
1800
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rte-embed-selector-edit-form", children: [
|
|
1801
|
+
/* @__PURE__ */ jsx25(
|
|
1728
1802
|
"input",
|
|
1729
1803
|
{
|
|
1730
1804
|
ref: inputRef,
|
|
@@ -1742,7 +1816,7 @@ var EmbedToolbar = ({
|
|
|
1742
1816
|
}
|
|
1743
1817
|
}
|
|
1744
1818
|
),
|
|
1745
|
-
/* @__PURE__ */
|
|
1819
|
+
/* @__PURE__ */ jsx25(
|
|
1746
1820
|
"button",
|
|
1747
1821
|
{
|
|
1748
1822
|
type: "button",
|
|
@@ -1751,7 +1825,7 @@ var EmbedToolbar = ({
|
|
|
1751
1825
|
children: "Save"
|
|
1752
1826
|
}
|
|
1753
1827
|
),
|
|
1754
|
-
/* @__PURE__ */
|
|
1828
|
+
/* @__PURE__ */ jsx25(
|
|
1755
1829
|
"button",
|
|
1756
1830
|
{
|
|
1757
1831
|
type: "button",
|
|
@@ -1762,8 +1836,8 @@ var EmbedToolbar = ({
|
|
|
1762
1836
|
)
|
|
1763
1837
|
] });
|
|
1764
1838
|
}
|
|
1765
|
-
return /* @__PURE__ */
|
|
1766
|
-
/* @__PURE__ */
|
|
1839
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
1840
|
+
/* @__PURE__ */ jsx25("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ jsx25(
|
|
1767
1841
|
"button",
|
|
1768
1842
|
{
|
|
1769
1843
|
type: "button",
|
|
@@ -1771,12 +1845,12 @@ var EmbedToolbar = ({
|
|
|
1771
1845
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1772
1846
|
className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
|
|
1773
1847
|
onClick: () => updateAttributes({ align: dir }),
|
|
1774
|
-
children: /* @__PURE__ */
|
|
1848
|
+
children: /* @__PURE__ */ jsx25(AlignIcon, { dir })
|
|
1775
1849
|
},
|
|
1776
1850
|
dir
|
|
1777
1851
|
)) }),
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1852
|
+
/* @__PURE__ */ jsx25("div", { className: "rte-embed-selector-divider" }),
|
|
1853
|
+
/* @__PURE__ */ jsx25("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ jsxs12(
|
|
1780
1854
|
"button",
|
|
1781
1855
|
{
|
|
1782
1856
|
type: "button",
|
|
@@ -1790,9 +1864,9 @@ var EmbedToolbar = ({
|
|
|
1790
1864
|
},
|
|
1791
1865
|
pct
|
|
1792
1866
|
)) }),
|
|
1793
|
-
/* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1795
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */
|
|
1867
|
+
/* @__PURE__ */ jsx25("div", { className: "rte-embed-selector-divider" }),
|
|
1868
|
+
/* @__PURE__ */ jsxs12("div", { className: "rte-embed-selector-group", children: [
|
|
1869
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ jsx25(
|
|
1796
1870
|
"button",
|
|
1797
1871
|
{
|
|
1798
1872
|
type: "button",
|
|
@@ -1803,10 +1877,10 @@ var EmbedToolbar = ({
|
|
|
1803
1877
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1804
1878
|
setIsEditingUrl(true);
|
|
1805
1879
|
},
|
|
1806
|
-
children: /* @__PURE__ */
|
|
1880
|
+
children: /* @__PURE__ */ jsx25(EditUrlIcon, {})
|
|
1807
1881
|
}
|
|
1808
1882
|
),
|
|
1809
|
-
watchUrl && /* @__PURE__ */
|
|
1883
|
+
watchUrl && /* @__PURE__ */ jsx25(
|
|
1810
1884
|
"button",
|
|
1811
1885
|
{
|
|
1812
1886
|
type: "button",
|
|
@@ -1814,10 +1888,10 @@ var EmbedToolbar = ({
|
|
|
1814
1888
|
"aria-label": "Open video in YouTube",
|
|
1815
1889
|
className: "rte-embed-selector-btn",
|
|
1816
1890
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1817
|
-
children: /* @__PURE__ */
|
|
1891
|
+
children: /* @__PURE__ */ jsx25(OpenInYouTubeIcon, {})
|
|
1818
1892
|
}
|
|
1819
1893
|
),
|
|
1820
|
-
deleteNode && /* @__PURE__ */
|
|
1894
|
+
deleteNode && /* @__PURE__ */ jsx25(
|
|
1821
1895
|
"button",
|
|
1822
1896
|
{
|
|
1823
1897
|
type: "button",
|
|
@@ -1825,7 +1899,7 @@ var EmbedToolbar = ({
|
|
|
1825
1899
|
"aria-label": "Delete Embed",
|
|
1826
1900
|
className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
|
|
1827
1901
|
onClick: () => deleteNode(),
|
|
1828
|
-
children: /* @__PURE__ */
|
|
1902
|
+
children: /* @__PURE__ */ jsx25(DeleteEmbedIcon, {})
|
|
1829
1903
|
}
|
|
1830
1904
|
)
|
|
1831
1905
|
] })
|
|
@@ -1996,13 +2070,13 @@ var ResizableNodeView = ({
|
|
|
1996
2070
|
setIsEditingUrl(false);
|
|
1997
2071
|
};
|
|
1998
2072
|
const isEditable = editor ? editor.isEditable : true;
|
|
1999
|
-
return /* @__PURE__ */
|
|
2073
|
+
return /* @__PURE__ */ jsx25(
|
|
2000
2074
|
NodeViewWrapper,
|
|
2001
2075
|
{
|
|
2002
2076
|
className: "rte-embed-wrapper",
|
|
2003
2077
|
"data-selected": selected || void 0,
|
|
2004
2078
|
"data-align": align,
|
|
2005
|
-
children: /* @__PURE__ */
|
|
2079
|
+
children: /* @__PURE__ */ jsxs12(
|
|
2006
2080
|
"div",
|
|
2007
2081
|
{
|
|
2008
2082
|
ref: containerRef,
|
|
@@ -2015,7 +2089,7 @@ var ResizableNodeView = ({
|
|
|
2015
2089
|
},
|
|
2016
2090
|
children: [
|
|
2017
2091
|
children,
|
|
2018
|
-
selected && isEditable && /* @__PURE__ */
|
|
2092
|
+
selected && isEditable && /* @__PURE__ */ jsx25("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ jsx25(
|
|
2019
2093
|
EmbedToolbar,
|
|
2020
2094
|
{
|
|
2021
2095
|
align,
|
|
@@ -2033,14 +2107,14 @@ var ResizableNodeView = ({
|
|
|
2033
2107
|
nodeSrc: node.attrs.src
|
|
2034
2108
|
}
|
|
2035
2109
|
) }),
|
|
2036
|
-
isResizing && currentDimensions && /* @__PURE__ */
|
|
2110
|
+
isResizing && currentDimensions && /* @__PURE__ */ jsxs12("div", { className: "rte-embed-resize-badge", children: [
|
|
2037
2111
|
currentDimensions.w,
|
|
2038
2112
|
" \xD7 ",
|
|
2039
2113
|
currentDimensions.h,
|
|
2040
2114
|
" px"
|
|
2041
2115
|
] }),
|
|
2042
|
-
selected && isEditable && /* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2116
|
+
selected && isEditable && /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2117
|
+
/* @__PURE__ */ jsx25(
|
|
2044
2118
|
"div",
|
|
2045
2119
|
{
|
|
2046
2120
|
className: "rte-resize-handle rte-resize-handle--left",
|
|
@@ -2048,7 +2122,7 @@ var ResizableNodeView = ({
|
|
|
2048
2122
|
role: "presentation"
|
|
2049
2123
|
}
|
|
2050
2124
|
),
|
|
2051
|
-
/* @__PURE__ */
|
|
2125
|
+
/* @__PURE__ */ jsx25(
|
|
2052
2126
|
"div",
|
|
2053
2127
|
{
|
|
2054
2128
|
className: "rte-resize-handle rte-resize-handle--right",
|
|
@@ -2056,7 +2130,7 @@ var ResizableNodeView = ({
|
|
|
2056
2130
|
role: "presentation"
|
|
2057
2131
|
}
|
|
2058
2132
|
),
|
|
2059
|
-
/* @__PURE__ */
|
|
2133
|
+
/* @__PURE__ */ jsx25(
|
|
2060
2134
|
"div",
|
|
2061
2135
|
{
|
|
2062
2136
|
className: "rte-resize-handle rte-resize-handle--bottom",
|
|
@@ -2064,7 +2138,7 @@ var ResizableNodeView = ({
|
|
|
2064
2138
|
role: "presentation"
|
|
2065
2139
|
}
|
|
2066
2140
|
),
|
|
2067
|
-
/* @__PURE__ */
|
|
2141
|
+
/* @__PURE__ */ jsx25(
|
|
2068
2142
|
"div",
|
|
2069
2143
|
{
|
|
2070
2144
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
|
|
@@ -2072,7 +2146,7 @@ var ResizableNodeView = ({
|
|
|
2072
2146
|
role: "presentation"
|
|
2073
2147
|
}
|
|
2074
2148
|
),
|
|
2075
|
-
/* @__PURE__ */
|
|
2149
|
+
/* @__PURE__ */ jsx25(
|
|
2076
2150
|
"div",
|
|
2077
2151
|
{
|
|
2078
2152
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
|
|
@@ -2089,7 +2163,7 @@ var ResizableNodeView = ({
|
|
|
2089
2163
|
};
|
|
2090
2164
|
|
|
2091
2165
|
// src/controls/rte-twitter-control.tsx
|
|
2092
|
-
import { jsx as
|
|
2166
|
+
import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2093
2167
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2094
2168
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2095
2169
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2236,7 +2310,7 @@ var TwitterNodeView = (props) => {
|
|
|
2236
2310
|
retryToken.current += 1;
|
|
2237
2311
|
setRetryCount(retryToken.current);
|
|
2238
2312
|
}, []);
|
|
2239
|
-
return /* @__PURE__ */
|
|
2313
|
+
return /* @__PURE__ */ jsxs13(
|
|
2240
2314
|
ResizableNodeView,
|
|
2241
2315
|
{
|
|
2242
2316
|
...props,
|
|
@@ -2244,17 +2318,31 @@ var TwitterNodeView = (props) => {
|
|
|
2244
2318
|
minWidth: 300,
|
|
2245
2319
|
maxWidth: 1200,
|
|
2246
2320
|
children: [
|
|
2247
|
-
loading && /* @__PURE__ */
|
|
2248
|
-
!loading && failed && /* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2321
|
+
loading && /* @__PURE__ */ jsx26("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
|
|
2322
|
+
!loading && failed && /* @__PURE__ */ jsxs13("div", { className: "rte-embed-error", children: [
|
|
2323
|
+
/* @__PURE__ */ jsx26("p", { children: "Couldn't load this tweet." }),
|
|
2324
|
+
/* @__PURE__ */ jsx26("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2251
2325
|
] }),
|
|
2252
|
-
/* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ jsx26("div", { ref: containerRef })
|
|
2253
2327
|
]
|
|
2254
2328
|
}
|
|
2255
2329
|
);
|
|
2256
2330
|
};
|
|
2257
2331
|
var TwitterEmbed = Node.create({
|
|
2332
|
+
...createAtomBlockMarkdownSpec({
|
|
2333
|
+
allowedAttributes: ["tweetId", "width", "height", "align"],
|
|
2334
|
+
nodeName: "twitter",
|
|
2335
|
+
parseAttributes: (text) => {
|
|
2336
|
+
const attrs = parseAttributes(text);
|
|
2337
|
+
for (const key of ["width", "height"]) {
|
|
2338
|
+
if (key in attrs) {
|
|
2339
|
+
attrs[key] = Number(attrs[key]);
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
return attrs;
|
|
2343
|
+
},
|
|
2344
|
+
requiredAttributes: ["tweetId"]
|
|
2345
|
+
}),
|
|
2258
2346
|
addAttributes() {
|
|
2259
2347
|
return {
|
|
2260
2348
|
align: {
|
|
@@ -2363,7 +2451,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2363
2451
|
resetState();
|
|
2364
2452
|
return true;
|
|
2365
2453
|
}, [tweetId, editor, resetState]);
|
|
2366
|
-
return /* @__PURE__ */
|
|
2454
|
+
return /* @__PURE__ */ jsxs13(
|
|
2367
2455
|
Dialog,
|
|
2368
2456
|
{
|
|
2369
2457
|
open,
|
|
@@ -2374,36 +2462,36 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2374
2462
|
}
|
|
2375
2463
|
},
|
|
2376
2464
|
children: [
|
|
2377
|
-
/* @__PURE__ */
|
|
2465
|
+
/* @__PURE__ */ jsx26(
|
|
2378
2466
|
DialogTrigger,
|
|
2379
2467
|
{
|
|
2380
|
-
render: /* @__PURE__ */
|
|
2468
|
+
render: /* @__PURE__ */ jsx26(
|
|
2381
2469
|
RichTextEditorControl,
|
|
2382
2470
|
{
|
|
2383
2471
|
active,
|
|
2384
2472
|
className,
|
|
2385
2473
|
title: "Embed Tweet",
|
|
2386
2474
|
"aria-label": "Embed Tweet",
|
|
2387
|
-
children: /* @__PURE__ */
|
|
2475
|
+
children: /* @__PURE__ */ jsx26(
|
|
2388
2476
|
"svg",
|
|
2389
2477
|
{
|
|
2390
2478
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2391
2479
|
viewBox: "0 0 24 24",
|
|
2392
2480
|
fill: "currentColor",
|
|
2393
2481
|
className: "rte-editor-icon",
|
|
2394
|
-
children: /* @__PURE__ */
|
|
2482
|
+
children: /* @__PURE__ */ jsx26("path", { d: "M18.2 3.2h3.3l-7.2 8.2 8.5 11.2h-6.6l-5.2-6.8-6 6.8H2.7l7.7-8.8L2.3 3.2h6.8l4.7 6.2 5.4-6.2zm-1.2 17.3h1.8L7 4.8H5.1l11.9 15.7z" })
|
|
2395
2483
|
}
|
|
2396
2484
|
)
|
|
2397
2485
|
}
|
|
2398
2486
|
)
|
|
2399
2487
|
}
|
|
2400
2488
|
),
|
|
2401
|
-
/* @__PURE__ */
|
|
2402
|
-
/* @__PURE__ */
|
|
2403
|
-
/* @__PURE__ */
|
|
2404
|
-
/* @__PURE__ */
|
|
2489
|
+
/* @__PURE__ */ jsxs13(DialogContent, { children: [
|
|
2490
|
+
/* @__PURE__ */ jsxs13(DialogHeader, { children: [
|
|
2491
|
+
/* @__PURE__ */ jsx26(DialogTitle, { children: "Embed Tweet" }),
|
|
2492
|
+
/* @__PURE__ */ jsx26(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2405
2493
|
] }),
|
|
2406
|
-
/* @__PURE__ */
|
|
2494
|
+
/* @__PURE__ */ jsx26(
|
|
2407
2495
|
Input,
|
|
2408
2496
|
{
|
|
2409
2497
|
value: url,
|
|
@@ -2423,10 +2511,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2423
2511
|
}
|
|
2424
2512
|
}
|
|
2425
2513
|
),
|
|
2426
|
-
showError && /* @__PURE__ */
|
|
2427
|
-
/* @__PURE__ */
|
|
2428
|
-
/* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2514
|
+
showError && /* @__PURE__ */ jsx26("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2515
|
+
/* @__PURE__ */ jsxs13(DialogFooter, { children: [
|
|
2516
|
+
/* @__PURE__ */ jsx26(DialogClose, { children: "Cancel" }),
|
|
2517
|
+
/* @__PURE__ */ jsx26(
|
|
2430
2518
|
"button",
|
|
2431
2519
|
{
|
|
2432
2520
|
type: "button",
|
|
@@ -2448,10 +2536,15 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2448
2536
|
};
|
|
2449
2537
|
|
|
2450
2538
|
// src/controls/rte-youtube-control.tsx
|
|
2451
|
-
import {
|
|
2539
|
+
import {
|
|
2540
|
+
createAtomBlockMarkdownSpec as createAtomBlockMarkdownSpec2,
|
|
2541
|
+
Node as Node2,
|
|
2542
|
+
nodeInputRule as nodeInputRule2,
|
|
2543
|
+
parseAttributes as parseAttributes2
|
|
2544
|
+
} from "@tiptap/core";
|
|
2452
2545
|
import { ReactNodeViewRenderer as ReactNodeViewRenderer2, useEditorState as useEditorState5 } from "@tiptap/react";
|
|
2453
2546
|
import { useState as useState7, useCallback as useCallback7 } from "react";
|
|
2454
|
-
import { jsx as
|
|
2547
|
+
import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2455
2548
|
var getYouTubeId = (url) => {
|
|
2456
2549
|
const clean = url.trim();
|
|
2457
2550
|
const patterns = [
|
|
@@ -2479,7 +2572,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2479
2572
|
if (videoId) {
|
|
2480
2573
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2481
2574
|
}
|
|
2482
|
-
return /* @__PURE__ */
|
|
2575
|
+
return /* @__PURE__ */ jsx27(
|
|
2483
2576
|
ResizableNodeView,
|
|
2484
2577
|
{
|
|
2485
2578
|
...props,
|
|
@@ -2490,7 +2583,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2490
2583
|
videoSrc: rawSrc,
|
|
2491
2584
|
watchUrl,
|
|
2492
2585
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2493
|
-
children: /* @__PURE__ */
|
|
2586
|
+
children: /* @__PURE__ */ jsx27(
|
|
2494
2587
|
"iframe",
|
|
2495
2588
|
{
|
|
2496
2589
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2504,6 +2597,20 @@ var YouTubeNodeView = (props) => {
|
|
|
2504
2597
|
);
|
|
2505
2598
|
};
|
|
2506
2599
|
var YouTubeEmbed = Node2.create({
|
|
2600
|
+
...createAtomBlockMarkdownSpec2({
|
|
2601
|
+
allowedAttributes: ["src", "width", "height", "align"],
|
|
2602
|
+
nodeName: "youtube",
|
|
2603
|
+
parseAttributes: (text) => {
|
|
2604
|
+
const attrs = parseAttributes2(text);
|
|
2605
|
+
for (const key of ["width", "height"]) {
|
|
2606
|
+
if (key in attrs) {
|
|
2607
|
+
attrs[key] = Number(attrs[key]);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
return attrs;
|
|
2611
|
+
},
|
|
2612
|
+
requiredAttributes: ["src"]
|
|
2613
|
+
}),
|
|
2507
2614
|
addAttributes() {
|
|
2508
2615
|
return {
|
|
2509
2616
|
align: {
|
|
@@ -2592,18 +2699,18 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2592
2699
|
setUrl("");
|
|
2593
2700
|
}
|
|
2594
2701
|
}, [url, editor]);
|
|
2595
|
-
return /* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2702
|
+
return /* @__PURE__ */ jsxs14(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2703
|
+
/* @__PURE__ */ jsx27(
|
|
2597
2704
|
DialogTrigger,
|
|
2598
2705
|
{
|
|
2599
|
-
render: /* @__PURE__ */
|
|
2706
|
+
render: /* @__PURE__ */ jsx27(
|
|
2600
2707
|
RichTextEditorControl,
|
|
2601
2708
|
{
|
|
2602
2709
|
active,
|
|
2603
2710
|
className,
|
|
2604
2711
|
title: "Embed YouTube video",
|
|
2605
2712
|
"aria-label": "Embed YouTube video",
|
|
2606
|
-
children: /* @__PURE__ */
|
|
2713
|
+
children: /* @__PURE__ */ jsxs14(
|
|
2607
2714
|
"svg",
|
|
2608
2715
|
{
|
|
2609
2716
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2615,8 +2722,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2615
2722
|
strokeLinejoin: "round",
|
|
2616
2723
|
className: "rte-editor-icon",
|
|
2617
2724
|
children: [
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2725
|
+
/* @__PURE__ */ jsx27("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.5 12 3.5 12 3.5s-7.5 0-9.4.6a3 3 0 0 0-2.1 2.1C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8z" }),
|
|
2726
|
+
/* @__PURE__ */ jsx27("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2620
2727
|
]
|
|
2621
2728
|
}
|
|
2622
2729
|
)
|
|
@@ -2624,12 +2731,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2624
2731
|
)
|
|
2625
2732
|
}
|
|
2626
2733
|
),
|
|
2627
|
-
/* @__PURE__ */
|
|
2628
|
-
/* @__PURE__ */
|
|
2629
|
-
/* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
2734
|
+
/* @__PURE__ */ jsxs14(DialogContent, { showCloseButton: false, children: [
|
|
2735
|
+
/* @__PURE__ */ jsxs14(DialogHeader, { children: [
|
|
2736
|
+
/* @__PURE__ */ jsx27(DialogTitle, { children: "Embed YouTube video" }),
|
|
2737
|
+
/* @__PURE__ */ jsx27(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2631
2738
|
] }),
|
|
2632
|
-
/* @__PURE__ */
|
|
2739
|
+
/* @__PURE__ */ jsx27(
|
|
2633
2740
|
Input,
|
|
2634
2741
|
{
|
|
2635
2742
|
value: url,
|
|
@@ -2643,9 +2750,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2643
2750
|
}
|
|
2644
2751
|
}
|
|
2645
2752
|
),
|
|
2646
|
-
/* @__PURE__ */
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsxs14(DialogFooter, { children: [
|
|
2754
|
+
/* @__PURE__ */ jsx27(DialogClose, { children: "Cancel" }),
|
|
2755
|
+
/* @__PURE__ */ jsx27(
|
|
2649
2756
|
DialogClose,
|
|
2650
2757
|
{
|
|
2651
2758
|
disabled: !url,
|
|
@@ -2702,18 +2809,19 @@ var DEFAULT_LABELS = {
|
|
|
2702
2809
|
|
|
2703
2810
|
// src/rte-content.tsx
|
|
2704
2811
|
import { EditorContent } from "@tiptap/react";
|
|
2705
|
-
import { jsx as
|
|
2812
|
+
import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2706
2813
|
var Content = ({
|
|
2707
2814
|
children,
|
|
2708
2815
|
className
|
|
2709
2816
|
}) => {
|
|
2710
2817
|
const { editor } = useRichTextEditorContext();
|
|
2711
|
-
return /* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2818
|
+
return /* @__PURE__ */ jsxs15("div", { className: "relative", children: [
|
|
2819
|
+
/* @__PURE__ */ jsx28(
|
|
2713
2820
|
EditorContent,
|
|
2714
2821
|
{
|
|
2715
2822
|
editor,
|
|
2716
|
-
className: cn("rte-content w-full", className)
|
|
2823
|
+
className: cn("rte-content w-full", className),
|
|
2824
|
+
spellCheck: false
|
|
2717
2825
|
}
|
|
2718
2826
|
),
|
|
2719
2827
|
children
|
|
@@ -2721,15 +2829,15 @@ var Content = ({
|
|
|
2721
2829
|
};
|
|
2722
2830
|
|
|
2723
2831
|
// src/rte-controls-group.tsx
|
|
2724
|
-
import { jsx as
|
|
2832
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2725
2833
|
var ControlsGroup = ({
|
|
2726
2834
|
children,
|
|
2727
2835
|
className
|
|
2728
|
-
}) => /* @__PURE__ */
|
|
2836
|
+
}) => /* @__PURE__ */ jsx29("div", { className: cn("rte-controls-group", className), children });
|
|
2729
2837
|
|
|
2730
2838
|
// src/rte-footer.tsx
|
|
2731
2839
|
import { useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState8 } from "react";
|
|
2732
|
-
import { Fragment as Fragment6, jsx as
|
|
2840
|
+
import { Fragment as Fragment6, jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2733
2841
|
var Footer = ({
|
|
2734
2842
|
children,
|
|
2735
2843
|
className,
|
|
@@ -2788,7 +2896,7 @@ var Footer = ({
|
|
|
2788
2896
|
if (!showWordCount && !children) {
|
|
2789
2897
|
return null;
|
|
2790
2898
|
}
|
|
2791
|
-
return /* @__PURE__ */
|
|
2899
|
+
return /* @__PURE__ */ jsxs16(
|
|
2792
2900
|
"div",
|
|
2793
2901
|
{
|
|
2794
2902
|
className: cn(
|
|
@@ -2800,21 +2908,21 @@ var Footer = ({
|
|
|
2800
2908
|
"data-sticky": sticky ? "" : void 0,
|
|
2801
2909
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2802
2910
|
children: [
|
|
2803
|
-
showWordCount && wordCount && /* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
2806
|
-
/* @__PURE__ */
|
|
2911
|
+
showWordCount && wordCount && /* @__PURE__ */ jsx30("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
|
2912
|
+
/* @__PURE__ */ jsxs16("span", { className: "rte-footer-word-count-stat", children: [
|
|
2913
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
|
|
2914
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-unit", children: "words" })
|
|
2807
2915
|
] }),
|
|
2808
|
-
/* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ jsx30(
|
|
2809
2917
|
"span",
|
|
2810
2918
|
{
|
|
2811
2919
|
className: "rte-footer-word-count-separator",
|
|
2812
2920
|
"aria-hidden": "true"
|
|
2813
2921
|
}
|
|
2814
2922
|
),
|
|
2815
|
-
/* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
2923
|
+
/* @__PURE__ */ jsxs16("span", { className: "rte-footer-word-count-stat", children: [
|
|
2924
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
|
|
2925
|
+
/* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-unit", children: "characters" })
|
|
2818
2926
|
] })
|
|
2819
2927
|
] }) }),
|
|
2820
2928
|
children
|
|
@@ -2824,7 +2932,7 @@ var Footer = ({
|
|
|
2824
2932
|
};
|
|
2825
2933
|
|
|
2826
2934
|
// src/rte-toolbar.tsx
|
|
2827
|
-
import { jsx as
|
|
2935
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2828
2936
|
var Toolbar = ({
|
|
2829
2937
|
children,
|
|
2830
2938
|
className,
|
|
@@ -2835,7 +2943,7 @@ var Toolbar = ({
|
|
|
2835
2943
|
if (!editable) {
|
|
2836
2944
|
return null;
|
|
2837
2945
|
}
|
|
2838
|
-
return /* @__PURE__ */
|
|
2946
|
+
return /* @__PURE__ */ jsx31(
|
|
2839
2947
|
"div",
|
|
2840
2948
|
{
|
|
2841
2949
|
className: cn(
|
|
@@ -2852,7 +2960,7 @@ var Toolbar = ({
|
|
|
2852
2960
|
};
|
|
2853
2961
|
|
|
2854
2962
|
// src/rte-text-editor.tsx
|
|
2855
|
-
import { jsx as
|
|
2963
|
+
import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2856
2964
|
var RichTextEditorRoot = ({
|
|
2857
2965
|
editor,
|
|
2858
2966
|
children,
|
|
@@ -2867,12 +2975,13 @@ var RichTextEditorRoot = ({
|
|
|
2867
2975
|
[labels]
|
|
2868
2976
|
);
|
|
2869
2977
|
const mergedIcons = useMemo2(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
2978
|
+
const [tooltip] = useState9(() => TooltipPrimitive2.createHandle());
|
|
2870
2979
|
useEffect6(() => {
|
|
2871
2980
|
if (editor && editor.isEditable !== editable) {
|
|
2872
2981
|
editor.setEditable(editable);
|
|
2873
2982
|
}
|
|
2874
2983
|
}, [editor, editable]);
|
|
2875
|
-
return /* @__PURE__ */
|
|
2984
|
+
return /* @__PURE__ */ jsx32(
|
|
2876
2985
|
RichTextEditorContext.Provider,
|
|
2877
2986
|
{
|
|
2878
2987
|
value: {
|
|
@@ -2880,9 +2989,10 @@ var RichTextEditorRoot = ({
|
|
|
2880
2989
|
editor,
|
|
2881
2990
|
icons: mergedIcons,
|
|
2882
2991
|
labels: mergedLabels,
|
|
2992
|
+
tooltip,
|
|
2883
2993
|
variant
|
|
2884
2994
|
},
|
|
2885
|
-
children: /* @__PURE__ */
|
|
2995
|
+
children: /* @__PURE__ */ jsx32(
|
|
2886
2996
|
"div",
|
|
2887
2997
|
{
|
|
2888
2998
|
className: cn(
|
|
@@ -2891,7 +3001,10 @@ var RichTextEditorRoot = ({
|
|
|
2891
3001
|
className
|
|
2892
3002
|
),
|
|
2893
3003
|
"data-variant": variant,
|
|
2894
|
-
children
|
|
3004
|
+
children: /* @__PURE__ */ jsxs17(TooltipProvider, { children: [
|
|
3005
|
+
children,
|
|
3006
|
+
/* @__PURE__ */ jsx32(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ jsx32(TooltipContent, { side: "bottom", children: payload }) })
|
|
3007
|
+
] })
|
|
2895
3008
|
}
|
|
2896
3009
|
)
|
|
2897
3010
|
}
|
|
@@ -2929,6 +3042,7 @@ var RichTextEditor = Object.assign(RichTextEditorRoot, {
|
|
|
2929
3042
|
Subscript: SubscriptControl,
|
|
2930
3043
|
Superscript: SuperscriptControl,
|
|
2931
3044
|
Toolbar,
|
|
3045
|
+
Tooltip: RichTextEditorTooltip,
|
|
2932
3046
|
TwitterEmbed: TwitterEmbedControl,
|
|
2933
3047
|
Underline: UnderlineControl,
|
|
2934
3048
|
Undo: UndoControl,
|