@editorcn/editor 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +360 -513
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.js +315 -467
- package/dist/index.js.map +1 -1
- package/dist/style.css +1314 -1415
- package/package.json +62 -67
package/dist/index.cjs
CHANGED
|
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
BubbleMenu: () => BubbleMenu,
|
|
34
|
-
CodeBlock: () => CodeBlock,
|
|
35
34
|
DEFAULT_ICONS: () => DEFAULT_ICONS,
|
|
36
35
|
DEFAULT_LABELS: () => DEFAULT_LABELS,
|
|
37
36
|
DEFAULT_LANGUAGE_ICONS: () => DEFAULT_LANGUAGE_ICONS,
|
|
@@ -45,12 +44,12 @@ module.exports = __toCommonJS(index_exports);
|
|
|
45
44
|
|
|
46
45
|
// src/rte-text-editor.tsx
|
|
47
46
|
var import_tooltip5 = require("@base-ui/react/tooltip");
|
|
48
|
-
var
|
|
47
|
+
var import_react20 = require("react");
|
|
49
48
|
|
|
50
49
|
// src/bubble-menu/index.tsx
|
|
51
50
|
var import_core = require("@tiptap/core");
|
|
52
51
|
var import_menus = require("@tiptap/react/menus");
|
|
53
|
-
var
|
|
52
|
+
var import_react4 = require("react");
|
|
54
53
|
|
|
55
54
|
// src/ui/button.tsx
|
|
56
55
|
var import_button = require("@base-ui/react/button");
|
|
@@ -694,53 +693,6 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
|
|
|
694
693
|
const getSnapshot = (0, import_react2.useCallback)(() => snapshotRef.current.value, []);
|
|
695
694
|
return (0, import_react2.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
696
695
|
};
|
|
697
|
-
var CODE_BLOCK_LANGUAGES = [
|
|
698
|
-
"javascript",
|
|
699
|
-
"typescript",
|
|
700
|
-
"html",
|
|
701
|
-
"css",
|
|
702
|
-
"json",
|
|
703
|
-
"python",
|
|
704
|
-
"rust",
|
|
705
|
-
"go",
|
|
706
|
-
"java",
|
|
707
|
-
"c",
|
|
708
|
-
"cpp",
|
|
709
|
-
"ruby",
|
|
710
|
-
"php",
|
|
711
|
-
"swift",
|
|
712
|
-
"kotlin",
|
|
713
|
-
"sql",
|
|
714
|
-
"bash",
|
|
715
|
-
"markdown",
|
|
716
|
-
"yaml",
|
|
717
|
-
"xml",
|
|
718
|
-
"plaintext"
|
|
719
|
-
];
|
|
720
|
-
var CODE_BLOCK_LANGUAGE_LABELS = {
|
|
721
|
-
bash: "Bash",
|
|
722
|
-
c: "C",
|
|
723
|
-
cpp: "C++",
|
|
724
|
-
css: "CSS",
|
|
725
|
-
go: "Go",
|
|
726
|
-
html: "HTML",
|
|
727
|
-
java: "Java",
|
|
728
|
-
javascript: "JavaScript",
|
|
729
|
-
json: "JSON",
|
|
730
|
-
kotlin: "Kotlin",
|
|
731
|
-
markdown: "Markdown",
|
|
732
|
-
php: "PHP",
|
|
733
|
-
plaintext: "Plain Text",
|
|
734
|
-
python: "Python",
|
|
735
|
-
ruby: "Ruby",
|
|
736
|
-
rust: "Rust",
|
|
737
|
-
sql: "SQL",
|
|
738
|
-
swift: "Swift",
|
|
739
|
-
typescript: "TypeScript",
|
|
740
|
-
xml: "XML",
|
|
741
|
-
yaml: "YAML"
|
|
742
|
-
};
|
|
743
|
-
var getLanguageLabel = (lang) => CODE_BLOCK_LANGUAGE_LABELS[lang] ?? lang;
|
|
744
696
|
|
|
745
697
|
// src/bubble-menu/color-selector.tsx
|
|
746
698
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
@@ -931,115 +883,12 @@ var ColorSelector = ({ editor }) => {
|
|
|
931
883
|
] });
|
|
932
884
|
};
|
|
933
885
|
|
|
934
|
-
// src/bubble-menu/language-selector.tsx
|
|
935
|
-
var import_react5 = require("react");
|
|
936
|
-
|
|
937
|
-
// src/rte-context.ts
|
|
938
|
-
var import_react4 = require("react");
|
|
939
|
-
var RichTextEditorContext = (0, import_react4.createContext)(null);
|
|
940
|
-
var useRichTextEditorContext = () => {
|
|
941
|
-
const context = (0, import_react4.useContext)(RichTextEditorContext);
|
|
942
|
-
if (!context) {
|
|
943
|
-
throw new Error(
|
|
944
|
-
"useRichTextEditorContext must be used within RichTextEditor"
|
|
945
|
-
);
|
|
946
|
-
}
|
|
947
|
-
return context;
|
|
948
|
-
};
|
|
949
|
-
|
|
950
|
-
// src/bubble-menu/language-selector.tsx
|
|
951
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
952
|
-
var FallbackIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
953
|
-
"svg",
|
|
954
|
-
{
|
|
955
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
956
|
-
viewBox: "0 0 24 24",
|
|
957
|
-
fill: "none",
|
|
958
|
-
stroke: "currentColor",
|
|
959
|
-
strokeWidth: 2,
|
|
960
|
-
strokeLinecap: "round",
|
|
961
|
-
strokeLinejoin: "round",
|
|
962
|
-
className: "rte-editor-icon",
|
|
963
|
-
children: [
|
|
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" })
|
|
966
|
-
]
|
|
967
|
-
}
|
|
968
|
-
);
|
|
969
|
-
var LanguageSelector = ({ editor }) => {
|
|
970
|
-
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
971
|
-
const { icons } = useRichTextEditorContext();
|
|
972
|
-
const { currentLanguage } = useEditorState(
|
|
973
|
-
editor,
|
|
974
|
-
(ed) => ({
|
|
975
|
-
currentLanguage: ed.getAttributes("codeBlock").language || "javascript"
|
|
976
|
-
}),
|
|
977
|
-
shallowEqual
|
|
978
|
-
);
|
|
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)(
|
|
982
|
-
RteButton,
|
|
983
|
-
{
|
|
984
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
985
|
-
onClick: () => setOpen(!open),
|
|
986
|
-
children: [
|
|
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)(
|
|
990
|
-
"svg",
|
|
991
|
-
{
|
|
992
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
993
|
-
viewBox: "0 0 24 24",
|
|
994
|
-
fill: "none",
|
|
995
|
-
stroke: "currentColor",
|
|
996
|
-
strokeWidth: 2,
|
|
997
|
-
strokeLinecap: "round",
|
|
998
|
-
strokeLinejoin: "round",
|
|
999
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "m6 9 6 6 6-6" })
|
|
1000
|
-
}
|
|
1001
|
-
) })
|
|
1002
|
-
]
|
|
1003
|
-
}
|
|
1004
|
-
),
|
|
1005
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
|
1006
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1007
|
-
RteOverlay,
|
|
1008
|
-
{
|
|
1009
|
-
onClick: () => setOpen(false),
|
|
1010
|
-
onKeyDown: (e) => {
|
|
1011
|
-
if (e.key === "Escape") {
|
|
1012
|
-
setOpen(false);
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
),
|
|
1017
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteDropdown, { variant: "language", children: CODE_BLOCK_LANGUAGES.map((lang) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1018
|
-
RteDropdownItem,
|
|
1019
|
-
{
|
|
1020
|
-
active: currentLanguage === lang,
|
|
1021
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1022
|
-
onClick: () => {
|
|
1023
|
-
editor.chain().focus().updateAttributes("codeBlock", { language: lang }).run();
|
|
1024
|
-
setOpen(false);
|
|
1025
|
-
},
|
|
1026
|
-
children: [
|
|
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) })
|
|
1029
|
-
]
|
|
1030
|
-
},
|
|
1031
|
-
lang
|
|
1032
|
-
)) })
|
|
1033
|
-
] })
|
|
1034
|
-
] });
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
886
|
// src/bubble-menu/text-buttons.tsx
|
|
1038
|
-
var
|
|
887
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1039
888
|
var Svg = ({
|
|
1040
889
|
children,
|
|
1041
890
|
strokeWidth = 2
|
|
1042
|
-
}) => /* @__PURE__ */ (0,
|
|
891
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1043
892
|
"svg",
|
|
1044
893
|
{
|
|
1045
894
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1053,47 +902,47 @@ var Svg = ({
|
|
|
1053
902
|
children
|
|
1054
903
|
}
|
|
1055
904
|
);
|
|
1056
|
-
var Icon = ({ children }) => /* @__PURE__ */ (0,
|
|
905
|
+
var Icon = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteIcon, { children });
|
|
1057
906
|
var textItems = [
|
|
1058
907
|
{
|
|
1059
908
|
command: (e) => e.chain().focus().toggleBold().run(),
|
|
1060
|
-
icon: /* @__PURE__ */ (0,
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
909
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
|
|
1063
912
|
] }) }),
|
|
1064
913
|
isActive: (s) => s.isBold
|
|
1065
914
|
},
|
|
1066
915
|
{
|
|
1067
916
|
command: (e) => e.chain().focus().toggleItalic().run(),
|
|
1068
|
-
icon: /* @__PURE__ */ (0,
|
|
1069
|
-
/* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
917
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
1072
921
|
] }) }),
|
|
1073
922
|
isActive: (s) => s.isItalic
|
|
1074
923
|
},
|
|
1075
924
|
{
|
|
1076
925
|
command: (e) => e.chain().focus().toggleUnderline().run(),
|
|
1077
|
-
icon: /* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
926
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
|
|
928
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
|
|
1080
929
|
] }) }),
|
|
1081
930
|
isActive: (s) => s.isUnderline
|
|
1082
931
|
},
|
|
1083
932
|
{
|
|
1084
933
|
command: (e) => e.chain().focus().toggleStrike().run(),
|
|
1085
|
-
icon: /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
934
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
935
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
|
|
936
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
1089
938
|
] }) }),
|
|
1090
939
|
isActive: (s) => s.isStrike
|
|
1091
940
|
},
|
|
1092
941
|
{
|
|
1093
942
|
command: (e) => e.chain().focus().toggleCode().run(),
|
|
1094
|
-
icon: /* @__PURE__ */ (0,
|
|
1095
|
-
/* @__PURE__ */ (0,
|
|
1096
|
-
/* @__PURE__ */ (0,
|
|
943
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
1097
946
|
] }) }),
|
|
1098
947
|
isActive: (s) => s.isCode
|
|
1099
948
|
}
|
|
@@ -1110,7 +959,7 @@ var TextButtons = ({ editor }) => {
|
|
|
1110
959
|
}),
|
|
1111
960
|
shallowEqual
|
|
1112
961
|
);
|
|
1113
|
-
return /* @__PURE__ */ (0,
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteButtonGroup, { children: textItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1114
963
|
RteButton,
|
|
1115
964
|
{
|
|
1116
965
|
active: item.isActive(editorState),
|
|
@@ -1123,16 +972,9 @@ var TextButtons = ({ editor }) => {
|
|
|
1123
972
|
};
|
|
1124
973
|
|
|
1125
974
|
// src/bubble-menu/index.tsx
|
|
1126
|
-
var
|
|
975
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1127
976
|
var BubbleMenu = ({ editor }) => {
|
|
1128
|
-
const
|
|
1129
|
-
editor,
|
|
1130
|
-
(ed) => ({
|
|
1131
|
-
isCodeBlock: ed.isActive("codeBlock")
|
|
1132
|
-
}),
|
|
1133
|
-
shallowEqual
|
|
1134
|
-
);
|
|
1135
|
-
const shouldShow = (0, import_react6.useCallback)(
|
|
977
|
+
const shouldShow = (0, import_react4.useCallback)(
|
|
1136
978
|
({
|
|
1137
979
|
editor: ed,
|
|
1138
980
|
state
|
|
@@ -1141,7 +983,7 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1141
983
|
if (!ed.isEditable) {
|
|
1142
984
|
return false;
|
|
1143
985
|
}
|
|
1144
|
-
if (selection.empty
|
|
986
|
+
if (selection.empty || ed.isActive("codeBlock")) {
|
|
1145
987
|
return false;
|
|
1146
988
|
}
|
|
1147
989
|
if (!selection.empty && !(0, import_core.isTextSelection)(selection)) {
|
|
@@ -1154,35 +996,49 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1154
996
|
if (!editor) {
|
|
1155
997
|
return null;
|
|
1156
998
|
}
|
|
1157
|
-
|
|
1158
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1159
1000
|
import_menus.BubbleMenu,
|
|
1160
1001
|
{
|
|
1161
1002
|
editor,
|
|
1162
1003
|
options: { offset: 8, placement: "top" },
|
|
1163
1004
|
shouldShow,
|
|
1164
|
-
children: /* @__PURE__ */ (0,
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1166
|
-
/* @__PURE__ */ (0,
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1168
|
-
] })
|
|
1005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "rte-bubble-menu", children: [
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextButtons, { editor }),
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RteSeparator, {}),
|
|
1008
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColorSelector, { editor })
|
|
1009
|
+
] })
|
|
1169
1010
|
}
|
|
1170
1011
|
);
|
|
1171
1012
|
};
|
|
1172
1013
|
|
|
1173
1014
|
// src/controls/rte-control.tsx
|
|
1174
|
-
var
|
|
1175
|
-
var
|
|
1176
|
-
|
|
1015
|
+
var import_react6 = require("@tiptap/react");
|
|
1016
|
+
var import_react7 = require("react");
|
|
1017
|
+
|
|
1018
|
+
// src/rte-context.ts
|
|
1019
|
+
var import_react5 = require("react");
|
|
1020
|
+
var RichTextEditorContext = (0, import_react5.createContext)(null);
|
|
1021
|
+
var useRichTextEditorContext = () => {
|
|
1022
|
+
const context = (0, import_react5.useContext)(RichTextEditorContext);
|
|
1023
|
+
if (!context) {
|
|
1024
|
+
throw new Error(
|
|
1025
|
+
"useRichTextEditorContext must be used within RichTextEditor"
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
return context;
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
// src/controls/rte-control.tsx
|
|
1032
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1177
1033
|
var RichTextEditorTooltip = ({
|
|
1178
1034
|
children,
|
|
1179
1035
|
label
|
|
1180
1036
|
}) => {
|
|
1181
|
-
const tooltip = (0,
|
|
1037
|
+
const tooltip = (0, import_react7.useContext)(RichTextEditorContext)?.tooltip;
|
|
1182
1038
|
if (!tooltip) {
|
|
1183
1039
|
return children;
|
|
1184
1040
|
}
|
|
1185
|
-
return /* @__PURE__ */ (0,
|
|
1041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipTrigger, { handle: tooltip, payload: label, render: children });
|
|
1186
1042
|
};
|
|
1187
1043
|
var RichTextEditorControl = ({
|
|
1188
1044
|
active = false,
|
|
@@ -1194,7 +1050,7 @@ var RichTextEditorControl = ({
|
|
|
1194
1050
|
disabled,
|
|
1195
1051
|
...props
|
|
1196
1052
|
}) => {
|
|
1197
|
-
const toggle = /* @__PURE__ */ (0,
|
|
1053
|
+
const toggle = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1198
1054
|
Toggle,
|
|
1199
1055
|
{
|
|
1200
1056
|
size: "sm",
|
|
@@ -1210,7 +1066,7 @@ var RichTextEditorControl = ({
|
|
|
1210
1066
|
children
|
|
1211
1067
|
}
|
|
1212
1068
|
);
|
|
1213
|
-
return props.title ? /* @__PURE__ */ (0,
|
|
1069
|
+
return props.title ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextEditorTooltip, { label: props.title, children: toggle }) : toggle;
|
|
1214
1070
|
};
|
|
1215
1071
|
var resolveIsActive = (editor, config) => {
|
|
1216
1072
|
if (!editor || !config) {
|
|
@@ -1239,9 +1095,9 @@ var createControl = ({
|
|
|
1239
1095
|
const { editor, labels, icons } = useRichTextEditorContext();
|
|
1240
1096
|
const ariaLabel = labels[label];
|
|
1241
1097
|
const selector = createSelector(isActive, isDisabled);
|
|
1242
|
-
(0,
|
|
1098
|
+
(0, import_react6.useEditorState)({ editor: editor ?? null, selector });
|
|
1243
1099
|
const { active, disabled } = selector({ editor: editor ?? null });
|
|
1244
|
-
return /* @__PURE__ */ (0,
|
|
1100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1245
1101
|
RichTextEditorControl,
|
|
1246
1102
|
{
|
|
1247
1103
|
active,
|
|
@@ -1426,19 +1282,19 @@ var SuperscriptControl = createControl({
|
|
|
1426
1282
|
});
|
|
1427
1283
|
|
|
1428
1284
|
// src/controls/rte-link-control.tsx
|
|
1429
|
-
var
|
|
1285
|
+
var import_react8 = require("@tiptap/react");
|
|
1430
1286
|
var React15 = __toESM(require("react"), 1);
|
|
1431
|
-
var
|
|
1432
|
-
var
|
|
1287
|
+
var import_react9 = require("react");
|
|
1288
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1433
1289
|
var LinkControl = () => {
|
|
1434
1290
|
const { editor, icons, labels, tooltip } = useRichTextEditorContext();
|
|
1435
|
-
const [url, setUrl] = (0,
|
|
1436
|
-
const [open, setOpen] = (0,
|
|
1437
|
-
const active = (0,
|
|
1291
|
+
const [url, setUrl] = (0, import_react9.useState)("");
|
|
1292
|
+
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
1293
|
+
const active = (0, import_react8.useEditorState)({
|
|
1438
1294
|
editor: editor ?? null,
|
|
1439
1295
|
selector: (ctx) => ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("link") : false
|
|
1440
1296
|
});
|
|
1441
|
-
const handleOpen = (0,
|
|
1297
|
+
const handleOpen = (0, import_react9.useCallback)(
|
|
1442
1298
|
(isOpen) => {
|
|
1443
1299
|
if (isOpen) {
|
|
1444
1300
|
const linkData = editor?.getAttributes("link");
|
|
@@ -1473,16 +1329,16 @@ var LinkControl = () => {
|
|
|
1473
1329
|
window.addEventListener("edit-link", handler);
|
|
1474
1330
|
return () => window.removeEventListener("edit-link", handler);
|
|
1475
1331
|
}, [handleOpen]);
|
|
1476
|
-
return /* @__PURE__ */ (0,
|
|
1477
|
-
/* @__PURE__ */ (0,
|
|
1332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Popover, { open, onOpenChange: handleOpen, children: [
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1478
1334
|
TooltipTrigger,
|
|
1479
1335
|
{
|
|
1480
1336
|
handle: tooltip,
|
|
1481
1337
|
payload: labels.linkControlLabel,
|
|
1482
|
-
render: /* @__PURE__ */ (0,
|
|
1338
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1483
1339
|
PopoverTrigger,
|
|
1484
1340
|
{
|
|
1485
|
-
render: /* @__PURE__ */ (0,
|
|
1341
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1486
1342
|
Toggle,
|
|
1487
1343
|
{
|
|
1488
1344
|
size: "sm",
|
|
@@ -1497,8 +1353,8 @@ var LinkControl = () => {
|
|
|
1497
1353
|
)
|
|
1498
1354
|
}
|
|
1499
1355
|
),
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rte-link-editor", children: [
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1502
1358
|
Input,
|
|
1503
1359
|
{
|
|
1504
1360
|
type: "url",
|
|
@@ -1510,7 +1366,7 @@ var LinkControl = () => {
|
|
|
1510
1366
|
className: "rte-link-editor-input h-8 text-sm"
|
|
1511
1367
|
}
|
|
1512
1368
|
),
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1369
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1514
1370
|
Button,
|
|
1515
1371
|
{
|
|
1516
1372
|
size: "sm",
|
|
@@ -1526,24 +1382,24 @@ var LinkControl = () => {
|
|
|
1526
1382
|
|
|
1527
1383
|
// src/controls/rte-twitter-control.tsx
|
|
1528
1384
|
var import_core2 = require("@tiptap/core");
|
|
1529
|
-
var
|
|
1530
|
-
var
|
|
1385
|
+
var import_react14 = require("@tiptap/react");
|
|
1386
|
+
var import_react15 = require("react");
|
|
1531
1387
|
|
|
1532
1388
|
// src/extensions/resizable-node-view.tsx
|
|
1533
|
-
var
|
|
1534
|
-
var
|
|
1389
|
+
var import_react12 = require("@tiptap/react");
|
|
1390
|
+
var import_react13 = require("react");
|
|
1535
1391
|
|
|
1536
1392
|
// src/icons.tsx
|
|
1537
1393
|
var import_lucide_react = require("lucide-react");
|
|
1538
|
-
var
|
|
1394
|
+
var import_react11 = require("react");
|
|
1539
1395
|
|
|
1540
1396
|
// src/language-icons.tsx
|
|
1541
|
-
var
|
|
1542
|
-
var
|
|
1397
|
+
var import_react10 = require("react");
|
|
1398
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1543
1399
|
var LangIcon = ({
|
|
1544
1400
|
children,
|
|
1545
1401
|
className
|
|
1546
|
-
}) => /* @__PURE__ */ (0,
|
|
1402
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1547
1403
|
"svg",
|
|
1548
1404
|
{
|
|
1549
1405
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1558,140 +1414,140 @@ var LangIcon = ({
|
|
|
1558
1414
|
}
|
|
1559
1415
|
);
|
|
1560
1416
|
var DEFAULT_LANGUAGE_ICONS = {
|
|
1561
|
-
bash: /* @__PURE__ */ (0,
|
|
1562
|
-
/* @__PURE__ */ (0,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1564
|
-
/* @__PURE__ */ (0,
|
|
1417
|
+
bash: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 15.5h5.5" })
|
|
1565
1421
|
] }),
|
|
1566
|
-
c: /* @__PURE__ */ (0,
|
|
1567
|
-
/* @__PURE__ */ (0,
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1422
|
+
c: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
|
|
1569
1425
|
] }),
|
|
1570
|
-
cpp: /* @__PURE__ */ (0,
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1426
|
+
cpp: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
|
|
1575
1431
|
] }),
|
|
1576
|
-
css: /* @__PURE__ */ (0,
|
|
1577
|
-
/* @__PURE__ */ (0,
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1432
|
+
css: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.7 7.5l-1 9" }),
|
|
1435
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.3 7.5l-1 9" }),
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7 10.3h11" }),
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 14.3h11" })
|
|
1582
1438
|
] }),
|
|
1583
|
-
go: /* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1585
|
-
/* @__PURE__ */ (0,
|
|
1586
|
-
/* @__PURE__ */ (0,
|
|
1587
|
-
/* @__PURE__ */ (0,
|
|
1439
|
+
go: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 12h-1.9" }),
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
|
|
1588
1444
|
] }),
|
|
1589
|
-
html: /* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
1591
|
-
/* @__PURE__ */ (0,
|
|
1592
|
-
/* @__PURE__ */ (0,
|
|
1593
|
-
/* @__PURE__ */ (0,
|
|
1445
|
+
html: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13 7.3l-2 9.4" })
|
|
1594
1450
|
] }),
|
|
1595
|
-
java: /* @__PURE__ */ (0,
|
|
1596
|
-
/* @__PURE__ */ (0,
|
|
1597
|
-
/* @__PURE__ */ (0,
|
|
1598
|
-
/* @__PURE__ */ (0,
|
|
1599
|
-
/* @__PURE__ */ (0,
|
|
1451
|
+
java: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" }),
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 19.3h10" })
|
|
1600
1456
|
] }),
|
|
1601
|
-
javascript: /* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1603
|
-
/* @__PURE__ */ (0,
|
|
1604
|
-
/* @__PURE__ */ (0,
|
|
1457
|
+
javascript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" })
|
|
1605
1461
|
] }),
|
|
1606
|
-
json: /* @__PURE__ */ (0,
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1462
|
+
json: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1463
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" }),
|
|
1464
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" })
|
|
1609
1465
|
] }),
|
|
1610
|
-
kotlin: /* @__PURE__ */ (0,
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
1613
|
-
/* @__PURE__ */ (0,
|
|
1614
|
-
/* @__PURE__ */ (0,
|
|
1466
|
+
kotlin: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 7.5v9" }),
|
|
1469
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6-4.5" }),
|
|
1470
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6 4.5" })
|
|
1615
1471
|
] }),
|
|
1616
|
-
markdown: /* @__PURE__ */ (0,
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1619
|
-
/* @__PURE__ */ (0,
|
|
1620
|
-
/* @__PURE__ */ (0,
|
|
1472
|
+
markdown: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16.5 9v6" }),
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 13l2 2 2-2" })
|
|
1621
1477
|
] }),
|
|
1622
|
-
php: /* @__PURE__ */ (0,
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1624
|
-
/* @__PURE__ */ (0,
|
|
1625
|
-
/* @__PURE__ */ (0,
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1478
|
+
php: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1479
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" }),
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
|
|
1627
1483
|
] }),
|
|
1628
|
-
plaintext: /* @__PURE__ */ (0,
|
|
1629
|
-
/* @__PURE__ */ (0,
|
|
1630
|
-
/* @__PURE__ */ (0,
|
|
1631
|
-
/* @__PURE__ */ (0,
|
|
1632
|
-
/* @__PURE__ */ (0,
|
|
1484
|
+
plaintext: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1485
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
|
|
1633
1489
|
] }),
|
|
1634
|
-
python: /* @__PURE__ */ (0,
|
|
1635
|
-
/* @__PURE__ */ (0,
|
|
1636
|
-
/* @__PURE__ */ (0,
|
|
1637
|
-
/* @__PURE__ */ (0,
|
|
1638
|
-
/* @__PURE__ */ (0,
|
|
1490
|
+
python: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
|
|
1639
1495
|
] }),
|
|
1640
|
-
ruby: /* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1643
|
-
/* @__PURE__ */ (0,
|
|
1496
|
+
ruby: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4.5 8h15" }),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v19" })
|
|
1644
1500
|
] }),
|
|
1645
|
-
rust: /* @__PURE__ */ (0,
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1501
|
+
rust: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
|
|
1505
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" })
|
|
1650
1506
|
] }),
|
|
1651
|
-
sql: /* @__PURE__ */ (0,
|
|
1652
|
-
/* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1654
|
-
/* @__PURE__ */ (0,
|
|
1507
|
+
sql: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1508
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
|
|
1510
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
|
|
1655
1511
|
] }),
|
|
1656
|
-
swift: /* @__PURE__ */ (0,
|
|
1657
|
-
typescript: /* @__PURE__ */ (0,
|
|
1658
|
-
/* @__PURE__ */ (0,
|
|
1659
|
-
/* @__PURE__ */ (0,
|
|
1660
|
-
/* @__PURE__ */ (0,
|
|
1512
|
+
swift: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(LangIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime22.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" }) }),
|
|
1513
|
+
typescript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1515
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.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" })
|
|
1661
1517
|
] }),
|
|
1662
|
-
xml: /* @__PURE__ */ (0,
|
|
1663
|
-
/* @__PURE__ */ (0,
|
|
1664
|
-
/* @__PURE__ */ (0,
|
|
1665
|
-
/* @__PURE__ */ (0,
|
|
1518
|
+
xml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
|
|
1520
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 8v8" })
|
|
1666
1522
|
] }),
|
|
1667
|
-
yaml: /* @__PURE__ */ (0,
|
|
1668
|
-
/* @__PURE__ */ (0,
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1523
|
+
yaml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1524
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
|
|
1526
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
|
|
1527
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1672
1528
|
] })
|
|
1673
1529
|
};
|
|
1674
1530
|
|
|
1675
1531
|
// src/icons.tsx
|
|
1676
|
-
var
|
|
1532
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1677
1533
|
var ALIGN_PATHS = {
|
|
1678
|
-
center: /* @__PURE__ */ (0,
|
|
1679
|
-
/* @__PURE__ */ (0,
|
|
1680
|
-
/* @__PURE__ */ (0,
|
|
1681
|
-
/* @__PURE__ */ (0,
|
|
1534
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1535
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1537
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1682
1538
|
] }),
|
|
1683
|
-
left: /* @__PURE__ */ (0,
|
|
1684
|
-
/* @__PURE__ */ (0,
|
|
1685
|
-
/* @__PURE__ */ (0,
|
|
1686
|
-
/* @__PURE__ */ (0,
|
|
1539
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1687
1543
|
] }),
|
|
1688
|
-
right: /* @__PURE__ */ (0,
|
|
1689
|
-
/* @__PURE__ */ (0,
|
|
1690
|
-
/* @__PURE__ */ (0,
|
|
1691
|
-
/* @__PURE__ */ (0,
|
|
1544
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1545
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1546
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1692
1548
|
] })
|
|
1693
1549
|
};
|
|
1694
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0,
|
|
1550
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1695
1551
|
"svg",
|
|
1696
1552
|
{
|
|
1697
1553
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1705,7 +1561,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
1705
1561
|
children: ALIGN_PATHS[dir]
|
|
1706
1562
|
}
|
|
1707
1563
|
);
|
|
1708
|
-
var EditUrlIcon = () => /* @__PURE__ */ (0,
|
|
1564
|
+
var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1709
1565
|
"svg",
|
|
1710
1566
|
{
|
|
1711
1567
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1717,12 +1573,12 @@ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
|
1717
1573
|
strokeLinejoin: "round",
|
|
1718
1574
|
className: "rte-editor-icon",
|
|
1719
1575
|
children: [
|
|
1720
|
-
/* @__PURE__ */ (0,
|
|
1721
|
-
/* @__PURE__ */ (0,
|
|
1576
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 20h9" }),
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
|
|
1722
1578
|
]
|
|
1723
1579
|
}
|
|
1724
1580
|
);
|
|
1725
|
-
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0,
|
|
1581
|
+
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1726
1582
|
"svg",
|
|
1727
1583
|
{
|
|
1728
1584
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1734,13 +1590,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
|
1734
1590
|
strokeLinejoin: "round",
|
|
1735
1591
|
className: "rte-editor-icon",
|
|
1736
1592
|
children: [
|
|
1737
|
-
/* @__PURE__ */ (0,
|
|
1738
|
-
/* @__PURE__ */ (0,
|
|
1739
|
-
/* @__PURE__ */ (0,
|
|
1593
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1740
1596
|
]
|
|
1741
1597
|
}
|
|
1742
1598
|
);
|
|
1743
|
-
var DeleteEmbedIcon = () => /* @__PURE__ */ (0,
|
|
1599
|
+
var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1744
1600
|
"svg",
|
|
1745
1601
|
{
|
|
1746
1602
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1752,46 +1608,46 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
|
1752
1608
|
strokeLinejoin: "round",
|
|
1753
1609
|
className: "rte-editor-icon",
|
|
1754
1610
|
children: [
|
|
1755
|
-
/* @__PURE__ */ (0,
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1612
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.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" })
|
|
1757
1613
|
]
|
|
1758
1614
|
}
|
|
1759
1615
|
);
|
|
1760
1616
|
var iconProps = { className: "rte-editor-icon" };
|
|
1761
1617
|
var DEFAULT_ICONS = {
|
|
1762
|
-
alignCenterControlIcon: /* @__PURE__ */ (0,
|
|
1763
|
-
alignJustifyControlIcon: /* @__PURE__ */ (0,
|
|
1764
|
-
alignLeftControlIcon: /* @__PURE__ */ (0,
|
|
1765
|
-
alignRightControlIcon: /* @__PURE__ */ (0,
|
|
1766
|
-
blockquoteControlIcon: /* @__PURE__ */ (0,
|
|
1767
|
-
boldControlIcon: /* @__PURE__ */ (0,
|
|
1768
|
-
bulletListControlIcon: /* @__PURE__ */ (0,
|
|
1769
|
-
clearFormattingControlIcon: /* @__PURE__ */ (0,
|
|
1770
|
-
codeBlockControlIcon: /* @__PURE__ */ (0,
|
|
1771
|
-
codeControlIcon: /* @__PURE__ */ (0,
|
|
1772
|
-
h1ControlIcon: /* @__PURE__ */ (0,
|
|
1773
|
-
h2ControlIcon: /* @__PURE__ */ (0,
|
|
1774
|
-
h3ControlIcon: /* @__PURE__ */ (0,
|
|
1775
|
-
h4ControlIcon: /* @__PURE__ */ (0,
|
|
1776
|
-
h5ControlIcon: /* @__PURE__ */ (0,
|
|
1777
|
-
h6ControlIcon: /* @__PURE__ */ (0,
|
|
1778
|
-
highlightControlIcon: /* @__PURE__ */ (0,
|
|
1779
|
-
hrControlIcon: /* @__PURE__ */ (0,
|
|
1780
|
-
italicControlIcon: /* @__PURE__ */ (0,
|
|
1618
|
+
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
|
|
1619
|
+
alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
|
|
1620
|
+
alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
|
|
1621
|
+
alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
|
|
1622
|
+
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
|
|
1623
|
+
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Bold, { ...iconProps }),
|
|
1624
|
+
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.List, { ...iconProps }),
|
|
1625
|
+
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
|
|
1626
|
+
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
|
|
1627
|
+
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Code, { ...iconProps }),
|
|
1628
|
+
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading1, { ...iconProps }),
|
|
1629
|
+
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading2, { ...iconProps }),
|
|
1630
|
+
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading3, { ...iconProps }),
|
|
1631
|
+
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading4, { ...iconProps }),
|
|
1632
|
+
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading5, { ...iconProps }),
|
|
1633
|
+
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading6, { ...iconProps }),
|
|
1634
|
+
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
|
|
1635
|
+
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Minus, { ...iconProps }),
|
|
1636
|
+
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Italic, { ...iconProps }),
|
|
1781
1637
|
languageIcons: DEFAULT_LANGUAGE_ICONS,
|
|
1782
|
-
linkControlIcon: /* @__PURE__ */ (0,
|
|
1783
|
-
orderedListControlIcon: /* @__PURE__ */ (0,
|
|
1784
|
-
redoControlIcon: /* @__PURE__ */ (0,
|
|
1785
|
-
strikeControlIcon: /* @__PURE__ */ (0,
|
|
1786
|
-
subscriptControlIcon: /* @__PURE__ */ (0,
|
|
1787
|
-
superscriptControlIcon: /* @__PURE__ */ (0,
|
|
1788
|
-
underlineControlIcon: /* @__PURE__ */ (0,
|
|
1789
|
-
undoControlIcon: /* @__PURE__ */ (0,
|
|
1790
|
-
unlinkControlIcon: /* @__PURE__ */ (0,
|
|
1638
|
+
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link, { ...iconProps }),
|
|
1639
|
+
orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
|
|
1640
|
+
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Redo2, { ...iconProps }),
|
|
1641
|
+
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
|
|
1642
|
+
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Subscript, { ...iconProps }),
|
|
1643
|
+
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Superscript, { ...iconProps }),
|
|
1644
|
+
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Underline, { ...iconProps }),
|
|
1645
|
+
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Undo2, { ...iconProps }),
|
|
1646
|
+
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link2Off, { ...iconProps })
|
|
1791
1647
|
};
|
|
1792
1648
|
|
|
1793
1649
|
// src/extensions/resizable-node-view.tsx
|
|
1794
|
-
var
|
|
1650
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1795
1651
|
var EmbedToolbar = ({
|
|
1796
1652
|
align,
|
|
1797
1653
|
videoSrc,
|
|
@@ -1808,8 +1664,8 @@ var EmbedToolbar = ({
|
|
|
1808
1664
|
nodeSrc
|
|
1809
1665
|
}) => {
|
|
1810
1666
|
if (isEditingUrl) {
|
|
1811
|
-
return /* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1813
1669
|
"input",
|
|
1814
1670
|
{
|
|
1815
1671
|
ref: inputRef,
|
|
@@ -1827,7 +1683,7 @@ var EmbedToolbar = ({
|
|
|
1827
1683
|
}
|
|
1828
1684
|
}
|
|
1829
1685
|
),
|
|
1830
|
-
/* @__PURE__ */ (0,
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1831
1687
|
"button",
|
|
1832
1688
|
{
|
|
1833
1689
|
type: "button",
|
|
@@ -1836,7 +1692,7 @@ var EmbedToolbar = ({
|
|
|
1836
1692
|
children: "Save"
|
|
1837
1693
|
}
|
|
1838
1694
|
),
|
|
1839
|
-
/* @__PURE__ */ (0,
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1840
1696
|
"button",
|
|
1841
1697
|
{
|
|
1842
1698
|
type: "button",
|
|
@@ -1847,8 +1703,8 @@ var EmbedToolbar = ({
|
|
|
1847
1703
|
)
|
|
1848
1704
|
] });
|
|
1849
1705
|
}
|
|
1850
|
-
return /* @__PURE__ */ (0,
|
|
1851
|
-
/* @__PURE__ */ (0,
|
|
1706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1852
1708
|
"button",
|
|
1853
1709
|
{
|
|
1854
1710
|
type: "button",
|
|
@@ -1856,12 +1712,12 @@ var EmbedToolbar = ({
|
|
|
1856
1712
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1857
1713
|
className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
|
|
1858
1714
|
onClick: () => updateAttributes({ align: dir }),
|
|
1859
|
-
children: /* @__PURE__ */ (0,
|
|
1715
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AlignIcon, { dir })
|
|
1860
1716
|
},
|
|
1861
1717
|
dir
|
|
1862
1718
|
)) }),
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
1719
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1720
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1865
1721
|
"button",
|
|
1866
1722
|
{
|
|
1867
1723
|
type: "button",
|
|
@@ -1875,9 +1731,9 @@ var EmbedToolbar = ({
|
|
|
1875
1731
|
},
|
|
1876
1732
|
pct
|
|
1877
1733
|
)) }),
|
|
1878
|
-
/* @__PURE__ */ (0,
|
|
1879
|
-
/* @__PURE__ */ (0,
|
|
1880
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */ (0,
|
|
1734
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-group", children: [
|
|
1736
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1881
1737
|
"button",
|
|
1882
1738
|
{
|
|
1883
1739
|
type: "button",
|
|
@@ -1888,10 +1744,10 @@ var EmbedToolbar = ({
|
|
|
1888
1744
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1889
1745
|
setIsEditingUrl(true);
|
|
1890
1746
|
},
|
|
1891
|
-
children: /* @__PURE__ */ (0,
|
|
1747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EditUrlIcon, {})
|
|
1892
1748
|
}
|
|
1893
1749
|
),
|
|
1894
|
-
watchUrl && /* @__PURE__ */ (0,
|
|
1750
|
+
watchUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1895
1751
|
"button",
|
|
1896
1752
|
{
|
|
1897
1753
|
type: "button",
|
|
@@ -1899,10 +1755,10 @@ var EmbedToolbar = ({
|
|
|
1899
1755
|
"aria-label": "Open video in YouTube",
|
|
1900
1756
|
className: "rte-embed-selector-btn",
|
|
1901
1757
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1902
|
-
children: /* @__PURE__ */ (0,
|
|
1758
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OpenInYouTubeIcon, {})
|
|
1903
1759
|
}
|
|
1904
1760
|
),
|
|
1905
|
-
deleteNode && /* @__PURE__ */ (0,
|
|
1761
|
+
deleteNode && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1906
1762
|
"button",
|
|
1907
1763
|
{
|
|
1908
1764
|
type: "button",
|
|
@@ -1910,7 +1766,7 @@ var EmbedToolbar = ({
|
|
|
1910
1766
|
"aria-label": "Delete Embed",
|
|
1911
1767
|
className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
|
|
1912
1768
|
onClick: () => deleteNode(),
|
|
1913
|
-
children: /* @__PURE__ */ (0,
|
|
1769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeleteEmbedIcon, {})
|
|
1914
1770
|
}
|
|
1915
1771
|
)
|
|
1916
1772
|
] })
|
|
@@ -1932,26 +1788,26 @@ var ResizableNodeView = ({
|
|
|
1932
1788
|
watchUrl,
|
|
1933
1789
|
onSrcChange
|
|
1934
1790
|
}) => {
|
|
1935
|
-
const containerRef = (0,
|
|
1936
|
-
const [isEditingUrl, setIsEditingUrl] = (0,
|
|
1937
|
-
const [urlInput, setUrlInput] = (0,
|
|
1938
|
-
const [isResizing, setIsResizing] = (0,
|
|
1939
|
-
const [currentDimensions, setCurrentDimensions] = (0,
|
|
1940
|
-
const resizingRef = (0,
|
|
1791
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
1792
|
+
const [isEditingUrl, setIsEditingUrl] = (0, import_react13.useState)(false);
|
|
1793
|
+
const [urlInput, setUrlInput] = (0, import_react13.useState)(videoSrc || "");
|
|
1794
|
+
const [isResizing, setIsResizing] = (0, import_react13.useState)(false);
|
|
1795
|
+
const [currentDimensions, setCurrentDimensions] = (0, import_react13.useState)(null);
|
|
1796
|
+
const resizingRef = (0, import_react13.useRef)(null);
|
|
1941
1797
|
const width = node.attrs.width;
|
|
1942
1798
|
const height = node.attrs.height;
|
|
1943
1799
|
const align = node.attrs.align || "center";
|
|
1944
|
-
const getEditorWidth = (0,
|
|
1800
|
+
const getEditorWidth = (0, import_react13.useCallback)(
|
|
1945
1801
|
() => view?.dom?.parentElement?.offsetWidth ?? 800,
|
|
1946
1802
|
[view]
|
|
1947
1803
|
);
|
|
1948
|
-
const inputRef = (0,
|
|
1949
|
-
(0,
|
|
1804
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
1805
|
+
(0, import_react13.useEffect)(() => {
|
|
1950
1806
|
if (isEditingUrl) {
|
|
1951
1807
|
inputRef.current?.focus();
|
|
1952
1808
|
}
|
|
1953
1809
|
}, [isEditingUrl]);
|
|
1954
|
-
const handleMouseMove = (0,
|
|
1810
|
+
const handleMouseMove = (0, import_react13.useCallback)(
|
|
1955
1811
|
(e) => {
|
|
1956
1812
|
const resize = resizingRef.current;
|
|
1957
1813
|
if (!resize) {
|
|
@@ -2001,7 +1857,7 @@ var ResizableNodeView = ({
|
|
|
2001
1857
|
},
|
|
2002
1858
|
[lockAspect, aspectRatio, minWidth, maxWidth]
|
|
2003
1859
|
);
|
|
2004
|
-
const handleMouseUp = (0,
|
|
1860
|
+
const handleMouseUp = (0, import_react13.useCallback)(
|
|
2005
1861
|
function handleMouseUp2() {
|
|
2006
1862
|
const resize = resizingRef.current;
|
|
2007
1863
|
if (!resize) {
|
|
@@ -2022,7 +1878,7 @@ var ResizableNodeView = ({
|
|
|
2022
1878
|
},
|
|
2023
1879
|
[handleMouseMove, updateAttributes]
|
|
2024
1880
|
);
|
|
2025
|
-
const handleMouseDown = (0,
|
|
1881
|
+
const handleMouseDown = (0, import_react13.useCallback)(
|
|
2026
1882
|
(e, direction) => {
|
|
2027
1883
|
e.preventDefault();
|
|
2028
1884
|
e.stopPropagation();
|
|
@@ -2053,7 +1909,7 @@ var ResizableNodeView = ({
|
|
|
2053
1909
|
},
|
|
2054
1910
|
[width, height, getEditorWidth, handleMouseMove, handleMouseUp]
|
|
2055
1911
|
);
|
|
2056
|
-
(0,
|
|
1912
|
+
(0, import_react13.useEffect)(
|
|
2057
1913
|
() => () => {
|
|
2058
1914
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
2059
1915
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -2081,13 +1937,13 @@ var ResizableNodeView = ({
|
|
|
2081
1937
|
setIsEditingUrl(false);
|
|
2082
1938
|
};
|
|
2083
1939
|
const isEditable = editor ? editor.isEditable : true;
|
|
2084
|
-
return /* @__PURE__ */ (0,
|
|
2085
|
-
|
|
1940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1941
|
+
import_react12.NodeViewWrapper,
|
|
2086
1942
|
{
|
|
2087
1943
|
className: "rte-embed-wrapper",
|
|
2088
1944
|
"data-selected": selected || void 0,
|
|
2089
1945
|
"data-align": align,
|
|
2090
|
-
children: /* @__PURE__ */ (0,
|
|
1946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2091
1947
|
"div",
|
|
2092
1948
|
{
|
|
2093
1949
|
ref: containerRef,
|
|
@@ -2100,7 +1956,7 @@ var ResizableNodeView = ({
|
|
|
2100
1956
|
},
|
|
2101
1957
|
children: [
|
|
2102
1958
|
children,
|
|
2103
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
1959
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2104
1960
|
EmbedToolbar,
|
|
2105
1961
|
{
|
|
2106
1962
|
align,
|
|
@@ -2118,14 +1974,14 @@ var ResizableNodeView = ({
|
|
|
2118
1974
|
nodeSrc: node.attrs.src
|
|
2119
1975
|
}
|
|
2120
1976
|
) }),
|
|
2121
|
-
isResizing && currentDimensions && /* @__PURE__ */ (0,
|
|
1977
|
+
isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-resize-badge", children: [
|
|
2122
1978
|
currentDimensions.w,
|
|
2123
1979
|
" \xD7 ",
|
|
2124
1980
|
currentDimensions.h,
|
|
2125
1981
|
" px"
|
|
2126
1982
|
] }),
|
|
2127
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
2128
|
-
/* @__PURE__ */ (0,
|
|
1983
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1984
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2129
1985
|
"div",
|
|
2130
1986
|
{
|
|
2131
1987
|
className: "rte-resize-handle rte-resize-handle--left",
|
|
@@ -2133,7 +1989,7 @@ var ResizableNodeView = ({
|
|
|
2133
1989
|
role: "presentation"
|
|
2134
1990
|
}
|
|
2135
1991
|
),
|
|
2136
|
-
/* @__PURE__ */ (0,
|
|
1992
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2137
1993
|
"div",
|
|
2138
1994
|
{
|
|
2139
1995
|
className: "rte-resize-handle rte-resize-handle--right",
|
|
@@ -2141,7 +1997,7 @@ var ResizableNodeView = ({
|
|
|
2141
1997
|
role: "presentation"
|
|
2142
1998
|
}
|
|
2143
1999
|
),
|
|
2144
|
-
/* @__PURE__ */ (0,
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2145
2001
|
"div",
|
|
2146
2002
|
{
|
|
2147
2003
|
className: "rte-resize-handle rte-resize-handle--bottom",
|
|
@@ -2149,7 +2005,7 @@ var ResizableNodeView = ({
|
|
|
2149
2005
|
role: "presentation"
|
|
2150
2006
|
}
|
|
2151
2007
|
),
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2153
2009
|
"div",
|
|
2154
2010
|
{
|
|
2155
2011
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
|
|
@@ -2157,7 +2013,7 @@ var ResizableNodeView = ({
|
|
|
2157
2013
|
role: "presentation"
|
|
2158
2014
|
}
|
|
2159
2015
|
),
|
|
2160
|
-
/* @__PURE__ */ (0,
|
|
2016
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2161
2017
|
"div",
|
|
2162
2018
|
{
|
|
2163
2019
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
|
|
@@ -2174,7 +2030,7 @@ var ResizableNodeView = ({
|
|
|
2174
2030
|
};
|
|
2175
2031
|
|
|
2176
2032
|
// src/controls/rte-twitter-control.tsx
|
|
2177
|
-
var
|
|
2033
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2178
2034
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2179
2035
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2180
2036
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2250,15 +2106,15 @@ var loadTwitterScript = () => {
|
|
|
2250
2106
|
};
|
|
2251
2107
|
var TwitterNodeView = (props) => {
|
|
2252
2108
|
const { node } = props;
|
|
2253
|
-
const containerRef = (0,
|
|
2254
|
-
const [loading, setLoading] = (0,
|
|
2255
|
-
const [failed, setFailed] = (0,
|
|
2109
|
+
const containerRef = (0, import_react15.useRef)(null);
|
|
2110
|
+
const [loading, setLoading] = (0, import_react15.useState)(true);
|
|
2111
|
+
const [failed, setFailed] = (0, import_react15.useState)(false);
|
|
2256
2112
|
const { tweetId } = node.attrs;
|
|
2257
|
-
const renderedTweetIdRef = (0,
|
|
2258
|
-
const activeRenderIdRef = (0,
|
|
2259
|
-
const retryToken = (0,
|
|
2260
|
-
const [retryCount, setRetryCount] = (0,
|
|
2261
|
-
(0,
|
|
2113
|
+
const renderedTweetIdRef = (0, import_react15.useRef)(null);
|
|
2114
|
+
const activeRenderIdRef = (0, import_react15.useRef)(0);
|
|
2115
|
+
const retryToken = (0, import_react15.useRef)(0);
|
|
2116
|
+
const [retryCount, setRetryCount] = (0, import_react15.useState)(0);
|
|
2117
|
+
(0, import_react15.useEffect)(() => {
|
|
2262
2118
|
if (!containerRef.current || !tweetId) {
|
|
2263
2119
|
return;
|
|
2264
2120
|
}
|
|
@@ -2317,11 +2173,11 @@ var TwitterNodeView = (props) => {
|
|
|
2317
2173
|
isCancelled = true;
|
|
2318
2174
|
};
|
|
2319
2175
|
}, [tweetId, retryCount, failed]);
|
|
2320
|
-
const handleRetry = (0,
|
|
2176
|
+
const handleRetry = (0, import_react15.useCallback)(() => {
|
|
2321
2177
|
retryToken.current += 1;
|
|
2322
2178
|
setRetryCount(retryToken.current);
|
|
2323
2179
|
}, []);
|
|
2324
|
-
return /* @__PURE__ */ (0,
|
|
2180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2325
2181
|
ResizableNodeView,
|
|
2326
2182
|
{
|
|
2327
2183
|
...props,
|
|
@@ -2329,12 +2185,12 @@ var TwitterNodeView = (props) => {
|
|
|
2329
2185
|
minWidth: 300,
|
|
2330
2186
|
maxWidth: 1200,
|
|
2331
2187
|
children: [
|
|
2332
|
-
loading && /* @__PURE__ */ (0,
|
|
2333
|
-
!loading && failed && /* @__PURE__ */ (0,
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2188
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
|
|
2189
|
+
!loading && failed && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-error", children: [
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "Couldn't load this tweet." }),
|
|
2191
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2336
2192
|
] }),
|
|
2337
|
-
/* @__PURE__ */ (0,
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: containerRef })
|
|
2338
2194
|
]
|
|
2339
2195
|
}
|
|
2340
2196
|
);
|
|
@@ -2404,7 +2260,7 @@ var TwitterEmbed = import_core2.Node.create({
|
|
|
2404
2260
|
];
|
|
2405
2261
|
},
|
|
2406
2262
|
addNodeView() {
|
|
2407
|
-
return (0,
|
|
2263
|
+
return (0, import_react14.ReactNodeViewRenderer)(TwitterNodeView);
|
|
2408
2264
|
},
|
|
2409
2265
|
atom: true,
|
|
2410
2266
|
draggable: true,
|
|
@@ -2438,10 +2294,10 @@ var extractTweetId = (input) => {
|
|
|
2438
2294
|
};
|
|
2439
2295
|
var TwitterEmbedControl = ({ className }) => {
|
|
2440
2296
|
const { editor } = useRichTextEditorContext();
|
|
2441
|
-
const [open, setOpen] = (0,
|
|
2442
|
-
const [url, setUrl] = (0,
|
|
2443
|
-
const [touched, setTouched] = (0,
|
|
2444
|
-
const { active } = (0,
|
|
2297
|
+
const [open, setOpen] = (0, import_react15.useState)(false);
|
|
2298
|
+
const [url, setUrl] = (0, import_react15.useState)("");
|
|
2299
|
+
const [touched, setTouched] = (0, import_react15.useState)(false);
|
|
2300
|
+
const { active } = (0, import_react14.useEditorState)({
|
|
2445
2301
|
editor: editor ?? null,
|
|
2446
2302
|
selector: (ctx) => ({
|
|
2447
2303
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
|
|
@@ -2449,11 +2305,11 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2449
2305
|
}) ?? { active: false };
|
|
2450
2306
|
const tweetId = url ? extractTweetId(url) : null;
|
|
2451
2307
|
const showError = touched && url.length > 0 && !tweetId;
|
|
2452
|
-
const resetState = (0,
|
|
2308
|
+
const resetState = (0, import_react15.useCallback)(() => {
|
|
2453
2309
|
setUrl("");
|
|
2454
2310
|
setTouched(false);
|
|
2455
2311
|
}, []);
|
|
2456
|
-
const handleInsert = (0,
|
|
2312
|
+
const handleInsert = (0, import_react15.useCallback)(() => {
|
|
2457
2313
|
setTouched(true);
|
|
2458
2314
|
if (!tweetId || !editor) {
|
|
2459
2315
|
return false;
|
|
@@ -2462,7 +2318,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2462
2318
|
resetState();
|
|
2463
2319
|
return true;
|
|
2464
2320
|
}, [tweetId, editor, resetState]);
|
|
2465
|
-
return /* @__PURE__ */ (0,
|
|
2321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2466
2322
|
Dialog,
|
|
2467
2323
|
{
|
|
2468
2324
|
open,
|
|
@@ -2473,36 +2329,36 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2473
2329
|
}
|
|
2474
2330
|
},
|
|
2475
2331
|
children: [
|
|
2476
|
-
/* @__PURE__ */ (0,
|
|
2332
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2477
2333
|
DialogTrigger,
|
|
2478
2334
|
{
|
|
2479
|
-
render: /* @__PURE__ */ (0,
|
|
2335
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2480
2336
|
RichTextEditorControl,
|
|
2481
2337
|
{
|
|
2482
2338
|
active,
|
|
2483
2339
|
className,
|
|
2484
2340
|
title: "Embed Tweet",
|
|
2485
2341
|
"aria-label": "Embed Tweet",
|
|
2486
|
-
children: /* @__PURE__ */ (0,
|
|
2342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2487
2343
|
"svg",
|
|
2488
2344
|
{
|
|
2489
2345
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2490
2346
|
viewBox: "0 0 24 24",
|
|
2491
2347
|
fill: "currentColor",
|
|
2492
2348
|
className: "rte-editor-icon",
|
|
2493
|
-
children: /* @__PURE__ */ (0,
|
|
2349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.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" })
|
|
2494
2350
|
}
|
|
2495
2351
|
)
|
|
2496
2352
|
}
|
|
2497
2353
|
)
|
|
2498
2354
|
}
|
|
2499
2355
|
),
|
|
2500
|
-
/* @__PURE__ */ (0,
|
|
2501
|
-
/* @__PURE__ */ (0,
|
|
2502
|
-
/* @__PURE__ */ (0,
|
|
2503
|
-
/* @__PURE__ */ (0,
|
|
2356
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogContent, { children: [
|
|
2357
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogHeader, { children: [
|
|
2358
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { children: "Embed Tweet" }),
|
|
2359
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2504
2360
|
] }),
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
2361
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2506
2362
|
Input,
|
|
2507
2363
|
{
|
|
2508
2364
|
value: url,
|
|
@@ -2522,10 +2378,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2522
2378
|
}
|
|
2523
2379
|
}
|
|
2524
2380
|
),
|
|
2525
|
-
showError && /* @__PURE__ */ (0,
|
|
2526
|
-
/* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2528
|
-
/* @__PURE__ */ (0,
|
|
2381
|
+
showError && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
|
|
2382
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogFooter, { children: [
|
|
2383
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogClose, { children: "Cancel" }),
|
|
2384
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2529
2385
|
"button",
|
|
2530
2386
|
{
|
|
2531
2387
|
type: "button",
|
|
@@ -2548,9 +2404,9 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2548
2404
|
|
|
2549
2405
|
// src/controls/rte-youtube-control.tsx
|
|
2550
2406
|
var import_core3 = require("@tiptap/core");
|
|
2551
|
-
var
|
|
2552
|
-
var
|
|
2553
|
-
var
|
|
2407
|
+
var import_react16 = require("@tiptap/react");
|
|
2408
|
+
var import_react17 = require("react");
|
|
2409
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2554
2410
|
var getYouTubeId = (url) => {
|
|
2555
2411
|
const clean = url.trim();
|
|
2556
2412
|
const patterns = [
|
|
@@ -2578,7 +2434,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2578
2434
|
if (videoId) {
|
|
2579
2435
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2580
2436
|
}
|
|
2581
|
-
return /* @__PURE__ */ (0,
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2582
2438
|
ResizableNodeView,
|
|
2583
2439
|
{
|
|
2584
2440
|
...props,
|
|
@@ -2589,7 +2445,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2589
2445
|
videoSrc: rawSrc,
|
|
2590
2446
|
watchUrl,
|
|
2591
2447
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2592
|
-
children: /* @__PURE__ */ (0,
|
|
2448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2593
2449
|
"iframe",
|
|
2594
2450
|
{
|
|
2595
2451
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2667,7 +2523,7 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2667
2523
|
];
|
|
2668
2524
|
},
|
|
2669
2525
|
addNodeView() {
|
|
2670
|
-
return (0,
|
|
2526
|
+
return (0, import_react16.ReactNodeViewRenderer)(YouTubeNodeView);
|
|
2671
2527
|
},
|
|
2672
2528
|
atom: true,
|
|
2673
2529
|
draggable: true,
|
|
@@ -2691,32 +2547,32 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2691
2547
|
});
|
|
2692
2548
|
var YouTubeEmbedControl = ({ className }) => {
|
|
2693
2549
|
const { editor } = useRichTextEditorContext();
|
|
2694
|
-
const [open, setOpen] = (0,
|
|
2695
|
-
const [url, setUrl] = (0,
|
|
2696
|
-
const { active } = (0,
|
|
2550
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
2551
|
+
const [url, setUrl] = (0, import_react17.useState)("");
|
|
2552
|
+
const { active } = (0, import_react16.useEditorState)({
|
|
2697
2553
|
editor: editor ?? null,
|
|
2698
2554
|
selector: (ctx) => ({
|
|
2699
2555
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
|
|
2700
2556
|
})
|
|
2701
2557
|
}) ?? { active: false };
|
|
2702
|
-
const handleInsert = (0,
|
|
2558
|
+
const handleInsert = (0, import_react17.useCallback)(() => {
|
|
2703
2559
|
if (url && editor) {
|
|
2704
2560
|
editor.chain().focus().setYouTubeEmbed(url).run();
|
|
2705
2561
|
setUrl("");
|
|
2706
2562
|
}
|
|
2707
2563
|
}, [url, editor]);
|
|
2708
|
-
return /* @__PURE__ */ (0,
|
|
2709
|
-
/* @__PURE__ */ (0,
|
|
2564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2710
2566
|
DialogTrigger,
|
|
2711
2567
|
{
|
|
2712
|
-
render: /* @__PURE__ */ (0,
|
|
2568
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2713
2569
|
RichTextEditorControl,
|
|
2714
2570
|
{
|
|
2715
2571
|
active,
|
|
2716
2572
|
className,
|
|
2717
2573
|
title: "Embed YouTube video",
|
|
2718
2574
|
"aria-label": "Embed YouTube video",
|
|
2719
|
-
children: /* @__PURE__ */ (0,
|
|
2575
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2720
2576
|
"svg",
|
|
2721
2577
|
{
|
|
2722
2578
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2728,8 +2584,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2728
2584
|
strokeLinejoin: "round",
|
|
2729
2585
|
className: "rte-editor-icon",
|
|
2730
2586
|
children: [
|
|
2731
|
-
/* @__PURE__ */ (0,
|
|
2732
|
-
/* @__PURE__ */ (0,
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.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" }),
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2733
2589
|
]
|
|
2734
2590
|
}
|
|
2735
2591
|
)
|
|
@@ -2737,12 +2593,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2737
2593
|
)
|
|
2738
2594
|
}
|
|
2739
2595
|
),
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2741
|
-
/* @__PURE__ */ (0,
|
|
2742
|
-
/* @__PURE__ */ (0,
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogContent, { showCloseButton: false, children: [
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogHeader, { children: [
|
|
2598
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTitle, { children: "Embed YouTube video" }),
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2744
2600
|
] }),
|
|
2745
|
-
/* @__PURE__ */ (0,
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2746
2602
|
Input,
|
|
2747
2603
|
{
|
|
2748
2604
|
value: url,
|
|
@@ -2756,9 +2612,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2756
2612
|
}
|
|
2757
2613
|
}
|
|
2758
2614
|
),
|
|
2759
|
-
/* @__PURE__ */ (0,
|
|
2760
|
-
/* @__PURE__ */ (0,
|
|
2761
|
-
/* @__PURE__ */ (0,
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogFooter, { children: [
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogClose, { children: "Cancel" }),
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2762
2618
|
DialogClose,
|
|
2763
2619
|
{
|
|
2764
2620
|
disabled: !url,
|
|
@@ -2814,19 +2670,20 @@ var DEFAULT_LABELS = {
|
|
|
2814
2670
|
};
|
|
2815
2671
|
|
|
2816
2672
|
// src/rte-content.tsx
|
|
2817
|
-
var
|
|
2818
|
-
var
|
|
2673
|
+
var import_react18 = require("@tiptap/react");
|
|
2674
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2819
2675
|
var Content = ({
|
|
2820
2676
|
children,
|
|
2821
2677
|
className
|
|
2822
2678
|
}) => {
|
|
2823
2679
|
const { editor } = useRichTextEditorContext();
|
|
2824
|
-
return /* @__PURE__ */ (0,
|
|
2825
|
-
/* @__PURE__ */ (0,
|
|
2826
|
-
|
|
2680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2682
|
+
import_react18.EditorContent,
|
|
2827
2683
|
{
|
|
2828
2684
|
editor,
|
|
2829
|
-
className: cn("rte-content w-full", className)
|
|
2685
|
+
className: cn("rte-content w-full", className),
|
|
2686
|
+
spellCheck: false
|
|
2830
2687
|
}
|
|
2831
2688
|
),
|
|
2832
2689
|
children
|
|
@@ -2834,15 +2691,15 @@ var Content = ({
|
|
|
2834
2691
|
};
|
|
2835
2692
|
|
|
2836
2693
|
// src/rte-controls-group.tsx
|
|
2837
|
-
var
|
|
2694
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2838
2695
|
var ControlsGroup = ({
|
|
2839
2696
|
children,
|
|
2840
2697
|
className
|
|
2841
|
-
}) => /* @__PURE__ */ (0,
|
|
2698
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("rte-controls-group", className), children });
|
|
2842
2699
|
|
|
2843
2700
|
// src/rte-footer.tsx
|
|
2844
|
-
var
|
|
2845
|
-
var
|
|
2701
|
+
var import_react19 = require("react");
|
|
2702
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2846
2703
|
var Footer = ({
|
|
2847
2704
|
children,
|
|
2848
2705
|
className,
|
|
@@ -2853,9 +2710,9 @@ var Footer = ({
|
|
|
2853
2710
|
wordCountFormatter
|
|
2854
2711
|
}) => {
|
|
2855
2712
|
const { editor, variant } = useRichTextEditorContext();
|
|
2856
|
-
const [, forceUpdate] = (0,
|
|
2857
|
-
const rafRef = (0,
|
|
2858
|
-
(0,
|
|
2713
|
+
const [, forceUpdate] = (0, import_react19.useState)(0);
|
|
2714
|
+
const rafRef = (0, import_react19.useRef)(null);
|
|
2715
|
+
(0, import_react19.useEffect)(() => {
|
|
2859
2716
|
if (!editor || !showWordCount) {
|
|
2860
2717
|
return;
|
|
2861
2718
|
}
|
|
@@ -2884,7 +2741,7 @@ var Footer = ({
|
|
|
2884
2741
|
}
|
|
2885
2742
|
};
|
|
2886
2743
|
}, [editor, showWordCount]);
|
|
2887
|
-
const wordCount = (0,
|
|
2744
|
+
const wordCount = (0, import_react19.useMemo)(() => {
|
|
2888
2745
|
if (!editor || !showWordCount) {
|
|
2889
2746
|
return null;
|
|
2890
2747
|
}
|
|
@@ -2901,7 +2758,7 @@ var Footer = ({
|
|
|
2901
2758
|
if (!showWordCount && !children) {
|
|
2902
2759
|
return null;
|
|
2903
2760
|
}
|
|
2904
|
-
return /* @__PURE__ */ (0,
|
|
2761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2905
2762
|
"div",
|
|
2906
2763
|
{
|
|
2907
2764
|
className: cn(
|
|
@@ -2913,21 +2770,21 @@ var Footer = ({
|
|
|
2913
2770
|
"data-sticky": sticky ? "" : void 0,
|
|
2914
2771
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2915
2772
|
children: [
|
|
2916
|
-
showWordCount && wordCount && /* @__PURE__ */ (0,
|
|
2917
|
-
/* @__PURE__ */ (0,
|
|
2918
|
-
/* @__PURE__ */ (0,
|
|
2919
|
-
/* @__PURE__ */ (0,
|
|
2773
|
+
showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
2774
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2775
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
|
|
2776
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
|
|
2920
2777
|
] }),
|
|
2921
|
-
/* @__PURE__ */ (0,
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2922
2779
|
"span",
|
|
2923
2780
|
{
|
|
2924
2781
|
className: "rte-footer-word-count-separator",
|
|
2925
2782
|
"aria-hidden": "true"
|
|
2926
2783
|
}
|
|
2927
2784
|
),
|
|
2928
|
-
/* @__PURE__ */ (0,
|
|
2929
|
-
/* @__PURE__ */ (0,
|
|
2930
|
-
/* @__PURE__ */ (0,
|
|
2785
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2786
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
|
|
2787
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
|
|
2931
2788
|
] })
|
|
2932
2789
|
] }) }),
|
|
2933
2790
|
children
|
|
@@ -2937,7 +2794,7 @@ var Footer = ({
|
|
|
2937
2794
|
};
|
|
2938
2795
|
|
|
2939
2796
|
// src/rte-toolbar.tsx
|
|
2940
|
-
var
|
|
2797
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2941
2798
|
var Toolbar = ({
|
|
2942
2799
|
children,
|
|
2943
2800
|
className,
|
|
@@ -2948,7 +2805,7 @@ var Toolbar = ({
|
|
|
2948
2805
|
if (!editable) {
|
|
2949
2806
|
return null;
|
|
2950
2807
|
}
|
|
2951
|
-
return /* @__PURE__ */ (0,
|
|
2808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2952
2809
|
"div",
|
|
2953
2810
|
{
|
|
2954
2811
|
className: cn(
|
|
@@ -2965,7 +2822,7 @@ var Toolbar = ({
|
|
|
2965
2822
|
};
|
|
2966
2823
|
|
|
2967
2824
|
// src/rte-text-editor.tsx
|
|
2968
|
-
var
|
|
2825
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2969
2826
|
var RichTextEditorRoot = ({
|
|
2970
2827
|
editor,
|
|
2971
2828
|
children,
|
|
@@ -2975,18 +2832,18 @@ var RichTextEditorRoot = ({
|
|
|
2975
2832
|
variant = "default",
|
|
2976
2833
|
editable = true
|
|
2977
2834
|
}) => {
|
|
2978
|
-
const mergedLabels = (0,
|
|
2835
|
+
const mergedLabels = (0, import_react20.useMemo)(
|
|
2979
2836
|
() => ({ ...DEFAULT_LABELS, ...labels }),
|
|
2980
2837
|
[labels]
|
|
2981
2838
|
);
|
|
2982
|
-
const mergedIcons = (0,
|
|
2983
|
-
const [tooltip] = (0,
|
|
2984
|
-
(0,
|
|
2839
|
+
const mergedIcons = (0, import_react20.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
2840
|
+
const [tooltip] = (0, import_react20.useState)(() => import_tooltip5.Tooltip.createHandle());
|
|
2841
|
+
(0, import_react20.useEffect)(() => {
|
|
2985
2842
|
if (editor && editor.isEditable !== editable) {
|
|
2986
2843
|
editor.setEditable(editable);
|
|
2987
2844
|
}
|
|
2988
2845
|
}, [editor, editable]);
|
|
2989
|
-
return /* @__PURE__ */ (0,
|
|
2846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2990
2847
|
RichTextEditorContext.Provider,
|
|
2991
2848
|
{
|
|
2992
2849
|
value: {
|
|
@@ -2997,7 +2854,7 @@ var RichTextEditorRoot = ({
|
|
|
2997
2854
|
tooltip,
|
|
2998
2855
|
variant
|
|
2999
2856
|
},
|
|
3000
|
-
children: /* @__PURE__ */ (0,
|
|
2857
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3001
2858
|
"div",
|
|
3002
2859
|
{
|
|
3003
2860
|
className: cn(
|
|
@@ -3006,9 +2863,9 @@ var RichTextEditorRoot = ({
|
|
|
3006
2863
|
className
|
|
3007
2864
|
),
|
|
3008
2865
|
"data-variant": variant,
|
|
3009
|
-
children: /* @__PURE__ */ (0,
|
|
2866
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(TooltipProvider, { children: [
|
|
3010
2867
|
children,
|
|
3011
|
-
/* @__PURE__ */ (0,
|
|
2868
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContent, { side: "bottom", children: payload }) })
|
|
3012
2869
|
] })
|
|
3013
2870
|
}
|
|
3014
2871
|
)
|
|
@@ -3067,19 +2924,9 @@ var Link2 = import_extension_link.default.extend({
|
|
|
3067
2924
|
};
|
|
3068
2925
|
}
|
|
3069
2926
|
}).configure({ openOnClick: false });
|
|
3070
|
-
|
|
3071
|
-
// src/extensions/code-block.ts
|
|
3072
|
-
var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
|
|
3073
|
-
var import_lowlight = require("lowlight");
|
|
3074
|
-
var lowlight = (0, import_lowlight.createLowlight)(import_lowlight.common);
|
|
3075
|
-
var CodeBlock = import_extension_code_block_lowlight.default.configure({
|
|
3076
|
-
defaultLanguage: "javascript",
|
|
3077
|
-
lowlight
|
|
3078
|
-
});
|
|
3079
2927
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3080
2928
|
0 && (module.exports = {
|
|
3081
2929
|
BubbleMenu,
|
|
3082
|
-
CodeBlock,
|
|
3083
2930
|
DEFAULT_ICONS,
|
|
3084
2931
|
DEFAULT_LABELS,
|
|
3085
2932
|
DEFAULT_LANGUAGE_ICONS,
|