@editorcn/editor 0.3.1 → 0.3.2

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 CHANGED
@@ -86,9 +86,11 @@ var shallowEqual = (a, b) => {
86
86
  };
87
87
  var useEditorState = (editor, selector, isEqual = defaultEqual) => {
88
88
  const selectorRef = (0, import_react2.useRef)(selector);
89
- selectorRef.current = selector;
90
89
  const isEqualRef = (0, import_react2.useRef)(isEqual);
91
- isEqualRef.current = isEqual;
90
+ (0, import_react2.useEffect)(() => {
91
+ selectorRef.current = selector;
92
+ isEqualRef.current = isEqual;
93
+ });
92
94
  const snapshotRef = (0, import_react2.useRef)({
93
95
  value: editor ? selector(editor) : void 0
94
96
  });
@@ -703,6 +705,7 @@ var H6Control = createControl({
703
705
  });
704
706
  var AlignLeftControl = createControl({
705
707
  iconKey: "alignLeftControlIcon",
708
+ isActive: { attrs: { textAlign: "left" } },
706
709
  label: "alignLeftControlLabel",
707
710
  operation: { attributes: "left", name: "setTextAlign" }
708
711
  });
@@ -943,34 +946,426 @@ var LinkControl = () => {
943
946
 
944
947
  // src/controls/rte-twitter-control.tsx
945
948
  var import_core2 = require("@tiptap/core");
946
- var import_react11 = require("@tiptap/react");
947
- var import_react12 = require("react");
949
+ var import_react12 = require("@tiptap/react");
950
+ var import_react13 = require("react");
948
951
 
949
952
  // src/extensions/resizable-node-view.tsx
950
- var import_react9 = require("@tiptap/react");
951
- var import_react10 = require("react");
953
+ var import_react10 = require("@tiptap/react");
954
+ var import_react11 = require("react");
955
+
956
+ // src/icons.tsx
957
+ var import_lucide_react = require("lucide-react");
958
+ var import_react9 = require("react");
952
959
  var import_jsx_runtime10 = require("react/jsx-runtime");
960
+ var ALIGN_PATHS = {
961
+ center: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
962
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
963
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
964
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
965
+ ] }),
966
+ left: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
967
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
968
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
969
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
970
+ ] }),
971
+ right: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
972
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
973
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
974
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
975
+ ] })
976
+ };
977
+ var AlignIcon = ({ dir }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
978
+ "svg",
979
+ {
980
+ xmlns: "http://www.w3.org/2000/svg",
981
+ viewBox: "0 0 24 24",
982
+ fill: "none",
983
+ stroke: "currentColor",
984
+ strokeWidth: "2",
985
+ strokeLinecap: "round",
986
+ strokeLinejoin: "round",
987
+ className: "rte-editor-icon",
988
+ children: ALIGN_PATHS[dir]
989
+ }
990
+ );
991
+ var EditUrlIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
992
+ "svg",
993
+ {
994
+ xmlns: "http://www.w3.org/2000/svg",
995
+ viewBox: "0 0 24 24",
996
+ fill: "none",
997
+ stroke: "currentColor",
998
+ strokeWidth: "2",
999
+ strokeLinecap: "round",
1000
+ strokeLinejoin: "round",
1001
+ className: "rte-editor-icon",
1002
+ children: [
1003
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 20h9" }),
1004
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z" })
1005
+ ]
1006
+ }
1007
+ );
1008
+ var OpenInYouTubeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1009
+ "svg",
1010
+ {
1011
+ xmlns: "http://www.w3.org/2000/svg",
1012
+ viewBox: "0 0 24 24",
1013
+ fill: "none",
1014
+ stroke: "currentColor",
1015
+ strokeWidth: "2",
1016
+ strokeLinecap: "round",
1017
+ strokeLinejoin: "round",
1018
+ className: "rte-editor-icon",
1019
+ children: [
1020
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
1021
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "15 3 21 3 21 9" }),
1022
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
1023
+ ]
1024
+ }
1025
+ );
1026
+ var DeleteEmbedIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1027
+ "svg",
1028
+ {
1029
+ xmlns: "http://www.w3.org/2000/svg",
1030
+ viewBox: "0 0 24 24",
1031
+ fill: "none",
1032
+ stroke: "currentColor",
1033
+ strokeWidth: "2",
1034
+ strokeLinecap: "round",
1035
+ strokeLinejoin: "round",
1036
+ className: "rte-editor-icon",
1037
+ children: [
1038
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polyline", { points: "3 6 5 6 21 6" }),
1039
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" })
1040
+ ]
1041
+ }
1042
+ );
1043
+ var iconProps = { className: "rte-editor-icon" };
1044
+ var LangIcon = ({
1045
+ children,
1046
+ className
1047
+ }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1048
+ "svg",
1049
+ {
1050
+ xmlns: "http://www.w3.org/2000/svg",
1051
+ viewBox: "0 0 24 24",
1052
+ fill: "none",
1053
+ stroke: "currentColor",
1054
+ strokeWidth: 1.5,
1055
+ strokeLinecap: "round",
1056
+ strokeLinejoin: "round",
1057
+ className,
1058
+ children
1059
+ }
1060
+ );
1061
+ var DEFAULT_LANGUAGE_ICONS = {
1062
+ bash: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1063
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
1064
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
1065
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 15.5h5.5" })
1066
+ ] }),
1067
+ c: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1068
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
1069
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
1070
+ ] }),
1071
+ cpp: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1072
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
1073
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
1074
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
1075
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
1076
+ ] }),
1077
+ css: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1078
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1079
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9.7 7.5l-1 9" }),
1080
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15.3 7.5l-1 9" }),
1081
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M7 10.3h11" }),
1082
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 14.3h11" })
1083
+ ] }),
1084
+ go: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1085
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1086
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
1087
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12.6 12h-1.9" }),
1088
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
1089
+ ] }),
1090
+ html: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1091
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1092
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
1093
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
1094
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M13 7.3l-2 9.4" })
1095
+ ] }),
1096
+ java: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1097
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
1098
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
1099
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
1100
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 19.3h10" })
1101
+ ] }),
1102
+ javascript: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1103
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1104
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
1105
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" })
1106
+ ] }),
1107
+ json: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1108
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
1109
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" })
1110
+ ] }),
1111
+ kotlin: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1112
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1113
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 7.5v9" }),
1114
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 12l6-4.5" }),
1115
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 12l6 4.5" })
1116
+ ] }),
1117
+ markdown: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1118
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
1119
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
1120
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16.5 9v6" }),
1121
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14.5 13l2 2 2-2" })
1122
+ ] }),
1123
+ php: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1124
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1125
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
1126
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
1127
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
1128
+ ] }),
1129
+ plaintext: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1130
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
1131
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
1132
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
1133
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
1134
+ ] }),
1135
+ python: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1136
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
1137
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
1138
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
1139
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
1140
+ ] }),
1141
+ ruby: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1142
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
1143
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4.5 8h15" }),
1144
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 2.5v19" })
1145
+ ] }),
1146
+ rust: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1147
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
1148
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
1149
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
1150
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" })
1151
+ ] }),
1152
+ sql: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1153
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
1154
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
1155
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
1156
+ ] }),
1157
+ swift: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LangIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime10.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" }) }),
1158
+ typescript: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1159
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1160
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
1161
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" })
1162
+ ] }),
1163
+ xml: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1164
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
1165
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
1166
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 8v8" })
1167
+ ] }),
1168
+ yaml: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(LangIcon, { children: [
1169
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
1170
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
1171
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
1172
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
1173
+ ] })
1174
+ };
1175
+ var DEFAULT_ICONS = {
1176
+ alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
1177
+ alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
1178
+ alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
1179
+ alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
1180
+ blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
1181
+ boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Bold, { ...iconProps }),
1182
+ bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.List, { ...iconProps }),
1183
+ clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
1184
+ codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
1185
+ codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Code, { ...iconProps }),
1186
+ h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading1, { ...iconProps }),
1187
+ h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading2, { ...iconProps }),
1188
+ h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading3, { ...iconProps }),
1189
+ h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading4, { ...iconProps }),
1190
+ h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading5, { ...iconProps }),
1191
+ h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Heading6, { ...iconProps }),
1192
+ highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
1193
+ hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Minus, { ...iconProps }),
1194
+ italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Italic, { ...iconProps }),
1195
+ languageIcons: DEFAULT_LANGUAGE_ICONS,
1196
+ linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Link, { ...iconProps }),
1197
+ orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
1198
+ redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Redo2, { ...iconProps }),
1199
+ strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
1200
+ subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Subscript, { ...iconProps }),
1201
+ superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Superscript, { ...iconProps }),
1202
+ underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Underline, { ...iconProps }),
1203
+ undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Undo2, { ...iconProps }),
1204
+ unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.Link2Off, { ...iconProps })
1205
+ };
1206
+
1207
+ // src/extensions/resizable-node-view.tsx
1208
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1209
+ var EmbedToolbar = ({
1210
+ align,
1211
+ videoSrc,
1212
+ watchUrl,
1213
+ deleteNode,
1214
+ inputRef,
1215
+ isEditingUrl,
1216
+ urlInput,
1217
+ setUrlInput,
1218
+ setIsEditingUrl,
1219
+ handleSaveUrl,
1220
+ handleApplyPreset,
1221
+ updateAttributes,
1222
+ nodeSrc
1223
+ }) => {
1224
+ if (isEditingUrl) {
1225
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
1226
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1227
+ "input",
1228
+ {
1229
+ ref: inputRef,
1230
+ type: "text",
1231
+ value: urlInput,
1232
+ onChange: (e) => setUrlInput(e.target.value),
1233
+ placeholder: "Paste YouTube URL or video ID...",
1234
+ className: "rte-embed-selector-input",
1235
+ onKeyDown: (e) => {
1236
+ if (e.key === "Enter") {
1237
+ handleSaveUrl();
1238
+ } else if (e.key === "Escape") {
1239
+ setIsEditingUrl(false);
1240
+ }
1241
+ }
1242
+ }
1243
+ ),
1244
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1245
+ "button",
1246
+ {
1247
+ type: "button",
1248
+ onClick: handleSaveUrl,
1249
+ className: "rte-embed-selector-btn rte-embed-selector-btn--save",
1250
+ children: "Save"
1251
+ }
1252
+ ),
1253
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1254
+ "button",
1255
+ {
1256
+ type: "button",
1257
+ onClick: () => setIsEditingUrl(false),
1258
+ className: "rte-embed-selector-btn",
1259
+ children: "Cancel"
1260
+ }
1261
+ )
1262
+ ] });
1263
+ }
1264
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1265
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1266
+ "button",
1267
+ {
1268
+ type: "button",
1269
+ title: `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1270
+ "aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1271
+ className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
1272
+ onClick: () => updateAttributes({ align: dir }),
1273
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AlignIcon, { dir })
1274
+ },
1275
+ dir
1276
+ )) }),
1277
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-divider" }),
1278
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1279
+ "button",
1280
+ {
1281
+ type: "button",
1282
+ title: `${pct}%`,
1283
+ className: "rte-embed-selector-btn rte-embed-selector-btn--preset",
1284
+ onClick: () => handleApplyPreset(pct),
1285
+ children: [
1286
+ pct,
1287
+ "%"
1288
+ ]
1289
+ },
1290
+ pct
1291
+ )) }),
1292
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector-divider" }),
1293
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-embed-selector-group", children: [
1294
+ (videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1295
+ "button",
1296
+ {
1297
+ type: "button",
1298
+ title: "Edit URL",
1299
+ "aria-label": "Edit URL",
1300
+ className: "rte-embed-selector-btn",
1301
+ onClick: () => {
1302
+ setUrlInput(videoSrc || nodeSrc || "");
1303
+ setIsEditingUrl(true);
1304
+ },
1305
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(EditUrlIcon, {})
1306
+ }
1307
+ ),
1308
+ watchUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1309
+ "button",
1310
+ {
1311
+ type: "button",
1312
+ title: "Open video in YouTube",
1313
+ "aria-label": "Open video in YouTube",
1314
+ className: "rte-embed-selector-btn",
1315
+ onClick: () => window.open(watchUrl, "_blank"),
1316
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(OpenInYouTubeIcon, {})
1317
+ }
1318
+ ),
1319
+ deleteNode && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1320
+ "button",
1321
+ {
1322
+ type: "button",
1323
+ title: "Delete Embed",
1324
+ "aria-label": "Delete Embed",
1325
+ className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
1326
+ onClick: () => deleteNode(),
1327
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DeleteEmbedIcon, {})
1328
+ }
1329
+ )
1330
+ ] })
1331
+ ] });
1332
+ };
953
1333
  var ResizableNodeView = ({
954
1334
  node,
955
1335
  selected,
956
1336
  updateAttributes,
1337
+ deleteNode,
1338
+ editor,
957
1339
  view,
958
1340
  children,
959
1341
  lockAspect = false,
960
1342
  aspectRatio = 16 / 9,
961
1343
  minWidth = 300,
962
- maxWidth = 1200
1344
+ maxWidth = 1200,
1345
+ videoSrc,
1346
+ watchUrl,
1347
+ onSrcChange
963
1348
  }) => {
964
- const containerRef = (0, import_react10.useRef)(null);
965
- const resizingRef = (0, import_react10.useRef)(null);
1349
+ const containerRef = (0, import_react11.useRef)(null);
1350
+ const [isEditingUrl, setIsEditingUrl] = (0, import_react11.useState)(false);
1351
+ const [urlInput, setUrlInput] = (0, import_react11.useState)(videoSrc || "");
1352
+ const [isResizing, setIsResizing] = (0, import_react11.useState)(false);
1353
+ const [currentDimensions, setCurrentDimensions] = (0, import_react11.useState)(null);
1354
+ const resizingRef = (0, import_react11.useRef)(null);
966
1355
  const width = node.attrs.width;
967
1356
  const height = node.attrs.height;
968
1357
  const align = node.attrs.align || "center";
969
- const getEditorWidth = (0, import_react10.useCallback)(
970
- () => view?.dom?.parentElement?.offsetWidth ?? 0,
1358
+ const getEditorWidth = (0, import_react11.useCallback)(
1359
+ () => view?.dom?.parentElement?.offsetWidth ?? 800,
971
1360
  [view]
972
1361
  );
973
- const handleMouseMove = (0, import_react10.useCallback)(
1362
+ const inputRef = (0, import_react11.useRef)(null);
1363
+ (0, import_react11.useEffect)(() => {
1364
+ if (isEditingUrl) {
1365
+ inputRef.current?.focus();
1366
+ }
1367
+ }, [isEditingUrl]);
1368
+ const handleMouseMove = (0, import_react11.useCallback)(
974
1369
  (e) => {
975
1370
  const resize = resizingRef.current;
976
1371
  if (!resize) {
@@ -979,7 +1374,7 @@ var ResizableNodeView = ({
979
1374
  const effectiveMax = Math.min(maxWidth, resize.editorWidth);
980
1375
  let newWidth = resize.startWidth;
981
1376
  let newHeight = resize.startHeight;
982
- if (resize.direction === "right" || resize.direction === "corner") {
1377
+ if (resize.direction === "right" || resize.direction === "corner-br") {
983
1378
  newWidth = Math.max(
984
1379
  minWidth,
985
1380
  Math.min(
@@ -987,8 +1382,16 @@ var ResizableNodeView = ({
987
1382
  resize.startWidth + (e.clientX - resize.startX)
988
1383
  )
989
1384
  );
1385
+ } else if (resize.direction === "left" || resize.direction === "corner-bl") {
1386
+ newWidth = Math.max(
1387
+ minWidth,
1388
+ Math.min(
1389
+ effectiveMax,
1390
+ resize.startWidth - (e.clientX - resize.startX)
1391
+ )
1392
+ );
990
1393
  }
991
- if (resize.direction === "bottom" || resize.direction === "corner") {
1394
+ if (resize.direction === "bottom" || resize.direction === "corner-br" || resize.direction === "corner-bl") {
992
1395
  newHeight = Math.max(
993
1396
  Math.round(minWidth / aspectRatio),
994
1397
  Math.min(
@@ -998,7 +1401,7 @@ var ResizableNodeView = ({
998
1401
  );
999
1402
  }
1000
1403
  if (lockAspect) {
1001
- if (resize.direction === "right" || resize.direction === "corner") {
1404
+ if (resize.direction === "left" || resize.direction === "right" || resize.direction === "corner-br" || resize.direction === "corner-bl") {
1002
1405
  newHeight = Math.round(newWidth / aspectRatio);
1003
1406
  } else {
1004
1407
  newWidth = Math.round(newHeight * aspectRatio);
@@ -1008,10 +1411,11 @@ var ResizableNodeView = ({
1008
1411
  containerRef.current.style.width = `${newWidth}px`;
1009
1412
  containerRef.current.style.height = `${newHeight}px`;
1010
1413
  }
1414
+ setCurrentDimensions({ h: newHeight, w: newWidth });
1011
1415
  },
1012
1416
  [lockAspect, aspectRatio, minWidth, maxWidth]
1013
1417
  );
1014
- const handleMouseUp = (0, import_react10.useCallback)(
1418
+ const handleMouseUp = (0, import_react11.useCallback)(
1015
1419
  function handleMouseUp2() {
1016
1420
  const resize = resizingRef.current;
1017
1421
  if (!resize) {
@@ -1027,10 +1431,12 @@ var ResizableNodeView = ({
1027
1431
  updateAttributes({ height: h, width: w });
1028
1432
  }
1029
1433
  resizingRef.current = null;
1434
+ setIsResizing(false);
1435
+ setCurrentDimensions(null);
1030
1436
  },
1031
1437
  [handleMouseMove, updateAttributes]
1032
1438
  );
1033
- const handleMouseDown = (0, import_react10.useCallback)(
1439
+ const handleMouseDown = (0, import_react11.useCallback)(
1034
1440
  (e, direction) => {
1035
1441
  e.preventDefault();
1036
1442
  e.stopPropagation();
@@ -1045,20 +1451,23 @@ var ResizableNodeView = ({
1045
1451
  startX: e.clientX,
1046
1452
  startY: e.clientY
1047
1453
  };
1454
+ setIsResizing(true);
1455
+ setCurrentDimensions({ h: startHeight, w: startWidth });
1048
1456
  document.addEventListener("mousemove", handleMouseMove);
1049
1457
  document.addEventListener("mouseup", handleMouseUp);
1050
- let cursor = "nwse-resize";
1051
- if (direction === "right") {
1052
- cursor = "ew-resize";
1053
- } else if (direction === "bottom") {
1054
- cursor = "ns-resize";
1055
- }
1056
- document.body.style.cursor = cursor;
1458
+ const cursors = {
1459
+ bottom: "ns-resize",
1460
+ "corner-bl": "nesw-resize",
1461
+ "corner-br": "nwse-resize",
1462
+ left: "ew-resize",
1463
+ right: "ew-resize"
1464
+ };
1465
+ document.body.style.cursor = cursors[direction];
1057
1466
  document.body.style.userSelect = "none";
1058
1467
  },
1059
1468
  [width, height, getEditorWidth, handleMouseMove, handleMouseUp]
1060
1469
  );
1061
- (0, import_react10.useEffect)(
1470
+ (0, import_react11.useEffect)(
1062
1471
  () => () => {
1063
1472
  document.removeEventListener("mousemove", handleMouseMove);
1064
1473
  document.removeEventListener("mouseup", handleMouseUp);
@@ -1067,13 +1476,32 @@ var ResizableNodeView = ({
1067
1476
  },
1068
1477
  [handleMouseMove, handleMouseUp]
1069
1478
  );
1070
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1071
- import_react9.NodeViewWrapper,
1479
+ const handleApplyPreset = (percent) => {
1480
+ const editorW = getEditorWidth() || 800;
1481
+ const targetW = Math.round(
1482
+ Math.max(minWidth, Math.min(maxWidth, editorW * percent / 100))
1483
+ );
1484
+ updateAttributes({
1485
+ height: Math.round(targetW / aspectRatio),
1486
+ width: targetW
1487
+ });
1488
+ };
1489
+ const handleSaveUrl = () => {
1490
+ if (urlInput && onSrcChange) {
1491
+ onSrcChange(urlInput);
1492
+ } else if (urlInput) {
1493
+ updateAttributes({ src: urlInput });
1494
+ }
1495
+ setIsEditingUrl(false);
1496
+ };
1497
+ const isEditable = editor ? editor.isEditable : true;
1498
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1499
+ import_react10.NodeViewWrapper,
1072
1500
  {
1073
1501
  className: "rte-embed-wrapper",
1074
1502
  "data-selected": selected || void 0,
1075
1503
  "data-align": align,
1076
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1504
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1077
1505
  "div",
1078
1506
  {
1079
1507
  ref: containerRef,
@@ -1086,8 +1514,40 @@ var ResizableNodeView = ({
1086
1514
  },
1087
1515
  children: [
1088
1516
  children,
1089
- selected && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1090
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1517
+ selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1518
+ EmbedToolbar,
1519
+ {
1520
+ align,
1521
+ videoSrc,
1522
+ watchUrl,
1523
+ deleteNode,
1524
+ inputRef,
1525
+ isEditingUrl,
1526
+ urlInput,
1527
+ setUrlInput,
1528
+ setIsEditingUrl,
1529
+ handleSaveUrl,
1530
+ handleApplyPreset,
1531
+ updateAttributes,
1532
+ nodeSrc: node.attrs.src
1533
+ }
1534
+ ) }),
1535
+ isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rte-embed-resize-badge", children: [
1536
+ currentDimensions.w,
1537
+ " \xD7 ",
1538
+ currentDimensions.h,
1539
+ " px"
1540
+ ] }),
1541
+ selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1542
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1543
+ "div",
1544
+ {
1545
+ className: "rte-resize-handle rte-resize-handle--left",
1546
+ onMouseDown: (e) => handleMouseDown(e, "left"),
1547
+ role: "presentation"
1548
+ }
1549
+ ),
1550
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1091
1551
  "div",
1092
1552
  {
1093
1553
  className: "rte-resize-handle rte-resize-handle--right",
@@ -1095,7 +1555,7 @@ var ResizableNodeView = ({
1095
1555
  role: "presentation"
1096
1556
  }
1097
1557
  ),
1098
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1558
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1099
1559
  "div",
1100
1560
  {
1101
1561
  className: "rte-resize-handle rte-resize-handle--bottom",
@@ -1103,11 +1563,19 @@ var ResizableNodeView = ({
1103
1563
  role: "presentation"
1104
1564
  }
1105
1565
  ),
1106
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1566
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1107
1567
  "div",
1108
1568
  {
1109
- className: "rte-resize-handle rte-resize-handle--corner",
1110
- onMouseDown: (e) => handleMouseDown(e, "corner"),
1569
+ className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
1570
+ onMouseDown: (e) => handleMouseDown(e, "corner-bl"),
1571
+ role: "presentation"
1572
+ }
1573
+ ),
1574
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1575
+ "div",
1576
+ {
1577
+ className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
1578
+ onMouseDown: (e) => handleMouseDown(e, "corner-br"),
1111
1579
  role: "presentation"
1112
1580
  }
1113
1581
  )
@@ -1121,16 +1589,16 @@ var ResizableNodeView = ({
1121
1589
 
1122
1590
  // src/ui/dialog.tsx
1123
1591
  var import_dialog = require("@base-ui/react/dialog");
1124
- var React5 = require("react");
1125
- var import_jsx_runtime11 = require("react/jsx-runtime");
1126
- var Dialog = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dialog.Dialog.Root, { "data-slot": "dialog", ...props });
1127
- var DialogTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
1128
- var DialogPortal = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
1129
- var DialogClose = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
1592
+ var React6 = require("react");
1593
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1594
+ var Dialog = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Root, { "data-slot": "dialog", ...props });
1595
+ var DialogTrigger = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Trigger, { "data-slot": "dialog-trigger", ...props });
1596
+ var DialogPortal = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Portal, { "data-slot": "dialog-portal", ...props });
1597
+ var DialogClose = ({ ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Close, { "data-slot": "dialog-close", ...props });
1130
1598
  var DialogOverlay = ({
1131
1599
  className,
1132
1600
  ...props
1133
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1601
+ }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1134
1602
  import_dialog.Dialog.Backdrop,
1135
1603
  {
1136
1604
  "data-slot": "dialog-overlay",
@@ -1146,9 +1614,9 @@ var DialogContent = ({
1146
1614
  children,
1147
1615
  showCloseButton = true,
1148
1616
  ...props
1149
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(DialogPortal, { children: [
1150
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DialogOverlay, {}),
1151
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1617
+ }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DialogPortal, { children: [
1618
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogOverlay, {}),
1619
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1152
1620
  import_dialog.Dialog.Popup,
1153
1621
  {
1154
1622
  "data-slot": "dialog-content",
@@ -1159,11 +1627,11 @@ var DialogContent = ({
1159
1627
  ...props,
1160
1628
  children: [
1161
1629
  children,
1162
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1630
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1163
1631
  import_dialog.Dialog.Close,
1164
1632
  {
1165
1633
  "data-slot": "dialog-close",
1166
- render: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1634
+ render: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1167
1635
  Button,
1168
1636
  {
1169
1637
  variant: "ghost",
@@ -1173,7 +1641,7 @@ var DialogContent = ({
1173
1641
  ),
1174
1642
  children: [
1175
1643
  "X",
1176
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Close" })
1644
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Close" })
1177
1645
  ]
1178
1646
  }
1179
1647
  )
@@ -1181,7 +1649,7 @@ var DialogContent = ({
1181
1649
  }
1182
1650
  )
1183
1651
  ] });
1184
- var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1652
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1185
1653
  "div",
1186
1654
  {
1187
1655
  "data-slot": "dialog-header",
@@ -1194,7 +1662,7 @@ var DialogFooter = ({
1194
1662
  showCloseButton = false,
1195
1663
  children,
1196
1664
  ...props
1197
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1665
+ }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1198
1666
  "div",
1199
1667
  {
1200
1668
  "data-slot": "dialog-footer",
@@ -1205,11 +1673,11 @@ var DialogFooter = ({
1205
1673
  ...props,
1206
1674
  children: [
1207
1675
  children,
1208
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_dialog.Dialog.Close, { render: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { variant: "outline" }), children: "Close" })
1676
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_dialog.Dialog.Close, { render: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "outline" }), children: "Close" })
1209
1677
  ]
1210
1678
  }
1211
1679
  );
1212
- var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1680
+ var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1213
1681
  import_dialog.Dialog.Title,
1214
1682
  {
1215
1683
  "data-slot": "dialog-title",
@@ -1220,7 +1688,7 @@ var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_ru
1220
1688
  var DialogDescription = ({
1221
1689
  className,
1222
1690
  ...props
1223
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1691
+ }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1224
1692
  import_dialog.Dialog.Description,
1225
1693
  {
1226
1694
  "data-slot": "dialog-description",
@@ -1233,56 +1701,149 @@ var DialogDescription = ({
1233
1701
  );
1234
1702
 
1235
1703
  // src/controls/rte-twitter-control.tsx
1236
- var import_jsx_runtime12 = require("react/jsx-runtime");
1704
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1237
1705
  var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
1706
+ var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
1707
+ var READY_POLL_INTERVAL_MS = 50;
1708
+ var twitterScriptPromise = null;
1709
+ var loadTwitterScript = () => {
1710
+ if (typeof window === "undefined") {
1711
+ return Promise.resolve();
1712
+ }
1713
+ if (window.twttr?.widgets) {
1714
+ return Promise.resolve();
1715
+ }
1716
+ if (twitterScriptPromise) {
1717
+ return twitterScriptPromise;
1718
+ }
1719
+ twitterScriptPromise = new Promise((resolve, reject) => {
1720
+ let script = document.querySelector(
1721
+ `script[src="${WIDGET_SCRIPT_URL}"]`
1722
+ );
1723
+ const isNewScript = !script;
1724
+ if (!script) {
1725
+ script = document.createElement("script");
1726
+ script.src = WIDGET_SCRIPT_URL;
1727
+ script.async = true;
1728
+ document.body.append(script);
1729
+ }
1730
+ let settled = false;
1731
+ const cleanup = () => {
1732
+ clearInterval(pollId);
1733
+ clearTimeout(timeoutId);
1734
+ };
1735
+ const succeed = () => {
1736
+ if (settled) return;
1737
+ settled = true;
1738
+ cleanup();
1739
+ resolve();
1740
+ };
1741
+ const fail = () => {
1742
+ if (settled) return;
1743
+ settled = true;
1744
+ cleanup();
1745
+ twitterScriptPromise = null;
1746
+ reject(new Error("Failed to load Twitter widgets script"));
1747
+ };
1748
+ if (window.twttr?.widgets) {
1749
+ succeed();
1750
+ return;
1751
+ }
1752
+ const pollId = setInterval(() => {
1753
+ if (window.twttr?.widgets) {
1754
+ succeed();
1755
+ }
1756
+ }, READY_POLL_INTERVAL_MS);
1757
+ const timeoutId = setTimeout(fail, SCRIPT_LOAD_TIMEOUT_MS);
1758
+ if (isNewScript) {
1759
+ script.addEventListener(
1760
+ "load",
1761
+ () => {
1762
+ if (window.twttr?.widgets) {
1763
+ succeed();
1764
+ }
1765
+ },
1766
+ { once: true }
1767
+ );
1768
+ }
1769
+ script.addEventListener("error", fail, { once: true });
1770
+ });
1771
+ return twitterScriptPromise;
1772
+ };
1238
1773
  var TwitterNodeView = (props) => {
1239
1774
  const { node } = props;
1240
- const containerRef = (0, import_react12.useRef)(null);
1241
- const [loading, setLoading] = (0, import_react12.useState)(true);
1775
+ const containerRef = (0, import_react13.useRef)(null);
1776
+ const [loading, setLoading] = (0, import_react13.useState)(true);
1777
+ const [failed, setFailed] = (0, import_react13.useState)(false);
1242
1778
  const { tweetId } = node.attrs;
1243
- const w = node.attrs.width;
1244
- const h = node.attrs.height;
1245
- const renderTweet = (0, import_react12.useCallback)(async () => {
1779
+ const renderedTweetIdRef = (0, import_react13.useRef)(null);
1780
+ const activeRenderIdRef = (0, import_react13.useRef)(0);
1781
+ const retryToken = (0, import_react13.useRef)(0);
1782
+ const [retryCount, setRetryCount] = (0, import_react13.useState)(0);
1783
+ (0, import_react13.useEffect)(() => {
1246
1784
  if (!containerRef.current || !tweetId) {
1247
1785
  return;
1248
1786
  }
1249
- containerRef.current.innerHTML = "";
1250
- setLoading(true);
1251
- const { twttr } = window;
1252
- if (twttr?.widgets && containerRef.current) {
1253
- try {
1254
- await twttr.widgets.createTweet(tweetId, containerRef.current);
1255
- setLoading(false);
1256
- } catch {
1257
- }
1258
- }
1259
- }, [tweetId]);
1260
- (0, import_react12.useEffect)(() => {
1261
- if (!containerRef.current || !tweetId) {
1787
+ if (renderedTweetIdRef.current === tweetId && containerRef.current.children.length > 0 && !failed) {
1788
+ setLoading(false);
1262
1789
  return;
1263
1790
  }
1264
- const load = async () => {
1265
- if (window.twttr?.widgets && containerRef.current) {
1791
+ let isCancelled = false;
1792
+ activeRenderIdRef.current += 1;
1793
+ const renderId = activeRenderIdRef.current;
1794
+ setLoading(true);
1795
+ setFailed(false);
1796
+ const render = async () => {
1797
+ try {
1798
+ await loadTwitterScript();
1799
+ if (isCancelled || renderId !== activeRenderIdRef.current || !containerRef.current) {
1800
+ return;
1801
+ }
1802
+ const { twttr } = window;
1803
+ if (!twttr?.widgets) {
1804
+ throw new Error("Twitter widgets script unavailable");
1805
+ }
1266
1806
  containerRef.current.innerHTML = "";
1267
- setLoading(true);
1268
- try {
1269
- await window.twttr.widgets.createTweet(tweetId, containerRef.current);
1807
+ const el = await twttr.widgets.createTweet(
1808
+ tweetId,
1809
+ containerRef.current
1810
+ );
1811
+ if (isCancelled || renderId !== activeRenderIdRef.current || !containerRef.current) {
1812
+ if (el && typeof el.remove === "function") {
1813
+ el.remove();
1814
+ } else if (containerRef.current) {
1815
+ containerRef.current.innerHTML = "";
1816
+ }
1817
+ return;
1818
+ }
1819
+ if (!el) {
1820
+ throw new Error("Tweet could not be embedded");
1821
+ }
1822
+ while (containerRef.current.children.length > 1) {
1823
+ containerRef.current.firstElementChild?.remove();
1824
+ }
1825
+ renderedTweetIdRef.current = tweetId;
1826
+ } catch {
1827
+ if (!isCancelled && renderId === activeRenderIdRef.current) {
1828
+ setFailed(true);
1829
+ renderedTweetIdRef.current = null;
1830
+ }
1831
+ } finally {
1832
+ if (!isCancelled && renderId === activeRenderIdRef.current) {
1270
1833
  setLoading(false);
1271
- } catch {
1272
1834
  }
1273
- } else {
1274
- const script = document.createElement("script");
1275
- script.src = WIDGET_SCRIPT_URL;
1276
- script.async = true;
1277
- script.addEventListener("load", () => {
1278
- void renderTweet();
1279
- });
1280
- document.body.append(script);
1281
1835
  }
1282
1836
  };
1283
- void load();
1284
- }, [tweetId, w, h, renderTweet]);
1285
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1837
+ void render();
1838
+ return () => {
1839
+ isCancelled = true;
1840
+ };
1841
+ }, [tweetId, retryCount, failed]);
1842
+ const handleRetry = (0, import_react13.useCallback)(() => {
1843
+ retryToken.current += 1;
1844
+ setRetryCount(retryToken.current);
1845
+ }, []);
1846
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1286
1847
  ResizableNodeView,
1287
1848
  {
1288
1849
  ...props,
@@ -1290,8 +1851,12 @@ var TwitterNodeView = (props) => {
1290
1851
  minWidth: 300,
1291
1852
  maxWidth: 1200,
1292
1853
  children: [
1293
- loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
1294
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ref: containerRef })
1854
+ loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
1855
+ !loading && failed && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "rte-embed-error", children: [
1856
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: "Couldn't load this tweet." }),
1857
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
1858
+ ] }),
1859
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: containerRef })
1295
1860
  ]
1296
1861
  }
1297
1862
  );
@@ -1347,7 +1912,7 @@ var TwitterEmbed = import_core2.Node.create({
1347
1912
  ];
1348
1913
  },
1349
1914
  addNodeView() {
1350
- return (0, import_react11.ReactNodeViewRenderer)(TwitterNodeView);
1915
+ return (0, import_react12.ReactNodeViewRenderer)(TwitterNodeView);
1351
1916
  },
1352
1917
  atom: true,
1353
1918
  draggable: true,
@@ -1381,88 +1946,119 @@ var extractTweetId = (input) => {
1381
1946
  };
1382
1947
  var TwitterEmbedControl = ({ className }) => {
1383
1948
  const { editor } = useRichTextEditorContext();
1384
- const [open, setOpen] = (0, import_react12.useState)(false);
1385
- const [url, setUrl] = (0, import_react12.useState)("");
1386
- const { active } = (0, import_react11.useEditorState)({
1949
+ const [open, setOpen] = (0, import_react13.useState)(false);
1950
+ const [url, setUrl] = (0, import_react13.useState)("");
1951
+ const [touched, setTouched] = (0, import_react13.useState)(false);
1952
+ const { active } = (0, import_react12.useEditorState)({
1387
1953
  editor: editor ?? null,
1388
1954
  selector: (ctx) => ({
1389
1955
  active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("twitter") : false
1390
1956
  })
1391
1957
  }) ?? { active: false };
1392
- const handleInsert = (0, import_react12.useCallback)(() => {
1393
- if (url && editor) {
1394
- const tweetId = extractTweetId(url);
1395
- if (tweetId) {
1396
- editor.chain().focus().setTwitterEmbed(tweetId).run();
1397
- setUrl("");
1398
- }
1958
+ const tweetId = url ? extractTweetId(url) : null;
1959
+ const showError = touched && url.length > 0 && !tweetId;
1960
+ const resetState = (0, import_react13.useCallback)(() => {
1961
+ setUrl("");
1962
+ setTouched(false);
1963
+ }, []);
1964
+ const handleInsert = (0, import_react13.useCallback)(() => {
1965
+ setTouched(true);
1966
+ if (!tweetId || !editor) {
1967
+ return false;
1399
1968
  }
1400
- }, [url, editor]);
1401
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
1402
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1403
- DialogTrigger,
1404
- {
1405
- render: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1406
- RichTextEditorControl,
1969
+ editor.chain().focus().setTwitterEmbed(tweetId).run();
1970
+ resetState();
1971
+ return true;
1972
+ }, [tweetId, editor, resetState]);
1973
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1974
+ Dialog,
1975
+ {
1976
+ open,
1977
+ onOpenChange: (next) => {
1978
+ setOpen(next);
1979
+ if (!next) {
1980
+ resetState();
1981
+ }
1982
+ },
1983
+ children: [
1984
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1985
+ DialogTrigger,
1407
1986
  {
1408
- active,
1409
- className,
1410
- title: "Embed Tweet",
1411
- "aria-label": "Embed Tweet",
1412
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1413
- "svg",
1987
+ render: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1988
+ RichTextEditorControl,
1414
1989
  {
1415
- xmlns: "http://www.w3.org/2000/svg",
1416
- viewBox: "0 0 24 24",
1417
- fill: "currentColor",
1418
- className: "rte-editor-icon",
1419
- children: /* @__PURE__ */ (0, import_jsx_runtime12.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" })
1990
+ active,
1991
+ className,
1992
+ title: "Embed Tweet",
1993
+ "aria-label": "Embed Tweet",
1994
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1995
+ "svg",
1996
+ {
1997
+ xmlns: "http://www.w3.org/2000/svg",
1998
+ viewBox: "0 0 24 24",
1999
+ fill: "currentColor",
2000
+ className: "rte-editor-icon",
2001
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.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" })
2002
+ }
2003
+ )
1420
2004
  }
1421
2005
  )
1422
2006
  }
1423
- )
1424
- }
1425
- ),
1426
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DialogContent, { children: [
1427
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DialogHeader, { children: [
1428
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogTitle, { children: "Embed Tweet" }),
1429
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
1430
- ] }),
1431
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1432
- Input,
1433
- {
1434
- value: url,
1435
- onChange: (e) => setUrl(e.target.value),
1436
- placeholder: "https://x.com/user/status/...",
1437
- onKeyDown: (e) => {
1438
- if (e.key === "Enter" && url) {
1439
- handleInsert();
1440
- setOpen(false);
2007
+ ),
2008
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogContent, { children: [
2009
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogHeader, { children: [
2010
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogTitle, { children: "Embed Tweet" }),
2011
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogDescription, { children: "Paste a tweet URL or ID." })
2012
+ ] }),
2013
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2014
+ Input,
2015
+ {
2016
+ value: url,
2017
+ onChange: (e) => {
2018
+ setUrl(e.target.value);
2019
+ if (touched) setTouched(false);
2020
+ },
2021
+ onBlur: () => setTouched(true),
2022
+ placeholder: "https://x.com/user/status/...",
2023
+ "aria-invalid": showError,
2024
+ onKeyDown: (e) => {
2025
+ if (e.key === "Enter" && url) {
2026
+ if (handleInsert()) {
2027
+ setOpen(false);
2028
+ }
2029
+ }
2030
+ }
1441
2031
  }
1442
- }
1443
- }
1444
- ),
1445
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DialogFooter, { children: [
1446
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DialogClose, { children: "Cancel" }),
1447
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1448
- DialogClose,
1449
- {
1450
- disabled: !url,
1451
- className: "rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-50",
1452
- onClick: handleInsert,
1453
- children: "Insert"
1454
- }
1455
- )
1456
- ] })
1457
- ] })
1458
- ] });
2032
+ ),
2033
+ showError && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
2034
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogFooter, { children: [
2035
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogClose, { children: "Cancel" }),
2036
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2037
+ "button",
2038
+ {
2039
+ type: "button",
2040
+ disabled: !url,
2041
+ className: "rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-50",
2042
+ onClick: () => {
2043
+ if (handleInsert()) {
2044
+ setOpen(false);
2045
+ }
2046
+ },
2047
+ children: "Insert"
2048
+ }
2049
+ )
2050
+ ] })
2051
+ ] })
2052
+ ]
2053
+ }
2054
+ );
1459
2055
  };
1460
2056
 
1461
2057
  // src/controls/rte-youtube-control.tsx
1462
2058
  var import_core3 = require("@tiptap/core");
1463
- var import_react13 = require("@tiptap/react");
1464
- var import_react14 = require("react");
1465
- var import_jsx_runtime13 = require("react/jsx-runtime");
2059
+ var import_react14 = require("@tiptap/react");
2060
+ var import_react15 = require("react");
2061
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1466
2062
  var getYouTubeId = (url) => {
1467
2063
  const clean = url.trim();
1468
2064
  const patterns = [
@@ -1483,9 +2079,14 @@ var getYouTubeId = (url) => {
1483
2079
  return /^[a-zA-Z0-9_-]{11}$/.test(clean) ? clean : null;
1484
2080
  };
1485
2081
  var YouTubeNodeView = (props) => {
1486
- const { node } = props;
1487
- const videoId = getYouTubeId(node.attrs.src) || node.attrs.src;
1488
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2082
+ const { node, updateAttributes } = props;
2083
+ const rawSrc = node.attrs.src || "";
2084
+ const videoId = getYouTubeId(rawSrc) || rawSrc;
2085
+ let watchUrl;
2086
+ if (videoId) {
2087
+ watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
2088
+ }
2089
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1489
2090
  ResizableNodeView,
1490
2091
  {
1491
2092
  ...props,
@@ -1493,7 +2094,10 @@ var YouTubeNodeView = (props) => {
1493
2094
  aspectRatio: 16 / 9,
1494
2095
  minWidth: 320,
1495
2096
  maxWidth: 1200,
1496
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2097
+ videoSrc: rawSrc,
2098
+ watchUrl,
2099
+ onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
2100
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1497
2101
  "iframe",
1498
2102
  {
1499
2103
  src: `https://www.youtube-nocookie.com/embed/${videoId}`,
@@ -1557,7 +2161,7 @@ var YouTubeEmbed = import_core3.Node.create({
1557
2161
  ];
1558
2162
  },
1559
2163
  addNodeView() {
1560
- return (0, import_react13.ReactNodeViewRenderer)(YouTubeNodeView);
2164
+ return (0, import_react14.ReactNodeViewRenderer)(YouTubeNodeView);
1561
2165
  },
1562
2166
  atom: true,
1563
2167
  draggable: true,
@@ -1581,32 +2185,32 @@ var YouTubeEmbed = import_core3.Node.create({
1581
2185
  });
1582
2186
  var YouTubeEmbedControl = ({ className }) => {
1583
2187
  const { editor } = useRichTextEditorContext();
1584
- const [open, setOpen] = (0, import_react14.useState)(false);
1585
- const [url, setUrl] = (0, import_react14.useState)("");
1586
- const { active } = (0, import_react13.useEditorState)({
2188
+ const [open, setOpen] = (0, import_react15.useState)(false);
2189
+ const [url, setUrl] = (0, import_react15.useState)("");
2190
+ const { active } = (0, import_react14.useEditorState)({
1587
2191
  editor: editor ?? null,
1588
2192
  selector: (ctx) => ({
1589
2193
  active: ctx.editor && !ctx.editor.isDestroyed ? ctx.editor.isActive("youtube") : false
1590
2194
  })
1591
2195
  }) ?? { active: false };
1592
- const handleInsert = (0, import_react14.useCallback)(() => {
2196
+ const handleInsert = (0, import_react15.useCallback)(() => {
1593
2197
  if (url && editor) {
1594
2198
  editor.chain().focus().setYouTubeEmbed(url).run();
1595
2199
  setUrl("");
1596
2200
  }
1597
2201
  }, [url, editor]);
1598
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
1599
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2202
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Dialog, { open, onOpenChange: setOpen, children: [
2203
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1600
2204
  DialogTrigger,
1601
2205
  {
1602
- render: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2206
+ render: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1603
2207
  RichTextEditorControl,
1604
2208
  {
1605
2209
  active,
1606
2210
  className,
1607
2211
  title: "Embed YouTube video",
1608
2212
  "aria-label": "Embed YouTube video",
1609
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2213
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
1610
2214
  "svg",
1611
2215
  {
1612
2216
  xmlns: "http://www.w3.org/2000/svg",
@@ -1618,8 +2222,8 @@ var YouTubeEmbedControl = ({ className }) => {
1618
2222
  strokeLinejoin: "round",
1619
2223
  className: "rte-editor-icon",
1620
2224
  children: [
1621
- /* @__PURE__ */ (0, import_jsx_runtime13.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" }),
1622
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
2225
+ /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
2226
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
1623
2227
  ]
1624
2228
  }
1625
2229
  )
@@ -1627,12 +2231,12 @@ var YouTubeEmbedControl = ({ className }) => {
1627
2231
  )
1628
2232
  }
1629
2233
  ),
1630
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogContent, { showCloseButton: false, children: [
1631
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogHeader, { children: [
1632
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogTitle, { children: "Embed YouTube video" }),
1633
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
2234
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogContent, { showCloseButton: false, children: [
2235
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogHeader, { children: [
2236
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogTitle, { children: "Embed YouTube video" }),
2237
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogDescription, { children: "Paste a YouTube video URL or ID." })
1634
2238
  ] }),
1635
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2239
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1636
2240
  Input,
1637
2241
  {
1638
2242
  value: url,
@@ -1646,9 +2250,9 @@ var YouTubeEmbedControl = ({ className }) => {
1646
2250
  }
1647
2251
  }
1648
2252
  ),
1649
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogFooter, { children: [
1650
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogClose, { children: "Cancel" }),
1651
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2253
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogFooter, { children: [
2254
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogClose, { children: "Cancel" }),
2255
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1652
2256
  DialogClose,
1653
2257
  {
1654
2258
  disabled: !url,
@@ -1662,174 +2266,6 @@ var YouTubeEmbedControl = ({ className }) => {
1662
2266
  ] });
1663
2267
  };
1664
2268
 
1665
- // src/icons.tsx
1666
- var import_lucide_react = require("lucide-react");
1667
- var import_react15 = require("react");
1668
- var import_jsx_runtime14 = require("react/jsx-runtime");
1669
- var iconProps = { className: "rte-editor-icon" };
1670
- var LangIcon = ({
1671
- children,
1672
- className
1673
- }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1674
- "svg",
1675
- {
1676
- xmlns: "http://www.w3.org/2000/svg",
1677
- viewBox: "0 0 24 24",
1678
- fill: "none",
1679
- stroke: "currentColor",
1680
- strokeWidth: 1.5,
1681
- strokeLinecap: "round",
1682
- strokeLinejoin: "round",
1683
- className,
1684
- children
1685
- }
1686
- );
1687
- var DEFAULT_LANGUAGE_ICONS = {
1688
- bash: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1689
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "2.5", y: "4", width: "19", height: "16", rx: "2" }),
1690
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6.5 9.5l3.5 3-3.5 3" }),
1691
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 15.5h5.5" })
1692
- ] }),
1693
- c: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1694
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "12", cy: "12", r: "8.5" }),
1695
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M15.6 9.3a4.5 4.5 0 1 0 0 5.4" })
1696
- ] }),
1697
- cpp: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1698
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "9.5", cy: "12", r: "6.5" }),
1699
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12.3 9.7a3.3 3.3 0 1 0 0 4.6" }),
1700
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M15.7 10.5v3M14.2 12h3" }),
1701
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M19.3 10.5v3M17.8 12h3" })
1702
- ] }),
1703
- css: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1704
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1705
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9.7 7.5l-1 9" }),
1706
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M15.3 7.5l-1 9" }),
1707
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M7 10.3h11" }),
1708
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6.5 14.3h11" })
1709
- ] }),
1710
- go: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1711
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1712
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12.6 9.7A3.3 3.3 0 1 0 12.6 14.3" }),
1713
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12.6 12h-1.9" }),
1714
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "17", cy: "12", r: "2.9" })
1715
- ] }),
1716
- html: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1717
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1718
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9.5 8.5L6.5 12l3 3.5" }),
1719
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14.5 8.5L17.5 12l-3 3.5" }),
1720
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M13 7.3l-2 9.4" })
1721
- ] }),
1722
- java: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1723
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6 10h10v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5z" }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M16 12h1.3a1.8 1.8 0 0 1 0 3.6H16" }),
1725
- /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1726
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6 19.3h10" })
1727
- ] }),
1728
- javascript: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1729
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1730
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M10.5 8v6.5a2 2 0 0 1-3.5 1.3" }),
1731
- /* @__PURE__ */ (0, import_jsx_runtime14.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" })
1732
- ] }),
1733
- json: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1734
- /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1735
- /* @__PURE__ */ (0, import_jsx_runtime14.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" })
1736
- ] }),
1737
- kotlin: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1738
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1739
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 7.5v9" }),
1740
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 12l6-4.5" }),
1741
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9 12l6 4.5" })
1742
- ] }),
1743
- markdown: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1744
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
1745
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6 15V9l3 4 3-4v6" }),
1746
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M16.5 9v6" }),
1747
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M14.5 13l2 2 2-2" })
1748
- ] }),
1749
- php: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1750
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1751
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M11.5 8.5L7.5 12l4 3.5" }),
1752
- /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1753
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "14.3", cy: "16.2", r: ".5", fill: "currentColor", stroke: "none" })
1754
- ] }),
1755
- plaintext: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1756
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "4", y: "2.5", width: "16", height: "19", rx: "2" }),
1757
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "7.5", y1: "7.5", x2: "16.5", y2: "7.5" }),
1758
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "7.5", y1: "11.5", x2: "16.5", y2: "11.5" }),
1759
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("line", { x1: "7.5", y1: "15.5", x2: "13.5", y2: "15.5" })
1760
- ] }),
1761
- python: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1762
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4.5 15c0-3 2.5-4.7 5.7-4.7h1.6c2.8 0 5-2 5-4.5" }),
1763
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M9.5 3.3c1.3-.3 2.6 0 3.3 1-.7 1-2 1.3-3.3 1" }),
1764
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "15.5", cy: "4.3", r: ".55", fill: "currentColor", stroke: "none" }),
1765
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M17.8 4.5l1.4-.6M17.8 4.9l1.4.6" })
1766
- ] }),
1767
- ruby: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1768
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("polygon", { points: "12 2.5 19.5 8 12 21.5 4.5 8" }),
1769
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4.5 8h15" }),
1770
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 2.5v19" })
1771
- ] }),
1772
- rust: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1773
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "12", cy: "12", r: "7" }),
1774
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: "12", cy: "12", r: "2.3" }),
1775
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3" }),
1776
- /* @__PURE__ */ (0, import_jsx_runtime14.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" })
1777
- ] }),
1778
- sql: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1779
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ellipse", { cx: "12", cy: "6", rx: "8", ry: "3" }),
1780
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 6v6c0 1.7 3.6 3 8 3s8-1.3 8-3V6" }),
1781
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 12v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6" })
1782
- ] }),
1783
- swift: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LangIcon, { children: /* @__PURE__ */ (0, import_jsx_runtime14.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" }) }),
1784
- typescript: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1785
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "3", y: "3", width: "18", height: "18", rx: "4" }),
1786
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M7.3 8.2h5M9.8 8.2v7.6" }),
1787
- /* @__PURE__ */ (0, import_jsx_runtime14.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" })
1788
- ] }),
1789
- xml: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1790
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M8 7l-4.5 5 4.5 5" }),
1791
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M16 7l4.5 5-4.5 5" }),
1792
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 8v8" })
1793
- ] }),
1794
- yaml: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(LangIcon, { children: [
1795
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { x: "2.5", y: "3", width: "19", height: "18", rx: "2" }),
1796
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6.5 8h2M9.5 8h8" }),
1797
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6.5 12h2M9.5 12h6" }),
1798
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M6.5 16h2M9.5 16h7" })
1799
- ] })
1800
- };
1801
- var DEFAULT_ICONS = {
1802
- alignCenterControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignCenter, { ...iconProps }),
1803
- alignJustifyControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignJustify, { ...iconProps }),
1804
- alignLeftControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignStart, { ...iconProps }),
1805
- alignRightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextAlignEnd, { ...iconProps }),
1806
- blockquoteControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.TextQuote, { ...iconProps }),
1807
- boldControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Bold, { ...iconProps }),
1808
- bulletListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.List, { ...iconProps }),
1809
- clearFormattingControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.RemoveFormatting, { ...iconProps }),
1810
- codeBlockControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.SquareCode, { ...iconProps }),
1811
- codeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Code, { ...iconProps }),
1812
- h1ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading1, { ...iconProps }),
1813
- h2ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading2, { ...iconProps }),
1814
- h3ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading3, { ...iconProps }),
1815
- h4ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading4, { ...iconProps }),
1816
- h5ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading5, { ...iconProps }),
1817
- h6ControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Heading6, { ...iconProps }),
1818
- highlightControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Highlighter, { ...iconProps }),
1819
- hrControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Minus, { ...iconProps }),
1820
- italicControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Italic, { ...iconProps }),
1821
- languageIcons: DEFAULT_LANGUAGE_ICONS,
1822
- linkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Link, { ...iconProps }),
1823
- orderedListControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.ListOrdered, { ...iconProps }),
1824
- redoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Redo2, { ...iconProps }),
1825
- strikeControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Strikethrough, { ...iconProps }),
1826
- subscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Subscript, { ...iconProps }),
1827
- superscriptControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Superscript, { ...iconProps }),
1828
- underlineControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Underline, { ...iconProps }),
1829
- undoControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Undo2, { ...iconProps }),
1830
- unlinkControlIcon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react.Link2Off, { ...iconProps })
1831
- };
1832
-
1833
2269
  // src/labels.ts
1834
2270
  var DEFAULT_LABELS = {
1835
2271
  alignCenterControlLabel: "Align center",