@editorcn/editor 0.3.6 → 0.3.8
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 +439 -336
- 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 +453 -340
- package/dist/index.js.map +1 -1
- package/dist/style.css +1415 -1405
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(index_exports);
|
|
45
45
|
|
|
46
46
|
// src/rte-text-editor.tsx
|
|
47
|
+
var import_tooltip5 = require("@base-ui/react/tooltip");
|
|
47
48
|
var import_react21 = require("react");
|
|
48
49
|
|
|
49
50
|
// src/bubble-menu/index.tsx
|
|
@@ -581,6 +582,56 @@ var Toggle = ({
|
|
|
581
582
|
}
|
|
582
583
|
);
|
|
583
584
|
|
|
585
|
+
// src/ui/tooltip.tsx
|
|
586
|
+
var import_tooltip = require("@base-ui/react/tooltip");
|
|
587
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
588
|
+
var TooltipProvider = ({
|
|
589
|
+
delay = 0,
|
|
590
|
+
...props
|
|
591
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
592
|
+
import_tooltip.Tooltip.Provider,
|
|
593
|
+
{
|
|
594
|
+
"data-slot": "tooltip-provider",
|
|
595
|
+
delay,
|
|
596
|
+
...props
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
var Tooltip = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Root, { "data-slot": "tooltip", ...props });
|
|
600
|
+
var TooltipTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
601
|
+
var TooltipContent = ({
|
|
602
|
+
className,
|
|
603
|
+
side = "top",
|
|
604
|
+
sideOffset = 4,
|
|
605
|
+
align = "center",
|
|
606
|
+
alignOffset = 0,
|
|
607
|
+
children,
|
|
608
|
+
...props
|
|
609
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
610
|
+
import_tooltip.Tooltip.Positioner,
|
|
611
|
+
{
|
|
612
|
+
align,
|
|
613
|
+
alignOffset,
|
|
614
|
+
side,
|
|
615
|
+
sideOffset,
|
|
616
|
+
className: "isolate z-50",
|
|
617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
618
|
+
import_tooltip.Tooltip.Popup,
|
|
619
|
+
{
|
|
620
|
+
"data-slot": "tooltip-content",
|
|
621
|
+
className: cn(
|
|
622
|
+
"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",
|
|
623
|
+
className
|
|
624
|
+
),
|
|
625
|
+
...props,
|
|
626
|
+
children: [
|
|
627
|
+
children,
|
|
628
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.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" })
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
)
|
|
632
|
+
}
|
|
633
|
+
) });
|
|
634
|
+
|
|
584
635
|
// src/bubble-menu/color-selector.tsx
|
|
585
636
|
var import_react3 = require("react");
|
|
586
637
|
|
|
@@ -692,7 +743,7 @@ var CODE_BLOCK_LANGUAGE_LABELS = {
|
|
|
692
743
|
var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
|
|
693
744
|
|
|
694
745
|
// src/bubble-menu/color-selector.tsx
|
|
695
|
-
var
|
|
746
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
696
747
|
var RECENT_KEY = "editorcn-editor-recent-colors";
|
|
697
748
|
var RECENT_LIMIT = 10;
|
|
698
749
|
var readRecentColors = () => {
|
|
@@ -786,15 +837,15 @@ var ColorSelector = ({ editor }) => {
|
|
|
786
837
|
if (!hasColor && !hasHighlight) {
|
|
787
838
|
return null;
|
|
788
839
|
}
|
|
789
|
-
return /* @__PURE__ */ (0,
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { position: "relative" }, children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
791
842
|
RteButton,
|
|
792
843
|
{
|
|
793
844
|
active: Boolean(textColor || highlightColor),
|
|
794
845
|
onMouseDown: (e) => e.preventDefault(),
|
|
795
846
|
onClick: () => setOpen(!open),
|
|
796
847
|
title: "Text color",
|
|
797
|
-
children: /* @__PURE__ */ (0,
|
|
848
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
798
849
|
"svg",
|
|
799
850
|
{
|
|
800
851
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -806,16 +857,16 @@ var ColorSelector = ({ editor }) => {
|
|
|
806
857
|
strokeLinejoin: "round",
|
|
807
858
|
className: "rte-editor-icon",
|
|
808
859
|
children: [
|
|
809
|
-
/* @__PURE__ */ (0,
|
|
810
|
-
/* @__PURE__ */ (0,
|
|
811
|
-
/* @__PURE__ */ (0,
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M4 20h16" }),
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "m6 16 6-12 6 12" }),
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M8 12h8" })
|
|
812
863
|
]
|
|
813
864
|
}
|
|
814
865
|
) })
|
|
815
866
|
}
|
|
816
867
|
),
|
|
817
|
-
open && /* @__PURE__ */ (0,
|
|
818
|
-
/* @__PURE__ */ (0,
|
|
868
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
819
870
|
RteOverlay,
|
|
820
871
|
{
|
|
821
872
|
onClick: () => setOpen(false),
|
|
@@ -826,10 +877,10 @@ var ColorSelector = ({ editor }) => {
|
|
|
826
877
|
}
|
|
827
878
|
}
|
|
828
879
|
),
|
|
829
|
-
/* @__PURE__ */ (0,
|
|
830
|
-
recent.length > 0 ? /* @__PURE__ */ (0,
|
|
831
|
-
/* @__PURE__ */ (0,
|
|
832
|
-
/* @__PURE__ */ (0,
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(RteDropdown, { variant: "color", children: [
|
|
881
|
+
recent.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
|
|
882
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
|
|
883
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
833
884
|
RteColorSwatch,
|
|
834
885
|
{
|
|
835
886
|
variant: item.type,
|
|
@@ -841,11 +892,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
841
892
|
`${item.type}-${item.color}`
|
|
842
893
|
)) })
|
|
843
894
|
] }) : null,
|
|
844
|
-
hasColor ? /* @__PURE__ */ (0,
|
|
845
|
-
recent.length > 0 && /* @__PURE__ */ (0,
|
|
846
|
-
/* @__PURE__ */ (0,
|
|
847
|
-
/* @__PURE__ */ (0,
|
|
848
|
-
/* @__PURE__ */ (0,
|
|
895
|
+
hasColor ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
896
|
+
recent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdownDivider, {}),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Text Color" }),
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
849
900
|
RteColorSwatch,
|
|
850
901
|
{
|
|
851
902
|
variant: "text",
|
|
@@ -858,11 +909,11 @@ var ColorSelector = ({ editor }) => {
|
|
|
858
909
|
)) })
|
|
859
910
|
] })
|
|
860
911
|
] }) : null,
|
|
861
|
-
hasHighlight ? /* @__PURE__ */ (0,
|
|
862
|
-
(recent.length > 0 || hasColor) && /* @__PURE__ */ (0,
|
|
863
|
-
/* @__PURE__ */ (0,
|
|
864
|
-
/* @__PURE__ */ (0,
|
|
865
|
-
/* @__PURE__ */ (0,
|
|
912
|
+
hasHighlight ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
913
|
+
(recent.length > 0 || hasColor) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdownDivider, {}),
|
|
914
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
|
|
915
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
866
917
|
RteColorSwatch,
|
|
867
918
|
{
|
|
868
919
|
variant: "highlight",
|
|
@@ -897,8 +948,8 @@ var useRichTextEditorContext = () => {
|
|
|
897
948
|
};
|
|
898
949
|
|
|
899
950
|
// src/bubble-menu/language-selector.tsx
|
|
900
|
-
var
|
|
901
|
-
var FallbackIcon = () => /* @__PURE__ */ (0,
|
|
951
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
952
|
+
var FallbackIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
902
953
|
"svg",
|
|
903
954
|
{
|
|
904
955
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -910,8 +961,8 @@ var FallbackIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
|
910
961
|
strokeLinejoin: "round",
|
|
911
962
|
className: "rte-editor-icon",
|
|
912
963
|
children: [
|
|
913
|
-
/* @__PURE__ */ (0,
|
|
914
|
-
/* @__PURE__ */ (0,
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
965
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
915
966
|
]
|
|
916
967
|
}
|
|
917
968
|
);
|
|
@@ -925,17 +976,17 @@ var LanguageSelector = ({ editor }) => {
|
|
|
925
976
|
}),
|
|
926
977
|
shallowEqual
|
|
927
978
|
);
|
|
928
|
-
const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ (0,
|
|
929
|
-
return /* @__PURE__ */ (0,
|
|
930
|
-
/* @__PURE__ */ (0,
|
|
979
|
+
const langIcon = icons.languageIcons[currentLanguage] ?? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FallbackIcon, {});
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { position: "relative" }, children: [
|
|
981
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
931
982
|
RteButton,
|
|
932
983
|
{
|
|
933
984
|
onMouseDown: (e) => e.preventDefault(),
|
|
934
985
|
onClick: () => setOpen(!open),
|
|
935
986
|
children: [
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
937
|
-
/* @__PURE__ */ (0,
|
|
938
|
-
/* @__PURE__ */ (0,
|
|
987
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteIcon, { children: langIcon }),
|
|
988
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "rte-bubble-btn-text", children: getLanguageLabel(currentLanguage) }),
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteIcon, { style: { height: 12, width: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
939
990
|
"svg",
|
|
940
991
|
{
|
|
941
992
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -945,14 +996,14 @@ var LanguageSelector = ({ editor }) => {
|
|
|
945
996
|
strokeWidth: 2,
|
|
946
997
|
strokeLinecap: "round",
|
|
947
998
|
strokeLinejoin: "round",
|
|
948
|
-
children: /* @__PURE__ */ (0,
|
|
999
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "m6 9 6 6 6-6" })
|
|
949
1000
|
}
|
|
950
1001
|
) })
|
|
951
1002
|
]
|
|
952
1003
|
}
|
|
953
1004
|
),
|
|
954
|
-
open && /* @__PURE__ */ (0,
|
|
955
|
-
/* @__PURE__ */ (0,
|
|
1005
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
956
1007
|
RteOverlay,
|
|
957
1008
|
{
|
|
958
1009
|
onClick: () => setOpen(false),
|
|
@@ -963,7 +1014,7 @@ var LanguageSelector = ({ editor }) => {
|
|
|
963
1014
|
}
|
|
964
1015
|
}
|
|
965
1016
|
),
|
|
966
|
-
/* @__PURE__ */ (0,
|
|
1017
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteDropdown, { variant: "language", children: CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
967
1018
|
RteDropdownItem,
|
|
968
1019
|
{
|
|
969
1020
|
active: currentLanguage === lang,
|
|
@@ -973,8 +1024,8 @@ var LanguageSelector = ({ editor }) => {
|
|
|
973
1024
|
setOpen(false);
|
|
974
1025
|
},
|
|
975
1026
|
children: [
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
977
|
-
/* @__PURE__ */ (0,
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteDropdownIcon, { children: icons.languageIcons[lang] ?? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FallbackIcon, {}) }),
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: getLanguageLabel(lang) })
|
|
978
1029
|
]
|
|
979
1030
|
},
|
|
980
1031
|
lang
|
|
@@ -984,11 +1035,11 @@ var LanguageSelector = ({ editor }) => {
|
|
|
984
1035
|
};
|
|
985
1036
|
|
|
986
1037
|
// src/bubble-menu/text-buttons.tsx
|
|
987
|
-
var
|
|
1038
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
988
1039
|
var Svg = ({
|
|
989
1040
|
children,
|
|
990
1041
|
strokeWidth = 2
|
|
991
|
-
}) => /* @__PURE__ */ (0,
|
|
1042
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
992
1043
|
"svg",
|
|
993
1044
|
{
|
|
994
1045
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1002,47 +1053,47 @@ var Svg = ({
|
|
|
1002
1053
|
children
|
|
1003
1054
|
}
|
|
1004
1055
|
);
|
|
1005
|
-
var Icon = ({ children }) => /* @__PURE__ */ (0,
|
|
1056
|
+
var Icon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RteIcon, { children });
|
|
1006
1057
|
var textItems = [
|
|
1007
1058
|
{
|
|
1008
1059
|
command: (e) => e.chain().focus().toggleBold().run(),
|
|
1009
|
-
icon: /* @__PURE__ */ (0,
|
|
1010
|
-
/* @__PURE__ */ (0,
|
|
1011
|
-
/* @__PURE__ */ (0,
|
|
1060
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Svg, { children: [
|
|
1061
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
|
|
1062
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
|
|
1012
1063
|
] }) }),
|
|
1013
1064
|
isActive: (s) => s.isBold
|
|
1014
1065
|
},
|
|
1015
1066
|
{
|
|
1016
1067
|
command: (e) => e.chain().focus().toggleItalic().run(),
|
|
1017
|
-
icon: /* @__PURE__ */ (0,
|
|
1018
|
-
/* @__PURE__ */ (0,
|
|
1019
|
-
/* @__PURE__ */ (0,
|
|
1020
|
-
/* @__PURE__ */ (0,
|
|
1068
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Svg, { children: [
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
1070
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
1021
1072
|
] }) }),
|
|
1022
1073
|
isActive: (s) => s.isItalic
|
|
1023
1074
|
},
|
|
1024
1075
|
{
|
|
1025
1076
|
command: (e) => e.chain().focus().toggleUnderline().run(),
|
|
1026
|
-
icon: /* @__PURE__ */ (0,
|
|
1027
|
-
/* @__PURE__ */ (0,
|
|
1028
|
-
/* @__PURE__ */ (0,
|
|
1077
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Svg, { children: [
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
|
|
1029
1080
|
] }) }),
|
|
1030
1081
|
isActive: (s) => s.isUnderline
|
|
1031
1082
|
},
|
|
1032
1083
|
{
|
|
1033
1084
|
command: (e) => e.chain().focus().toggleStrike().run(),
|
|
1034
|
-
icon: /* @__PURE__ */ (0,
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1036
|
-
/* @__PURE__ */ (0,
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1085
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Svg, { children: [
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
|
|
1087
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
1038
1089
|
] }) }),
|
|
1039
1090
|
isActive: (s) => s.isStrike
|
|
1040
1091
|
},
|
|
1041
1092
|
{
|
|
1042
1093
|
command: (e) => e.chain().focus().toggleCode().run(),
|
|
1043
|
-
icon: /* @__PURE__ */ (0,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1045
|
-
/* @__PURE__ */ (0,
|
|
1094
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Svg, { children: [
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
1096
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
1046
1097
|
] }) }),
|
|
1047
1098
|
isActive: (s) => s.isCode
|
|
1048
1099
|
}
|
|
@@ -1059,7 +1110,7 @@ var TextButtons = ({ editor }) => {
|
|
|
1059
1110
|
}),
|
|
1060
1111
|
shallowEqual
|
|
1061
1112
|
);
|
|
1062
|
-
return /* @__PURE__ */ (0,
|
|
1113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RteButtonGroup, { children: textItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1063
1114
|
RteButton,
|
|
1064
1115
|
{
|
|
1065
1116
|
active: item.isActive(editorState),
|
|
@@ -1072,7 +1123,7 @@ var TextButtons = ({ editor }) => {
|
|
|
1072
1123
|
};
|
|
1073
1124
|
|
|
1074
1125
|
// src/bubble-menu/index.tsx
|
|
1075
|
-
var
|
|
1126
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1076
1127
|
var BubbleMenu = ({ editor }) => {
|
|
1077
1128
|
const editorState = useEditorState(
|
|
1078
1129
|
editor,
|
|
@@ -1104,16 +1155,16 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1104
1155
|
return null;
|
|
1105
1156
|
}
|
|
1106
1157
|
const isCodeBlockActive = editorState?.isCodeBlock ?? false;
|
|
1107
|
-
return /* @__PURE__ */ (0,
|
|
1158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1108
1159
|
import_menus.BubbleMenu,
|
|
1109
1160
|
{
|
|
1110
1161
|
editor,
|
|
1111
1162
|
options: { offset: 8, placement: "top" },
|
|
1112
1163
|
shouldShow,
|
|
1113
|
-
children: /* @__PURE__ */ (0,
|
|
1114
|
-
/* @__PURE__ */ (0,
|
|
1115
|
-
/* @__PURE__ */ (0,
|
|
1116
|
-
/* @__PURE__ */ (0,
|
|
1164
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "rte-bubble-menu", children: isCodeBlockActive ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LanguageSelector, { editor }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TextButtons, { editor }),
|
|
1166
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RteSeparator, {}),
|
|
1167
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ColorSelector, { editor })
|
|
1117
1168
|
] }) })
|
|
1118
1169
|
}
|
|
1119
1170
|
);
|
|
@@ -1122,7 +1173,17 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1122
1173
|
// src/controls/rte-control.tsx
|
|
1123
1174
|
var import_react7 = require("@tiptap/react");
|
|
1124
1175
|
var import_react8 = require("react");
|
|
1125
|
-
var
|
|
1176
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1177
|
+
var RichTextEditorTooltip = ({
|
|
1178
|
+
children,
|
|
1179
|
+
label
|
|
1180
|
+
}) => {
|
|
1181
|
+
const tooltip = (0, import_react8.useContext)(RichTextEditorContext)?.tooltip;
|
|
1182
|
+
if (!tooltip) {
|
|
1183
|
+
return children;
|
|
1184
|
+
}
|
|
1185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { handle: tooltip, payload: label, render: children });
|
|
1186
|
+
};
|
|
1126
1187
|
var RichTextEditorControl = ({
|
|
1127
1188
|
active = false,
|
|
1128
1189
|
interactive: _interactive = true,
|
|
@@ -1132,23 +1193,25 @@ var RichTextEditorControl = ({
|
|
|
1132
1193
|
onClick,
|
|
1133
1194
|
disabled,
|
|
1134
1195
|
...props
|
|
1135
|
-
}) =>
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
);
|
|
1196
|
+
}) => {
|
|
1197
|
+
const toggle = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1198
|
+
Toggle,
|
|
1199
|
+
{
|
|
1200
|
+
size: "sm",
|
|
1201
|
+
pressed: active,
|
|
1202
|
+
disabled,
|
|
1203
|
+
"aria-label": props["aria-label"],
|
|
1204
|
+
className: cn("rte-control-button", className),
|
|
1205
|
+
onMouseDown: (e) => {
|
|
1206
|
+
e.preventDefault();
|
|
1207
|
+
onMouseDown?.(e);
|
|
1208
|
+
},
|
|
1209
|
+
onPressedChange: () => onClick?.({}),
|
|
1210
|
+
children
|
|
1211
|
+
}
|
|
1212
|
+
);
|
|
1213
|
+
return props.title ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(RichTextEditorTooltip, { label: props.title, children: toggle }) : toggle;
|
|
1214
|
+
};
|
|
1152
1215
|
var resolveIsActive = (editor, config) => {
|
|
1153
1216
|
if (!editor || !config) {
|
|
1154
1217
|
return false;
|
|
@@ -1178,7 +1241,7 @@ var createControl = ({
|
|
|
1178
1241
|
const selector = createSelector(isActive, isDisabled);
|
|
1179
1242
|
(0, import_react7.useEditorState)({ editor: editor ?? null, selector });
|
|
1180
1243
|
const { active, disabled } = selector({ editor: editor ?? null });
|
|
1181
|
-
return /* @__PURE__ */ (0,
|
|
1244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1182
1245
|
RichTextEditorControl,
|
|
1183
1246
|
{
|
|
1184
1247
|
active,
|
|
@@ -1366,9 +1429,9 @@ var SuperscriptControl = createControl({
|
|
|
1366
1429
|
var import_react9 = require("@tiptap/react");
|
|
1367
1430
|
var React15 = __toESM(require("react"), 1);
|
|
1368
1431
|
var import_react10 = require("react");
|
|
1369
|
-
var
|
|
1432
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1370
1433
|
var LinkControl = () => {
|
|
1371
|
-
const { editor, labels,
|
|
1434
|
+
const { editor, icons, labels, tooltip } = useRichTextEditorContext();
|
|
1372
1435
|
const [url, setUrl] = (0, import_react10.useState)("");
|
|
1373
1436
|
const [open, setOpen] = (0, import_react10.useState)(false);
|
|
1374
1437
|
const active = (0, import_react9.useEditorState)({
|
|
@@ -1410,26 +1473,32 @@ var LinkControl = () => {
|
|
|
1410
1473
|
window.addEventListener("edit-link", handler);
|
|
1411
1474
|
return () => window.removeEventListener("edit-link", handler);
|
|
1412
1475
|
}, [handleOpen]);
|
|
1413
|
-
return /* @__PURE__ */ (0,
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1415
|
-
|
|
1476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Popover, { open, onOpenChange: handleOpen, children: [
|
|
1477
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1478
|
+
TooltipTrigger,
|
|
1416
1479
|
{
|
|
1417
|
-
|
|
1418
|
-
|
|
1480
|
+
handle: tooltip,
|
|
1481
|
+
payload: labels.linkControlLabel,
|
|
1482
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1483
|
+
PopoverTrigger,
|
|
1419
1484
|
{
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1485
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1486
|
+
Toggle,
|
|
1487
|
+
{
|
|
1488
|
+
size: "sm",
|
|
1489
|
+
pressed: active ?? false,
|
|
1490
|
+
"aria-label": labels.linkControlLabel,
|
|
1491
|
+
className: "p-0"
|
|
1492
|
+
}
|
|
1493
|
+
),
|
|
1494
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1495
|
+
children: icons.linkControlIcon
|
|
1425
1496
|
}
|
|
1426
|
-
)
|
|
1427
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1428
|
-
children: icons.linkControlIcon
|
|
1497
|
+
)
|
|
1429
1498
|
}
|
|
1430
1499
|
),
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1500
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "rte-link-editor", children: [
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1433
1502
|
Input,
|
|
1434
1503
|
{
|
|
1435
1504
|
type: "url",
|
|
@@ -1441,7 +1510,7 @@ var LinkControl = () => {
|
|
|
1441
1510
|
className: "rte-link-editor-input h-8 text-sm"
|
|
1442
1511
|
}
|
|
1443
1512
|
),
|
|
1444
|
-
/* @__PURE__ */ (0,
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1445
1514
|
Button,
|
|
1446
1515
|
{
|
|
1447
1516
|
size: "sm",
|
|
@@ -1470,11 +1539,11 @@ var import_react12 = require("react");
|
|
|
1470
1539
|
|
|
1471
1540
|
// src/language-icons.tsx
|
|
1472
1541
|
var import_react11 = require("react");
|
|
1473
|
-
var
|
|
1542
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1474
1543
|
var LangIcon = ({
|
|
1475
1544
|
children,
|
|
1476
1545
|
className
|
|
1477
|
-
}) => /* @__PURE__ */ (0,
|
|
1546
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1478
1547
|
"svg",
|
|
1479
1548
|
{
|
|
1480
1549
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1489,140 +1558,140 @@ var LangIcon = ({
|
|
|
1489
1558
|
}
|
|
1490
1559
|
);
|
|
1491
1560
|
var DEFAULT_LANGUAGE_ICONS = {
|
|
1492
|
-
bash: /* @__PURE__ */ (0,
|
|
1493
|
-
/* @__PURE__ */ (0,
|
|
1494
|
-
/* @__PURE__ */ (0,
|
|
1495
|
-
/* @__PURE__ */ (0,
|
|
1561
|
+
bash: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
|
|
1563
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
|
|
1564
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 15.5h5.5" })
|
|
1496
1565
|
] }),
|
|
1497
|
-
c: /* @__PURE__ */ (0,
|
|
1498
|
-
/* @__PURE__ */ (0,
|
|
1499
|
-
/* @__PURE__ */ (0,
|
|
1566
|
+
c: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
|
|
1500
1569
|
] }),
|
|
1501
|
-
cpp: /* @__PURE__ */ (0,
|
|
1502
|
-
/* @__PURE__ */ (0,
|
|
1503
|
-
/* @__PURE__ */ (0,
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1505
|
-
/* @__PURE__ */ (0,
|
|
1570
|
+
cpp: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1571
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
|
|
1573
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
|
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
|
|
1506
1575
|
] }),
|
|
1507
|
-
css: /* @__PURE__ */ (0,
|
|
1508
|
-
/* @__PURE__ */ (0,
|
|
1509
|
-
/* @__PURE__ */ (0,
|
|
1510
|
-
/* @__PURE__ */ (0,
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1512
|
-
/* @__PURE__ */ (0,
|
|
1576
|
+
css: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9.7 7.5l-1 9" }),
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M15.3 7.5l-1 9" }),
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M7 10.3h11" }),
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 14.3h11" })
|
|
1513
1582
|
] }),
|
|
1514
|
-
go: /* @__PURE__ */ (0,
|
|
1515
|
-
/* @__PURE__ */ (0,
|
|
1516
|
-
/* @__PURE__ */ (0,
|
|
1517
|
-
/* @__PURE__ */ (0,
|
|
1518
|
-
/* @__PURE__ */ (0,
|
|
1583
|
+
go: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1584
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12.6 12h-1.9" }),
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
|
|
1519
1588
|
] }),
|
|
1520
|
-
html: /* @__PURE__ */ (0,
|
|
1521
|
-
/* @__PURE__ */ (0,
|
|
1522
|
-
/* @__PURE__ */ (0,
|
|
1523
|
-
/* @__PURE__ */ (0,
|
|
1524
|
-
/* @__PURE__ */ (0,
|
|
1589
|
+
html: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1590
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
|
|
1593
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M13 7.3l-2 9.4" })
|
|
1525
1594
|
] }),
|
|
1526
|
-
java: /* @__PURE__ */ (0,
|
|
1527
|
-
/* @__PURE__ */ (0,
|
|
1528
|
-
/* @__PURE__ */ (0,
|
|
1529
|
-
/* @__PURE__ */ (0,
|
|
1530
|
-
/* @__PURE__ */ (0,
|
|
1595
|
+
java: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1596
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
|
|
1597
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
|
|
1598
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" }),
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 19.3h10" })
|
|
1531
1600
|
] }),
|
|
1532
|
-
javascript: /* @__PURE__ */ (0,
|
|
1533
|
-
/* @__PURE__ */ (0,
|
|
1534
|
-
/* @__PURE__ */ (0,
|
|
1535
|
-
/* @__PURE__ */ (0,
|
|
1601
|
+
javascript: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1602
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1603
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" })
|
|
1536
1605
|
] }),
|
|
1537
|
-
json: /* @__PURE__ */ (0,
|
|
1538
|
-
/* @__PURE__ */ (0,
|
|
1539
|
-
/* @__PURE__ */ (0,
|
|
1606
|
+
json: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" }),
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" })
|
|
1540
1609
|
] }),
|
|
1541
|
-
kotlin: /* @__PURE__ */ (0,
|
|
1542
|
-
/* @__PURE__ */ (0,
|
|
1543
|
-
/* @__PURE__ */ (0,
|
|
1544
|
-
/* @__PURE__ */ (0,
|
|
1545
|
-
/* @__PURE__ */ (0,
|
|
1610
|
+
kotlin: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1612
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9 7.5v9" }),
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9 12l6-4.5" }),
|
|
1614
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9 12l6 4.5" })
|
|
1546
1615
|
] }),
|
|
1547
|
-
markdown: /* @__PURE__ */ (0,
|
|
1548
|
-
/* @__PURE__ */ (0,
|
|
1549
|
-
/* @__PURE__ */ (0,
|
|
1550
|
-
/* @__PURE__ */ (0,
|
|
1551
|
-
/* @__PURE__ */ (0,
|
|
1616
|
+
markdown: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1617
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16.5 9v6" }),
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M14.5 13l2 2 2-2" })
|
|
1552
1621
|
] }),
|
|
1553
|
-
php: /* @__PURE__ */ (0,
|
|
1554
|
-
/* @__PURE__ */ (0,
|
|
1555
|
-
/* @__PURE__ */ (0,
|
|
1556
|
-
/* @__PURE__ */ (0,
|
|
1557
|
-
/* @__PURE__ */ (0,
|
|
1622
|
+
php: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1623
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" }),
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
|
|
1558
1627
|
] }),
|
|
1559
|
-
plaintext: /* @__PURE__ */ (0,
|
|
1560
|
-
/* @__PURE__ */ (0,
|
|
1561
|
-
/* @__PURE__ */ (0,
|
|
1562
|
-
/* @__PURE__ */ (0,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1628
|
+
plaintext: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
|
|
1564
1633
|
] }),
|
|
1565
|
-
python: /* @__PURE__ */ (0,
|
|
1566
|
-
/* @__PURE__ */ (0,
|
|
1567
|
-
/* @__PURE__ */ (0,
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1569
|
-
/* @__PURE__ */ (0,
|
|
1634
|
+
python: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
|
|
1570
1639
|
] }),
|
|
1571
|
-
ruby: /* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1640
|
+
ruby: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4.5 8h15" }),
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2.5v19" })
|
|
1575
1644
|
] }),
|
|
1576
|
-
rust: /* @__PURE__ */ (0,
|
|
1577
|
-
/* @__PURE__ */ (0,
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1645
|
+
rust: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" })
|
|
1581
1650
|
] }),
|
|
1582
|
-
sql: /* @__PURE__ */ (0,
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1585
|
-
/* @__PURE__ */ (0,
|
|
1651
|
+
sql: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
|
|
1586
1655
|
] }),
|
|
1587
|
-
swift: /* @__PURE__ */ (0,
|
|
1588
|
-
typescript: /* @__PURE__ */ (0,
|
|
1589
|
-
/* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
1591
|
-
/* @__PURE__ */ (0,
|
|
1656
|
+
swift: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LangIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" }) }),
|
|
1657
|
+
typescript: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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" })
|
|
1592
1661
|
] }),
|
|
1593
|
-
xml: /* @__PURE__ */ (0,
|
|
1594
|
-
/* @__PURE__ */ (0,
|
|
1595
|
-
/* @__PURE__ */ (0,
|
|
1596
|
-
/* @__PURE__ */ (0,
|
|
1662
|
+
xml: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
|
|
1665
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 8v8" })
|
|
1597
1666
|
] }),
|
|
1598
|
-
yaml: /* @__PURE__ */ (0,
|
|
1599
|
-
/* @__PURE__ */ (0,
|
|
1600
|
-
/* @__PURE__ */ (0,
|
|
1601
|
-
/* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1667
|
+
yaml: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(LangIcon, { children: [
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1603
1672
|
] })
|
|
1604
1673
|
};
|
|
1605
1674
|
|
|
1606
1675
|
// src/icons.tsx
|
|
1607
|
-
var
|
|
1676
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1608
1677
|
var ALIGN_PATHS = {
|
|
1609
|
-
center: /* @__PURE__ */ (0,
|
|
1610
|
-
/* @__PURE__ */ (0,
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
1678
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1613
1682
|
] }),
|
|
1614
|
-
left: /* @__PURE__ */ (0,
|
|
1615
|
-
/* @__PURE__ */ (0,
|
|
1616
|
-
/* @__PURE__ */ (0,
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1683
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1618
1687
|
] }),
|
|
1619
|
-
right: /* @__PURE__ */ (0,
|
|
1620
|
-
/* @__PURE__ */ (0,
|
|
1621
|
-
/* @__PURE__ */ (0,
|
|
1622
|
-
/* @__PURE__ */ (0,
|
|
1688
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1623
1692
|
] })
|
|
1624
1693
|
};
|
|
1625
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0,
|
|
1694
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1626
1695
|
"svg",
|
|
1627
1696
|
{
|
|
1628
1697
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1636,7 +1705,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
|
1636
1705
|
children: ALIGN_PATHS[dir]
|
|
1637
1706
|
}
|
|
1638
1707
|
);
|
|
1639
|
-
var EditUrlIcon = () => /* @__PURE__ */ (0,
|
|
1708
|
+
var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1640
1709
|
"svg",
|
|
1641
1710
|
{
|
|
1642
1711
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1648,12 +1717,12 @@ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
|
1648
1717
|
strokeLinejoin: "round",
|
|
1649
1718
|
className: "rte-editor-icon",
|
|
1650
1719
|
children: [
|
|
1651
|
-
/* @__PURE__ */ (0,
|
|
1652
|
-
/* @__PURE__ */ (0,
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M12 20h9" }),
|
|
1721
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1653
1722
|
]
|
|
1654
1723
|
}
|
|
1655
1724
|
);
|
|
1656
|
-
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0,
|
|
1725
|
+
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1657
1726
|
"svg",
|
|
1658
1727
|
{
|
|
1659
1728
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1665,13 +1734,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
|
1665
1734
|
strokeLinejoin: "round",
|
|
1666
1735
|
className: "rte-editor-icon",
|
|
1667
1736
|
children: [
|
|
1668
|
-
/* @__PURE__ */ (0,
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1737
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1738
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1671
1740
|
]
|
|
1672
1741
|
}
|
|
1673
1742
|
);
|
|
1674
|
-
var DeleteEmbedIcon = () => /* @__PURE__ */ (0,
|
|
1743
|
+
var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1675
1744
|
"svg",
|
|
1676
1745
|
{
|
|
1677
1746
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1683,46 +1752,46 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
|
1683
1752
|
strokeLinejoin: "round",
|
|
1684
1753
|
className: "rte-editor-icon",
|
|
1685
1754
|
children: [
|
|
1686
|
-
/* @__PURE__ */ (0,
|
|
1687
|
-
/* @__PURE__ */ (0,
|
|
1755
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1756
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("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" })
|
|
1688
1757
|
]
|
|
1689
1758
|
}
|
|
1690
1759
|
);
|
|
1691
1760
|
var iconProps = { className: "rte-editor-icon" };
|
|
1692
1761
|
var DEFAULT_ICONS = {
|
|
1693
|
-
alignCenterControlIcon: /* @__PURE__ */ (0,
|
|
1694
|
-
alignJustifyControlIcon: /* @__PURE__ */ (0,
|
|
1695
|
-
alignLeftControlIcon: /* @__PURE__ */ (0,
|
|
1696
|
-
alignRightControlIcon: /* @__PURE__ */ (0,
|
|
1697
|
-
blockquoteControlIcon: /* @__PURE__ */ (0,
|
|
1698
|
-
boldControlIcon: /* @__PURE__ */ (0,
|
|
1699
|
-
bulletListControlIcon: /* @__PURE__ */ (0,
|
|
1700
|
-
clearFormattingControlIcon: /* @__PURE__ */ (0,
|
|
1701
|
-
codeBlockControlIcon: /* @__PURE__ */ (0,
|
|
1702
|
-
codeControlIcon: /* @__PURE__ */ (0,
|
|
1703
|
-
h1ControlIcon: /* @__PURE__ */ (0,
|
|
1704
|
-
h2ControlIcon: /* @__PURE__ */ (0,
|
|
1705
|
-
h3ControlIcon: /* @__PURE__ */ (0,
|
|
1706
|
-
h4ControlIcon: /* @__PURE__ */ (0,
|
|
1707
|
-
h5ControlIcon: /* @__PURE__ */ (0,
|
|
1708
|
-
h6ControlIcon: /* @__PURE__ */ (0,
|
|
1709
|
-
highlightControlIcon: /* @__PURE__ */ (0,
|
|
1710
|
-
hrControlIcon: /* @__PURE__ */ (0,
|
|
1711
|
-
italicControlIcon: /* @__PURE__ */ (0,
|
|
1762
|
+
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
|
|
1763
|
+
alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
|
|
1764
|
+
alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
|
|
1765
|
+
alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
|
|
1766
|
+
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
|
|
1767
|
+
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Bold, { ...iconProps }),
|
|
1768
|
+
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.List, { ...iconProps }),
|
|
1769
|
+
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
|
|
1770
|
+
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
|
|
1771
|
+
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Code, { ...iconProps }),
|
|
1772
|
+
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Heading1, { ...iconProps }),
|
|
1773
|
+
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Heading2, { ...iconProps }),
|
|
1774
|
+
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Heading3, { ...iconProps }),
|
|
1775
|
+
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Heading4, { ...iconProps }),
|
|
1776
|
+
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Heading5, { ...iconProps }),
|
|
1777
|
+
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Heading6, { ...iconProps }),
|
|
1778
|
+
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
|
|
1779
|
+
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Minus, { ...iconProps }),
|
|
1780
|
+
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Italic, { ...iconProps }),
|
|
1712
1781
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1713
|
-
linkControlIcon: /* @__PURE__ */ (0,
|
|
1714
|
-
orderedListControlIcon: /* @__PURE__ */ (0,
|
|
1715
|
-
redoControlIcon: /* @__PURE__ */ (0,
|
|
1716
|
-
strikeControlIcon: /* @__PURE__ */ (0,
|
|
1717
|
-
subscriptControlIcon: /* @__PURE__ */ (0,
|
|
1718
|
-
superscriptControlIcon: /* @__PURE__ */ (0,
|
|
1719
|
-
underlineControlIcon: /* @__PURE__ */ (0,
|
|
1720
|
-
undoControlIcon: /* @__PURE__ */ (0,
|
|
1721
|
-
unlinkControlIcon: /* @__PURE__ */ (0,
|
|
1782
|
+
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Link, { ...iconProps }),
|
|
1783
|
+
orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
|
|
1784
|
+
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Redo2, { ...iconProps }),
|
|
1785
|
+
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
|
|
1786
|
+
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Subscript, { ...iconProps }),
|
|
1787
|
+
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Superscript, { ...iconProps }),
|
|
1788
|
+
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Underline, { ...iconProps }),
|
|
1789
|
+
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Undo2, { ...iconProps }),
|
|
1790
|
+
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react.Link2Off, { ...iconProps })
|
|
1722
1791
|
};
|
|
1723
1792
|
|
|
1724
1793
|
// src/extensions/resizable-node-view.tsx
|
|
1725
|
-
var
|
|
1794
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1726
1795
|
var EmbedToolbar = ({
|
|
1727
1796
|
align,
|
|
1728
1797
|
videoSrc,
|
|
@@ -1739,8 +1808,8 @@ var EmbedToolbar = ({
|
|
|
1739
1808
|
nodeSrc
|
|
1740
1809
|
}) => {
|
|
1741
1810
|
if (isEditingUrl) {
|
|
1742
|
-
return /* @__PURE__ */ (0,
|
|
1743
|
-
/* @__PURE__ */ (0,
|
|
1811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1744
1813
|
"input",
|
|
1745
1814
|
{
|
|
1746
1815
|
ref: inputRef,
|
|
@@ -1758,7 +1827,7 @@ var EmbedToolbar = ({
|
|
|
1758
1827
|
}
|
|
1759
1828
|
}
|
|
1760
1829
|
),
|
|
1761
|
-
/* @__PURE__ */ (0,
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1762
1831
|
"button",
|
|
1763
1832
|
{
|
|
1764
1833
|
type: "button",
|
|
@@ -1767,7 +1836,7 @@ var EmbedToolbar = ({
|
|
|
1767
1836
|
children: "Save"
|
|
1768
1837
|
}
|
|
1769
1838
|
),
|
|
1770
|
-
/* @__PURE__ */ (0,
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1771
1840
|
"button",
|
|
1772
1841
|
{
|
|
1773
1842
|
type: "button",
|
|
@@ -1778,8 +1847,8 @@ var EmbedToolbar = ({
|
|
|
1778
1847
|
)
|
|
1779
1848
|
] });
|
|
1780
1849
|
}
|
|
1781
|
-
return /* @__PURE__ */ (0,
|
|
1782
|
-
/* @__PURE__ */ (0,
|
|
1850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1783
1852
|
"button",
|
|
1784
1853
|
{
|
|
1785
1854
|
type: "button",
|
|
@@ -1787,12 +1856,12 @@ var EmbedToolbar = ({
|
|
|
1787
1856
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1788
1857
|
className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
|
|
1789
1858
|
onClick: () => updateAttributes({ align: dir }),
|
|
1790
|
-
children: /* @__PURE__ */ (0,
|
|
1859
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AlignIcon, { dir })
|
|
1791
1860
|
},
|
|
1792
1861
|
dir
|
|
1793
1862
|
)) }),
|
|
1794
|
-
/* @__PURE__ */ (0,
|
|
1795
|
-
/* @__PURE__ */ (0,
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1864
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1796
1865
|
"button",
|
|
1797
1866
|
{
|
|
1798
1867
|
type: "button",
|
|
@@ -1806,9 +1875,9 @@ var EmbedToolbar = ({
|
|
|
1806
1875
|
},
|
|
1807
1876
|
pct
|
|
1808
1877
|
)) }),
|
|
1809
|
-
/* @__PURE__ */ (0,
|
|
1810
|
-
/* @__PURE__ */ (0,
|
|
1811
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */ (0,
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-selector-group", children: [
|
|
1880
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1812
1881
|
"button",
|
|
1813
1882
|
{
|
|
1814
1883
|
type: "button",
|
|
@@ -1819,10 +1888,10 @@ var EmbedToolbar = ({
|
|
|
1819
1888
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1820
1889
|
setIsEditingUrl(true);
|
|
1821
1890
|
},
|
|
1822
|
-
children: /* @__PURE__ */ (0,
|
|
1891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(EditUrlIcon, {})
|
|
1823
1892
|
}
|
|
1824
1893
|
),
|
|
1825
|
-
watchUrl && /* @__PURE__ */ (0,
|
|
1894
|
+
watchUrl && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1826
1895
|
"button",
|
|
1827
1896
|
{
|
|
1828
1897
|
type: "button",
|
|
@@ -1830,10 +1899,10 @@ var EmbedToolbar = ({
|
|
|
1830
1899
|
"aria-label": "Open video in YouTube",
|
|
1831
1900
|
className: "rte-embed-selector-btn",
|
|
1832
1901
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1833
|
-
children: /* @__PURE__ */ (0,
|
|
1902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OpenInYouTubeIcon, {})
|
|
1834
1903
|
}
|
|
1835
1904
|
),
|
|
1836
|
-
deleteNode && /* @__PURE__ */ (0,
|
|
1905
|
+
deleteNode && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1837
1906
|
"button",
|
|
1838
1907
|
{
|
|
1839
1908
|
type: "button",
|
|
@@ -1841,7 +1910,7 @@ var EmbedToolbar = ({
|
|
|
1841
1910
|
"aria-label": "Delete Embed",
|
|
1842
1911
|
className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
|
|
1843
1912
|
onClick: () => deleteNode(),
|
|
1844
|
-
children: /* @__PURE__ */ (0,
|
|
1913
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DeleteEmbedIcon, {})
|
|
1845
1914
|
}
|
|
1846
1915
|
)
|
|
1847
1916
|
] })
|
|
@@ -2012,13 +2081,13 @@ var ResizableNodeView = ({
|
|
|
2012
2081
|
setIsEditingUrl(false);
|
|
2013
2082
|
};
|
|
2014
2083
|
const isEditable = editor ? editor.isEditable : true;
|
|
2015
|
-
return /* @__PURE__ */ (0,
|
|
2084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2016
2085
|
import_react13.NodeViewWrapper,
|
|
2017
2086
|
{
|
|
2018
2087
|
className: "rte-embed-wrapper",
|
|
2019
2088
|
"data-selected": selected || void 0,
|
|
2020
2089
|
"data-align": align,
|
|
2021
|
-
children: /* @__PURE__ */ (0,
|
|
2090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2022
2091
|
"div",
|
|
2023
2092
|
{
|
|
2024
2093
|
ref: containerRef,
|
|
@@ -2031,7 +2100,7 @@ var ResizableNodeView = ({
|
|
|
2031
2100
|
},
|
|
2032
2101
|
children: [
|
|
2033
2102
|
children,
|
|
2034
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
2103
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2035
2104
|
EmbedToolbar,
|
|
2036
2105
|
{
|
|
2037
2106
|
align,
|
|
@@ -2049,14 +2118,14 @@ var ResizableNodeView = ({
|
|
|
2049
2118
|
nodeSrc: node.attrs.src
|
|
2050
2119
|
}
|
|
2051
2120
|
) }),
|
|
2052
|
-
isResizing && currentDimensions && /* @__PURE__ */ (0,
|
|
2121
|
+
isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-resize-badge", children: [
|
|
2053
2122
|
currentDimensions.w,
|
|
2054
2123
|
" \xD7 ",
|
|
2055
2124
|
currentDimensions.h,
|
|
2056
2125
|
" px"
|
|
2057
2126
|
] }),
|
|
2058
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
2059
|
-
/* @__PURE__ */ (0,
|
|
2127
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2128
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2060
2129
|
"div",
|
|
2061
2130
|
{
|
|
2062
2131
|
className: "rte-resize-handle rte-resize-handle--left",
|
|
@@ -2064,7 +2133,7 @@ var ResizableNodeView = ({
|
|
|
2064
2133
|
role: "presentation"
|
|
2065
2134
|
}
|
|
2066
2135
|
),
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
2136
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2068
2137
|
"div",
|
|
2069
2138
|
{
|
|
2070
2139
|
className: "rte-resize-handle rte-resize-handle--right",
|
|
@@ -2072,7 +2141,7 @@ var ResizableNodeView = ({
|
|
|
2072
2141
|
role: "presentation"
|
|
2073
2142
|
}
|
|
2074
2143
|
),
|
|
2075
|
-
/* @__PURE__ */ (0,
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2076
2145
|
"div",
|
|
2077
2146
|
{
|
|
2078
2147
|
className: "rte-resize-handle rte-resize-handle--bottom",
|
|
@@ -2080,7 +2149,7 @@ var ResizableNodeView = ({
|
|
|
2080
2149
|
role: "presentation"
|
|
2081
2150
|
}
|
|
2082
2151
|
),
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2084
2153
|
"div",
|
|
2085
2154
|
{
|
|
2086
2155
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
|
|
@@ -2088,7 +2157,7 @@ var ResizableNodeView = ({
|
|
|
2088
2157
|
role: "presentation"
|
|
2089
2158
|
}
|
|
2090
2159
|
),
|
|
2091
|
-
/* @__PURE__ */ (0,
|
|
2160
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2092
2161
|
"div",
|
|
2093
2162
|
{
|
|
2094
2163
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
|
|
@@ -2105,7 +2174,7 @@ var ResizableNodeView = ({
|
|
|
2105
2174
|
};
|
|
2106
2175
|
|
|
2107
2176
|
// src/controls/rte-twitter-control.tsx
|
|
2108
|
-
var
|
|
2177
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2109
2178
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2110
2179
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2111
2180
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2252,7 +2321,7 @@ var TwitterNodeView = (props) => {
|
|
|
2252
2321
|
retryToken.current += 1;
|
|
2253
2322
|
setRetryCount(retryToken.current);
|
|
2254
2323
|
}, []);
|
|
2255
|
-
return /* @__PURE__ */ (0,
|
|
2324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2256
2325
|
ResizableNodeView,
|
|
2257
2326
|
{
|
|
2258
2327
|
...props,
|
|
@@ -2260,17 +2329,31 @@ var TwitterNodeView = (props) => {
|
|
|
2260
2329
|
minWidth: 300,
|
|
2261
2330
|
maxWidth: 1200,
|
|
2262
2331
|
children: [
|
|
2263
|
-
loading && /* @__PURE__ */ (0,
|
|
2264
|
-
!loading && failed && /* @__PURE__ */ (0,
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2266
|
-
/* @__PURE__ */ (0,
|
|
2332
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
|
|
2333
|
+
!loading && failed && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "rte-embed-error", children: [
|
|
2334
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { children: "Couldn't load this tweet." }),
|
|
2335
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2267
2336
|
] }),
|
|
2268
|
-
/* @__PURE__ */ (0,
|
|
2337
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref: containerRef })
|
|
2269
2338
|
]
|
|
2270
2339
|
}
|
|
2271
2340
|
);
|
|
2272
2341
|
};
|
|
2273
2342
|
var TwitterEmbed = import_core2.Node.create({
|
|
2343
|
+
...(0, import_core2.createAtomBlockMarkdownSpec)({
|
|
2344
|
+
allowedAttributes: ["tweetId", "width", "height", "align"],
|
|
2345
|
+
nodeName: "twitter",
|
|
2346
|
+
parseAttributes: (text) => {
|
|
2347
|
+
const attrs = (0, import_core2.parseAttributes)(text);
|
|
2348
|
+
for (const key of ["width", "height"]) {
|
|
2349
|
+
if (key in attrs) {
|
|
2350
|
+
attrs[key] = Number(attrs[key]);
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
return attrs;
|
|
2354
|
+
},
|
|
2355
|
+
requiredAttributes: ["tweetId"]
|
|
2356
|
+
}),
|
|
2274
2357
|
addAttributes() {
|
|
2275
2358
|
return {
|
|
2276
2359
|
align: {
|
|
@@ -2379,7 +2462,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2379
2462
|
resetState();
|
|
2380
2463
|
return true;
|
|
2381
2464
|
}, [tweetId, editor, resetState]);
|
|
2382
|
-
return /* @__PURE__ */ (0,
|
|
2465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2383
2466
|
Dialog,
|
|
2384
2467
|
{
|
|
2385
2468
|
open,
|
|
@@ -2390,36 +2473,36 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2390
2473
|
}
|
|
2391
2474
|
},
|
|
2392
2475
|
children: [
|
|
2393
|
-
/* @__PURE__ */ (0,
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2394
2477
|
DialogTrigger,
|
|
2395
2478
|
{
|
|
2396
|
-
render: /* @__PURE__ */ (0,
|
|
2479
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2397
2480
|
RichTextEditorControl,
|
|
2398
2481
|
{
|
|
2399
2482
|
active,
|
|
2400
2483
|
className,
|
|
2401
2484
|
title: "Embed Tweet",
|
|
2402
2485
|
"aria-label": "Embed Tweet",
|
|
2403
|
-
children: /* @__PURE__ */ (0,
|
|
2486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2404
2487
|
"svg",
|
|
2405
2488
|
{
|
|
2406
2489
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2407
2490
|
viewBox: "0 0 24 24",
|
|
2408
2491
|
fill: "currentColor",
|
|
2409
2492
|
className: "rte-editor-icon",
|
|
2410
|
-
children: /* @__PURE__ */ (0,
|
|
2493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("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" })
|
|
2411
2494
|
}
|
|
2412
2495
|
)
|
|
2413
2496
|
}
|
|
2414
2497
|
)
|
|
2415
2498
|
}
|
|
2416
2499
|
),
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2418
|
-
/* @__PURE__ */ (0,
|
|
2419
|
-
/* @__PURE__ */ (0,
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
2500
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogContent, { children: [
|
|
2501
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogHeader, { children: [
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTitle, { children: "Embed Tweet" }),
|
|
2503
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2421
2504
|
] }),
|
|
2422
|
-
/* @__PURE__ */ (0,
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2423
2506
|
Input,
|
|
2424
2507
|
{
|
|
2425
2508
|
value: url,
|
|
@@ -2439,10 +2522,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2439
2522
|
}
|
|
2440
2523
|
}
|
|
2441
2524
|
),
|
|
2442
|
-
showError && /* @__PURE__ */ (0,
|
|
2443
|
-
/* @__PURE__ */ (0,
|
|
2444
|
-
/* @__PURE__ */ (0,
|
|
2445
|
-
/* @__PURE__ */ (0,
|
|
2525
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogFooter, { children: [
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogClose, { children: "Cancel" }),
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2446
2529
|
"button",
|
|
2447
2530
|
{
|
|
2448
2531
|
type: "button",
|
|
@@ -2467,7 +2550,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2467
2550
|
var import_core3 = require("@tiptap/core");
|
|
2468
2551
|
var import_react17 = require("@tiptap/react");
|
|
2469
2552
|
var import_react18 = require("react");
|
|
2470
|
-
var
|
|
2553
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2471
2554
|
var getYouTubeId = (url) => {
|
|
2472
2555
|
const clean = url.trim();
|
|
2473
2556
|
const patterns = [
|
|
@@ -2495,7 +2578,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2495
2578
|
if (videoId) {
|
|
2496
2579
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2497
2580
|
}
|
|
2498
|
-
return /* @__PURE__ */ (0,
|
|
2581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2499
2582
|
ResizableNodeView,
|
|
2500
2583
|
{
|
|
2501
2584
|
...props,
|
|
@@ -2506,7 +2589,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2506
2589
|
videoSrc: rawSrc,
|
|
2507
2590
|
watchUrl,
|
|
2508
2591
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2509
|
-
children: /* @__PURE__ */ (0,
|
|
2592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2510
2593
|
"iframe",
|
|
2511
2594
|
{
|
|
2512
2595
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2520,6 +2603,20 @@ var YouTubeNodeView = (props) => {
|
|
|
2520
2603
|
);
|
|
2521
2604
|
};
|
|
2522
2605
|
var YouTubeEmbed = import_core3.Node.create({
|
|
2606
|
+
...(0, import_core3.createAtomBlockMarkdownSpec)({
|
|
2607
|
+
allowedAttributes: ["src", "width", "height", "align"],
|
|
2608
|
+
nodeName: "youtube",
|
|
2609
|
+
parseAttributes: (text) => {
|
|
2610
|
+
const attrs = (0, import_core3.parseAttributes)(text);
|
|
2611
|
+
for (const key of ["width", "height"]) {
|
|
2612
|
+
if (key in attrs) {
|
|
2613
|
+
attrs[key] = Number(attrs[key]);
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
return attrs;
|
|
2617
|
+
},
|
|
2618
|
+
requiredAttributes: ["src"]
|
|
2619
|
+
}),
|
|
2523
2620
|
addAttributes() {
|
|
2524
2621
|
return {
|
|
2525
2622
|
align: {
|
|
@@ -2608,18 +2705,18 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2608
2705
|
setUrl("");
|
|
2609
2706
|
}
|
|
2610
2707
|
}, [url, editor]);
|
|
2611
|
-
return /* @__PURE__ */ (0,
|
|
2612
|
-
/* @__PURE__ */ (0,
|
|
2708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2709
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2613
2710
|
DialogTrigger,
|
|
2614
2711
|
{
|
|
2615
|
-
render: /* @__PURE__ */ (0,
|
|
2712
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2616
2713
|
RichTextEditorControl,
|
|
2617
2714
|
{
|
|
2618
2715
|
active,
|
|
2619
2716
|
className,
|
|
2620
2717
|
title: "Embed YouTube video",
|
|
2621
2718
|
"aria-label": "Embed YouTube video",
|
|
2622
|
-
children: /* @__PURE__ */ (0,
|
|
2719
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2623
2720
|
"svg",
|
|
2624
2721
|
{
|
|
2625
2722
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2631,8 +2728,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2631
2728
|
strokeLinejoin: "round",
|
|
2632
2729
|
className: "rte-editor-icon",
|
|
2633
2730
|
children: [
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2635
|
-
/* @__PURE__ */ (0,
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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" }),
|
|
2732
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2636
2733
|
]
|
|
2637
2734
|
}
|
|
2638
2735
|
)
|
|
@@ -2640,12 +2737,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2640
2737
|
)
|
|
2641
2738
|
}
|
|
2642
2739
|
),
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2644
|
-
/* @__PURE__ */ (0,
|
|
2645
|
-
/* @__PURE__ */ (0,
|
|
2646
|
-
/* @__PURE__ */ (0,
|
|
2740
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogContent, { showCloseButton: false, children: [
|
|
2741
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogHeader, { children: [
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTitle, { children: "Embed YouTube video" }),
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2647
2744
|
] }),
|
|
2648
|
-
/* @__PURE__ */ (0,
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2649
2746
|
Input,
|
|
2650
2747
|
{
|
|
2651
2748
|
value: url,
|
|
@@ -2659,9 +2756,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2659
2756
|
}
|
|
2660
2757
|
}
|
|
2661
2758
|
),
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2663
|
-
/* @__PURE__ */ (0,
|
|
2664
|
-
/* @__PURE__ */ (0,
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogFooter, { children: [
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogClose, { children: "Cancel" }),
|
|
2761
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2665
2762
|
DialogClose,
|
|
2666
2763
|
{
|
|
2667
2764
|
disabled: !url,
|
|
@@ -2718,14 +2815,14 @@ var DEFAULT_LABELS = {
|
|
|
2718
2815
|
|
|
2719
2816
|
// src/rte-content.tsx
|
|
2720
2817
|
var import_react19 = require("@tiptap/react");
|
|
2721
|
-
var
|
|
2818
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2722
2819
|
var Content = ({
|
|
2723
2820
|
children,
|
|
2724
2821
|
className
|
|
2725
2822
|
}) => {
|
|
2726
2823
|
const { editor } = useRichTextEditorContext();
|
|
2727
|
-
return /* @__PURE__ */ (0,
|
|
2728
|
-
/* @__PURE__ */ (0,
|
|
2824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative", children: [
|
|
2825
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2729
2826
|
import_react19.EditorContent,
|
|
2730
2827
|
{
|
|
2731
2828
|
editor,
|
|
@@ -2737,15 +2834,15 @@ var Content = ({
|
|
|
2737
2834
|
};
|
|
2738
2835
|
|
|
2739
2836
|
// src/rte-controls-group.tsx
|
|
2740
|
-
var
|
|
2837
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2741
2838
|
var ControlsGroup = ({
|
|
2742
2839
|
children,
|
|
2743
2840
|
className
|
|
2744
|
-
}) => /* @__PURE__ */ (0,
|
|
2841
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("rte-controls-group", className), children });
|
|
2745
2842
|
|
|
2746
2843
|
// src/rte-footer.tsx
|
|
2747
2844
|
var import_react20 = require("react");
|
|
2748
|
-
var
|
|
2845
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2749
2846
|
var Footer = ({
|
|
2750
2847
|
children,
|
|
2751
2848
|
className,
|
|
@@ -2804,7 +2901,7 @@ var Footer = ({
|
|
|
2804
2901
|
if (!showWordCount && !children) {
|
|
2805
2902
|
return null;
|
|
2806
2903
|
}
|
|
2807
|
-
return /* @__PURE__ */ (0,
|
|
2904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
2808
2905
|
"div",
|
|
2809
2906
|
{
|
|
2810
2907
|
className: cn(
|
|
@@ -2816,21 +2913,21 @@ var Footer = ({
|
|
|
2816
2913
|
"data-sticky": sticky ? "" : void 0,
|
|
2817
2914
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2818
2915
|
children: [
|
|
2819
|
-
showWordCount && wordCount && /* @__PURE__ */ (0,
|
|
2820
|
-
/* @__PURE__ */ (0,
|
|
2821
|
-
/* @__PURE__ */ (0,
|
|
2822
|
-
/* @__PURE__ */ (0,
|
|
2916
|
+
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
|
|
2823
2920
|
] }),
|
|
2824
|
-
/* @__PURE__ */ (0,
|
|
2921
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2825
2922
|
"span",
|
|
2826
2923
|
{
|
|
2827
2924
|
className: "rte-footer-word-count-separator",
|
|
2828
2925
|
"aria-hidden": "true"
|
|
2829
2926
|
}
|
|
2830
2927
|
),
|
|
2831
|
-
/* @__PURE__ */ (0,
|
|
2832
|
-
/* @__PURE__ */ (0,
|
|
2833
|
-
/* @__PURE__ */ (0,
|
|
2928
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2929
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
|
|
2930
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
|
|
2834
2931
|
] })
|
|
2835
2932
|
] }) }),
|
|
2836
2933
|
children
|
|
@@ -2840,7 +2937,7 @@ var Footer = ({
|
|
|
2840
2937
|
};
|
|
2841
2938
|
|
|
2842
2939
|
// src/rte-toolbar.tsx
|
|
2843
|
-
var
|
|
2940
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2844
2941
|
var Toolbar = ({
|
|
2845
2942
|
children,
|
|
2846
2943
|
className,
|
|
@@ -2851,7 +2948,7 @@ var Toolbar = ({
|
|
|
2851
2948
|
if (!editable) {
|
|
2852
2949
|
return null;
|
|
2853
2950
|
}
|
|
2854
|
-
return /* @__PURE__ */ (0,
|
|
2951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2855
2952
|
"div",
|
|
2856
2953
|
{
|
|
2857
2954
|
className: cn(
|
|
@@ -2868,7 +2965,7 @@ var Toolbar = ({
|
|
|
2868
2965
|
};
|
|
2869
2966
|
|
|
2870
2967
|
// src/rte-text-editor.tsx
|
|
2871
|
-
var
|
|
2968
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2872
2969
|
var RichTextEditorRoot = ({
|
|
2873
2970
|
editor,
|
|
2874
2971
|
children,
|
|
@@ -2883,12 +2980,13 @@ var RichTextEditorRoot = ({
|
|
|
2883
2980
|
[labels]
|
|
2884
2981
|
);
|
|
2885
2982
|
const mergedIcons = (0, import_react21.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
2983
|
+
const [tooltip] = (0, import_react21.useState)(() => import_tooltip5.Tooltip.createHandle());
|
|
2886
2984
|
(0, import_react21.useEffect)(() => {
|
|
2887
2985
|
if (editor && editor.isEditable !== editable) {
|
|
2888
2986
|
editor.setEditable(editable);
|
|
2889
2987
|
}
|
|
2890
2988
|
}, [editor, editable]);
|
|
2891
|
-
return /* @__PURE__ */ (0,
|
|
2989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2892
2990
|
RichTextEditorContext.Provider,
|
|
2893
2991
|
{
|
|
2894
2992
|
value: {
|
|
@@ -2896,9 +2994,10 @@ var RichTextEditorRoot = ({
|
|
|
2896
2994
|
editor,
|
|
2897
2995
|
icons: mergedIcons,
|
|
2898
2996
|
labels: mergedLabels,
|
|
2997
|
+
tooltip,
|
|
2899
2998
|
variant
|
|
2900
2999
|
},
|
|
2901
|
-
children: /* @__PURE__ */ (0,
|
|
3000
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2902
3001
|
"div",
|
|
2903
3002
|
{
|
|
2904
3003
|
className: cn(
|
|
@@ -2907,7 +3006,10 @@ var RichTextEditorRoot = ({
|
|
|
2907
3006
|
className
|
|
2908
3007
|
),
|
|
2909
3008
|
"data-variant": variant,
|
|
2910
|
-
children
|
|
3009
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(TooltipProvider, { children: [
|
|
3010
|
+
children,
|
|
3011
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TooltipContent, { side: "bottom", children: payload }) })
|
|
3012
|
+
] })
|
|
2911
3013
|
}
|
|
2912
3014
|
)
|
|
2913
3015
|
}
|
|
@@ -2945,6 +3047,7 @@ var RichTextEditor = Object.assign(RichTextEditorRoot, {
|
|
|
2945
3047
|
Subscript: SubscriptControl,
|
|
2946
3048
|
Superscript: SuperscriptControl,
|
|
2947
3049
|
Toolbar,
|
|
3050
|
+
Tooltip: RichTextEditorTooltip,
|
|
2948
3051
|
TwitterEmbed: TwitterEmbedControl,
|
|
2949
3052
|
Underline: UnderlineControl,
|
|
2950
3053
|
Undo: UndoControl,
|