@editorcn/editor 0.3.9 → 0.4.1
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 +87 -87
- package/dist/index.cjs +377 -518
- 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 +332 -472
- 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,51 +902,57 @@ 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
|
-
isActive: (s) => s.isBold
|
|
913
|
+
isActive: (s) => s.isBold,
|
|
914
|
+
mark: "bold"
|
|
1065
915
|
},
|
|
1066
916
|
{
|
|
1067
917
|
command: (e) => e.chain().focus().toggleItalic().run(),
|
|
1068
|
-
icon: /* @__PURE__ */ (0,
|
|
1069
|
-
/* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
918
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
|
|
1072
922
|
] }) }),
|
|
1073
|
-
isActive: (s) => s.isItalic
|
|
923
|
+
isActive: (s) => s.isItalic,
|
|
924
|
+
mark: "italic"
|
|
1074
925
|
},
|
|
1075
926
|
{
|
|
1076
927
|
command: (e) => e.chain().focus().toggleUnderline().run(),
|
|
1077
|
-
icon: /* @__PURE__ */ (0,
|
|
1078
|
-
/* @__PURE__ */ (0,
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
928
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
929
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
|
|
930
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
|
|
1080
931
|
] }) }),
|
|
1081
|
-
isActive: (s) => s.isUnderline
|
|
932
|
+
isActive: (s) => s.isUnderline,
|
|
933
|
+
mark: "underline"
|
|
1082
934
|
},
|
|
1083
935
|
{
|
|
1084
936
|
command: (e) => e.chain().focus().toggleStrike().run(),
|
|
1085
|
-
icon: /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__PURE__ */ (0,
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
937
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
|
|
939
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
|
|
940
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
|
|
1089
941
|
] }) }),
|
|
1090
|
-
isActive: (s) => s.isStrike
|
|
942
|
+
isActive: (s) => s.isStrike,
|
|
943
|
+
mark: "strike"
|
|
1091
944
|
},
|
|
1092
945
|
{
|
|
1093
946
|
command: (e) => e.chain().focus().toggleCode().run(),
|
|
1094
|
-
icon: /* @__PURE__ */ (0,
|
|
1095
|
-
/* @__PURE__ */ (0,
|
|
1096
|
-
/* @__PURE__ */ (0,
|
|
947
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Svg, { children: [
|
|
948
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
949
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
1097
950
|
] }) }),
|
|
1098
|
-
isActive: (s) => s.isCode
|
|
951
|
+
isActive: (s) => s.isCode,
|
|
952
|
+
mark: "code"
|
|
1099
953
|
}
|
|
1100
954
|
];
|
|
955
|
+
var getTextItems = (editor) => textItems.filter((item) => Boolean(editor.schema.marks[item.mark]));
|
|
1101
956
|
var TextButtons = ({ editor }) => {
|
|
1102
957
|
const editorState = useEditorState(
|
|
1103
958
|
editor,
|
|
@@ -1110,7 +965,7 @@ var TextButtons = ({ editor }) => {
|
|
|
1110
965
|
}),
|
|
1111
966
|
shallowEqual
|
|
1112
967
|
);
|
|
1113
|
-
return /* @__PURE__ */ (0,
|
|
968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RteButtonGroup, { children: getTextItems(editor).map((item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1114
969
|
RteButton,
|
|
1115
970
|
{
|
|
1116
971
|
active: item.isActive(editorState),
|
|
@@ -1118,21 +973,14 @@ var TextButtons = ({ editor }) => {
|
|
|
1118
973
|
onClick: () => item.command(editor),
|
|
1119
974
|
children: item.icon
|
|
1120
975
|
},
|
|
1121
|
-
|
|
976
|
+
item.mark
|
|
1122
977
|
)) });
|
|
1123
978
|
};
|
|
1124
979
|
|
|
1125
980
|
// src/bubble-menu/index.tsx
|
|
1126
|
-
var
|
|
981
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1127
982
|
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)(
|
|
983
|
+
const shouldShow = (0, import_react4.useCallback)(
|
|
1136
984
|
({
|
|
1137
985
|
editor: ed,
|
|
1138
986
|
state
|
|
@@ -1141,7 +989,7 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1141
989
|
if (!ed.isEditable) {
|
|
1142
990
|
return false;
|
|
1143
991
|
}
|
|
1144
|
-
if (selection.empty
|
|
992
|
+
if (selection.empty || ed.isActive("codeBlock")) {
|
|
1145
993
|
return false;
|
|
1146
994
|
}
|
|
1147
995
|
if (!selection.empty && !(0, import_core.isTextSelection)(selection)) {
|
|
@@ -1154,35 +1002,56 @@ var BubbleMenu = ({ editor }) => {
|
|
|
1154
1002
|
if (!editor) {
|
|
1155
1003
|
return null;
|
|
1156
1004
|
}
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1005
|
+
const hasText = getTextItems(editor).length > 0;
|
|
1006
|
+
const hasColor = editor.extensionManager.extensions.some(
|
|
1007
|
+
(ext) => ext.name === "color" || ext.name === "highlight"
|
|
1008
|
+
);
|
|
1009
|
+
if (!(hasText || hasColor)) {
|
|
1010
|
+
return null;
|
|
1011
|
+
}
|
|
1012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1159
1013
|
import_menus.BubbleMenu,
|
|
1160
1014
|
{
|
|
1161
1015
|
editor,
|
|
1162
1016
|
options: { offset: 8, placement: "top" },
|
|
1163
1017
|
shouldShow,
|
|
1164
|
-
children: /* @__PURE__ */ (0,
|
|
1165
|
-
/* @__PURE__ */ (0,
|
|
1166
|
-
/* @__PURE__ */ (0,
|
|
1167
|
-
/* @__PURE__ */ (0,
|
|
1168
|
-
] })
|
|
1018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "rte-bubble-menu", children: [
|
|
1019
|
+
hasText && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextButtons, { editor }),
|
|
1020
|
+
hasText && hasColor && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RteSeparator, {}),
|
|
1021
|
+
hasColor && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColorSelector, { editor })
|
|
1022
|
+
] })
|
|
1169
1023
|
}
|
|
1170
1024
|
);
|
|
1171
1025
|
};
|
|
1172
1026
|
|
|
1173
1027
|
// src/controls/rte-control.tsx
|
|
1174
|
-
var
|
|
1175
|
-
var
|
|
1176
|
-
|
|
1028
|
+
var import_react6 = require("@tiptap/react");
|
|
1029
|
+
var import_react7 = require("react");
|
|
1030
|
+
|
|
1031
|
+
// src/rte-context.ts
|
|
1032
|
+
var import_react5 = require("react");
|
|
1033
|
+
var RichTextEditorContext = (0, import_react5.createContext)(null);
|
|
1034
|
+
var useRichTextEditorContext = () => {
|
|
1035
|
+
const context = (0, import_react5.useContext)(RichTextEditorContext);
|
|
1036
|
+
if (!context) {
|
|
1037
|
+
throw new Error(
|
|
1038
|
+
"useRichTextEditorContext must be used within RichTextEditor"
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
1041
|
+
return context;
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
// src/controls/rte-control.tsx
|
|
1045
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1177
1046
|
var RichTextEditorTooltip = ({
|
|
1178
1047
|
children,
|
|
1179
1048
|
label
|
|
1180
1049
|
}) => {
|
|
1181
|
-
const tooltip = (0,
|
|
1050
|
+
const tooltip = (0, import_react7.useContext)(RichTextEditorContext)?.tooltip;
|
|
1182
1051
|
if (!tooltip) {
|
|
1183
1052
|
return children;
|
|
1184
1053
|
}
|
|
1185
|
-
return /* @__PURE__ */ (0,
|
|
1054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipTrigger, { handle: tooltip, payload: label, render: children });
|
|
1186
1055
|
};
|
|
1187
1056
|
var RichTextEditorControl = ({
|
|
1188
1057
|
active = false,
|
|
@@ -1194,7 +1063,7 @@ var RichTextEditorControl = ({
|
|
|
1194
1063
|
disabled,
|
|
1195
1064
|
...props
|
|
1196
1065
|
}) => {
|
|
1197
|
-
const toggle = /* @__PURE__ */ (0,
|
|
1066
|
+
const toggle = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1198
1067
|
Toggle,
|
|
1199
1068
|
{
|
|
1200
1069
|
size: "sm",
|
|
@@ -1210,7 +1079,7 @@ var RichTextEditorControl = ({
|
|
|
1210
1079
|
children
|
|
1211
1080
|
}
|
|
1212
1081
|
);
|
|
1213
|
-
return props.title ? /* @__PURE__ */ (0,
|
|
1082
|
+
return props.title ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RichTextEditorTooltip, { label: props.title, children: toggle }) : toggle;
|
|
1214
1083
|
};
|
|
1215
1084
|
var resolveIsActive = (editor, config) => {
|
|
1216
1085
|
if (!editor || !config) {
|
|
@@ -1239,9 +1108,9 @@ var createControl = ({
|
|
|
1239
1108
|
const { editor, labels, icons } = useRichTextEditorContext();
|
|
1240
1109
|
const ariaLabel = labels[label];
|
|
1241
1110
|
const selector = createSelector(isActive, isDisabled);
|
|
1242
|
-
(0,
|
|
1111
|
+
(0, import_react6.useEditorState)({ editor: editor ?? null, selector });
|
|
1243
1112
|
const { active, disabled } = selector({ editor: editor ?? null });
|
|
1244
|
-
return /* @__PURE__ */ (0,
|
|
1113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1245
1114
|
RichTextEditorControl,
|
|
1246
1115
|
{
|
|
1247
1116
|
active,
|
|
@@ -1426,19 +1295,19 @@ var SuperscriptControl = createControl({
|
|
|
1426
1295
|
});
|
|
1427
1296
|
|
|
1428
1297
|
// src/controls/rte-link-control.tsx
|
|
1429
|
-
var
|
|
1298
|
+
var import_react8 = require("@tiptap/react");
|
|
1430
1299
|
var React15 = __toESM(require("react"), 1);
|
|
1431
|
-
var
|
|
1432
|
-
var
|
|
1300
|
+
var import_react9 = require("react");
|
|
1301
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1433
1302
|
var LinkControl = () => {
|
|
1434
1303
|
const { editor, icons, labels, tooltip } = useRichTextEditorContext();
|
|
1435
|
-
const [url, setUrl] = (0,
|
|
1436
|
-
const [open, setOpen] = (0,
|
|
1437
|
-
const active = (0,
|
|
1304
|
+
const [url, setUrl] = (0, import_react9.useState)("");
|
|
1305
|
+
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
1306
|
+
const active = (0, import_react8.useEditorState)({
|
|
1438
1307
|
editor: editor ?? null,
|
|
1439
1308
|
selector: (ctx) => ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("link") : false
|
|
1440
1309
|
});
|
|
1441
|
-
const handleOpen = (0,
|
|
1310
|
+
const handleOpen = (0, import_react9.useCallback)(
|
|
1442
1311
|
(isOpen) => {
|
|
1443
1312
|
if (isOpen) {
|
|
1444
1313
|
const linkData = editor?.getAttributes("link");
|
|
@@ -1473,16 +1342,16 @@ var LinkControl = () => {
|
|
|
1473
1342
|
window.addEventListener("edit-link", handler);
|
|
1474
1343
|
return () => window.removeEventListener("edit-link", handler);
|
|
1475
1344
|
}, [handleOpen]);
|
|
1476
|
-
return /* @__PURE__ */ (0,
|
|
1477
|
-
/* @__PURE__ */ (0,
|
|
1345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Popover, { open, onOpenChange: handleOpen, children: [
|
|
1346
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1478
1347
|
TooltipTrigger,
|
|
1479
1348
|
{
|
|
1480
1349
|
handle: tooltip,
|
|
1481
1350
|
payload: labels.linkControlLabel,
|
|
1482
|
-
render: /* @__PURE__ */ (0,
|
|
1351
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1483
1352
|
PopoverTrigger,
|
|
1484
1353
|
{
|
|
1485
|
-
render: /* @__PURE__ */ (0,
|
|
1354
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1486
1355
|
Toggle,
|
|
1487
1356
|
{
|
|
1488
1357
|
size: "sm",
|
|
@@ -1497,8 +1366,8 @@ var LinkControl = () => {
|
|
|
1497
1366
|
)
|
|
1498
1367
|
}
|
|
1499
1368
|
),
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1369
|
+
/* @__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: [
|
|
1370
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1502
1371
|
Input,
|
|
1503
1372
|
{
|
|
1504
1373
|
type: "url",
|
|
@@ -1510,7 +1379,7 @@ var LinkControl = () => {
|
|
|
1510
1379
|
className: "rte-link-editor-input h-8 text-sm"
|
|
1511
1380
|
}
|
|
1512
1381
|
),
|
|
1513
|
-
/* @__PURE__ */ (0,
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1514
1383
|
Button,
|
|
1515
1384
|
{
|
|
1516
1385
|
size: "sm",
|
|
@@ -1526,24 +1395,24 @@ var LinkControl = () => {
|
|
|
1526
1395
|
|
|
1527
1396
|
// src/controls/rte-twitter-control.tsx
|
|
1528
1397
|
var import_core2 = require("@tiptap/core");
|
|
1529
|
-
var
|
|
1530
|
-
var
|
|
1398
|
+
var import_react14 = require("@tiptap/react");
|
|
1399
|
+
var import_react15 = require("react");
|
|
1531
1400
|
|
|
1532
1401
|
// src/extensions/resizable-node-view.tsx
|
|
1533
|
-
var
|
|
1534
|
-
var
|
|
1402
|
+
var import_react12 = require("@tiptap/react");
|
|
1403
|
+
var import_react13 = require("react");
|
|
1535
1404
|
|
|
1536
1405
|
// src/icons.tsx
|
|
1537
1406
|
var import_lucide_react = require("lucide-react");
|
|
1538
|
-
var
|
|
1407
|
+
var import_react11 = require("react");
|
|
1539
1408
|
|
|
1540
1409
|
// src/language-icons.tsx
|
|
1541
|
-
var
|
|
1542
|
-
var
|
|
1410
|
+
var import_react10 = require("react");
|
|
1411
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1543
1412
|
var LangIcon = ({
|
|
1544
1413
|
children,
|
|
1545
1414
|
className
|
|
1546
|
-
}) => /* @__PURE__ */ (0,
|
|
1415
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1547
1416
|
"svg",
|
|
1548
1417
|
{
|
|
1549
1418
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1558,140 +1427,140 @@ var LangIcon = ({
|
|
|
1558
1427
|
}
|
|
1559
1428
|
);
|
|
1560
1429
|
var DEFAULT_LANGUAGE_ICONS = {
|
|
1561
|
-
bash: /* @__PURE__ */ (0,
|
|
1562
|
-
/* @__PURE__ */ (0,
|
|
1563
|
-
/* @__PURE__ */ (0,
|
|
1564
|
-
/* @__PURE__ */ (0,
|
|
1430
|
+
bash: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1431
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 15.5h5.5" })
|
|
1565
1434
|
] }),
|
|
1566
|
-
c: /* @__PURE__ */ (0,
|
|
1567
|
-
/* @__PURE__ */ (0,
|
|
1568
|
-
/* @__PURE__ */ (0,
|
|
1435
|
+
c: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
|
|
1569
1438
|
] }),
|
|
1570
|
-
cpp: /* @__PURE__ */ (0,
|
|
1571
|
-
/* @__PURE__ */ (0,
|
|
1572
|
-
/* @__PURE__ */ (0,
|
|
1573
|
-
/* @__PURE__ */ (0,
|
|
1574
|
-
/* @__PURE__ */ (0,
|
|
1439
|
+
cpp: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
|
|
1575
1444
|
] }),
|
|
1576
|
-
css: /* @__PURE__ */ (0,
|
|
1577
|
-
/* @__PURE__ */ (0,
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1580
|
-
/* @__PURE__ */ (0,
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1445
|
+
css: /* @__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.7 7.5l-1 9" }),
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15.3 7.5l-1 9" }),
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7 10.3h11" }),
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 14.3h11" })
|
|
1582
1451
|
] }),
|
|
1583
|
-
go: /* @__PURE__ */ (0,
|
|
1584
|
-
/* @__PURE__ */ (0,
|
|
1585
|
-
/* @__PURE__ */ (0,
|
|
1586
|
-
/* @__PURE__ */ (0,
|
|
1587
|
-
/* @__PURE__ */ (0,
|
|
1452
|
+
go: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1454
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
|
|
1455
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12.6 12h-1.9" }),
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
|
|
1588
1457
|
] }),
|
|
1589
|
-
html: /* @__PURE__ */ (0,
|
|
1590
|
-
/* @__PURE__ */ (0,
|
|
1591
|
-
/* @__PURE__ */ (0,
|
|
1592
|
-
/* @__PURE__ */ (0,
|
|
1593
|
-
/* @__PURE__ */ (0,
|
|
1458
|
+
html: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1460
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13 7.3l-2 9.4" })
|
|
1594
1463
|
] }),
|
|
1595
|
-
java: /* @__PURE__ */ (0,
|
|
1596
|
-
/* @__PURE__ */ (0,
|
|
1597
|
-
/* @__PURE__ */ (0,
|
|
1598
|
-
/* @__PURE__ */ (0,
|
|
1599
|
-
/* @__PURE__ */ (0,
|
|
1464
|
+
java: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1465
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
|
|
1467
|
+
/* @__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" }),
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 19.3h10" })
|
|
1600
1469
|
] }),
|
|
1601
|
-
javascript: /* @__PURE__ */ (0,
|
|
1602
|
-
/* @__PURE__ */ (0,
|
|
1603
|
-
/* @__PURE__ */ (0,
|
|
1604
|
-
/* @__PURE__ */ (0,
|
|
1470
|
+
javascript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
|
|
1473
|
+
/* @__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
1474
|
] }),
|
|
1606
|
-
json: /* @__PURE__ */ (0,
|
|
1607
|
-
/* @__PURE__ */ (0,
|
|
1608
|
-
/* @__PURE__ */ (0,
|
|
1475
|
+
json: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1476
|
+
/* @__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" }),
|
|
1477
|
+
/* @__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
1478
|
] }),
|
|
1610
|
-
kotlin: /* @__PURE__ */ (0,
|
|
1611
|
-
/* @__PURE__ */ (0,
|
|
1612
|
-
/* @__PURE__ */ (0,
|
|
1613
|
-
/* @__PURE__ */ (0,
|
|
1614
|
-
/* @__PURE__ */ (0,
|
|
1479
|
+
kotlin: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1481
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 7.5v9" }),
|
|
1482
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6-4.5" }),
|
|
1483
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M9 12l6 4.5" })
|
|
1615
1484
|
] }),
|
|
1616
|
-
markdown: /* @__PURE__ */ (0,
|
|
1617
|
-
/* @__PURE__ */ (0,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1619
|
-
/* @__PURE__ */ (0,
|
|
1620
|
-
/* @__PURE__ */ (0,
|
|
1485
|
+
markdown: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16.5 9v6" }),
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M14.5 13l2 2 2-2" })
|
|
1621
1490
|
] }),
|
|
1622
|
-
php: /* @__PURE__ */ (0,
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1624
|
-
/* @__PURE__ */ (0,
|
|
1625
|
-
/* @__PURE__ */ (0,
|
|
1626
|
-
/* @__PURE__ */ (0,
|
|
1491
|
+
php: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1492
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1493
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
|
|
1494
|
+
/* @__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" }),
|
|
1495
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
|
|
1627
1496
|
] }),
|
|
1628
|
-
plaintext: /* @__PURE__ */ (0,
|
|
1629
|
-
/* @__PURE__ */ (0,
|
|
1630
|
-
/* @__PURE__ */ (0,
|
|
1631
|
-
/* @__PURE__ */ (0,
|
|
1632
|
-
/* @__PURE__ */ (0,
|
|
1497
|
+
plaintext: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
|
|
1499
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
|
|
1500
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
|
|
1633
1502
|
] }),
|
|
1634
|
-
python: /* @__PURE__ */ (0,
|
|
1635
|
-
/* @__PURE__ */ (0,
|
|
1636
|
-
/* @__PURE__ */ (0,
|
|
1637
|
-
/* @__PURE__ */ (0,
|
|
1638
|
-
/* @__PURE__ */ (0,
|
|
1503
|
+
python: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1504
|
+
/* @__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" }),
|
|
1505
|
+
/* @__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" }),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
|
|
1639
1508
|
] }),
|
|
1640
|
-
ruby: /* @__PURE__ */ (0,
|
|
1641
|
-
/* @__PURE__ */ (0,
|
|
1642
|
-
/* @__PURE__ */ (0,
|
|
1643
|
-
/* @__PURE__ */ (0,
|
|
1509
|
+
ruby: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1510
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4.5 8h15" }),
|
|
1512
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v19" })
|
|
1644
1513
|
] }),
|
|
1645
|
-
rust: /* @__PURE__ */ (0,
|
|
1646
|
-
/* @__PURE__ */ (0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1648
|
-
/* @__PURE__ */ (0,
|
|
1649
|
-
/* @__PURE__ */ (0,
|
|
1514
|
+
rust: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1515
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
|
|
1518
|
+
/* @__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
1519
|
] }),
|
|
1651
|
-
sql: /* @__PURE__ */ (0,
|
|
1652
|
-
/* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1654
|
-
/* @__PURE__ */ (0,
|
|
1520
|
+
sql: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
|
|
1523
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
|
|
1655
1524
|
] }),
|
|
1656
|
-
swift: /* @__PURE__ */ (0,
|
|
1657
|
-
typescript: /* @__PURE__ */ (0,
|
|
1658
|
-
/* @__PURE__ */ (0,
|
|
1659
|
-
/* @__PURE__ */ (0,
|
|
1660
|
-
/* @__PURE__ */ (0,
|
|
1525
|
+
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" }) }),
|
|
1526
|
+
typescript: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1527
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
|
|
1528
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
|
|
1529
|
+
/* @__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
1530
|
] }),
|
|
1662
|
-
xml: /* @__PURE__ */ (0,
|
|
1663
|
-
/* @__PURE__ */ (0,
|
|
1664
|
-
/* @__PURE__ */ (0,
|
|
1665
|
-
/* @__PURE__ */ (0,
|
|
1531
|
+
xml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1532
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M12 8v8" })
|
|
1666
1535
|
] }),
|
|
1667
|
-
yaml: /* @__PURE__ */ (0,
|
|
1668
|
-
/* @__PURE__ */ (0,
|
|
1669
|
-
/* @__PURE__ */ (0,
|
|
1670
|
-
/* @__PURE__ */ (0,
|
|
1671
|
-
/* @__PURE__ */ (0,
|
|
1536
|
+
yaml: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(LangIcon, { children: [
|
|
1537
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
|
|
1538
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
|
|
1672
1541
|
] })
|
|
1673
1542
|
};
|
|
1674
1543
|
|
|
1675
1544
|
// src/icons.tsx
|
|
1676
|
-
var
|
|
1545
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1677
1546
|
var ALIGN_PATHS = {
|
|
1678
|
-
center: /* @__PURE__ */ (0,
|
|
1679
|
-
/* @__PURE__ */ (0,
|
|
1680
|
-
/* @__PURE__ */ (0,
|
|
1681
|
-
/* @__PURE__ */ (0,
|
|
1547
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1548
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
|
|
1682
1551
|
] }),
|
|
1683
|
-
left: /* @__PURE__ */ (0,
|
|
1684
|
-
/* @__PURE__ */ (0,
|
|
1685
|
-
/* @__PURE__ */ (0,
|
|
1686
|
-
/* @__PURE__ */ (0,
|
|
1552
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
|
|
1687
1556
|
] }),
|
|
1688
|
-
right: /* @__PURE__ */ (0,
|
|
1689
|
-
/* @__PURE__ */ (0,
|
|
1690
|
-
/* @__PURE__ */ (0,
|
|
1691
|
-
/* @__PURE__ */ (0,
|
|
1557
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
1558
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
|
|
1692
1561
|
] })
|
|
1693
1562
|
};
|
|
1694
|
-
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0,
|
|
1563
|
+
var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1695
1564
|
"svg",
|
|
1696
1565
|
{
|
|
1697
1566
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1705,7 +1574,7 @@ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
|
1705
1574
|
children: ALIGN_PATHS[dir]
|
|
1706
1575
|
}
|
|
1707
1576
|
);
|
|
1708
|
-
var EditUrlIcon = () => /* @__PURE__ */ (0,
|
|
1577
|
+
var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1709
1578
|
"svg",
|
|
1710
1579
|
{
|
|
1711
1580
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1717,12 +1586,12 @@ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
|
1717
1586
|
strokeLinejoin: "round",
|
|
1718
1587
|
className: "rte-editor-icon",
|
|
1719
1588
|
children: [
|
|
1720
|
-
/* @__PURE__ */ (0,
|
|
1721
|
-
/* @__PURE__ */ (0,
|
|
1589
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M12 20h9" }),
|
|
1590
|
+
/* @__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
1591
|
]
|
|
1723
1592
|
}
|
|
1724
1593
|
);
|
|
1725
|
-
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0,
|
|
1594
|
+
var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1726
1595
|
"svg",
|
|
1727
1596
|
{
|
|
1728
1597
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1734,13 +1603,13 @@ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
|
1734
1603
|
strokeLinejoin: "round",
|
|
1735
1604
|
className: "rte-editor-icon",
|
|
1736
1605
|
children: [
|
|
1737
|
-
/* @__PURE__ */ (0,
|
|
1738
|
-
/* @__PURE__ */ (0,
|
|
1739
|
-
/* @__PURE__ */ (0,
|
|
1606
|
+
/* @__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" }),
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1740
1609
|
]
|
|
1741
1610
|
}
|
|
1742
1611
|
);
|
|
1743
|
-
var DeleteEmbedIcon = () => /* @__PURE__ */ (0,
|
|
1612
|
+
var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1744
1613
|
"svg",
|
|
1745
1614
|
{
|
|
1746
1615
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1752,46 +1621,46 @@ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
|
1752
1621
|
strokeLinejoin: "round",
|
|
1753
1622
|
className: "rte-editor-icon",
|
|
1754
1623
|
children: [
|
|
1755
|
-
/* @__PURE__ */ (0,
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("polyline", { points: "3 6 5 6 21 6" }),
|
|
1625
|
+
/* @__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
1626
|
]
|
|
1758
1627
|
}
|
|
1759
1628
|
);
|
|
1760
1629
|
var iconProps = { className: "rte-editor-icon" };
|
|
1761
1630
|
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,
|
|
1631
|
+
alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
|
|
1632
|
+
alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
|
|
1633
|
+
alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
|
|
1634
|
+
alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
|
|
1635
|
+
blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
|
|
1636
|
+
boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Bold, { ...iconProps }),
|
|
1637
|
+
bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.List, { ...iconProps }),
|
|
1638
|
+
clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
|
|
1639
|
+
codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
|
|
1640
|
+
codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Code, { ...iconProps }),
|
|
1641
|
+
h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading1, { ...iconProps }),
|
|
1642
|
+
h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading2, { ...iconProps }),
|
|
1643
|
+
h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading3, { ...iconProps }),
|
|
1644
|
+
h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading4, { ...iconProps }),
|
|
1645
|
+
h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading5, { ...iconProps }),
|
|
1646
|
+
h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Heading6, { ...iconProps }),
|
|
1647
|
+
highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
|
|
1648
|
+
hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Minus, { ...iconProps }),
|
|
1649
|
+
italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Italic, { ...iconProps }),
|
|
1781
1650
|
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,
|
|
1651
|
+
linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link, { ...iconProps }),
|
|
1652
|
+
orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
|
|
1653
|
+
redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Redo2, { ...iconProps }),
|
|
1654
|
+
strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
|
|
1655
|
+
subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Subscript, { ...iconProps }),
|
|
1656
|
+
superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Superscript, { ...iconProps }),
|
|
1657
|
+
underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Underline, { ...iconProps }),
|
|
1658
|
+
undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Undo2, { ...iconProps }),
|
|
1659
|
+
unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react.Link2Off, { ...iconProps })
|
|
1791
1660
|
};
|
|
1792
1661
|
|
|
1793
1662
|
// src/extensions/resizable-node-view.tsx
|
|
1794
|
-
var
|
|
1663
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1795
1664
|
var EmbedToolbar = ({
|
|
1796
1665
|
align,
|
|
1797
1666
|
videoSrc,
|
|
@@ -1808,8 +1677,8 @@ var EmbedToolbar = ({
|
|
|
1808
1677
|
nodeSrc
|
|
1809
1678
|
}) => {
|
|
1810
1679
|
if (isEditingUrl) {
|
|
1811
|
-
return /* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1813
1682
|
"input",
|
|
1814
1683
|
{
|
|
1815
1684
|
ref: inputRef,
|
|
@@ -1827,7 +1696,7 @@ var EmbedToolbar = ({
|
|
|
1827
1696
|
}
|
|
1828
1697
|
}
|
|
1829
1698
|
),
|
|
1830
|
-
/* @__PURE__ */ (0,
|
|
1699
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1831
1700
|
"button",
|
|
1832
1701
|
{
|
|
1833
1702
|
type: "button",
|
|
@@ -1836,7 +1705,7 @@ var EmbedToolbar = ({
|
|
|
1836
1705
|
children: "Save"
|
|
1837
1706
|
}
|
|
1838
1707
|
),
|
|
1839
|
-
/* @__PURE__ */ (0,
|
|
1708
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1840
1709
|
"button",
|
|
1841
1710
|
{
|
|
1842
1711
|
type: "button",
|
|
@@ -1847,8 +1716,8 @@ var EmbedToolbar = ({
|
|
|
1847
1716
|
)
|
|
1848
1717
|
] });
|
|
1849
1718
|
}
|
|
1850
|
-
return /* @__PURE__ */ (0,
|
|
1851
|
-
/* @__PURE__ */ (0,
|
|
1719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1720
|
+
/* @__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
1721
|
"button",
|
|
1853
1722
|
{
|
|
1854
1723
|
type: "button",
|
|
@@ -1856,12 +1725,12 @@ var EmbedToolbar = ({
|
|
|
1856
1725
|
"aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
|
|
1857
1726
|
className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
|
|
1858
1727
|
onClick: () => updateAttributes({ align: dir }),
|
|
1859
|
-
children: /* @__PURE__ */ (0,
|
|
1728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AlignIcon, { dir })
|
|
1860
1729
|
},
|
|
1861
1730
|
dir
|
|
1862
1731
|
)) }),
|
|
1863
|
-
/* @__PURE__ */ (0,
|
|
1864
|
-
/* @__PURE__ */ (0,
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1733
|
+
/* @__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
1734
|
"button",
|
|
1866
1735
|
{
|
|
1867
1736
|
type: "button",
|
|
@@ -1875,9 +1744,9 @@ var EmbedToolbar = ({
|
|
|
1875
1744
|
},
|
|
1876
1745
|
pct
|
|
1877
1746
|
)) }),
|
|
1878
|
-
/* @__PURE__ */ (0,
|
|
1879
|
-
/* @__PURE__ */ (0,
|
|
1880
|
-
(videoSrc || nodeSrc) && /* @__PURE__ */ (0,
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
|
|
1748
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-group", children: [
|
|
1749
|
+
(videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1881
1750
|
"button",
|
|
1882
1751
|
{
|
|
1883
1752
|
type: "button",
|
|
@@ -1888,10 +1757,10 @@ var EmbedToolbar = ({
|
|
|
1888
1757
|
setUrlInput(videoSrc || nodeSrc || "");
|
|
1889
1758
|
setIsEditingUrl(true);
|
|
1890
1759
|
},
|
|
1891
|
-
children: /* @__PURE__ */ (0,
|
|
1760
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(EditUrlIcon, {})
|
|
1892
1761
|
}
|
|
1893
1762
|
),
|
|
1894
|
-
watchUrl && /* @__PURE__ */ (0,
|
|
1763
|
+
watchUrl && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1895
1764
|
"button",
|
|
1896
1765
|
{
|
|
1897
1766
|
type: "button",
|
|
@@ -1899,10 +1768,10 @@ var EmbedToolbar = ({
|
|
|
1899
1768
|
"aria-label": "Open video in YouTube",
|
|
1900
1769
|
className: "rte-embed-selector-btn",
|
|
1901
1770
|
onClick: () => window.open(watchUrl, "_blank"),
|
|
1902
|
-
children: /* @__PURE__ */ (0,
|
|
1771
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OpenInYouTubeIcon, {})
|
|
1903
1772
|
}
|
|
1904
1773
|
),
|
|
1905
|
-
deleteNode && /* @__PURE__ */ (0,
|
|
1774
|
+
deleteNode && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1906
1775
|
"button",
|
|
1907
1776
|
{
|
|
1908
1777
|
type: "button",
|
|
@@ -1910,7 +1779,7 @@ var EmbedToolbar = ({
|
|
|
1910
1779
|
"aria-label": "Delete Embed",
|
|
1911
1780
|
className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
|
|
1912
1781
|
onClick: () => deleteNode(),
|
|
1913
|
-
children: /* @__PURE__ */ (0,
|
|
1782
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeleteEmbedIcon, {})
|
|
1914
1783
|
}
|
|
1915
1784
|
)
|
|
1916
1785
|
] })
|
|
@@ -1932,26 +1801,26 @@ var ResizableNodeView = ({
|
|
|
1932
1801
|
watchUrl,
|
|
1933
1802
|
onSrcChange
|
|
1934
1803
|
}) => {
|
|
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,
|
|
1804
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
1805
|
+
const [isEditingUrl, setIsEditingUrl] = (0, import_react13.useState)(false);
|
|
1806
|
+
const [urlInput, setUrlInput] = (0, import_react13.useState)(videoSrc || "");
|
|
1807
|
+
const [isResizing, setIsResizing] = (0, import_react13.useState)(false);
|
|
1808
|
+
const [currentDimensions, setCurrentDimensions] = (0, import_react13.useState)(null);
|
|
1809
|
+
const resizingRef = (0, import_react13.useRef)(null);
|
|
1941
1810
|
const width = node.attrs.width;
|
|
1942
1811
|
const height = node.attrs.height;
|
|
1943
1812
|
const align = node.attrs.align || "center";
|
|
1944
|
-
const getEditorWidth = (0,
|
|
1813
|
+
const getEditorWidth = (0, import_react13.useCallback)(
|
|
1945
1814
|
() => view?.dom?.parentElement?.offsetWidth ?? 800,
|
|
1946
1815
|
[view]
|
|
1947
1816
|
);
|
|
1948
|
-
const inputRef = (0,
|
|
1949
|
-
(0,
|
|
1817
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
1818
|
+
(0, import_react13.useEffect)(() => {
|
|
1950
1819
|
if (isEditingUrl) {
|
|
1951
1820
|
inputRef.current?.focus();
|
|
1952
1821
|
}
|
|
1953
1822
|
}, [isEditingUrl]);
|
|
1954
|
-
const handleMouseMove = (0,
|
|
1823
|
+
const handleMouseMove = (0, import_react13.useCallback)(
|
|
1955
1824
|
(e) => {
|
|
1956
1825
|
const resize = resizingRef.current;
|
|
1957
1826
|
if (!resize) {
|
|
@@ -2001,7 +1870,7 @@ var ResizableNodeView = ({
|
|
|
2001
1870
|
},
|
|
2002
1871
|
[lockAspect, aspectRatio, minWidth, maxWidth]
|
|
2003
1872
|
);
|
|
2004
|
-
const handleMouseUp = (0,
|
|
1873
|
+
const handleMouseUp = (0, import_react13.useCallback)(
|
|
2005
1874
|
function handleMouseUp2() {
|
|
2006
1875
|
const resize = resizingRef.current;
|
|
2007
1876
|
if (!resize) {
|
|
@@ -2022,7 +1891,7 @@ var ResizableNodeView = ({
|
|
|
2022
1891
|
},
|
|
2023
1892
|
[handleMouseMove, updateAttributes]
|
|
2024
1893
|
);
|
|
2025
|
-
const handleMouseDown = (0,
|
|
1894
|
+
const handleMouseDown = (0, import_react13.useCallback)(
|
|
2026
1895
|
(e, direction) => {
|
|
2027
1896
|
e.preventDefault();
|
|
2028
1897
|
e.stopPropagation();
|
|
@@ -2053,7 +1922,7 @@ var ResizableNodeView = ({
|
|
|
2053
1922
|
},
|
|
2054
1923
|
[width, height, getEditorWidth, handleMouseMove, handleMouseUp]
|
|
2055
1924
|
);
|
|
2056
|
-
(0,
|
|
1925
|
+
(0, import_react13.useEffect)(
|
|
2057
1926
|
() => () => {
|
|
2058
1927
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
2059
1928
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
@@ -2081,13 +1950,13 @@ var ResizableNodeView = ({
|
|
|
2081
1950
|
setIsEditingUrl(false);
|
|
2082
1951
|
};
|
|
2083
1952
|
const isEditable = editor ? editor.isEditable : true;
|
|
2084
|
-
return /* @__PURE__ */ (0,
|
|
2085
|
-
|
|
1953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1954
|
+
import_react12.NodeViewWrapper,
|
|
2086
1955
|
{
|
|
2087
1956
|
className: "rte-embed-wrapper",
|
|
2088
1957
|
"data-selected": selected || void 0,
|
|
2089
1958
|
"data-align": align,
|
|
2090
|
-
children: /* @__PURE__ */ (0,
|
|
1959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2091
1960
|
"div",
|
|
2092
1961
|
{
|
|
2093
1962
|
ref: containerRef,
|
|
@@ -2100,7 +1969,7 @@ var ResizableNodeView = ({
|
|
|
2100
1969
|
},
|
|
2101
1970
|
children: [
|
|
2102
1971
|
children,
|
|
2103
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
1972
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2104
1973
|
EmbedToolbar,
|
|
2105
1974
|
{
|
|
2106
1975
|
align,
|
|
@@ -2118,14 +1987,14 @@ var ResizableNodeView = ({
|
|
|
2118
1987
|
nodeSrc: node.attrs.src
|
|
2119
1988
|
}
|
|
2120
1989
|
) }),
|
|
2121
|
-
isResizing && currentDimensions && /* @__PURE__ */ (0,
|
|
1990
|
+
isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-resize-badge", children: [
|
|
2122
1991
|
currentDimensions.w,
|
|
2123
1992
|
" \xD7 ",
|
|
2124
1993
|
currentDimensions.h,
|
|
2125
1994
|
" px"
|
|
2126
1995
|
] }),
|
|
2127
|
-
selected && isEditable && /* @__PURE__ */ (0,
|
|
2128
|
-
/* @__PURE__ */ (0,
|
|
1996
|
+
selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2129
1998
|
"div",
|
|
2130
1999
|
{
|
|
2131
2000
|
className: "rte-resize-handle rte-resize-handle--left",
|
|
@@ -2133,7 +2002,7 @@ var ResizableNodeView = ({
|
|
|
2133
2002
|
role: "presentation"
|
|
2134
2003
|
}
|
|
2135
2004
|
),
|
|
2136
|
-
/* @__PURE__ */ (0,
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2137
2006
|
"div",
|
|
2138
2007
|
{
|
|
2139
2008
|
className: "rte-resize-handle rte-resize-handle--right",
|
|
@@ -2141,7 +2010,7 @@ var ResizableNodeView = ({
|
|
|
2141
2010
|
role: "presentation"
|
|
2142
2011
|
}
|
|
2143
2012
|
),
|
|
2144
|
-
/* @__PURE__ */ (0,
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2145
2014
|
"div",
|
|
2146
2015
|
{
|
|
2147
2016
|
className: "rte-resize-handle rte-resize-handle--bottom",
|
|
@@ -2149,7 +2018,7 @@ var ResizableNodeView = ({
|
|
|
2149
2018
|
role: "presentation"
|
|
2150
2019
|
}
|
|
2151
2020
|
),
|
|
2152
|
-
/* @__PURE__ */ (0,
|
|
2021
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2153
2022
|
"div",
|
|
2154
2023
|
{
|
|
2155
2024
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
|
|
@@ -2157,7 +2026,7 @@ var ResizableNodeView = ({
|
|
|
2157
2026
|
role: "presentation"
|
|
2158
2027
|
}
|
|
2159
2028
|
),
|
|
2160
|
-
/* @__PURE__ */ (0,
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2161
2030
|
"div",
|
|
2162
2031
|
{
|
|
2163
2032
|
className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
|
|
@@ -2174,7 +2043,7 @@ var ResizableNodeView = ({
|
|
|
2174
2043
|
};
|
|
2175
2044
|
|
|
2176
2045
|
// src/controls/rte-twitter-control.tsx
|
|
2177
|
-
var
|
|
2046
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2178
2047
|
var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
|
|
2179
2048
|
var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
|
|
2180
2049
|
var READY_POLL_INTERVAL_MS = 50;
|
|
@@ -2250,15 +2119,15 @@ var loadTwitterScript = () => {
|
|
|
2250
2119
|
};
|
|
2251
2120
|
var TwitterNodeView = (props) => {
|
|
2252
2121
|
const { node } = props;
|
|
2253
|
-
const containerRef = (0,
|
|
2254
|
-
const [loading, setLoading] = (0,
|
|
2255
|
-
const [failed, setFailed] = (0,
|
|
2122
|
+
const containerRef = (0, import_react15.useRef)(null);
|
|
2123
|
+
const [loading, setLoading] = (0, import_react15.useState)(true);
|
|
2124
|
+
const [failed, setFailed] = (0, import_react15.useState)(false);
|
|
2256
2125
|
const { tweetId } = node.attrs;
|
|
2257
|
-
const renderedTweetIdRef = (0,
|
|
2258
|
-
const activeRenderIdRef = (0,
|
|
2259
|
-
const retryToken = (0,
|
|
2260
|
-
const [retryCount, setRetryCount] = (0,
|
|
2261
|
-
(0,
|
|
2126
|
+
const renderedTweetIdRef = (0, import_react15.useRef)(null);
|
|
2127
|
+
const activeRenderIdRef = (0, import_react15.useRef)(0);
|
|
2128
|
+
const retryToken = (0, import_react15.useRef)(0);
|
|
2129
|
+
const [retryCount, setRetryCount] = (0, import_react15.useState)(0);
|
|
2130
|
+
(0, import_react15.useEffect)(() => {
|
|
2262
2131
|
if (!containerRef.current || !tweetId) {
|
|
2263
2132
|
return;
|
|
2264
2133
|
}
|
|
@@ -2317,11 +2186,11 @@ var TwitterNodeView = (props) => {
|
|
|
2317
2186
|
isCancelled = true;
|
|
2318
2187
|
};
|
|
2319
2188
|
}, [tweetId, retryCount, failed]);
|
|
2320
|
-
const handleRetry = (0,
|
|
2189
|
+
const handleRetry = (0, import_react15.useCallback)(() => {
|
|
2321
2190
|
retryToken.current += 1;
|
|
2322
2191
|
setRetryCount(retryToken.current);
|
|
2323
2192
|
}, []);
|
|
2324
|
-
return /* @__PURE__ */ (0,
|
|
2193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2325
2194
|
ResizableNodeView,
|
|
2326
2195
|
{
|
|
2327
2196
|
...props,
|
|
@@ -2329,12 +2198,12 @@ var TwitterNodeView = (props) => {
|
|
|
2329
2198
|
minWidth: 300,
|
|
2330
2199
|
maxWidth: 1200,
|
|
2331
2200
|
children: [
|
|
2332
|
-
loading && /* @__PURE__ */ (0,
|
|
2333
|
-
!loading && failed && /* @__PURE__ */ (0,
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2201
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
|
|
2202
|
+
!loading && failed && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-error", children: [
|
|
2203
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "Couldn't load this tweet." }),
|
|
2204
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
|
|
2336
2205
|
] }),
|
|
2337
|
-
/* @__PURE__ */ (0,
|
|
2206
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: containerRef })
|
|
2338
2207
|
]
|
|
2339
2208
|
}
|
|
2340
2209
|
);
|
|
@@ -2404,7 +2273,7 @@ var TwitterEmbed = import_core2.Node.create({
|
|
|
2404
2273
|
];
|
|
2405
2274
|
},
|
|
2406
2275
|
addNodeView() {
|
|
2407
|
-
return (0,
|
|
2276
|
+
return (0, import_react14.ReactNodeViewRenderer)(TwitterNodeView);
|
|
2408
2277
|
},
|
|
2409
2278
|
atom: true,
|
|
2410
2279
|
draggable: true,
|
|
@@ -2438,10 +2307,10 @@ var extractTweetId = (input) => {
|
|
|
2438
2307
|
};
|
|
2439
2308
|
var TwitterEmbedControl = ({ className }) => {
|
|
2440
2309
|
const { editor } = useRichTextEditorContext();
|
|
2441
|
-
const [open, setOpen] = (0,
|
|
2442
|
-
const [url, setUrl] = (0,
|
|
2443
|
-
const [touched, setTouched] = (0,
|
|
2444
|
-
const { active } = (0,
|
|
2310
|
+
const [open, setOpen] = (0, import_react15.useState)(false);
|
|
2311
|
+
const [url, setUrl] = (0, import_react15.useState)("");
|
|
2312
|
+
const [touched, setTouched] = (0, import_react15.useState)(false);
|
|
2313
|
+
const { active } = (0, import_react14.useEditorState)({
|
|
2445
2314
|
editor: editor ?? null,
|
|
2446
2315
|
selector: (ctx) => ({
|
|
2447
2316
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
|
|
@@ -2449,11 +2318,11 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2449
2318
|
}) ?? { active: false };
|
|
2450
2319
|
const tweetId = url ? extractTweetId(url) : null;
|
|
2451
2320
|
const showError = touched && url.length > 0 && !tweetId;
|
|
2452
|
-
const resetState = (0,
|
|
2321
|
+
const resetState = (0, import_react15.useCallback)(() => {
|
|
2453
2322
|
setUrl("");
|
|
2454
2323
|
setTouched(false);
|
|
2455
2324
|
}, []);
|
|
2456
|
-
const handleInsert = (0,
|
|
2325
|
+
const handleInsert = (0, import_react15.useCallback)(() => {
|
|
2457
2326
|
setTouched(true);
|
|
2458
2327
|
if (!tweetId || !editor) {
|
|
2459
2328
|
return false;
|
|
@@ -2462,7 +2331,7 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2462
2331
|
resetState();
|
|
2463
2332
|
return true;
|
|
2464
2333
|
}, [tweetId, editor, resetState]);
|
|
2465
|
-
return /* @__PURE__ */ (0,
|
|
2334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2466
2335
|
Dialog,
|
|
2467
2336
|
{
|
|
2468
2337
|
open,
|
|
@@ -2473,36 +2342,36 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2473
2342
|
}
|
|
2474
2343
|
},
|
|
2475
2344
|
children: [
|
|
2476
|
-
/* @__PURE__ */ (0,
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2477
2346
|
DialogTrigger,
|
|
2478
2347
|
{
|
|
2479
|
-
render: /* @__PURE__ */ (0,
|
|
2348
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2480
2349
|
RichTextEditorControl,
|
|
2481
2350
|
{
|
|
2482
2351
|
active,
|
|
2483
2352
|
className,
|
|
2484
2353
|
title: "Embed Tweet",
|
|
2485
2354
|
"aria-label": "Embed Tweet",
|
|
2486
|
-
children: /* @__PURE__ */ (0,
|
|
2355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2487
2356
|
"svg",
|
|
2488
2357
|
{
|
|
2489
2358
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2490
2359
|
viewBox: "0 0 24 24",
|
|
2491
2360
|
fill: "currentColor",
|
|
2492
2361
|
className: "rte-editor-icon",
|
|
2493
|
-
children: /* @__PURE__ */ (0,
|
|
2362
|
+
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
2363
|
}
|
|
2495
2364
|
)
|
|
2496
2365
|
}
|
|
2497
2366
|
)
|
|
2498
2367
|
}
|
|
2499
2368
|
),
|
|
2500
|
-
/* @__PURE__ */ (0,
|
|
2501
|
-
/* @__PURE__ */ (0,
|
|
2502
|
-
/* @__PURE__ */ (0,
|
|
2503
|
-
/* @__PURE__ */ (0,
|
|
2369
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogContent, { children: [
|
|
2370
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogHeader, { children: [
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogTitle, { children: "Embed Tweet" }),
|
|
2372
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
|
|
2504
2373
|
] }),
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
2374
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2506
2375
|
Input,
|
|
2507
2376
|
{
|
|
2508
2377
|
value: url,
|
|
@@ -2522,10 +2391,10 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2522
2391
|
}
|
|
2523
2392
|
}
|
|
2524
2393
|
),
|
|
2525
|
-
showError && /* @__PURE__ */ (0,
|
|
2526
|
-
/* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2528
|
-
/* @__PURE__ */ (0,
|
|
2394
|
+
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." }),
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogFooter, { children: [
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogClose, { children: "Cancel" }),
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2529
2398
|
"button",
|
|
2530
2399
|
{
|
|
2531
2400
|
type: "button",
|
|
@@ -2548,9 +2417,9 @@ var TwitterEmbedControl = ({ className }) => {
|
|
|
2548
2417
|
|
|
2549
2418
|
// src/controls/rte-youtube-control.tsx
|
|
2550
2419
|
var import_core3 = require("@tiptap/core");
|
|
2551
|
-
var
|
|
2552
|
-
var
|
|
2553
|
-
var
|
|
2420
|
+
var import_react16 = require("@tiptap/react");
|
|
2421
|
+
var import_react17 = require("react");
|
|
2422
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2554
2423
|
var getYouTubeId = (url) => {
|
|
2555
2424
|
const clean = url.trim();
|
|
2556
2425
|
const patterns = [
|
|
@@ -2578,7 +2447,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2578
2447
|
if (videoId) {
|
|
2579
2448
|
watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
|
|
2580
2449
|
}
|
|
2581
|
-
return /* @__PURE__ */ (0,
|
|
2450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2582
2451
|
ResizableNodeView,
|
|
2583
2452
|
{
|
|
2584
2453
|
...props,
|
|
@@ -2589,7 +2458,7 @@ var YouTubeNodeView = (props) => {
|
|
|
2589
2458
|
videoSrc: rawSrc,
|
|
2590
2459
|
watchUrl,
|
|
2591
2460
|
onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
|
|
2592
|
-
children: /* @__PURE__ */ (0,
|
|
2461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2593
2462
|
"iframe",
|
|
2594
2463
|
{
|
|
2595
2464
|
src: `https://www.youtube-nocookie.com/embed/${videoId}`,
|
|
@@ -2667,7 +2536,7 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2667
2536
|
];
|
|
2668
2537
|
},
|
|
2669
2538
|
addNodeView() {
|
|
2670
|
-
return (0,
|
|
2539
|
+
return (0, import_react16.ReactNodeViewRenderer)(YouTubeNodeView);
|
|
2671
2540
|
},
|
|
2672
2541
|
atom: true,
|
|
2673
2542
|
draggable: true,
|
|
@@ -2691,32 +2560,32 @@ var YouTubeEmbed = import_core3.Node.create({
|
|
|
2691
2560
|
});
|
|
2692
2561
|
var YouTubeEmbedControl = ({ className }) => {
|
|
2693
2562
|
const { editor } = useRichTextEditorContext();
|
|
2694
|
-
const [open, setOpen] = (0,
|
|
2695
|
-
const [url, setUrl] = (0,
|
|
2696
|
-
const { active } = (0,
|
|
2563
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
2564
|
+
const [url, setUrl] = (0, import_react17.useState)("");
|
|
2565
|
+
const { active } = (0, import_react16.useEditorState)({
|
|
2697
2566
|
editor: editor ?? null,
|
|
2698
2567
|
selector: (ctx) => ({
|
|
2699
2568
|
active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
|
|
2700
2569
|
})
|
|
2701
2570
|
}) ?? { active: false };
|
|
2702
|
-
const handleInsert = (0,
|
|
2571
|
+
const handleInsert = (0, import_react17.useCallback)(() => {
|
|
2703
2572
|
if (url && editor) {
|
|
2704
2573
|
editor.chain().focus().setYouTubeEmbed(url).run();
|
|
2705
2574
|
setUrl("");
|
|
2706
2575
|
}
|
|
2707
2576
|
}, [url, editor]);
|
|
2708
|
-
return /* @__PURE__ */ (0,
|
|
2709
|
-
/* @__PURE__ */ (0,
|
|
2577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2710
2579
|
DialogTrigger,
|
|
2711
2580
|
{
|
|
2712
|
-
render: /* @__PURE__ */ (0,
|
|
2581
|
+
render: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2713
2582
|
RichTextEditorControl,
|
|
2714
2583
|
{
|
|
2715
2584
|
active,
|
|
2716
2585
|
className,
|
|
2717
2586
|
title: "Embed YouTube video",
|
|
2718
2587
|
"aria-label": "Embed YouTube video",
|
|
2719
|
-
children: /* @__PURE__ */ (0,
|
|
2588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2720
2589
|
"svg",
|
|
2721
2590
|
{
|
|
2722
2591
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2728,8 +2597,8 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2728
2597
|
strokeLinejoin: "round",
|
|
2729
2598
|
className: "rte-editor-icon",
|
|
2730
2599
|
children: [
|
|
2731
|
-
/* @__PURE__ */ (0,
|
|
2732
|
-
/* @__PURE__ */ (0,
|
|
2600
|
+
/* @__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" }),
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
|
|
2733
2602
|
]
|
|
2734
2603
|
}
|
|
2735
2604
|
)
|
|
@@ -2737,12 +2606,12 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2737
2606
|
)
|
|
2738
2607
|
}
|
|
2739
2608
|
),
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2741
|
-
/* @__PURE__ */ (0,
|
|
2742
|
-
/* @__PURE__ */ (0,
|
|
2743
|
-
/* @__PURE__ */ (0,
|
|
2609
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogContent, { showCloseButton: false, children: [
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogHeader, { children: [
|
|
2611
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTitle, { children: "Embed YouTube video" }),
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
|
|
2744
2613
|
] }),
|
|
2745
|
-
/* @__PURE__ */ (0,
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2746
2615
|
Input,
|
|
2747
2616
|
{
|
|
2748
2617
|
value: url,
|
|
@@ -2756,9 +2625,9 @@ var YouTubeEmbedControl = ({ className }) => {
|
|
|
2756
2625
|
}
|
|
2757
2626
|
}
|
|
2758
2627
|
),
|
|
2759
|
-
/* @__PURE__ */ (0,
|
|
2760
|
-
/* @__PURE__ */ (0,
|
|
2761
|
-
/* @__PURE__ */ (0,
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogFooter, { children: [
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogClose, { children: "Cancel" }),
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2762
2631
|
DialogClose,
|
|
2763
2632
|
{
|
|
2764
2633
|
disabled: !url,
|
|
@@ -2814,16 +2683,16 @@ var DEFAULT_LABELS = {
|
|
|
2814
2683
|
};
|
|
2815
2684
|
|
|
2816
2685
|
// src/rte-content.tsx
|
|
2817
|
-
var
|
|
2818
|
-
var
|
|
2686
|
+
var import_react18 = require("@tiptap/react");
|
|
2687
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2819
2688
|
var Content = ({
|
|
2820
2689
|
children,
|
|
2821
2690
|
className
|
|
2822
2691
|
}) => {
|
|
2823
2692
|
const { editor } = useRichTextEditorContext();
|
|
2824
|
-
return /* @__PURE__ */ (0,
|
|
2825
|
-
/* @__PURE__ */ (0,
|
|
2826
|
-
|
|
2693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2695
|
+
import_react18.EditorContent,
|
|
2827
2696
|
{
|
|
2828
2697
|
editor,
|
|
2829
2698
|
className: cn("rte-content w-full", className),
|
|
@@ -2835,15 +2704,15 @@ var Content = ({
|
|
|
2835
2704
|
};
|
|
2836
2705
|
|
|
2837
2706
|
// src/rte-controls-group.tsx
|
|
2838
|
-
var
|
|
2707
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2839
2708
|
var ControlsGroup = ({
|
|
2840
2709
|
children,
|
|
2841
2710
|
className
|
|
2842
|
-
}) => /* @__PURE__ */ (0,
|
|
2711
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("rte-controls-group", className), children });
|
|
2843
2712
|
|
|
2844
2713
|
// src/rte-footer.tsx
|
|
2845
|
-
var
|
|
2846
|
-
var
|
|
2714
|
+
var import_react19 = require("react");
|
|
2715
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2847
2716
|
var Footer = ({
|
|
2848
2717
|
children,
|
|
2849
2718
|
className,
|
|
@@ -2854,9 +2723,9 @@ var Footer = ({
|
|
|
2854
2723
|
wordCountFormatter
|
|
2855
2724
|
}) => {
|
|
2856
2725
|
const { editor, variant } = useRichTextEditorContext();
|
|
2857
|
-
const [, forceUpdate] = (0,
|
|
2858
|
-
const rafRef = (0,
|
|
2859
|
-
(0,
|
|
2726
|
+
const [, forceUpdate] = (0, import_react19.useState)(0);
|
|
2727
|
+
const rafRef = (0, import_react19.useRef)(null);
|
|
2728
|
+
(0, import_react19.useEffect)(() => {
|
|
2860
2729
|
if (!editor || !showWordCount) {
|
|
2861
2730
|
return;
|
|
2862
2731
|
}
|
|
@@ -2885,7 +2754,7 @@ var Footer = ({
|
|
|
2885
2754
|
}
|
|
2886
2755
|
};
|
|
2887
2756
|
}, [editor, showWordCount]);
|
|
2888
|
-
const wordCount = (0,
|
|
2757
|
+
const wordCount = (0, import_react19.useMemo)(() => {
|
|
2889
2758
|
if (!editor || !showWordCount) {
|
|
2890
2759
|
return null;
|
|
2891
2760
|
}
|
|
@@ -2902,7 +2771,7 @@ var Footer = ({
|
|
|
2902
2771
|
if (!showWordCount && !children) {
|
|
2903
2772
|
return null;
|
|
2904
2773
|
}
|
|
2905
|
-
return /* @__PURE__ */ (0,
|
|
2774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2906
2775
|
"div",
|
|
2907
2776
|
{
|
|
2908
2777
|
className: cn(
|
|
@@ -2914,21 +2783,21 @@ var Footer = ({
|
|
|
2914
2783
|
"data-sticky": sticky ? "" : void 0,
|
|
2915
2784
|
style: sticky ? { bottom: stickyOffset } : void 0,
|
|
2916
2785
|
children: [
|
|
2917
|
-
showWordCount && wordCount && /* @__PURE__ */ (0,
|
|
2918
|
-
/* @__PURE__ */ (0,
|
|
2919
|
-
/* @__PURE__ */ (0,
|
|
2920
|
-
/* @__PURE__ */ (0,
|
|
2786
|
+
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: [
|
|
2787
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
|
|
2921
2790
|
] }),
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
2791
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2923
2792
|
"span",
|
|
2924
2793
|
{
|
|
2925
2794
|
className: "rte-footer-word-count-separator",
|
|
2926
2795
|
"aria-hidden": "true"
|
|
2927
2796
|
}
|
|
2928
2797
|
),
|
|
2929
|
-
/* @__PURE__ */ (0,
|
|
2930
|
-
/* @__PURE__ */ (0,
|
|
2931
|
-
/* @__PURE__ */ (0,
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
|
|
2799
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
|
|
2800
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
|
|
2932
2801
|
] })
|
|
2933
2802
|
] }) }),
|
|
2934
2803
|
children
|
|
@@ -2938,7 +2807,7 @@ var Footer = ({
|
|
|
2938
2807
|
};
|
|
2939
2808
|
|
|
2940
2809
|
// src/rte-toolbar.tsx
|
|
2941
|
-
var
|
|
2810
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2942
2811
|
var Toolbar = ({
|
|
2943
2812
|
children,
|
|
2944
2813
|
className,
|
|
@@ -2949,7 +2818,7 @@ var Toolbar = ({
|
|
|
2949
2818
|
if (!editable) {
|
|
2950
2819
|
return null;
|
|
2951
2820
|
}
|
|
2952
|
-
return /* @__PURE__ */ (0,
|
|
2821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2953
2822
|
"div",
|
|
2954
2823
|
{
|
|
2955
2824
|
className: cn(
|
|
@@ -2966,7 +2835,7 @@ var Toolbar = ({
|
|
|
2966
2835
|
};
|
|
2967
2836
|
|
|
2968
2837
|
// src/rte-text-editor.tsx
|
|
2969
|
-
var
|
|
2838
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2970
2839
|
var RichTextEditorRoot = ({
|
|
2971
2840
|
editor,
|
|
2972
2841
|
children,
|
|
@@ -2976,18 +2845,18 @@ var RichTextEditorRoot = ({
|
|
|
2976
2845
|
variant = "default",
|
|
2977
2846
|
editable = true
|
|
2978
2847
|
}) => {
|
|
2979
|
-
const mergedLabels = (0,
|
|
2848
|
+
const mergedLabels = (0, import_react20.useMemo)(
|
|
2980
2849
|
() => ({ ...DEFAULT_LABELS, ...labels }),
|
|
2981
2850
|
[labels]
|
|
2982
2851
|
);
|
|
2983
|
-
const mergedIcons = (0,
|
|
2984
|
-
const [tooltip] = (0,
|
|
2985
|
-
(0,
|
|
2852
|
+
const mergedIcons = (0, import_react20.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
|
|
2853
|
+
const [tooltip] = (0, import_react20.useState)(() => import_tooltip5.Tooltip.createHandle());
|
|
2854
|
+
(0, import_react20.useEffect)(() => {
|
|
2986
2855
|
if (editor && editor.isEditable !== editable) {
|
|
2987
2856
|
editor.setEditable(editable);
|
|
2988
2857
|
}
|
|
2989
2858
|
}, [editor, editable]);
|
|
2990
|
-
return /* @__PURE__ */ (0,
|
|
2859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2991
2860
|
RichTextEditorContext.Provider,
|
|
2992
2861
|
{
|
|
2993
2862
|
value: {
|
|
@@ -2998,7 +2867,7 @@ var RichTextEditorRoot = ({
|
|
|
2998
2867
|
tooltip,
|
|
2999
2868
|
variant
|
|
3000
2869
|
},
|
|
3001
|
-
children: /* @__PURE__ */ (0,
|
|
2870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3002
2871
|
"div",
|
|
3003
2872
|
{
|
|
3004
2873
|
className: cn(
|
|
@@ -3007,9 +2876,9 @@ var RichTextEditorRoot = ({
|
|
|
3007
2876
|
className
|
|
3008
2877
|
),
|
|
3009
2878
|
"data-variant": variant,
|
|
3010
|
-
children: /* @__PURE__ */ (0,
|
|
2879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(TooltipProvider, { children: [
|
|
3011
2880
|
children,
|
|
3012
|
-
/* @__PURE__ */ (0,
|
|
2881
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContent, { side: "bottom", children: payload }) })
|
|
3013
2882
|
] })
|
|
3014
2883
|
}
|
|
3015
2884
|
)
|
|
@@ -3068,19 +2937,9 @@ var Link2 = import_extension_link.default.extend({
|
|
|
3068
2937
|
};
|
|
3069
2938
|
}
|
|
3070
2939
|
}).configure({ openOnClick: false });
|
|
3071
|
-
|
|
3072
|
-
// src/extensions/code-block.ts
|
|
3073
|
-
var import_extension_code_block_lowlight = __toESM(require("@tiptap/extension-code-block-lowlight"), 1);
|
|
3074
|
-
var import_lowlight = require("lowlight");
|
|
3075
|
-
var lowlight = (0, import_lowlight.createLowlight)(import_lowlight.common);
|
|
3076
|
-
var CodeBlock = import_extension_code_block_lowlight.default.configure({
|
|
3077
|
-
defaultLanguage: "javascript",
|
|
3078
|
-
lowlight
|
|
3079
|
-
});
|
|
3080
2940
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3081
2941
|
0 && (module.exports = {
|
|
3082
2942
|
BubbleMenu,
|
|
3083
|
-
CodeBlock,
|
|
3084
2943
|
DEFAULT_ICONS,
|
|
3085
2944
|
DEFAULT_LABELS,
|
|
3086
2945
|
DEFAULT_LANGUAGE_ICONS,
|