cms-block-editor 1.0.12 → 1.0.13
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 +37 -0
- package/dist/index.css +44 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +55 -3
- package/dist/index.mjs +1301 -752
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary";
|
|
|
13
13
|
|
|
14
14
|
// src/plugins/SlashCommandPlugin.tsx
|
|
15
15
|
import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
|
|
16
|
-
import { useEffect as
|
|
16
|
+
import { useEffect as useEffect4, useState as useState5 } from "react";
|
|
17
17
|
import {
|
|
18
18
|
$createParagraphNode,
|
|
19
19
|
$getSelection,
|
|
@@ -731,26 +731,465 @@ var ImageNode = class _ImageNode extends DecoratorNode {
|
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
733
|
|
|
734
|
-
// src/blocks/
|
|
734
|
+
// src/blocks/VideoNode.tsx
|
|
735
735
|
import { DecoratorNode as DecoratorNode2 } from "lexical";
|
|
736
|
-
import { useCallback as useCallback2, useRef as useRef2, useState as useState3 } from "react";
|
|
736
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
|
|
737
737
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
738
|
-
function
|
|
739
|
-
|
|
738
|
+
function VideoComponent({
|
|
739
|
+
src,
|
|
740
740
|
width: initialWidth,
|
|
741
741
|
height: initialHeight,
|
|
742
|
+
autoplay = false,
|
|
743
|
+
loop = false,
|
|
744
|
+
muted = false,
|
|
745
|
+
controls = true,
|
|
742
746
|
nodeKey,
|
|
743
747
|
editor
|
|
744
748
|
}) {
|
|
749
|
+
const videoRef = useRef2(null);
|
|
745
750
|
const wrapperRef = useRef2(null);
|
|
746
751
|
const [isResizing, setIsResizing] = useState3(false);
|
|
747
752
|
const [isSelected, setIsSelected] = useState3(false);
|
|
748
|
-
const [
|
|
753
|
+
const [showSettings, setShowSettings] = useState3(false);
|
|
749
754
|
const [size, setSize] = useState3({
|
|
755
|
+
width: initialWidth || 640,
|
|
756
|
+
height: initialHeight || 360
|
|
757
|
+
});
|
|
758
|
+
const [settings, setSettings] = useState3({
|
|
759
|
+
autoplay,
|
|
760
|
+
loop,
|
|
761
|
+
muted,
|
|
762
|
+
controls
|
|
763
|
+
});
|
|
764
|
+
useEffect3(() => {
|
|
765
|
+
if (videoRef.current && (!size.width || !size.height)) {
|
|
766
|
+
const video = videoRef.current;
|
|
767
|
+
const onLoadedMetadata = () => {
|
|
768
|
+
setSize({
|
|
769
|
+
width: initialWidth || video.videoWidth || 640,
|
|
770
|
+
height: initialHeight || video.videoHeight || 360
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
if (video.readyState >= 1) {
|
|
774
|
+
onLoadedMetadata();
|
|
775
|
+
} else {
|
|
776
|
+
video.addEventListener("loadedmetadata", onLoadedMetadata);
|
|
777
|
+
return () => video.removeEventListener("loadedmetadata", onLoadedMetadata);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}, [initialWidth, initialHeight, size.width, size.height]);
|
|
781
|
+
const onResizeStart = useCallback2((e, direction) => {
|
|
782
|
+
e.preventDefault();
|
|
783
|
+
e.stopPropagation();
|
|
784
|
+
setIsResizing(true);
|
|
785
|
+
const startX = e.clientX;
|
|
786
|
+
const startY = e.clientY;
|
|
787
|
+
const startWidth = size.width;
|
|
788
|
+
const startHeight = size.height;
|
|
789
|
+
const aspectRatio = startWidth / startHeight;
|
|
790
|
+
let finalWidth = startWidth;
|
|
791
|
+
let finalHeight = startHeight;
|
|
792
|
+
const onMouseMove = (moveEvent) => {
|
|
793
|
+
const deltaX = moveEvent.clientX - startX;
|
|
794
|
+
const deltaY = moveEvent.clientY - startY;
|
|
795
|
+
let newWidth = startWidth;
|
|
796
|
+
let newHeight = startHeight;
|
|
797
|
+
if (direction === "e" || direction === "ne" || direction === "se") {
|
|
798
|
+
newWidth = Math.max(200, startWidth + deltaX);
|
|
799
|
+
newHeight = newWidth / aspectRatio;
|
|
800
|
+
} else if (direction === "w" || direction === "nw" || direction === "sw") {
|
|
801
|
+
newWidth = Math.max(200, startWidth - deltaX);
|
|
802
|
+
newHeight = newWidth / aspectRatio;
|
|
803
|
+
} else if (direction === "n") {
|
|
804
|
+
newHeight = Math.max(150, startHeight - deltaY);
|
|
805
|
+
newWidth = newHeight * aspectRatio;
|
|
806
|
+
} else if (direction === "s") {
|
|
807
|
+
newHeight = Math.max(150, startHeight + deltaY);
|
|
808
|
+
newWidth = newHeight * aspectRatio;
|
|
809
|
+
}
|
|
810
|
+
finalWidth = newWidth;
|
|
811
|
+
finalHeight = newHeight;
|
|
812
|
+
setSize({ width: newWidth, height: newHeight });
|
|
813
|
+
};
|
|
814
|
+
const onMouseUp = () => {
|
|
815
|
+
setIsResizing(false);
|
|
816
|
+
editor.update(() => {
|
|
817
|
+
const node = editor.getEditorState()._nodeMap.get(nodeKey);
|
|
818
|
+
if (node && node instanceof VideoNode) {
|
|
819
|
+
const writable = node.getWritable();
|
|
820
|
+
writable.__width = finalWidth;
|
|
821
|
+
writable.__height = finalHeight;
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
825
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
826
|
+
};
|
|
827
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
828
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
829
|
+
}, [size, editor, nodeKey]);
|
|
830
|
+
const updateSettings = (newSettings) => {
|
|
831
|
+
const updated = { ...settings, ...newSettings };
|
|
832
|
+
setSettings(updated);
|
|
833
|
+
editor.update(() => {
|
|
834
|
+
const node = editor.getEditorState()._nodeMap.get(nodeKey);
|
|
835
|
+
if (node && node instanceof VideoNode) {
|
|
836
|
+
const writable = node.getWritable();
|
|
837
|
+
writable.__autoplay = updated.autoplay;
|
|
838
|
+
writable.__loop = updated.loop;
|
|
839
|
+
writable.__muted = updated.muted;
|
|
840
|
+
writable.__controls = updated.controls;
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
};
|
|
844
|
+
const deleteVideo = () => {
|
|
845
|
+
editor.update(() => {
|
|
846
|
+
const node = editor.getEditorState()._nodeMap.get(nodeKey);
|
|
847
|
+
if (node) {
|
|
848
|
+
node.remove();
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
};
|
|
852
|
+
return /* @__PURE__ */ jsxs3(
|
|
853
|
+
"div",
|
|
854
|
+
{
|
|
855
|
+
ref: wrapperRef,
|
|
856
|
+
className: `video-node-wrapper ${isSelected ? "selected" : ""} ${isResizing ? "resizing" : ""}`,
|
|
857
|
+
onClick: () => setIsSelected(!isSelected),
|
|
858
|
+
style: {
|
|
859
|
+
width: size.width ? `${size.width}px` : "auto",
|
|
860
|
+
maxWidth: "100%",
|
|
861
|
+
position: "relative",
|
|
862
|
+
display: "inline-block",
|
|
863
|
+
margin: "16px 0",
|
|
864
|
+
cursor: isSelected ? "default" : "pointer"
|
|
865
|
+
},
|
|
866
|
+
children: [
|
|
867
|
+
/* @__PURE__ */ jsx3(
|
|
868
|
+
"video",
|
|
869
|
+
{
|
|
870
|
+
ref: videoRef,
|
|
871
|
+
src,
|
|
872
|
+
autoPlay: settings.autoplay,
|
|
873
|
+
loop: settings.loop,
|
|
874
|
+
muted: settings.muted,
|
|
875
|
+
controls: settings.controls,
|
|
876
|
+
style: {
|
|
877
|
+
width: "100%",
|
|
878
|
+
height: "auto",
|
|
879
|
+
display: "block",
|
|
880
|
+
borderRadius: "4px",
|
|
881
|
+
border: isSelected ? "2px solid #667eea" : "2px solid transparent",
|
|
882
|
+
transition: "border-color 0.2s",
|
|
883
|
+
backgroundColor: "#000"
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
),
|
|
887
|
+
isSelected && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
888
|
+
/* @__PURE__ */ jsxs3("div", { style: {
|
|
889
|
+
position: "absolute",
|
|
890
|
+
top: "8px",
|
|
891
|
+
right: "8px",
|
|
892
|
+
display: "flex",
|
|
893
|
+
gap: "8px",
|
|
894
|
+
zIndex: 10
|
|
895
|
+
}, children: [
|
|
896
|
+
/* @__PURE__ */ jsx3(
|
|
897
|
+
"button",
|
|
898
|
+
{
|
|
899
|
+
onClick: (e) => {
|
|
900
|
+
e.stopPropagation();
|
|
901
|
+
setShowSettings(!showSettings);
|
|
902
|
+
},
|
|
903
|
+
style: {
|
|
904
|
+
padding: "8px 16px",
|
|
905
|
+
background: "#667eea",
|
|
906
|
+
color: "white",
|
|
907
|
+
border: "none",
|
|
908
|
+
borderRadius: "6px",
|
|
909
|
+
fontSize: "13px",
|
|
910
|
+
fontWeight: "500",
|
|
911
|
+
cursor: "pointer",
|
|
912
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
|
|
913
|
+
transition: "all 0.2s"
|
|
914
|
+
},
|
|
915
|
+
children: "\u2699\uFE0F Settings"
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
/* @__PURE__ */ jsx3(
|
|
919
|
+
"button",
|
|
920
|
+
{
|
|
921
|
+
onClick: (e) => {
|
|
922
|
+
e.stopPropagation();
|
|
923
|
+
if (confirm("Delete this video?")) {
|
|
924
|
+
deleteVideo();
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
style: {
|
|
928
|
+
padding: "8px 16px",
|
|
929
|
+
background: "#ef4444",
|
|
930
|
+
color: "white",
|
|
931
|
+
border: "none",
|
|
932
|
+
borderRadius: "6px",
|
|
933
|
+
fontSize: "13px",
|
|
934
|
+
fontWeight: "500",
|
|
935
|
+
cursor: "pointer",
|
|
936
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.2)",
|
|
937
|
+
transition: "all 0.2s"
|
|
938
|
+
},
|
|
939
|
+
children: "\u{1F5D1}\uFE0F Delete"
|
|
940
|
+
}
|
|
941
|
+
)
|
|
942
|
+
] }),
|
|
943
|
+
showSettings && /* @__PURE__ */ jsxs3(
|
|
944
|
+
"div",
|
|
945
|
+
{
|
|
946
|
+
style: {
|
|
947
|
+
position: "absolute",
|
|
948
|
+
top: "48px",
|
|
949
|
+
right: "8px",
|
|
950
|
+
background: "white",
|
|
951
|
+
border: "1px solid #e5e7eb",
|
|
952
|
+
borderRadius: "8px",
|
|
953
|
+
padding: "16px",
|
|
954
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
955
|
+
zIndex: 20,
|
|
956
|
+
minWidth: "200px"
|
|
957
|
+
},
|
|
958
|
+
onClick: (e) => e.stopPropagation(),
|
|
959
|
+
children: [
|
|
960
|
+
/* @__PURE__ */ jsx3("h4", { style: { margin: "0 0 12px 0", fontSize: "14px", fontWeight: "600" }, children: "Video Settings" }),
|
|
961
|
+
/* @__PURE__ */ jsxs3("label", { style: { display: "flex", alignItems: "center", marginBottom: "8px", fontSize: "13px", cursor: "pointer" }, children: [
|
|
962
|
+
/* @__PURE__ */ jsx3(
|
|
963
|
+
"input",
|
|
964
|
+
{
|
|
965
|
+
type: "checkbox",
|
|
966
|
+
checked: settings.controls,
|
|
967
|
+
onChange: (e) => updateSettings({ controls: e.target.checked }),
|
|
968
|
+
style: { marginRight: "8px" }
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
"Show Controls"
|
|
972
|
+
] }),
|
|
973
|
+
/* @__PURE__ */ jsxs3("label", { style: { display: "flex", alignItems: "center", marginBottom: "8px", fontSize: "13px", cursor: "pointer" }, children: [
|
|
974
|
+
/* @__PURE__ */ jsx3(
|
|
975
|
+
"input",
|
|
976
|
+
{
|
|
977
|
+
type: "checkbox",
|
|
978
|
+
checked: settings.autoplay,
|
|
979
|
+
onChange: (e) => updateSettings({ autoplay: e.target.checked }),
|
|
980
|
+
style: { marginRight: "8px" }
|
|
981
|
+
}
|
|
982
|
+
),
|
|
983
|
+
"Autoplay"
|
|
984
|
+
] }),
|
|
985
|
+
/* @__PURE__ */ jsxs3("label", { style: { display: "flex", alignItems: "center", marginBottom: "8px", fontSize: "13px", cursor: "pointer" }, children: [
|
|
986
|
+
/* @__PURE__ */ jsx3(
|
|
987
|
+
"input",
|
|
988
|
+
{
|
|
989
|
+
type: "checkbox",
|
|
990
|
+
checked: settings.loop,
|
|
991
|
+
onChange: (e) => updateSettings({ loop: e.target.checked }),
|
|
992
|
+
style: { marginRight: "8px" }
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
"Loop"
|
|
996
|
+
] }),
|
|
997
|
+
/* @__PURE__ */ jsxs3("label", { style: { display: "flex", alignItems: "center", fontSize: "13px", cursor: "pointer" }, children: [
|
|
998
|
+
/* @__PURE__ */ jsx3(
|
|
999
|
+
"input",
|
|
1000
|
+
{
|
|
1001
|
+
type: "checkbox",
|
|
1002
|
+
checked: settings.muted,
|
|
1003
|
+
onChange: (e) => updateSettings({ muted: e.target.checked }),
|
|
1004
|
+
style: { marginRight: "8px" }
|
|
1005
|
+
}
|
|
1006
|
+
),
|
|
1007
|
+
"Muted"
|
|
1008
|
+
] })
|
|
1009
|
+
]
|
|
1010
|
+
}
|
|
1011
|
+
),
|
|
1012
|
+
/* @__PURE__ */ jsx3(
|
|
1013
|
+
"div",
|
|
1014
|
+
{
|
|
1015
|
+
className: "video-resize-handle video-resize-handle-se",
|
|
1016
|
+
onMouseDown: (e) => onResizeStart(e, "se"),
|
|
1017
|
+
style: {
|
|
1018
|
+
position: "absolute",
|
|
1019
|
+
right: "-4px",
|
|
1020
|
+
bottom: "-4px",
|
|
1021
|
+
width: "12px",
|
|
1022
|
+
height: "12px",
|
|
1023
|
+
background: "#667eea",
|
|
1024
|
+
cursor: "nwse-resize",
|
|
1025
|
+
borderRadius: "50%",
|
|
1026
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
1027
|
+
border: "2px solid white"
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
),
|
|
1031
|
+
/* @__PURE__ */ jsx3(
|
|
1032
|
+
"div",
|
|
1033
|
+
{
|
|
1034
|
+
className: "video-resize-handle video-resize-handle-sw",
|
|
1035
|
+
onMouseDown: (e) => onResizeStart(e, "sw"),
|
|
1036
|
+
style: {
|
|
1037
|
+
position: "absolute",
|
|
1038
|
+
left: "-4px",
|
|
1039
|
+
bottom: "-4px",
|
|
1040
|
+
width: "12px",
|
|
1041
|
+
height: "12px",
|
|
1042
|
+
background: "#667eea",
|
|
1043
|
+
cursor: "nesw-resize",
|
|
1044
|
+
borderRadius: "50%",
|
|
1045
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
1046
|
+
border: "2px solid white"
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
),
|
|
1050
|
+
/* @__PURE__ */ jsx3(
|
|
1051
|
+
"div",
|
|
1052
|
+
{
|
|
1053
|
+
className: "video-resize-handle video-resize-handle-ne",
|
|
1054
|
+
onMouseDown: (e) => onResizeStart(e, "ne"),
|
|
1055
|
+
style: {
|
|
1056
|
+
position: "absolute",
|
|
1057
|
+
right: "-4px",
|
|
1058
|
+
top: "-4px",
|
|
1059
|
+
width: "12px",
|
|
1060
|
+
height: "12px",
|
|
1061
|
+
background: "#667eea",
|
|
1062
|
+
cursor: "nesw-resize",
|
|
1063
|
+
borderRadius: "50%",
|
|
1064
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
1065
|
+
border: "2px solid white"
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
/* @__PURE__ */ jsx3(
|
|
1070
|
+
"div",
|
|
1071
|
+
{
|
|
1072
|
+
className: "video-resize-handle video-resize-handle-nw",
|
|
1073
|
+
onMouseDown: (e) => onResizeStart(e, "nw"),
|
|
1074
|
+
style: {
|
|
1075
|
+
position: "absolute",
|
|
1076
|
+
left: "-4px",
|
|
1077
|
+
top: "-4px",
|
|
1078
|
+
width: "12px",
|
|
1079
|
+
height: "12px",
|
|
1080
|
+
background: "#667eea",
|
|
1081
|
+
cursor: "nwse-resize",
|
|
1082
|
+
borderRadius: "50%",
|
|
1083
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
1084
|
+
border: "2px solid white"
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
)
|
|
1088
|
+
] })
|
|
1089
|
+
]
|
|
1090
|
+
}
|
|
1091
|
+
);
|
|
1092
|
+
}
|
|
1093
|
+
var VideoNode = class _VideoNode extends DecoratorNode2 {
|
|
1094
|
+
static getType() {
|
|
1095
|
+
return "video";
|
|
1096
|
+
}
|
|
1097
|
+
static clone(node) {
|
|
1098
|
+
return new _VideoNode(
|
|
1099
|
+
node.__src,
|
|
1100
|
+
node.__width,
|
|
1101
|
+
node.__height,
|
|
1102
|
+
node.__autoplay,
|
|
1103
|
+
node.__loop,
|
|
1104
|
+
node.__muted,
|
|
1105
|
+
node.__controls,
|
|
1106
|
+
node.__key
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
static isInline() {
|
|
1110
|
+
return true;
|
|
1111
|
+
}
|
|
1112
|
+
constructor(src, width, height, autoplay = false, loop = false, muted = false, controls = true, key) {
|
|
1113
|
+
super(key);
|
|
1114
|
+
this.__src = src;
|
|
1115
|
+
this.__width = width;
|
|
1116
|
+
this.__height = height;
|
|
1117
|
+
this.__autoplay = autoplay;
|
|
1118
|
+
this.__loop = loop;
|
|
1119
|
+
this.__muted = muted;
|
|
1120
|
+
this.__controls = controls;
|
|
1121
|
+
}
|
|
1122
|
+
createDOM() {
|
|
1123
|
+
const span = document.createElement("span");
|
|
1124
|
+
span.style.display = "inline-block";
|
|
1125
|
+
span.style.maxWidth = "100%";
|
|
1126
|
+
return span;
|
|
1127
|
+
}
|
|
1128
|
+
updateDOM() {
|
|
1129
|
+
return false;
|
|
1130
|
+
}
|
|
1131
|
+
decorate(editor) {
|
|
1132
|
+
return /* @__PURE__ */ jsx3(
|
|
1133
|
+
VideoComponent,
|
|
1134
|
+
{
|
|
1135
|
+
src: this.__src,
|
|
1136
|
+
width: this.__width,
|
|
1137
|
+
height: this.__height,
|
|
1138
|
+
autoplay: this.__autoplay,
|
|
1139
|
+
loop: this.__loop,
|
|
1140
|
+
muted: this.__muted,
|
|
1141
|
+
controls: this.__controls,
|
|
1142
|
+
nodeKey: this.__key,
|
|
1143
|
+
editor
|
|
1144
|
+
}
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
exportJSON() {
|
|
1148
|
+
return {
|
|
1149
|
+
type: "video",
|
|
1150
|
+
src: this.__src,
|
|
1151
|
+
width: this.__width,
|
|
1152
|
+
height: this.__height,
|
|
1153
|
+
autoplay: this.__autoplay,
|
|
1154
|
+
loop: this.__loop,
|
|
1155
|
+
muted: this.__muted,
|
|
1156
|
+
controls: this.__controls,
|
|
1157
|
+
version: 1
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
static importJSON(serializedNode) {
|
|
1161
|
+
return new _VideoNode(
|
|
1162
|
+
serializedNode.src,
|
|
1163
|
+
serializedNode.width,
|
|
1164
|
+
serializedNode.height,
|
|
1165
|
+
serializedNode.autoplay,
|
|
1166
|
+
serializedNode.loop,
|
|
1167
|
+
serializedNode.muted,
|
|
1168
|
+
serializedNode.controls
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// src/blocks/YouTubeNode.tsx
|
|
1174
|
+
import { DecoratorNode as DecoratorNode3 } from "lexical";
|
|
1175
|
+
import { useCallback as useCallback3, useRef as useRef3, useState as useState4 } from "react";
|
|
1176
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1177
|
+
function YouTubeComponent({
|
|
1178
|
+
id,
|
|
1179
|
+
width: initialWidth,
|
|
1180
|
+
height: initialHeight,
|
|
1181
|
+
nodeKey,
|
|
1182
|
+
editor
|
|
1183
|
+
}) {
|
|
1184
|
+
const wrapperRef = useRef3(null);
|
|
1185
|
+
const [isResizing, setIsResizing] = useState4(false);
|
|
1186
|
+
const [isSelected, setIsSelected] = useState4(false);
|
|
1187
|
+
const [isDragging, setIsDragging] = useState4(false);
|
|
1188
|
+
const [size, setSize] = useState4({
|
|
750
1189
|
width: initialWidth || 560,
|
|
751
1190
|
height: initialHeight || 315
|
|
752
1191
|
});
|
|
753
|
-
const onResizeStart =
|
|
1192
|
+
const onResizeStart = useCallback3((e, direction) => {
|
|
754
1193
|
e.preventDefault();
|
|
755
1194
|
e.stopPropagation();
|
|
756
1195
|
setIsResizing(true);
|
|
@@ -799,7 +1238,7 @@ function YouTubeComponent({
|
|
|
799
1238
|
document.addEventListener("mousemove", onMouseMove);
|
|
800
1239
|
document.addEventListener("mouseup", onMouseUp);
|
|
801
1240
|
}, [size, editor, nodeKey]);
|
|
802
|
-
const onDragStart =
|
|
1241
|
+
const onDragStart = useCallback3((e) => {
|
|
803
1242
|
if (e.target.className.includes("resize-handle")) {
|
|
804
1243
|
return;
|
|
805
1244
|
}
|
|
@@ -842,7 +1281,7 @@ function YouTubeComponent({
|
|
|
842
1281
|
document.addEventListener("mousemove", onMouseMove);
|
|
843
1282
|
document.addEventListener("mouseup", onMouseUp);
|
|
844
1283
|
}, [id, size, nodeKey, editor]);
|
|
845
|
-
return /* @__PURE__ */
|
|
1284
|
+
return /* @__PURE__ */ jsxs4(
|
|
846
1285
|
"div",
|
|
847
1286
|
{
|
|
848
1287
|
ref: wrapperRef,
|
|
@@ -858,7 +1297,7 @@ function YouTubeComponent({
|
|
|
858
1297
|
cursor: isSelected ? "move" : "pointer"
|
|
859
1298
|
},
|
|
860
1299
|
children: [
|
|
861
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ jsx4(
|
|
862
1301
|
"iframe",
|
|
863
1302
|
{
|
|
864
1303
|
src: `https://www.youtube.com/embed/${id}`,
|
|
@@ -875,8 +1314,8 @@ function YouTubeComponent({
|
|
|
875
1314
|
}
|
|
876
1315
|
}
|
|
877
1316
|
),
|
|
878
|
-
isSelected && /* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */
|
|
1317
|
+
isSelected && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1318
|
+
/* @__PURE__ */ jsx4(
|
|
880
1319
|
"div",
|
|
881
1320
|
{
|
|
882
1321
|
className: "youtube-resize-handle youtube-resize-handle-nw",
|
|
@@ -896,7 +1335,7 @@ function YouTubeComponent({
|
|
|
896
1335
|
}
|
|
897
1336
|
}
|
|
898
1337
|
),
|
|
899
|
-
/* @__PURE__ */
|
|
1338
|
+
/* @__PURE__ */ jsx4(
|
|
900
1339
|
"div",
|
|
901
1340
|
{
|
|
902
1341
|
className: "youtube-resize-handle youtube-resize-handle-ne",
|
|
@@ -916,7 +1355,7 @@ function YouTubeComponent({
|
|
|
916
1355
|
}
|
|
917
1356
|
}
|
|
918
1357
|
),
|
|
919
|
-
/* @__PURE__ */
|
|
1358
|
+
/* @__PURE__ */ jsx4(
|
|
920
1359
|
"div",
|
|
921
1360
|
{
|
|
922
1361
|
className: "youtube-resize-handle youtube-resize-handle-sw",
|
|
@@ -936,7 +1375,7 @@ function YouTubeComponent({
|
|
|
936
1375
|
}
|
|
937
1376
|
}
|
|
938
1377
|
),
|
|
939
|
-
/* @__PURE__ */
|
|
1378
|
+
/* @__PURE__ */ jsx4(
|
|
940
1379
|
"div",
|
|
941
1380
|
{
|
|
942
1381
|
className: "youtube-resize-handle youtube-resize-handle-se",
|
|
@@ -956,7 +1395,7 @@ function YouTubeComponent({
|
|
|
956
1395
|
}
|
|
957
1396
|
}
|
|
958
1397
|
),
|
|
959
|
-
/* @__PURE__ */
|
|
1398
|
+
/* @__PURE__ */ jsx4(
|
|
960
1399
|
"div",
|
|
961
1400
|
{
|
|
962
1401
|
className: "youtube-resize-handle youtube-resize-handle-n",
|
|
@@ -976,7 +1415,7 @@ function YouTubeComponent({
|
|
|
976
1415
|
}
|
|
977
1416
|
}
|
|
978
1417
|
),
|
|
979
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ jsx4(
|
|
980
1419
|
"div",
|
|
981
1420
|
{
|
|
982
1421
|
className: "youtube-resize-handle youtube-resize-handle-s",
|
|
@@ -996,7 +1435,7 @@ function YouTubeComponent({
|
|
|
996
1435
|
}
|
|
997
1436
|
}
|
|
998
1437
|
),
|
|
999
|
-
/* @__PURE__ */
|
|
1438
|
+
/* @__PURE__ */ jsx4(
|
|
1000
1439
|
"div",
|
|
1001
1440
|
{
|
|
1002
1441
|
className: "youtube-resize-handle youtube-resize-handle-e",
|
|
@@ -1016,7 +1455,7 @@ function YouTubeComponent({
|
|
|
1016
1455
|
}
|
|
1017
1456
|
}
|
|
1018
1457
|
),
|
|
1019
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ jsx4(
|
|
1020
1459
|
"div",
|
|
1021
1460
|
{
|
|
1022
1461
|
className: "youtube-resize-handle youtube-resize-handle-w",
|
|
@@ -1041,7 +1480,7 @@ function YouTubeComponent({
|
|
|
1041
1480
|
}
|
|
1042
1481
|
);
|
|
1043
1482
|
}
|
|
1044
|
-
var YouTubeNode = class _YouTubeNode extends
|
|
1483
|
+
var YouTubeNode = class _YouTubeNode extends DecoratorNode3 {
|
|
1045
1484
|
static getType() {
|
|
1046
1485
|
return "youtube";
|
|
1047
1486
|
}
|
|
@@ -1067,7 +1506,7 @@ var YouTubeNode = class _YouTubeNode extends DecoratorNode2 {
|
|
|
1067
1506
|
return false;
|
|
1068
1507
|
}
|
|
1069
1508
|
decorate(editor) {
|
|
1070
|
-
return /* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ jsx4(
|
|
1071
1510
|
YouTubeComponent,
|
|
1072
1511
|
{
|
|
1073
1512
|
id: this.__id,
|
|
@@ -1205,12 +1644,12 @@ function $createColumnNode() {
|
|
|
1205
1644
|
}
|
|
1206
1645
|
|
|
1207
1646
|
// src/plugins/SlashCommandPlugin.tsx
|
|
1208
|
-
import { jsx as
|
|
1647
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1209
1648
|
function SlashCommandPlugin() {
|
|
1210
1649
|
const [editor] = useLexicalComposerContext2();
|
|
1211
|
-
const [showMenu, setShowMenu] =
|
|
1212
|
-
const [search, setSearch] =
|
|
1213
|
-
const [selectedIndex, setSelectedIndex] =
|
|
1650
|
+
const [showMenu, setShowMenu] = useState5(false);
|
|
1651
|
+
const [search, setSearch] = useState5("");
|
|
1652
|
+
const [selectedIndex, setSelectedIndex] = useState5(0);
|
|
1214
1653
|
const commands = [
|
|
1215
1654
|
{
|
|
1216
1655
|
title: "Heading 1",
|
|
@@ -1332,6 +1771,31 @@ function SlashCommandPlugin() {
|
|
|
1332
1771
|
input.click();
|
|
1333
1772
|
}
|
|
1334
1773
|
},
|
|
1774
|
+
{
|
|
1775
|
+
title: "Video",
|
|
1776
|
+
description: "Insert a video",
|
|
1777
|
+
keywords: ["video", "mp4", "movie", "film"],
|
|
1778
|
+
onSelect: (editor2) => {
|
|
1779
|
+
const input = document.createElement("input");
|
|
1780
|
+
input.type = "file";
|
|
1781
|
+
input.accept = "video/*";
|
|
1782
|
+
input.onchange = (e) => {
|
|
1783
|
+
const file = e.target?.files?.[0];
|
|
1784
|
+
if (file) {
|
|
1785
|
+
const url = URL.createObjectURL(file);
|
|
1786
|
+
editor2.update(() => {
|
|
1787
|
+
const selection = $getSelection();
|
|
1788
|
+
if ($isRangeSelection(selection)) {
|
|
1789
|
+
const videoNode = new VideoNode(url);
|
|
1790
|
+
const nodes = [videoNode];
|
|
1791
|
+
selection.insertNodes(nodes);
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
};
|
|
1796
|
+
input.click();
|
|
1797
|
+
}
|
|
1798
|
+
},
|
|
1335
1799
|
{
|
|
1336
1800
|
title: "Image from URL",
|
|
1337
1801
|
description: "Insert an image from a URL",
|
|
@@ -1393,7 +1857,7 @@ function SlashCommandPlugin() {
|
|
|
1393
1857
|
const searchLower = search.toLowerCase();
|
|
1394
1858
|
return cmd.title.toLowerCase().includes(searchLower) || cmd.description.toLowerCase().includes(searchLower) || cmd.keywords.some((kw) => kw.includes(searchLower));
|
|
1395
1859
|
});
|
|
1396
|
-
|
|
1860
|
+
useEffect4(() => {
|
|
1397
1861
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
1398
1862
|
editorState.read(() => {
|
|
1399
1863
|
const selection = $getSelection();
|
|
@@ -1415,7 +1879,7 @@ function SlashCommandPlugin() {
|
|
|
1415
1879
|
});
|
|
1416
1880
|
});
|
|
1417
1881
|
}, [editor, showMenu]);
|
|
1418
|
-
|
|
1882
|
+
useEffect4(() => {
|
|
1419
1883
|
if (!showMenu) return;
|
|
1420
1884
|
const handleKeyDown = (event) => {
|
|
1421
1885
|
if (event.key === "ArrowDown") {
|
|
@@ -1461,17 +1925,17 @@ function SlashCommandPlugin() {
|
|
|
1461
1925
|
if (!showMenu || filteredCommands.length === 0) {
|
|
1462
1926
|
return null;
|
|
1463
1927
|
}
|
|
1464
|
-
return /* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1466
|
-
filteredCommands.map((cmd, index) => /* @__PURE__ */
|
|
1928
|
+
return /* @__PURE__ */ jsxs5("div", { className: "slash-menu", children: [
|
|
1929
|
+
/* @__PURE__ */ jsx5("div", { className: "slash-menu-title", children: "Commands" }),
|
|
1930
|
+
filteredCommands.map((cmd, index) => /* @__PURE__ */ jsxs5(
|
|
1467
1931
|
"div",
|
|
1468
1932
|
{
|
|
1469
1933
|
className: `slash-menu-item ${index === selectedIndex ? "selected" : ""}`,
|
|
1470
1934
|
onClick: () => executeCommand(cmd),
|
|
1471
1935
|
onMouseEnter: () => setSelectedIndex(index),
|
|
1472
1936
|
children: [
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1937
|
+
/* @__PURE__ */ jsx5("div", { className: "slash-menu-item-title", children: cmd.title }),
|
|
1938
|
+
/* @__PURE__ */ jsx5("div", { className: "slash-menu-item-description", children: cmd.description })
|
|
1475
1939
|
]
|
|
1476
1940
|
},
|
|
1477
1941
|
cmd.title
|
|
@@ -1500,11 +1964,11 @@ import { $createCodeNode as $createCodeNode2 } from "@lexical/code";
|
|
|
1500
1964
|
|
|
1501
1965
|
// src/plugins/ColorPickerPlugin.tsx
|
|
1502
1966
|
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
1503
|
-
import { useState as
|
|
1967
|
+
import { useState as useState6, useCallback as useCallback4, useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
1504
1968
|
import { $getSelection as $getSelection2, $isRangeSelection as $isRangeSelection2, $isTextNode } from "lexical";
|
|
1505
1969
|
import { $patchStyleText } from "@lexical/selection";
|
|
1506
1970
|
import { MdFormatColorText, MdFormatColorFill } from "react-icons/md";
|
|
1507
|
-
import { Fragment as
|
|
1971
|
+
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1508
1972
|
var PRESET_COLORS = [
|
|
1509
1973
|
"#000000",
|
|
1510
1974
|
"#434343",
|
|
@@ -1589,15 +2053,15 @@ var PRESET_COLORS = [
|
|
|
1589
2053
|
];
|
|
1590
2054
|
function ColorPickerPlugin() {
|
|
1591
2055
|
const [editor] = useLexicalComposerContext3();
|
|
1592
|
-
const [showTextColorPicker, setShowTextColorPicker] =
|
|
1593
|
-
const [showBgColorPicker, setShowBgColorPicker] =
|
|
1594
|
-
const [currentTextColor, setCurrentTextColor] =
|
|
1595
|
-
const [currentBgColor, setCurrentBgColor] =
|
|
1596
|
-
const [textColorPosition, setTextColorPosition] =
|
|
1597
|
-
const [bgColorPosition, setBgColorPosition] =
|
|
1598
|
-
const textColorRef =
|
|
1599
|
-
const bgColorRef =
|
|
1600
|
-
|
|
2056
|
+
const [showTextColorPicker, setShowTextColorPicker] = useState6(false);
|
|
2057
|
+
const [showBgColorPicker, setShowBgColorPicker] = useState6(false);
|
|
2058
|
+
const [currentTextColor, setCurrentTextColor] = useState6("#000000");
|
|
2059
|
+
const [currentBgColor, setCurrentBgColor] = useState6("transparent");
|
|
2060
|
+
const [textColorPosition, setTextColorPosition] = useState6({ top: 0, left: 0 });
|
|
2061
|
+
const [bgColorPosition, setBgColorPosition] = useState6({ top: 0, left: 0 });
|
|
2062
|
+
const textColorRef = useRef4(null);
|
|
2063
|
+
const bgColorRef = useRef4(null);
|
|
2064
|
+
useEffect5(() => {
|
|
1601
2065
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
1602
2066
|
editorState.read(() => {
|
|
1603
2067
|
const selection = $getSelection2();
|
|
@@ -1621,7 +2085,7 @@ function ColorPickerPlugin() {
|
|
|
1621
2085
|
});
|
|
1622
2086
|
});
|
|
1623
2087
|
}, [editor]);
|
|
1624
|
-
|
|
2088
|
+
useEffect5(() => {
|
|
1625
2089
|
const handleClickOutside = (event) => {
|
|
1626
2090
|
if (textColorRef.current && !textColorRef.current.contains(event.target)) {
|
|
1627
2091
|
setShowTextColorPicker(false);
|
|
@@ -1633,7 +2097,7 @@ function ColorPickerPlugin() {
|
|
|
1633
2097
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1634
2098
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1635
2099
|
}, []);
|
|
1636
|
-
const applyTextColor =
|
|
2100
|
+
const applyTextColor = useCallback4((color) => {
|
|
1637
2101
|
editor.update(() => {
|
|
1638
2102
|
const selection = $getSelection2();
|
|
1639
2103
|
if ($isRangeSelection2(selection)) {
|
|
@@ -1642,7 +2106,7 @@ function ColorPickerPlugin() {
|
|
|
1642
2106
|
});
|
|
1643
2107
|
setCurrentTextColor(color);
|
|
1644
2108
|
}, [editor]);
|
|
1645
|
-
const applyBackgroundColor =
|
|
2109
|
+
const applyBackgroundColor = useCallback4((color) => {
|
|
1646
2110
|
editor.update(() => {
|
|
1647
2111
|
const selection = $getSelection2();
|
|
1648
2112
|
if ($isRangeSelection2(selection)) {
|
|
@@ -1651,7 +2115,7 @@ function ColorPickerPlugin() {
|
|
|
1651
2115
|
});
|
|
1652
2116
|
setCurrentBgColor(color);
|
|
1653
2117
|
}, [editor]);
|
|
1654
|
-
const toggleTextColorPicker =
|
|
2118
|
+
const toggleTextColorPicker = useCallback4((event) => {
|
|
1655
2119
|
if (!showTextColorPicker) {
|
|
1656
2120
|
const button = event.currentTarget;
|
|
1657
2121
|
const rect = button.getBoundingClientRect();
|
|
@@ -1663,7 +2127,7 @@ function ColorPickerPlugin() {
|
|
|
1663
2127
|
setShowTextColorPicker(!showTextColorPicker);
|
|
1664
2128
|
setShowBgColorPicker(false);
|
|
1665
2129
|
}, [showTextColorPicker]);
|
|
1666
|
-
const toggleBgColorPicker =
|
|
2130
|
+
const toggleBgColorPicker = useCallback4((event) => {
|
|
1667
2131
|
if (!showBgColorPicker) {
|
|
1668
2132
|
const button = event.currentTarget;
|
|
1669
2133
|
const rect = button.getBoundingClientRect();
|
|
@@ -1675,7 +2139,7 @@ function ColorPickerPlugin() {
|
|
|
1675
2139
|
setShowBgColorPicker(!showBgColorPicker);
|
|
1676
2140
|
setShowTextColorPicker(false);
|
|
1677
2141
|
}, [showBgColorPicker]);
|
|
1678
|
-
const removeTextColor =
|
|
2142
|
+
const removeTextColor = useCallback4(() => {
|
|
1679
2143
|
editor.update(() => {
|
|
1680
2144
|
const selection = $getSelection2();
|
|
1681
2145
|
if ($isRangeSelection2(selection)) {
|
|
@@ -1685,7 +2149,7 @@ function ColorPickerPlugin() {
|
|
|
1685
2149
|
setCurrentTextColor("#000000");
|
|
1686
2150
|
setShowTextColorPicker(false);
|
|
1687
2151
|
}, [editor]);
|
|
1688
|
-
const removeBgColor =
|
|
2152
|
+
const removeBgColor = useCallback4(() => {
|
|
1689
2153
|
editor.update(() => {
|
|
1690
2154
|
const selection = $getSelection2();
|
|
1691
2155
|
if ($isRangeSelection2(selection)) {
|
|
@@ -1695,18 +2159,18 @@ function ColorPickerPlugin() {
|
|
|
1695
2159
|
setCurrentBgColor("transparent");
|
|
1696
2160
|
setShowBgColorPicker(false);
|
|
1697
2161
|
}, [editor]);
|
|
1698
|
-
return /* @__PURE__ */
|
|
1699
|
-
/* @__PURE__ */
|
|
1700
|
-
/* @__PURE__ */
|
|
2162
|
+
return /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
2163
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-color-picker-plugin", ref: textColorRef, children: [
|
|
2164
|
+
/* @__PURE__ */ jsx6(
|
|
1701
2165
|
"button",
|
|
1702
2166
|
{
|
|
1703
2167
|
className: "cms-toolbar-button",
|
|
1704
2168
|
onClick: toggleTextColorPicker,
|
|
1705
2169
|
title: "Text Color",
|
|
1706
2170
|
type: "button",
|
|
1707
|
-
children: /* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */
|
|
2171
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "cms-color-button-wrapper", children: [
|
|
2172
|
+
/* @__PURE__ */ jsx6(MdFormatColorText, { size: 18 }),
|
|
2173
|
+
/* @__PURE__ */ jsx6(
|
|
1710
2174
|
"div",
|
|
1711
2175
|
{
|
|
1712
2176
|
className: "cms-color-indicator",
|
|
@@ -1716,7 +2180,7 @@ function ColorPickerPlugin() {
|
|
|
1716
2180
|
] })
|
|
1717
2181
|
}
|
|
1718
2182
|
),
|
|
1719
|
-
showTextColorPicker && /* @__PURE__ */
|
|
2183
|
+
showTextColorPicker && /* @__PURE__ */ jsxs6(
|
|
1720
2184
|
"div",
|
|
1721
2185
|
{
|
|
1722
2186
|
className: "cms-color-picker-menu",
|
|
@@ -1725,9 +2189,9 @@ function ColorPickerPlugin() {
|
|
|
1725
2189
|
left: `${textColorPosition.left}px`
|
|
1726
2190
|
},
|
|
1727
2191
|
children: [
|
|
1728
|
-
/* @__PURE__ */
|
|
1729
|
-
/* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
2192
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-color-picker-header", children: [
|
|
2193
|
+
/* @__PURE__ */ jsx6("span", { children: "Text Color" }),
|
|
2194
|
+
/* @__PURE__ */ jsx6(
|
|
1731
2195
|
"button",
|
|
1732
2196
|
{
|
|
1733
2197
|
className: "cms-color-remove-btn",
|
|
@@ -1737,7 +2201,7 @@ function ColorPickerPlugin() {
|
|
|
1737
2201
|
}
|
|
1738
2202
|
)
|
|
1739
2203
|
] }),
|
|
1740
|
-
/* @__PURE__ */
|
|
2204
|
+
/* @__PURE__ */ jsx6("div", { className: "cms-color-grid", children: PRESET_COLORS.map((color) => /* @__PURE__ */ jsx6(
|
|
1741
2205
|
"button",
|
|
1742
2206
|
{
|
|
1743
2207
|
className: `cms-color-swatch ${currentTextColor === color ? "active" : ""}`,
|
|
@@ -1748,9 +2212,9 @@ function ColorPickerPlugin() {
|
|
|
1748
2212
|
},
|
|
1749
2213
|
color
|
|
1750
2214
|
)) }),
|
|
1751
|
-
/* @__PURE__ */
|
|
2215
|
+
/* @__PURE__ */ jsx6("div", { className: "cms-color-custom", children: /* @__PURE__ */ jsxs6("label", { children: [
|
|
1752
2216
|
"Custom:",
|
|
1753
|
-
/* @__PURE__ */
|
|
2217
|
+
/* @__PURE__ */ jsx6(
|
|
1754
2218
|
"input",
|
|
1755
2219
|
{
|
|
1756
2220
|
type: "color",
|
|
@@ -1764,17 +2228,17 @@ function ColorPickerPlugin() {
|
|
|
1764
2228
|
}
|
|
1765
2229
|
)
|
|
1766
2230
|
] }),
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
2231
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-color-picker-plugin", ref: bgColorRef, children: [
|
|
2232
|
+
/* @__PURE__ */ jsx6(
|
|
1769
2233
|
"button",
|
|
1770
2234
|
{
|
|
1771
2235
|
className: "cms-toolbar-button",
|
|
1772
2236
|
onClick: toggleBgColorPicker,
|
|
1773
2237
|
title: "Background Color",
|
|
1774
2238
|
type: "button",
|
|
1775
|
-
children: /* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
2239
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "cms-color-button-wrapper", children: [
|
|
2240
|
+
/* @__PURE__ */ jsx6(MdFormatColorFill, { size: 18 }),
|
|
2241
|
+
/* @__PURE__ */ jsx6(
|
|
1778
2242
|
"div",
|
|
1779
2243
|
{
|
|
1780
2244
|
className: "cms-color-indicator",
|
|
@@ -1784,7 +2248,7 @@ function ColorPickerPlugin() {
|
|
|
1784
2248
|
] })
|
|
1785
2249
|
}
|
|
1786
2250
|
),
|
|
1787
|
-
showBgColorPicker && /* @__PURE__ */
|
|
2251
|
+
showBgColorPicker && /* @__PURE__ */ jsxs6(
|
|
1788
2252
|
"div",
|
|
1789
2253
|
{
|
|
1790
2254
|
className: "cms-color-picker-menu",
|
|
@@ -1793,9 +2257,9 @@ function ColorPickerPlugin() {
|
|
|
1793
2257
|
left: `${bgColorPosition.left}px`
|
|
1794
2258
|
},
|
|
1795
2259
|
children: [
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
2260
|
+
/* @__PURE__ */ jsxs6("div", { className: "cms-color-picker-header", children: [
|
|
2261
|
+
/* @__PURE__ */ jsx6("span", { children: "Background Color" }),
|
|
2262
|
+
/* @__PURE__ */ jsx6(
|
|
1799
2263
|
"button",
|
|
1800
2264
|
{
|
|
1801
2265
|
className: "cms-color-remove-btn",
|
|
@@ -1805,7 +2269,7 @@ function ColorPickerPlugin() {
|
|
|
1805
2269
|
}
|
|
1806
2270
|
)
|
|
1807
2271
|
] }),
|
|
1808
|
-
/* @__PURE__ */
|
|
2272
|
+
/* @__PURE__ */ jsx6("div", { className: "cms-color-grid", children: PRESET_COLORS.map((color) => /* @__PURE__ */ jsx6(
|
|
1809
2273
|
"button",
|
|
1810
2274
|
{
|
|
1811
2275
|
className: `cms-color-swatch ${currentBgColor === color ? "active" : ""}`,
|
|
@@ -1816,9 +2280,9 @@ function ColorPickerPlugin() {
|
|
|
1816
2280
|
},
|
|
1817
2281
|
color
|
|
1818
2282
|
)) }),
|
|
1819
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsx6("div", { className: "cms-color-custom", children: /* @__PURE__ */ jsxs6("label", { children: [
|
|
1820
2284
|
"Custom:",
|
|
1821
|
-
/* @__PURE__ */
|
|
2285
|
+
/* @__PURE__ */ jsx6(
|
|
1822
2286
|
"input",
|
|
1823
2287
|
{
|
|
1824
2288
|
type: "color",
|
|
@@ -1837,28 +2301,28 @@ function ColorPickerPlugin() {
|
|
|
1837
2301
|
|
|
1838
2302
|
// src/plugins/SpacingPlugin.tsx
|
|
1839
2303
|
import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
|
|
1840
|
-
import { useState as
|
|
2304
|
+
import { useState as useState7, useCallback as useCallback5, useEffect as useEffect6, useRef as useRef5 } from "react";
|
|
1841
2305
|
import { $getSelection as $getSelection3, $isRangeSelection as $isRangeSelection3, $isTextNode as $isTextNode2 } from "lexical";
|
|
1842
2306
|
import { $patchStyleText as $patchStyleText2 } from "@lexical/selection";
|
|
1843
2307
|
import { MdSettings } from "react-icons/md";
|
|
1844
2308
|
import { TbBoxPadding, TbBoxMargin } from "react-icons/tb";
|
|
1845
|
-
import { jsx as
|
|
2309
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1846
2310
|
var SPACING_PRESETS = [0, 4, 8, 12, 16, 20, 24, 32, 40, 48];
|
|
1847
2311
|
function SpacingPlugin() {
|
|
1848
2312
|
const [editor] = useLexicalComposerContext4();
|
|
1849
|
-
const [showSpacingMenu, setShowSpacingMenu] =
|
|
1850
|
-
const [spacingPosition, setSpacingPosition] =
|
|
1851
|
-
const spacingRef =
|
|
1852
|
-
const [display, setDisplay] =
|
|
1853
|
-
const [paddingTop, setPaddingTop] =
|
|
1854
|
-
const [paddingRight, setPaddingRight] =
|
|
1855
|
-
const [paddingBottom, setPaddingBottom] =
|
|
1856
|
-
const [paddingLeft, setPaddingLeft] =
|
|
1857
|
-
const [marginTop, setMarginTop] =
|
|
1858
|
-
const [marginRight, setMarginRight] =
|
|
1859
|
-
const [marginBottom, setMarginBottom] =
|
|
1860
|
-
const [marginLeft, setMarginLeft] =
|
|
1861
|
-
|
|
2313
|
+
const [showSpacingMenu, setShowSpacingMenu] = useState7(false);
|
|
2314
|
+
const [spacingPosition, setSpacingPosition] = useState7({ top: 0, left: 0 });
|
|
2315
|
+
const spacingRef = useRef5(null);
|
|
2316
|
+
const [display, setDisplay] = useState7("inline");
|
|
2317
|
+
const [paddingTop, setPaddingTop] = useState7(0);
|
|
2318
|
+
const [paddingRight, setPaddingRight] = useState7(0);
|
|
2319
|
+
const [paddingBottom, setPaddingBottom] = useState7(0);
|
|
2320
|
+
const [paddingLeft, setPaddingLeft] = useState7(0);
|
|
2321
|
+
const [marginTop, setMarginTop] = useState7(0);
|
|
2322
|
+
const [marginRight, setMarginRight] = useState7(0);
|
|
2323
|
+
const [marginBottom, setMarginBottom] = useState7(0);
|
|
2324
|
+
const [marginLeft, setMarginLeft] = useState7(0);
|
|
2325
|
+
useEffect6(() => {
|
|
1862
2326
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
1863
2327
|
editorState.read(() => {
|
|
1864
2328
|
const selection = $getSelection3();
|
|
@@ -1894,7 +2358,7 @@ function SpacingPlugin() {
|
|
|
1894
2358
|
});
|
|
1895
2359
|
});
|
|
1896
2360
|
}, [editor]);
|
|
1897
|
-
|
|
2361
|
+
useEffect6(() => {
|
|
1898
2362
|
const handleClickOutside = (event) => {
|
|
1899
2363
|
if (spacingRef.current && !spacingRef.current.contains(event.target)) {
|
|
1900
2364
|
setShowSpacingMenu(false);
|
|
@@ -1903,7 +2367,7 @@ function SpacingPlugin() {
|
|
|
1903
2367
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1904
2368
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1905
2369
|
}, []);
|
|
1906
|
-
const applyStyles =
|
|
2370
|
+
const applyStyles = useCallback5((styles) => {
|
|
1907
2371
|
editor.update(() => {
|
|
1908
2372
|
const selection = $getSelection3();
|
|
1909
2373
|
if ($isRangeSelection3(selection)) {
|
|
@@ -1911,11 +2375,11 @@ function SpacingPlugin() {
|
|
|
1911
2375
|
}
|
|
1912
2376
|
});
|
|
1913
2377
|
}, [editor]);
|
|
1914
|
-
const handleDisplayChange =
|
|
2378
|
+
const handleDisplayChange = useCallback5((newDisplay) => {
|
|
1915
2379
|
applyStyles({ display: newDisplay });
|
|
1916
2380
|
setDisplay(newDisplay);
|
|
1917
2381
|
}, [applyStyles]);
|
|
1918
|
-
const handlePaddingChange =
|
|
2382
|
+
const handlePaddingChange = useCallback5((side, value) => {
|
|
1919
2383
|
const styleKey = `padding-${side}`;
|
|
1920
2384
|
applyStyles({ [styleKey]: `${value}px` });
|
|
1921
2385
|
if (side === "top") setPaddingTop(value);
|
|
@@ -1923,7 +2387,7 @@ function SpacingPlugin() {
|
|
|
1923
2387
|
else if (side === "bottom") setPaddingBottom(value);
|
|
1924
2388
|
else if (side === "left") setPaddingLeft(value);
|
|
1925
2389
|
}, [applyStyles]);
|
|
1926
|
-
const handleMarginChange =
|
|
2390
|
+
const handleMarginChange = useCallback5((side, value) => {
|
|
1927
2391
|
const styleKey = `margin-${side}`;
|
|
1928
2392
|
applyStyles({ [styleKey]: `${value}px` });
|
|
1929
2393
|
if (side === "top") setMarginTop(value);
|
|
@@ -1931,7 +2395,7 @@ function SpacingPlugin() {
|
|
|
1931
2395
|
else if (side === "bottom") setMarginBottom(value);
|
|
1932
2396
|
else if (side === "left") setMarginLeft(value);
|
|
1933
2397
|
}, [applyStyles]);
|
|
1934
|
-
const handlePaddingAll =
|
|
2398
|
+
const handlePaddingAll = useCallback5((value) => {
|
|
1935
2399
|
applyStyles({
|
|
1936
2400
|
"padding-top": `${value}px`,
|
|
1937
2401
|
"padding-right": `${value}px`,
|
|
@@ -1943,7 +2407,7 @@ function SpacingPlugin() {
|
|
|
1943
2407
|
setPaddingBottom(value);
|
|
1944
2408
|
setPaddingLeft(value);
|
|
1945
2409
|
}, [applyStyles]);
|
|
1946
|
-
const handleMarginAll =
|
|
2410
|
+
const handleMarginAll = useCallback5((value) => {
|
|
1947
2411
|
applyStyles({
|
|
1948
2412
|
"margin-top": `${value}px`,
|
|
1949
2413
|
"margin-right": `${value}px`,
|
|
@@ -1955,7 +2419,7 @@ function SpacingPlugin() {
|
|
|
1955
2419
|
setMarginBottom(value);
|
|
1956
2420
|
setMarginLeft(value);
|
|
1957
2421
|
}, [applyStyles]);
|
|
1958
|
-
const resetSpacing =
|
|
2422
|
+
const resetSpacing = useCallback5(() => {
|
|
1959
2423
|
applyStyles({
|
|
1960
2424
|
display: null,
|
|
1961
2425
|
"padding-top": null,
|
|
@@ -1977,7 +2441,7 @@ function SpacingPlugin() {
|
|
|
1977
2441
|
setMarginBottom(0);
|
|
1978
2442
|
setMarginLeft(0);
|
|
1979
2443
|
}, [applyStyles]);
|
|
1980
|
-
const toggleSpacingMenu =
|
|
2444
|
+
const toggleSpacingMenu = useCallback5((event) => {
|
|
1981
2445
|
if (!showSpacingMenu) {
|
|
1982
2446
|
const button = event.currentTarget;
|
|
1983
2447
|
const rect = button.getBoundingClientRect();
|
|
@@ -1988,18 +2452,18 @@ function SpacingPlugin() {
|
|
|
1988
2452
|
}
|
|
1989
2453
|
setShowSpacingMenu(!showSpacingMenu);
|
|
1990
2454
|
}, [showSpacingMenu]);
|
|
1991
|
-
return /* @__PURE__ */
|
|
1992
|
-
/* @__PURE__ */
|
|
2455
|
+
return /* @__PURE__ */ jsxs7("div", { className: "cms-spacing-plugin", ref: spacingRef, children: [
|
|
2456
|
+
/* @__PURE__ */ jsx7(
|
|
1993
2457
|
"button",
|
|
1994
2458
|
{
|
|
1995
2459
|
className: "cms-toolbar-button",
|
|
1996
2460
|
onClick: toggleSpacingMenu,
|
|
1997
2461
|
title: "Spacing & Display",
|
|
1998
2462
|
type: "button",
|
|
1999
|
-
children: /* @__PURE__ */
|
|
2463
|
+
children: /* @__PURE__ */ jsx7(MdSettings, { size: 18 })
|
|
2000
2464
|
}
|
|
2001
2465
|
),
|
|
2002
|
-
showSpacingMenu && /* @__PURE__ */
|
|
2466
|
+
showSpacingMenu && /* @__PURE__ */ jsxs7(
|
|
2003
2467
|
"div",
|
|
2004
2468
|
{
|
|
2005
2469
|
className: "cms-spacing-menu",
|
|
@@ -2008,9 +2472,9 @@ function SpacingPlugin() {
|
|
|
2008
2472
|
left: `${spacingPosition.left}px`
|
|
2009
2473
|
},
|
|
2010
2474
|
children: [
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2475
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-header", children: [
|
|
2476
|
+
/* @__PURE__ */ jsx7("span", { children: "Spacing & Display" }),
|
|
2477
|
+
/* @__PURE__ */ jsx7(
|
|
2014
2478
|
"button",
|
|
2015
2479
|
{
|
|
2016
2480
|
className: "cms-spacing-reset-btn",
|
|
@@ -2020,10 +2484,10 @@ function SpacingPlugin() {
|
|
|
2020
2484
|
}
|
|
2021
2485
|
)
|
|
2022
2486
|
] }),
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2487
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-section", children: [
|
|
2488
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-spacing-label", children: "Display Mode" }),
|
|
2489
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-display-buttons", children: [
|
|
2490
|
+
/* @__PURE__ */ jsx7(
|
|
2027
2491
|
"button",
|
|
2028
2492
|
{
|
|
2029
2493
|
className: `cms-spacing-display-btn ${display === "inline" ? "active" : ""}`,
|
|
@@ -2032,7 +2496,7 @@ function SpacingPlugin() {
|
|
|
2032
2496
|
children: "Inline"
|
|
2033
2497
|
}
|
|
2034
2498
|
),
|
|
2035
|
-
/* @__PURE__ */
|
|
2499
|
+
/* @__PURE__ */ jsx7(
|
|
2036
2500
|
"button",
|
|
2037
2501
|
{
|
|
2038
2502
|
className: `cms-spacing-display-btn ${display === "inline-block" ? "active" : ""}`,
|
|
@@ -2041,7 +2505,7 @@ function SpacingPlugin() {
|
|
|
2041
2505
|
children: "Inline Block"
|
|
2042
2506
|
}
|
|
2043
2507
|
),
|
|
2044
|
-
/* @__PURE__ */
|
|
2508
|
+
/* @__PURE__ */ jsx7(
|
|
2045
2509
|
"button",
|
|
2046
2510
|
{
|
|
2047
2511
|
className: `cms-spacing-display-btn ${display === "block" ? "active" : ""}`,
|
|
@@ -2052,12 +2516,12 @@ function SpacingPlugin() {
|
|
|
2052
2516
|
)
|
|
2053
2517
|
] })
|
|
2054
2518
|
] }),
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
/* @__PURE__ */
|
|
2058
|
-
/* @__PURE__ */
|
|
2519
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-section", children: [
|
|
2520
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-label", children: [
|
|
2521
|
+
/* @__PURE__ */ jsx7(TbBoxPadding, { size: 16 }),
|
|
2522
|
+
/* @__PURE__ */ jsx7("span", { children: "Padding (px)" })
|
|
2059
2523
|
] }),
|
|
2060
|
-
/* @__PURE__ */
|
|
2524
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-spacing-quick-buttons", children: SPACING_PRESETS.map((value) => /* @__PURE__ */ jsx7(
|
|
2061
2525
|
"button",
|
|
2062
2526
|
{
|
|
2063
2527
|
className: "cms-spacing-quick-btn",
|
|
@@ -2067,10 +2531,10 @@ function SpacingPlugin() {
|
|
|
2067
2531
|
},
|
|
2068
2532
|
`padding-${value}`
|
|
2069
2533
|
)) }),
|
|
2070
|
-
/* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2534
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-controls", children: [
|
|
2535
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2536
|
+
/* @__PURE__ */ jsx7("label", { children: "Top" }),
|
|
2537
|
+
/* @__PURE__ */ jsx7(
|
|
2074
2538
|
"input",
|
|
2075
2539
|
{
|
|
2076
2540
|
type: "number",
|
|
@@ -2081,9 +2545,9 @@ function SpacingPlugin() {
|
|
|
2081
2545
|
}
|
|
2082
2546
|
)
|
|
2083
2547
|
] }),
|
|
2084
|
-
/* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2086
|
-
/* @__PURE__ */
|
|
2548
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2549
|
+
/* @__PURE__ */ jsx7("label", { children: "Right" }),
|
|
2550
|
+
/* @__PURE__ */ jsx7(
|
|
2087
2551
|
"input",
|
|
2088
2552
|
{
|
|
2089
2553
|
type: "number",
|
|
@@ -2094,9 +2558,9 @@ function SpacingPlugin() {
|
|
|
2094
2558
|
}
|
|
2095
2559
|
)
|
|
2096
2560
|
] }),
|
|
2097
|
-
/* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2561
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2562
|
+
/* @__PURE__ */ jsx7("label", { children: "Bottom" }),
|
|
2563
|
+
/* @__PURE__ */ jsx7(
|
|
2100
2564
|
"input",
|
|
2101
2565
|
{
|
|
2102
2566
|
type: "number",
|
|
@@ -2107,9 +2571,9 @@ function SpacingPlugin() {
|
|
|
2107
2571
|
}
|
|
2108
2572
|
)
|
|
2109
2573
|
] }),
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2574
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2575
|
+
/* @__PURE__ */ jsx7("label", { children: "Left" }),
|
|
2576
|
+
/* @__PURE__ */ jsx7(
|
|
2113
2577
|
"input",
|
|
2114
2578
|
{
|
|
2115
2579
|
type: "number",
|
|
@@ -2122,12 +2586,12 @@ function SpacingPlugin() {
|
|
|
2122
2586
|
] })
|
|
2123
2587
|
] })
|
|
2124
2588
|
] }),
|
|
2125
|
-
/* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2589
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-section", children: [
|
|
2590
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-label", children: [
|
|
2591
|
+
/* @__PURE__ */ jsx7(TbBoxMargin, { size: 16 }),
|
|
2592
|
+
/* @__PURE__ */ jsx7("span", { children: "Margin (px)" })
|
|
2129
2593
|
] }),
|
|
2130
|
-
/* @__PURE__ */
|
|
2594
|
+
/* @__PURE__ */ jsx7("div", { className: "cms-spacing-quick-buttons", children: SPACING_PRESETS.map((value) => /* @__PURE__ */ jsx7(
|
|
2131
2595
|
"button",
|
|
2132
2596
|
{
|
|
2133
2597
|
className: "cms-spacing-quick-btn",
|
|
@@ -2137,10 +2601,10 @@ function SpacingPlugin() {
|
|
|
2137
2601
|
},
|
|
2138
2602
|
`margin-${value}`
|
|
2139
2603
|
)) }),
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-controls", children: [
|
|
2605
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2606
|
+
/* @__PURE__ */ jsx7("label", { children: "Top" }),
|
|
2607
|
+
/* @__PURE__ */ jsx7(
|
|
2144
2608
|
"input",
|
|
2145
2609
|
{
|
|
2146
2610
|
type: "number",
|
|
@@ -2151,9 +2615,9 @@ function SpacingPlugin() {
|
|
|
2151
2615
|
}
|
|
2152
2616
|
)
|
|
2153
2617
|
] }),
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
/* @__PURE__ */
|
|
2156
|
-
/* @__PURE__ */
|
|
2618
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2619
|
+
/* @__PURE__ */ jsx7("label", { children: "Right" }),
|
|
2620
|
+
/* @__PURE__ */ jsx7(
|
|
2157
2621
|
"input",
|
|
2158
2622
|
{
|
|
2159
2623
|
type: "number",
|
|
@@ -2164,9 +2628,9 @@ function SpacingPlugin() {
|
|
|
2164
2628
|
}
|
|
2165
2629
|
)
|
|
2166
2630
|
] }),
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
/* @__PURE__ */
|
|
2169
|
-
/* @__PURE__ */
|
|
2631
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2632
|
+
/* @__PURE__ */ jsx7("label", { children: "Bottom" }),
|
|
2633
|
+
/* @__PURE__ */ jsx7(
|
|
2170
2634
|
"input",
|
|
2171
2635
|
{
|
|
2172
2636
|
type: "number",
|
|
@@ -2177,9 +2641,9 @@ function SpacingPlugin() {
|
|
|
2177
2641
|
}
|
|
2178
2642
|
)
|
|
2179
2643
|
] }),
|
|
2180
|
-
/* @__PURE__ */
|
|
2181
|
-
/* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsxs7("div", { className: "cms-spacing-control", children: [
|
|
2645
|
+
/* @__PURE__ */ jsx7("label", { children: "Left" }),
|
|
2646
|
+
/* @__PURE__ */ jsx7(
|
|
2183
2647
|
"input",
|
|
2184
2648
|
{
|
|
2185
2649
|
type: "number",
|
|
@@ -2200,7 +2664,7 @@ function SpacingPlugin() {
|
|
|
2200
2664
|
|
|
2201
2665
|
// src/plugins/ExportImportPlugin.tsx
|
|
2202
2666
|
import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
|
|
2203
|
-
import { useState as
|
|
2667
|
+
import { useState as useState8, useCallback as useCallback6, useRef as useRef6, useEffect as useEffect7 } from "react";
|
|
2204
2668
|
import { MdFileDownload, MdFileUpload } from "react-icons/md";
|
|
2205
2669
|
|
|
2206
2670
|
// src/utils/htmlExport.ts
|
|
@@ -2672,19 +3136,19 @@ async function pasteMarkdownFromClipboard(editor) {
|
|
|
2672
3136
|
}
|
|
2673
3137
|
|
|
2674
3138
|
// src/plugins/ExportImportPlugin.tsx
|
|
2675
|
-
import { Fragment as
|
|
3139
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2676
3140
|
function ExportImportPlugin() {
|
|
2677
3141
|
const [editor] = useLexicalComposerContext5();
|
|
2678
|
-
const [showExportMenu, setShowExportMenu] =
|
|
2679
|
-
const [showImportMenu, setShowImportMenu] =
|
|
2680
|
-
const [exportPosition, setExportPosition] =
|
|
2681
|
-
const [importPosition, setImportPosition] =
|
|
2682
|
-
const [notification, setNotification] =
|
|
2683
|
-
const exportRef =
|
|
2684
|
-
const importRef =
|
|
2685
|
-
const fileInputRef =
|
|
2686
|
-
const [importType, setImportType] =
|
|
2687
|
-
|
|
3142
|
+
const [showExportMenu, setShowExportMenu] = useState8(false);
|
|
3143
|
+
const [showImportMenu, setShowImportMenu] = useState8(false);
|
|
3144
|
+
const [exportPosition, setExportPosition] = useState8({ top: 0, left: 0 });
|
|
3145
|
+
const [importPosition, setImportPosition] = useState8({ top: 0, left: 0 });
|
|
3146
|
+
const [notification, setNotification] = useState8(null);
|
|
3147
|
+
const exportRef = useRef6(null);
|
|
3148
|
+
const importRef = useRef6(null);
|
|
3149
|
+
const fileInputRef = useRef6(null);
|
|
3150
|
+
const [importType, setImportType] = useState8("html");
|
|
3151
|
+
useEffect7(() => {
|
|
2688
3152
|
const handleClickOutside = (event) => {
|
|
2689
3153
|
if (exportRef.current && !exportRef.current.contains(event.target)) {
|
|
2690
3154
|
setShowExportMenu(false);
|
|
@@ -2696,7 +3160,7 @@ function ExportImportPlugin() {
|
|
|
2696
3160
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2697
3161
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2698
3162
|
}, []);
|
|
2699
|
-
|
|
3163
|
+
useEffect7(() => {
|
|
2700
3164
|
if (notification) {
|
|
2701
3165
|
const timer = setTimeout(() => setNotification(null), 3e3);
|
|
2702
3166
|
return () => clearTimeout(timer);
|
|
@@ -2705,7 +3169,7 @@ function ExportImportPlugin() {
|
|
|
2705
3169
|
const showNotification = (message) => {
|
|
2706
3170
|
setNotification(message);
|
|
2707
3171
|
};
|
|
2708
|
-
const toggleExportMenu =
|
|
3172
|
+
const toggleExportMenu = useCallback6((event) => {
|
|
2709
3173
|
if (!showExportMenu) {
|
|
2710
3174
|
const button = event.currentTarget;
|
|
2711
3175
|
const rect = button.getBoundingClientRect();
|
|
@@ -2717,7 +3181,7 @@ function ExportImportPlugin() {
|
|
|
2717
3181
|
setShowExportMenu(!showExportMenu);
|
|
2718
3182
|
setShowImportMenu(false);
|
|
2719
3183
|
}, [showExportMenu]);
|
|
2720
|
-
const toggleImportMenu =
|
|
3184
|
+
const toggleImportMenu = useCallback6((event) => {
|
|
2721
3185
|
if (!showImportMenu) {
|
|
2722
3186
|
const button = event.currentTarget;
|
|
2723
3187
|
const rect = button.getBoundingClientRect();
|
|
@@ -2729,22 +3193,22 @@ function ExportImportPlugin() {
|
|
|
2729
3193
|
setShowImportMenu(!showImportMenu);
|
|
2730
3194
|
setShowExportMenu(false);
|
|
2731
3195
|
}, [showImportMenu]);
|
|
2732
|
-
const handleExportHTML =
|
|
3196
|
+
const handleExportHTML = useCallback6(() => {
|
|
2733
3197
|
downloadHTML(editor, "content.html", { includeStyles: false });
|
|
2734
3198
|
setShowExportMenu(false);
|
|
2735
3199
|
showNotification("HTML exported successfully!");
|
|
2736
3200
|
}, [editor]);
|
|
2737
|
-
const handleExportHTMLWithStyles =
|
|
3201
|
+
const handleExportHTMLWithStyles = useCallback6(() => {
|
|
2738
3202
|
downloadHTML(editor, "content.html", { includeStyles: true });
|
|
2739
3203
|
setShowExportMenu(false);
|
|
2740
3204
|
showNotification("HTML with styles exported!");
|
|
2741
3205
|
}, [editor]);
|
|
2742
|
-
const handleExportMarkdown =
|
|
3206
|
+
const handleExportMarkdown = useCallback6(() => {
|
|
2743
3207
|
downloadMarkdown(editor, "content.md");
|
|
2744
3208
|
setShowExportMenu(false);
|
|
2745
3209
|
showNotification("Markdown exported successfully!");
|
|
2746
3210
|
}, [editor]);
|
|
2747
|
-
const handleCopyHTML =
|
|
3211
|
+
const handleCopyHTML = useCallback6(async () => {
|
|
2748
3212
|
const html = exportToHTML(editor);
|
|
2749
3213
|
try {
|
|
2750
3214
|
await navigator.clipboard.writeText(html);
|
|
@@ -2754,15 +3218,15 @@ function ExportImportPlugin() {
|
|
|
2754
3218
|
showNotification("Failed to copy HTML");
|
|
2755
3219
|
}
|
|
2756
3220
|
}, [editor]);
|
|
2757
|
-
const handleCopyMarkdown =
|
|
3221
|
+
const handleCopyMarkdown = useCallback6(async () => {
|
|
2758
3222
|
const success = await copyMarkdownToClipboard(editor);
|
|
2759
3223
|
setShowExportMenu(false);
|
|
2760
3224
|
showNotification(success ? "Markdown copied to clipboard!" : "Failed to copy Markdown");
|
|
2761
3225
|
}, [editor]);
|
|
2762
|
-
const handleImportFile =
|
|
3226
|
+
const handleImportFile = useCallback6(() => {
|
|
2763
3227
|
fileInputRef.current?.click();
|
|
2764
3228
|
}, []);
|
|
2765
|
-
const handleFileChange =
|
|
3229
|
+
const handleFileChange = useCallback6((event) => {
|
|
2766
3230
|
const file = event.target.files?.[0];
|
|
2767
3231
|
if (!file) return;
|
|
2768
3232
|
if (importType === "html") {
|
|
@@ -2792,7 +3256,7 @@ function ExportImportPlugin() {
|
|
|
2792
3256
|
}
|
|
2793
3257
|
event.target.value = "";
|
|
2794
3258
|
}, [editor, importType]);
|
|
2795
|
-
const handlePasteHTML =
|
|
3259
|
+
const handlePasteHTML = useCallback6(async () => {
|
|
2796
3260
|
try {
|
|
2797
3261
|
const html = await navigator.clipboard.readText();
|
|
2798
3262
|
importFromHTML(editor, html);
|
|
@@ -2802,7 +3266,7 @@ function ExportImportPlugin() {
|
|
|
2802
3266
|
showNotification("Failed to paste HTML");
|
|
2803
3267
|
}
|
|
2804
3268
|
}, [editor]);
|
|
2805
|
-
const handlePasteMarkdown =
|
|
3269
|
+
const handlePasteMarkdown = useCallback6(async () => {
|
|
2806
3270
|
try {
|
|
2807
3271
|
const markdown = await navigator.clipboard.readText();
|
|
2808
3272
|
importFromMarkdown(editor, markdown);
|
|
@@ -2812,19 +3276,19 @@ function ExportImportPlugin() {
|
|
|
2812
3276
|
showNotification("Failed to paste Markdown");
|
|
2813
3277
|
}
|
|
2814
3278
|
}, [editor]);
|
|
2815
|
-
return /* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
3279
|
+
return /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
3280
|
+
/* @__PURE__ */ jsxs8("div", { className: "cms-export-import-plugin", ref: exportRef, children: [
|
|
3281
|
+
/* @__PURE__ */ jsx8(
|
|
2818
3282
|
"button",
|
|
2819
3283
|
{
|
|
2820
3284
|
className: "cms-toolbar-button",
|
|
2821
3285
|
onClick: toggleExportMenu,
|
|
2822
3286
|
title: "Export Content",
|
|
2823
3287
|
type: "button",
|
|
2824
|
-
children: /* @__PURE__ */
|
|
3288
|
+
children: /* @__PURE__ */ jsx8(MdFileDownload, { size: 18 })
|
|
2825
3289
|
}
|
|
2826
3290
|
),
|
|
2827
|
-
showExportMenu && /* @__PURE__ */
|
|
3291
|
+
showExportMenu && /* @__PURE__ */ jsxs8(
|
|
2828
3292
|
"div",
|
|
2829
3293
|
{
|
|
2830
3294
|
className: "cms-export-import-menu",
|
|
@@ -2833,79 +3297,79 @@ function ExportImportPlugin() {
|
|
|
2833
3297
|
left: `${exportPosition.left}px`
|
|
2834
3298
|
},
|
|
2835
3299
|
children: [
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
/* @__PURE__ */
|
|
3300
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-header", children: "Export Content" }),
|
|
3301
|
+
/* @__PURE__ */ jsxs8(
|
|
2838
3302
|
"button",
|
|
2839
3303
|
{
|
|
2840
3304
|
className: "cms-export-import-item",
|
|
2841
3305
|
onClick: handleExportHTML,
|
|
2842
3306
|
type: "button",
|
|
2843
3307
|
children: [
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
/* @__PURE__ */
|
|
3308
|
+
/* @__PURE__ */ jsx8("span", { className: "cms-export-import-icon", children: "\u{1F4C4}" }),
|
|
3309
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3310
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-title", children: "HTML" }),
|
|
3311
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-desc", children: "Download as HTML file" })
|
|
2848
3312
|
] })
|
|
2849
3313
|
]
|
|
2850
3314
|
}
|
|
2851
3315
|
),
|
|
2852
|
-
/* @__PURE__ */
|
|
3316
|
+
/* @__PURE__ */ jsxs8(
|
|
2853
3317
|
"button",
|
|
2854
3318
|
{
|
|
2855
3319
|
className: "cms-export-import-item",
|
|
2856
3320
|
onClick: handleExportHTMLWithStyles,
|
|
2857
3321
|
type: "button",
|
|
2858
3322
|
children: [
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
2861
|
-
/* @__PURE__ */
|
|
2862
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ jsx8("span", { className: "cms-export-import-icon", children: "\u{1F3A8}" }),
|
|
3324
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3325
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-title", children: "HTML + Styles" }),
|
|
3326
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-desc", children: "Complete HTML document" })
|
|
2863
3327
|
] })
|
|
2864
3328
|
]
|
|
2865
3329
|
}
|
|
2866
3330
|
),
|
|
2867
|
-
/* @__PURE__ */
|
|
3331
|
+
/* @__PURE__ */ jsxs8(
|
|
2868
3332
|
"button",
|
|
2869
3333
|
{
|
|
2870
3334
|
className: "cms-export-import-item",
|
|
2871
3335
|
onClick: handleExportMarkdown,
|
|
2872
3336
|
type: "button",
|
|
2873
3337
|
children: [
|
|
2874
|
-
/* @__PURE__ */
|
|
2875
|
-
/* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2877
|
-
/* @__PURE__ */
|
|
3338
|
+
/* @__PURE__ */ jsx8("span", { className: "cms-export-import-icon", children: "\u{1F4DD}" }),
|
|
3339
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3340
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-title", children: "Markdown" }),
|
|
3341
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-desc", children: "Download as .md file" })
|
|
2878
3342
|
] })
|
|
2879
3343
|
]
|
|
2880
3344
|
}
|
|
2881
3345
|
),
|
|
2882
|
-
/* @__PURE__ */
|
|
2883
|
-
/* @__PURE__ */
|
|
3346
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-divider" }),
|
|
3347
|
+
/* @__PURE__ */ jsxs8(
|
|
2884
3348
|
"button",
|
|
2885
3349
|
{
|
|
2886
3350
|
className: "cms-export-import-item",
|
|
2887
3351
|
onClick: handleCopyHTML,
|
|
2888
3352
|
type: "button",
|
|
2889
3353
|
children: [
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
/* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
3354
|
+
/* @__PURE__ */ jsx8("span", { className: "cms-export-import-icon", children: "\u{1F4CB}" }),
|
|
3355
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3356
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-title", children: "Copy HTML" }),
|
|
3357
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-desc", children: "Copy to clipboard" })
|
|
2894
3358
|
] })
|
|
2895
3359
|
]
|
|
2896
3360
|
}
|
|
2897
3361
|
),
|
|
2898
|
-
/* @__PURE__ */
|
|
3362
|
+
/* @__PURE__ */ jsxs8(
|
|
2899
3363
|
"button",
|
|
2900
3364
|
{
|
|
2901
3365
|
className: "cms-export-import-item",
|
|
2902
3366
|
onClick: handleCopyMarkdown,
|
|
2903
3367
|
type: "button",
|
|
2904
3368
|
children: [
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
/* @__PURE__ */
|
|
2907
|
-
/* @__PURE__ */
|
|
2908
|
-
/* @__PURE__ */
|
|
3369
|
+
/* @__PURE__ */ jsx8("span", { className: "cms-export-import-icon", children: "\u{1F4CB}" }),
|
|
3370
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3371
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-title", children: "Copy Markdown" }),
|
|
3372
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-desc", children: "Copy to clipboard" })
|
|
2909
3373
|
] })
|
|
2910
3374
|
]
|
|
2911
3375
|
}
|
|
@@ -2914,18 +3378,18 @@ function ExportImportPlugin() {
|
|
|
2914
3378
|
}
|
|
2915
3379
|
)
|
|
2916
3380
|
] }),
|
|
2917
|
-
/* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
3381
|
+
/* @__PURE__ */ jsxs8("div", { className: "cms-export-import-plugin", ref: importRef, children: [
|
|
3382
|
+
/* @__PURE__ */ jsx8(
|
|
2919
3383
|
"button",
|
|
2920
3384
|
{
|
|
2921
3385
|
className: "cms-toolbar-button",
|
|
2922
3386
|
onClick: toggleImportMenu,
|
|
2923
3387
|
title: "Import Content",
|
|
2924
3388
|
type: "button",
|
|
2925
|
-
children: /* @__PURE__ */
|
|
3389
|
+
children: /* @__PURE__ */ jsx8(MdFileUpload, { size: 18 })
|
|
2926
3390
|
}
|
|
2927
3391
|
),
|
|
2928
|
-
showImportMenu && /* @__PURE__ */
|
|
3392
|
+
showImportMenu && /* @__PURE__ */ jsxs8(
|
|
2929
3393
|
"div",
|
|
2930
3394
|
{
|
|
2931
3395
|
className: "cms-export-import-menu",
|
|
@@ -2934,9 +3398,9 @@ function ExportImportPlugin() {
|
|
|
2934
3398
|
left: `${importPosition.left}px`
|
|
2935
3399
|
},
|
|
2936
3400
|
children: [
|
|
2937
|
-
/* @__PURE__ */
|
|
2938
|
-
/* @__PURE__ */
|
|
2939
|
-
/* @__PURE__ */
|
|
3401
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-header", children: "Import Content" }),
|
|
3402
|
+
/* @__PURE__ */ jsxs8("div", { className: "cms-import-type-selector", children: [
|
|
3403
|
+
/* @__PURE__ */ jsx8(
|
|
2940
3404
|
"button",
|
|
2941
3405
|
{
|
|
2942
3406
|
className: `cms-import-type-btn ${importType === "html" ? "active" : ""}`,
|
|
@@ -2945,7 +3409,7 @@ function ExportImportPlugin() {
|
|
|
2945
3409
|
children: "HTML"
|
|
2946
3410
|
}
|
|
2947
3411
|
),
|
|
2948
|
-
/* @__PURE__ */
|
|
3412
|
+
/* @__PURE__ */ jsx8(
|
|
2949
3413
|
"button",
|
|
2950
3414
|
{
|
|
2951
3415
|
className: `cms-import-type-btn ${importType === "markdown" ? "active" : ""}`,
|
|
@@ -2955,17 +3419,17 @@ function ExportImportPlugin() {
|
|
|
2955
3419
|
}
|
|
2956
3420
|
)
|
|
2957
3421
|
] }),
|
|
2958
|
-
/* @__PURE__ */
|
|
3422
|
+
/* @__PURE__ */ jsxs8(
|
|
2959
3423
|
"button",
|
|
2960
3424
|
{
|
|
2961
3425
|
className: "cms-export-import-item",
|
|
2962
3426
|
onClick: handleImportFile,
|
|
2963
3427
|
type: "button",
|
|
2964
3428
|
children: [
|
|
2965
|
-
/* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */
|
|
2967
|
-
/* @__PURE__ */
|
|
2968
|
-
/* @__PURE__ */
|
|
3429
|
+
/* @__PURE__ */ jsx8("span", { className: "cms-export-import-icon", children: "\u{1F4C1}" }),
|
|
3430
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3431
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-title", children: "From File" }),
|
|
3432
|
+
/* @__PURE__ */ jsxs8("div", { className: "cms-export-import-desc", children: [
|
|
2969
3433
|
"Upload ",
|
|
2970
3434
|
importType.toUpperCase(),
|
|
2971
3435
|
" file"
|
|
@@ -2974,17 +3438,17 @@ function ExportImportPlugin() {
|
|
|
2974
3438
|
]
|
|
2975
3439
|
}
|
|
2976
3440
|
),
|
|
2977
|
-
/* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsxs8(
|
|
2978
3442
|
"button",
|
|
2979
3443
|
{
|
|
2980
3444
|
className: "cms-export-import-item",
|
|
2981
3445
|
onClick: importType === "html" ? handlePasteHTML : handlePasteMarkdown,
|
|
2982
3446
|
type: "button",
|
|
2983
3447
|
children: [
|
|
2984
|
-
/* @__PURE__ */
|
|
2985
|
-
/* @__PURE__ */
|
|
2986
|
-
/* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
3448
|
+
/* @__PURE__ */ jsx8("span", { className: "cms-export-import-icon", children: "\u{1F4CB}" }),
|
|
3449
|
+
/* @__PURE__ */ jsxs8("div", { children: [
|
|
3450
|
+
/* @__PURE__ */ jsx8("div", { className: "cms-export-import-title", children: "From Clipboard" }),
|
|
3451
|
+
/* @__PURE__ */ jsxs8("div", { className: "cms-export-import-desc", children: [
|
|
2988
3452
|
"Paste ",
|
|
2989
3453
|
importType.toUpperCase()
|
|
2990
3454
|
] })
|
|
@@ -2995,7 +3459,7 @@ function ExportImportPlugin() {
|
|
|
2995
3459
|
]
|
|
2996
3460
|
}
|
|
2997
3461
|
),
|
|
2998
|
-
/* @__PURE__ */
|
|
3462
|
+
/* @__PURE__ */ jsx8(
|
|
2999
3463
|
"input",
|
|
3000
3464
|
{
|
|
3001
3465
|
ref: fileInputRef,
|
|
@@ -3006,13 +3470,13 @@ function ExportImportPlugin() {
|
|
|
3006
3470
|
}
|
|
3007
3471
|
)
|
|
3008
3472
|
] }),
|
|
3009
|
-
notification && /* @__PURE__ */
|
|
3473
|
+
notification && /* @__PURE__ */ jsx8("div", { className: "cms-export-import-notification", children: notification })
|
|
3010
3474
|
] });
|
|
3011
3475
|
}
|
|
3012
3476
|
|
|
3013
3477
|
// src/plugins/SectionCreatorPlugin.tsx
|
|
3014
3478
|
import { useLexicalComposerContext as useLexicalComposerContext6 } from "@lexical/react/LexicalComposerContext";
|
|
3015
|
-
import { useState as
|
|
3479
|
+
import { useState as useState9, useCallback as useCallback7, useRef as useRef7, useEffect as useEffect8 } from "react";
|
|
3016
3480
|
import { $getSelection as $getSelection4, $isRangeSelection as $isRangeSelection4, $createParagraphNode as $createParagraphNode3 } from "lexical";
|
|
3017
3481
|
|
|
3018
3482
|
// src/blocks/SectionNode.tsx
|
|
@@ -3593,13 +4057,13 @@ var SECTION_TEMPLATES = [
|
|
|
3593
4057
|
// src/plugins/SectionCreatorPlugin.tsx
|
|
3594
4058
|
import { $generateNodesFromDOM as $generateNodesFromDOM2 } from "@lexical/html";
|
|
3595
4059
|
import { MdViewModule } from "react-icons/md";
|
|
3596
|
-
import { jsx as
|
|
4060
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3597
4061
|
function SectionCreatorPlugin() {
|
|
3598
4062
|
const [editor] = useLexicalComposerContext6();
|
|
3599
|
-
const [showSectionMenu, setShowSectionMenu] =
|
|
3600
|
-
const [sectionPosition, setSectionPosition] =
|
|
3601
|
-
const sectionRef =
|
|
3602
|
-
|
|
4063
|
+
const [showSectionMenu, setShowSectionMenu] = useState9(false);
|
|
4064
|
+
const [sectionPosition, setSectionPosition] = useState9({ top: 0, left: 0 });
|
|
4065
|
+
const sectionRef = useRef7(null);
|
|
4066
|
+
useEffect8(() => {
|
|
3603
4067
|
const handleClickOutside = (event) => {
|
|
3604
4068
|
if (sectionRef.current && !sectionRef.current.contains(event.target)) {
|
|
3605
4069
|
setShowSectionMenu(false);
|
|
@@ -3608,7 +4072,7 @@ function SectionCreatorPlugin() {
|
|
|
3608
4072
|
document.addEventListener("mousedown", handleClickOutside);
|
|
3609
4073
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3610
4074
|
}, []);
|
|
3611
|
-
const toggleSectionMenu =
|
|
4075
|
+
const toggleSectionMenu = useCallback7((event) => {
|
|
3612
4076
|
if (!showSectionMenu) {
|
|
3613
4077
|
const button = event.currentTarget;
|
|
3614
4078
|
const rect = button.getBoundingClientRect();
|
|
@@ -3619,7 +4083,7 @@ function SectionCreatorPlugin() {
|
|
|
3619
4083
|
}
|
|
3620
4084
|
setShowSectionMenu(!showSectionMenu);
|
|
3621
4085
|
}, [showSectionMenu]);
|
|
3622
|
-
const insertSection =
|
|
4086
|
+
const insertSection = useCallback7((template) => {
|
|
3623
4087
|
editor.update(() => {
|
|
3624
4088
|
const selection = $getSelection4();
|
|
3625
4089
|
if ($isRangeSelection4(selection)) {
|
|
@@ -3642,18 +4106,18 @@ function SectionCreatorPlugin() {
|
|
|
3642
4106
|
});
|
|
3643
4107
|
setShowSectionMenu(false);
|
|
3644
4108
|
}, [editor]);
|
|
3645
|
-
return /* @__PURE__ */
|
|
3646
|
-
/* @__PURE__ */
|
|
4109
|
+
return /* @__PURE__ */ jsxs9("div", { className: "cms-section-creator-plugin", ref: sectionRef, children: [
|
|
4110
|
+
/* @__PURE__ */ jsx9(
|
|
3647
4111
|
"button",
|
|
3648
4112
|
{
|
|
3649
4113
|
className: "cms-toolbar-button",
|
|
3650
4114
|
onClick: toggleSectionMenu,
|
|
3651
4115
|
title: "Insert Section",
|
|
3652
4116
|
type: "button",
|
|
3653
|
-
children: /* @__PURE__ */
|
|
4117
|
+
children: /* @__PURE__ */ jsx9(MdViewModule, { size: 18 })
|
|
3654
4118
|
}
|
|
3655
4119
|
),
|
|
3656
|
-
showSectionMenu && /* @__PURE__ */
|
|
4120
|
+
showSectionMenu && /* @__PURE__ */ jsxs9(
|
|
3657
4121
|
"div",
|
|
3658
4122
|
{
|
|
3659
4123
|
className: "cms-section-menu",
|
|
@@ -3662,24 +4126,24 @@ function SectionCreatorPlugin() {
|
|
|
3662
4126
|
left: `${sectionPosition.left}px`
|
|
3663
4127
|
},
|
|
3664
4128
|
children: [
|
|
3665
|
-
/* @__PURE__ */
|
|
3666
|
-
/* @__PURE__ */
|
|
4129
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-section-menu-header", children: /* @__PURE__ */ jsx9("span", { children: "Insert Section" }) }),
|
|
4130
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-section-grid", children: SECTION_TEMPLATES.map((template) => /* @__PURE__ */ jsxs9(
|
|
3667
4131
|
"button",
|
|
3668
4132
|
{
|
|
3669
4133
|
className: "cms-section-card",
|
|
3670
4134
|
onClick: () => insertSection(template),
|
|
3671
4135
|
type: "button",
|
|
3672
4136
|
children: [
|
|
3673
|
-
/* @__PURE__ */
|
|
3674
|
-
/* @__PURE__ */
|
|
3675
|
-
/* @__PURE__ */
|
|
3676
|
-
/* @__PURE__ */
|
|
4137
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-section-card-icon", children: template.icon }),
|
|
4138
|
+
/* @__PURE__ */ jsxs9("div", { className: "cms-section-card-content", children: [
|
|
4139
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-section-card-title", children: template.name }),
|
|
4140
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-section-card-desc", children: template.description })
|
|
3677
4141
|
] })
|
|
3678
4142
|
]
|
|
3679
4143
|
},
|
|
3680
4144
|
template.type
|
|
3681
4145
|
)) }),
|
|
3682
|
-
/* @__PURE__ */
|
|
4146
|
+
/* @__PURE__ */ jsx9("div", { className: "cms-section-menu-footer", children: /* @__PURE__ */ jsx9("p", { children: "\u{1F4A1} Tip: Sections are fully editable after insertion" }) })
|
|
3683
4147
|
]
|
|
3684
4148
|
}
|
|
3685
4149
|
)
|
|
@@ -3688,21 +4152,21 @@ function SectionCreatorPlugin() {
|
|
|
3688
4152
|
|
|
3689
4153
|
// src/plugins/TablePlugin.tsx
|
|
3690
4154
|
import { useLexicalComposerContext as useLexicalComposerContext7 } from "@lexical/react/LexicalComposerContext";
|
|
3691
|
-
import { useState as
|
|
4155
|
+
import { useState as useState10, useCallback as useCallback8, useRef as useRef8, useEffect as useEffect9 } from "react";
|
|
3692
4156
|
import { $getSelection as $getSelection5, $isRangeSelection as $isRangeSelection5, $createParagraphNode as $createParagraphNode4 } from "lexical";
|
|
3693
4157
|
import {
|
|
3694
4158
|
$createTableNodeWithDimensions
|
|
3695
4159
|
} from "@lexical/table";
|
|
3696
4160
|
import { MdTableChart } from "react-icons/md";
|
|
3697
|
-
import { Fragment as
|
|
4161
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3698
4162
|
function TablePlugin() {
|
|
3699
4163
|
const [editor] = useLexicalComposerContext7();
|
|
3700
|
-
const [showModal, setShowModal] =
|
|
3701
|
-
const [rows, setRows] =
|
|
3702
|
-
const [columns, setColumns] =
|
|
3703
|
-
const [includeHeaders, setIncludeHeaders] =
|
|
3704
|
-
const modalRef =
|
|
3705
|
-
|
|
4164
|
+
const [showModal, setShowModal] = useState10(false);
|
|
4165
|
+
const [rows, setRows] = useState10(3);
|
|
4166
|
+
const [columns, setColumns] = useState10(3);
|
|
4167
|
+
const [includeHeaders, setIncludeHeaders] = useState10(true);
|
|
4168
|
+
const modalRef = useRef8(null);
|
|
4169
|
+
useEffect9(() => {
|
|
3706
4170
|
const handleClickOutside = (event) => {
|
|
3707
4171
|
if (modalRef.current && !modalRef.current.contains(event.target)) {
|
|
3708
4172
|
setShowModal(false);
|
|
@@ -3711,13 +4175,13 @@ function TablePlugin() {
|
|
|
3711
4175
|
document.addEventListener("mousedown", handleClickOutside);
|
|
3712
4176
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3713
4177
|
}, []);
|
|
3714
|
-
const openModal =
|
|
4178
|
+
const openModal = useCallback8(() => {
|
|
3715
4179
|
setShowModal(true);
|
|
3716
4180
|
setRows(3);
|
|
3717
4181
|
setColumns(3);
|
|
3718
4182
|
setIncludeHeaders(true);
|
|
3719
4183
|
}, []);
|
|
3720
|
-
const insertTable =
|
|
4184
|
+
const insertTable = useCallback8(() => {
|
|
3721
4185
|
editor.update(() => {
|
|
3722
4186
|
const selection = $getSelection5();
|
|
3723
4187
|
if ($isRangeSelection5(selection)) {
|
|
@@ -3733,7 +4197,7 @@ function TablePlugin() {
|
|
|
3733
4197
|
});
|
|
3734
4198
|
setShowModal(false);
|
|
3735
4199
|
}, [editor, rows, columns, includeHeaders]);
|
|
3736
|
-
const handleKeyDown =
|
|
4200
|
+
const handleKeyDown = useCallback8((e) => {
|
|
3737
4201
|
if (e.key === "Enter") {
|
|
3738
4202
|
e.preventDefault();
|
|
3739
4203
|
insertTable();
|
|
@@ -3741,31 +4205,31 @@ function TablePlugin() {
|
|
|
3741
4205
|
setShowModal(false);
|
|
3742
4206
|
}
|
|
3743
4207
|
}, [insertTable]);
|
|
3744
|
-
return /* @__PURE__ */
|
|
3745
|
-
/* @__PURE__ */
|
|
4208
|
+
return /* @__PURE__ */ jsxs10("div", { className: "cms-table-plugin", ref: modalRef, children: [
|
|
4209
|
+
/* @__PURE__ */ jsx10(
|
|
3746
4210
|
"button",
|
|
3747
4211
|
{
|
|
3748
4212
|
className: "cms-toolbar-button",
|
|
3749
4213
|
onClick: openModal,
|
|
3750
4214
|
title: "Insert Table",
|
|
3751
4215
|
type: "button",
|
|
3752
|
-
children: /* @__PURE__ */
|
|
4216
|
+
children: /* @__PURE__ */ jsx10(MdTableChart, { size: 18 })
|
|
3753
4217
|
}
|
|
3754
4218
|
),
|
|
3755
|
-
showModal && /* @__PURE__ */
|
|
3756
|
-
/* @__PURE__ */
|
|
3757
|
-
/* @__PURE__ */
|
|
3758
|
-
/* @__PURE__ */
|
|
3759
|
-
/* @__PURE__ */
|
|
3760
|
-
/* @__PURE__ */
|
|
3761
|
-
/* @__PURE__ */
|
|
4219
|
+
showModal && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4220
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-modal-backdrop", onClick: () => setShowModal(false) }),
|
|
4221
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-table-modal", children: [
|
|
4222
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-table-modal-header", children: /* @__PURE__ */ jsx10("span", { children: "Insert Table" }) }),
|
|
4223
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-table-modal-content", children: [
|
|
4224
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-table-preview", children: [
|
|
4225
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-table-preview-grid", children: Array.from({ length: rows }).map((_, rowIndex) => /* @__PURE__ */ jsx10("div", { className: "cms-table-preview-row", children: Array.from({ length: columns }).map((_2, colIndex) => /* @__PURE__ */ jsx10(
|
|
3762
4226
|
"div",
|
|
3763
4227
|
{
|
|
3764
4228
|
className: `cms-table-preview-cell ${includeHeaders && rowIndex === 0 ? "header" : ""}`
|
|
3765
4229
|
},
|
|
3766
4230
|
colIndex
|
|
3767
4231
|
)) }, rowIndex)) }),
|
|
3768
|
-
/* @__PURE__ */
|
|
4232
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-table-preview-label", children: [
|
|
3769
4233
|
rows,
|
|
3770
4234
|
" \xD7 ",
|
|
3771
4235
|
columns,
|
|
@@ -3773,10 +4237,10 @@ function TablePlugin() {
|
|
|
3773
4237
|
includeHeaders ? "(with headers)" : ""
|
|
3774
4238
|
] })
|
|
3775
4239
|
] }),
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
/* @__PURE__ */
|
|
3778
|
-
/* @__PURE__ */
|
|
3779
|
-
/* @__PURE__ */
|
|
4240
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-form-group", children: [
|
|
4241
|
+
/* @__PURE__ */ jsx10("label", { htmlFor: "table-rows", children: "Rows" }),
|
|
4242
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-number-input-group", children: [
|
|
4243
|
+
/* @__PURE__ */ jsx10(
|
|
3780
4244
|
"button",
|
|
3781
4245
|
{
|
|
3782
4246
|
onClick: () => setRows(Math.max(1, rows - 1)),
|
|
@@ -3785,7 +4249,7 @@ function TablePlugin() {
|
|
|
3785
4249
|
children: "\u2212"
|
|
3786
4250
|
}
|
|
3787
4251
|
),
|
|
3788
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx10(
|
|
3789
4253
|
"input",
|
|
3790
4254
|
{
|
|
3791
4255
|
id: "table-rows",
|
|
@@ -3798,7 +4262,7 @@ function TablePlugin() {
|
|
|
3798
4262
|
className: "cms-number-input"
|
|
3799
4263
|
}
|
|
3800
4264
|
),
|
|
3801
|
-
/* @__PURE__ */
|
|
4265
|
+
/* @__PURE__ */ jsx10(
|
|
3802
4266
|
"button",
|
|
3803
4267
|
{
|
|
3804
4268
|
onClick: () => setRows(Math.min(20, rows + 1)),
|
|
@@ -3809,10 +4273,10 @@ function TablePlugin() {
|
|
|
3809
4273
|
)
|
|
3810
4274
|
] })
|
|
3811
4275
|
] }),
|
|
3812
|
-
/* @__PURE__ */
|
|
3813
|
-
/* @__PURE__ */
|
|
3814
|
-
/* @__PURE__ */
|
|
3815
|
-
/* @__PURE__ */
|
|
4276
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-form-group", children: [
|
|
4277
|
+
/* @__PURE__ */ jsx10("label", { htmlFor: "table-columns", children: "Columns" }),
|
|
4278
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-number-input-group", children: [
|
|
4279
|
+
/* @__PURE__ */ jsx10(
|
|
3816
4280
|
"button",
|
|
3817
4281
|
{
|
|
3818
4282
|
onClick: () => setColumns(Math.max(1, columns - 1)),
|
|
@@ -3821,7 +4285,7 @@ function TablePlugin() {
|
|
|
3821
4285
|
children: "\u2212"
|
|
3822
4286
|
}
|
|
3823
4287
|
),
|
|
3824
|
-
/* @__PURE__ */
|
|
4288
|
+
/* @__PURE__ */ jsx10(
|
|
3825
4289
|
"input",
|
|
3826
4290
|
{
|
|
3827
4291
|
id: "table-columns",
|
|
@@ -3834,7 +4298,7 @@ function TablePlugin() {
|
|
|
3834
4298
|
className: "cms-number-input"
|
|
3835
4299
|
}
|
|
3836
4300
|
),
|
|
3837
|
-
/* @__PURE__ */
|
|
4301
|
+
/* @__PURE__ */ jsx10(
|
|
3838
4302
|
"button",
|
|
3839
4303
|
{
|
|
3840
4304
|
onClick: () => setColumns(Math.min(10, columns + 1)),
|
|
@@ -3845,8 +4309,8 @@ function TablePlugin() {
|
|
|
3845
4309
|
)
|
|
3846
4310
|
] })
|
|
3847
4311
|
] }),
|
|
3848
|
-
/* @__PURE__ */
|
|
3849
|
-
/* @__PURE__ */
|
|
4312
|
+
/* @__PURE__ */ jsx10("div", { className: "cms-form-group", children: /* @__PURE__ */ jsxs10("label", { className: "cms-checkbox-label", children: [
|
|
4313
|
+
/* @__PURE__ */ jsx10(
|
|
3850
4314
|
"input",
|
|
3851
4315
|
{
|
|
3852
4316
|
type: "checkbox",
|
|
@@ -3855,12 +4319,12 @@ function TablePlugin() {
|
|
|
3855
4319
|
className: "cms-checkbox"
|
|
3856
4320
|
}
|
|
3857
4321
|
),
|
|
3858
|
-
/* @__PURE__ */
|
|
4322
|
+
/* @__PURE__ */ jsx10("span", { children: "Include header row" })
|
|
3859
4323
|
] }) }),
|
|
3860
|
-
/* @__PURE__ */
|
|
3861
|
-
/* @__PURE__ */
|
|
3862
|
-
/* @__PURE__ */
|
|
3863
|
-
/* @__PURE__ */
|
|
4324
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-table-presets", children: [
|
|
4325
|
+
/* @__PURE__ */ jsx10("p", { className: "cms-table-presets-title", children: "Quick Presets:" }),
|
|
4326
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-table-preset-buttons", children: [
|
|
4327
|
+
/* @__PURE__ */ jsx10(
|
|
3864
4328
|
"button",
|
|
3865
4329
|
{
|
|
3866
4330
|
onClick: () => {
|
|
@@ -3873,7 +4337,7 @@ function TablePlugin() {
|
|
|
3873
4337
|
children: "3\xD73"
|
|
3874
4338
|
}
|
|
3875
4339
|
),
|
|
3876
|
-
/* @__PURE__ */
|
|
4340
|
+
/* @__PURE__ */ jsx10(
|
|
3877
4341
|
"button",
|
|
3878
4342
|
{
|
|
3879
4343
|
onClick: () => {
|
|
@@ -3886,7 +4350,7 @@ function TablePlugin() {
|
|
|
3886
4350
|
children: "5\xD73"
|
|
3887
4351
|
}
|
|
3888
4352
|
),
|
|
3889
|
-
/* @__PURE__ */
|
|
4353
|
+
/* @__PURE__ */ jsx10(
|
|
3890
4354
|
"button",
|
|
3891
4355
|
{
|
|
3892
4356
|
onClick: () => {
|
|
@@ -3899,7 +4363,7 @@ function TablePlugin() {
|
|
|
3899
4363
|
children: "4\xD74"
|
|
3900
4364
|
}
|
|
3901
4365
|
),
|
|
3902
|
-
/* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsx10(
|
|
3903
4367
|
"button",
|
|
3904
4368
|
{
|
|
3905
4369
|
onClick: () => {
|
|
@@ -3914,8 +4378,8 @@ function TablePlugin() {
|
|
|
3914
4378
|
)
|
|
3915
4379
|
] })
|
|
3916
4380
|
] }),
|
|
3917
|
-
/* @__PURE__ */
|
|
3918
|
-
/* @__PURE__ */
|
|
4381
|
+
/* @__PURE__ */ jsxs10("div", { className: "cms-modal-actions", children: [
|
|
4382
|
+
/* @__PURE__ */ jsx10(
|
|
3919
4383
|
"button",
|
|
3920
4384
|
{
|
|
3921
4385
|
onClick: () => setShowModal(false),
|
|
@@ -3924,7 +4388,7 @@ function TablePlugin() {
|
|
|
3924
4388
|
children: "Cancel"
|
|
3925
4389
|
}
|
|
3926
4390
|
),
|
|
3927
|
-
/* @__PURE__ */
|
|
4391
|
+
/* @__PURE__ */ jsx10(
|
|
3928
4392
|
"button",
|
|
3929
4393
|
{
|
|
3930
4394
|
onClick: insertTable,
|
|
@@ -3941,7 +4405,7 @@ function TablePlugin() {
|
|
|
3941
4405
|
}
|
|
3942
4406
|
|
|
3943
4407
|
// src/plugins/ToolbarPlugin.tsx
|
|
3944
|
-
import { useState as
|
|
4408
|
+
import { useState as useState11, useCallback as useCallback9, useEffect as useEffect10 } from "react";
|
|
3945
4409
|
import {
|
|
3946
4410
|
MdUndo,
|
|
3947
4411
|
MdRedo,
|
|
@@ -3970,18 +4434,18 @@ import {
|
|
|
3970
4434
|
LuHeading2,
|
|
3971
4435
|
LuHeading3
|
|
3972
4436
|
} from "react-icons/lu";
|
|
3973
|
-
import { jsx as
|
|
4437
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3974
4438
|
function ToolbarPlugin() {
|
|
3975
4439
|
const [editor] = useLexicalComposerContext8();
|
|
3976
|
-
const [isBold, setIsBold] =
|
|
3977
|
-
const [isItalic, setIsItalic] =
|
|
3978
|
-
const [isUnderline, setIsUnderline] =
|
|
3979
|
-
const [isStrikethrough, setIsStrikethrough] =
|
|
3980
|
-
const [isCode, setIsCode] =
|
|
3981
|
-
const [blockType, setBlockType] =
|
|
3982
|
-
const [showLayoutMenu, setShowLayoutMenu] =
|
|
3983
|
-
const [layoutMenuPosition, setLayoutMenuPosition] =
|
|
3984
|
-
|
|
4440
|
+
const [isBold, setIsBold] = useState11(false);
|
|
4441
|
+
const [isItalic, setIsItalic] = useState11(false);
|
|
4442
|
+
const [isUnderline, setIsUnderline] = useState11(false);
|
|
4443
|
+
const [isStrikethrough, setIsStrikethrough] = useState11(false);
|
|
4444
|
+
const [isCode, setIsCode] = useState11(false);
|
|
4445
|
+
const [blockType, setBlockType] = useState11("paragraph");
|
|
4446
|
+
const [showLayoutMenu, setShowLayoutMenu] = useState11(false);
|
|
4447
|
+
const [layoutMenuPosition, setLayoutMenuPosition] = useState11({ top: 0, left: 0 });
|
|
4448
|
+
useEffect10(() => {
|
|
3985
4449
|
return editor.registerUpdateListener(({ editorState }) => {
|
|
3986
4450
|
editorState.read(() => {
|
|
3987
4451
|
const selection = $getSelection6();
|
|
@@ -3995,7 +4459,7 @@ function ToolbarPlugin() {
|
|
|
3995
4459
|
});
|
|
3996
4460
|
});
|
|
3997
4461
|
}, [editor]);
|
|
3998
|
-
const handleImageUpload =
|
|
4462
|
+
const handleImageUpload = useCallback9(() => {
|
|
3999
4463
|
const input = document.createElement("input");
|
|
4000
4464
|
input.type = "file";
|
|
4001
4465
|
input.accept = "image/*";
|
|
@@ -4020,7 +4484,7 @@ function ToolbarPlugin() {
|
|
|
4020
4484
|
};
|
|
4021
4485
|
input.click();
|
|
4022
4486
|
}, [editor]);
|
|
4023
|
-
const formatHeading =
|
|
4487
|
+
const formatHeading = useCallback9((level) => {
|
|
4024
4488
|
editor.update(() => {
|
|
4025
4489
|
const selection = $getSelection6();
|
|
4026
4490
|
if ($isRangeSelection6(selection)) {
|
|
@@ -4029,7 +4493,7 @@ function ToolbarPlugin() {
|
|
|
4029
4493
|
});
|
|
4030
4494
|
setBlockType(level);
|
|
4031
4495
|
}, [editor]);
|
|
4032
|
-
const formatParagraph =
|
|
4496
|
+
const formatParagraph = useCallback9(() => {
|
|
4033
4497
|
editor.update(() => {
|
|
4034
4498
|
const selection = $getSelection6();
|
|
4035
4499
|
if ($isRangeSelection6(selection)) {
|
|
@@ -4038,7 +4502,7 @@ function ToolbarPlugin() {
|
|
|
4038
4502
|
});
|
|
4039
4503
|
setBlockType("paragraph");
|
|
4040
4504
|
}, [editor]);
|
|
4041
|
-
const formatQuote =
|
|
4505
|
+
const formatQuote = useCallback9(() => {
|
|
4042
4506
|
editor.update(() => {
|
|
4043
4507
|
const selection = $getSelection6();
|
|
4044
4508
|
if ($isRangeSelection6(selection)) {
|
|
@@ -4047,7 +4511,7 @@ function ToolbarPlugin() {
|
|
|
4047
4511
|
});
|
|
4048
4512
|
setBlockType("quote");
|
|
4049
4513
|
}, [editor]);
|
|
4050
|
-
const formatCode =
|
|
4514
|
+
const formatCode = useCallback9(() => {
|
|
4051
4515
|
editor.update(() => {
|
|
4052
4516
|
const selection = $getSelection6();
|
|
4053
4517
|
if ($isRangeSelection6(selection)) {
|
|
@@ -4056,45 +4520,45 @@ function ToolbarPlugin() {
|
|
|
4056
4520
|
});
|
|
4057
4521
|
setBlockType("code");
|
|
4058
4522
|
}, [editor]);
|
|
4059
|
-
const formatBold =
|
|
4523
|
+
const formatBold = useCallback9(() => {
|
|
4060
4524
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
4061
4525
|
}, [editor]);
|
|
4062
|
-
const formatItalic =
|
|
4526
|
+
const formatItalic = useCallback9(() => {
|
|
4063
4527
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic");
|
|
4064
4528
|
}, [editor]);
|
|
4065
|
-
const formatUnderline =
|
|
4529
|
+
const formatUnderline = useCallback9(() => {
|
|
4066
4530
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline");
|
|
4067
4531
|
}, [editor]);
|
|
4068
|
-
const formatStrikethrough =
|
|
4532
|
+
const formatStrikethrough = useCallback9(() => {
|
|
4069
4533
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough");
|
|
4070
4534
|
}, [editor]);
|
|
4071
|
-
const formatInlineCode =
|
|
4535
|
+
const formatInlineCode = useCallback9(() => {
|
|
4072
4536
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "code");
|
|
4073
4537
|
}, [editor]);
|
|
4074
|
-
const formatBulletList =
|
|
4538
|
+
const formatBulletList = useCallback9(() => {
|
|
4075
4539
|
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, void 0);
|
|
4076
4540
|
}, [editor]);
|
|
4077
|
-
const formatNumberedList =
|
|
4541
|
+
const formatNumberedList = useCallback9(() => {
|
|
4078
4542
|
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
4079
4543
|
}, [editor]);
|
|
4080
|
-
const formatAlignLeft =
|
|
4544
|
+
const formatAlignLeft = useCallback9(() => {
|
|
4081
4545
|
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "left");
|
|
4082
4546
|
}, [editor]);
|
|
4083
|
-
const formatAlignCenter =
|
|
4547
|
+
const formatAlignCenter = useCallback9(() => {
|
|
4084
4548
|
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "center");
|
|
4085
4549
|
}, [editor]);
|
|
4086
|
-
const formatAlignRight =
|
|
4550
|
+
const formatAlignRight = useCallback9(() => {
|
|
4087
4551
|
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "right");
|
|
4088
4552
|
}, [editor]);
|
|
4089
|
-
const formatAlignJustify =
|
|
4553
|
+
const formatAlignJustify = useCallback9(() => {
|
|
4090
4554
|
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, "justify");
|
|
4091
4555
|
}, [editor]);
|
|
4092
|
-
const insertLink =
|
|
4556
|
+
const insertLink = useCallback9(() => {
|
|
4093
4557
|
if (window.__insertLink) {
|
|
4094
4558
|
window.__insertLink();
|
|
4095
4559
|
}
|
|
4096
4560
|
}, []);
|
|
4097
|
-
const insertLayout =
|
|
4561
|
+
const insertLayout = useCallback9((layoutType) => {
|
|
4098
4562
|
editor.update(() => {
|
|
4099
4563
|
const selection = $getSelection6();
|
|
4100
4564
|
if ($isRangeSelection6(selection)) {
|
|
@@ -4115,7 +4579,7 @@ function ToolbarPlugin() {
|
|
|
4115
4579
|
});
|
|
4116
4580
|
setShowLayoutMenu(false);
|
|
4117
4581
|
}, [editor]);
|
|
4118
|
-
const toggleLayoutMenu =
|
|
4582
|
+
const toggleLayoutMenu = useCallback9((event) => {
|
|
4119
4583
|
if (!showLayoutMenu) {
|
|
4120
4584
|
const button = event.currentTarget;
|
|
4121
4585
|
const rect = button.getBoundingClientRect();
|
|
@@ -4126,248 +4590,248 @@ function ToolbarPlugin() {
|
|
|
4126
4590
|
}
|
|
4127
4591
|
setShowLayoutMenu(!showLayoutMenu);
|
|
4128
4592
|
}, [showLayoutMenu]);
|
|
4129
|
-
const handleUndo =
|
|
4593
|
+
const handleUndo = useCallback9(() => {
|
|
4130
4594
|
editor.dispatchCommand(UNDO_COMMAND, void 0);
|
|
4131
4595
|
}, [editor]);
|
|
4132
|
-
const handleRedo =
|
|
4596
|
+
const handleRedo = useCallback9(() => {
|
|
4133
4597
|
editor.dispatchCommand(REDO_COMMAND, void 0);
|
|
4134
4598
|
}, [editor]);
|
|
4135
|
-
return /* @__PURE__ */
|
|
4136
|
-
/* @__PURE__ */
|
|
4599
|
+
return /* @__PURE__ */ jsxs11("div", { className: "cms-toolbar", children: [
|
|
4600
|
+
/* @__PURE__ */ jsx11(
|
|
4137
4601
|
"button",
|
|
4138
4602
|
{
|
|
4139
4603
|
className: "cms-toolbar-button",
|
|
4140
4604
|
onClick: handleUndo,
|
|
4141
4605
|
title: "Undo (Cmd+Z)",
|
|
4142
4606
|
type: "button",
|
|
4143
|
-
children: /* @__PURE__ */
|
|
4607
|
+
children: /* @__PURE__ */ jsx11(MdUndo, { size: 18 })
|
|
4144
4608
|
}
|
|
4145
4609
|
),
|
|
4146
|
-
/* @__PURE__ */
|
|
4610
|
+
/* @__PURE__ */ jsx11(
|
|
4147
4611
|
"button",
|
|
4148
4612
|
{
|
|
4149
4613
|
className: "cms-toolbar-button",
|
|
4150
4614
|
onClick: handleRedo,
|
|
4151
4615
|
title: "Redo (Cmd+Shift+Z)",
|
|
4152
4616
|
type: "button",
|
|
4153
|
-
children: /* @__PURE__ */
|
|
4617
|
+
children: /* @__PURE__ */ jsx11(MdRedo, { size: 18 })
|
|
4154
4618
|
}
|
|
4155
4619
|
),
|
|
4156
|
-
/* @__PURE__ */
|
|
4157
|
-
/* @__PURE__ */
|
|
4620
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4621
|
+
/* @__PURE__ */ jsx11(
|
|
4158
4622
|
"button",
|
|
4159
4623
|
{
|
|
4160
4624
|
className: `cms-toolbar-button ${blockType === "paragraph" ? "active" : ""}`,
|
|
4161
4625
|
onClick: formatParagraph,
|
|
4162
4626
|
title: "Paragraph",
|
|
4163
4627
|
type: "button",
|
|
4164
|
-
children: /* @__PURE__ */
|
|
4628
|
+
children: /* @__PURE__ */ jsx11(BiParagraph, { size: 18 })
|
|
4165
4629
|
}
|
|
4166
4630
|
),
|
|
4167
|
-
/* @__PURE__ */
|
|
4631
|
+
/* @__PURE__ */ jsx11(
|
|
4168
4632
|
"button",
|
|
4169
4633
|
{
|
|
4170
4634
|
className: `cms-toolbar-button ${blockType === "h1" ? "active" : ""}`,
|
|
4171
4635
|
onClick: () => formatHeading("h1"),
|
|
4172
4636
|
title: "Heading 1",
|
|
4173
4637
|
type: "button",
|
|
4174
|
-
children: /* @__PURE__ */
|
|
4638
|
+
children: /* @__PURE__ */ jsx11(LuHeading1, { size: 18 })
|
|
4175
4639
|
}
|
|
4176
4640
|
),
|
|
4177
|
-
/* @__PURE__ */
|
|
4641
|
+
/* @__PURE__ */ jsx11(
|
|
4178
4642
|
"button",
|
|
4179
4643
|
{
|
|
4180
4644
|
className: `cms-toolbar-button ${blockType === "h2" ? "active" : ""}`,
|
|
4181
4645
|
onClick: () => formatHeading("h2"),
|
|
4182
4646
|
title: "Heading 2",
|
|
4183
4647
|
type: "button",
|
|
4184
|
-
children: /* @__PURE__ */
|
|
4648
|
+
children: /* @__PURE__ */ jsx11(LuHeading2, { size: 18 })
|
|
4185
4649
|
}
|
|
4186
4650
|
),
|
|
4187
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsx11(
|
|
4188
4652
|
"button",
|
|
4189
4653
|
{
|
|
4190
4654
|
className: `cms-toolbar-button ${blockType === "h3" ? "active" : ""}`,
|
|
4191
4655
|
onClick: () => formatHeading("h3"),
|
|
4192
4656
|
title: "Heading 3",
|
|
4193
4657
|
type: "button",
|
|
4194
|
-
children: /* @__PURE__ */
|
|
4658
|
+
children: /* @__PURE__ */ jsx11(LuHeading3, { size: 18 })
|
|
4195
4659
|
}
|
|
4196
4660
|
),
|
|
4197
|
-
/* @__PURE__ */
|
|
4198
|
-
/* @__PURE__ */
|
|
4661
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4662
|
+
/* @__PURE__ */ jsx11(
|
|
4199
4663
|
"button",
|
|
4200
4664
|
{
|
|
4201
4665
|
className: `cms-toolbar-button ${isBold ? "active" : ""}`,
|
|
4202
4666
|
onClick: formatBold,
|
|
4203
4667
|
title: "Bold (Cmd+B)",
|
|
4204
4668
|
type: "button",
|
|
4205
|
-
children: /* @__PURE__ */
|
|
4669
|
+
children: /* @__PURE__ */ jsx11(MdFormatBold, { size: 18 })
|
|
4206
4670
|
}
|
|
4207
4671
|
),
|
|
4208
|
-
/* @__PURE__ */
|
|
4672
|
+
/* @__PURE__ */ jsx11(
|
|
4209
4673
|
"button",
|
|
4210
4674
|
{
|
|
4211
4675
|
className: `cms-toolbar-button ${isItalic ? "active" : ""}`,
|
|
4212
4676
|
onClick: formatItalic,
|
|
4213
4677
|
title: "Italic (Cmd+I)",
|
|
4214
4678
|
type: "button",
|
|
4215
|
-
children: /* @__PURE__ */
|
|
4679
|
+
children: /* @__PURE__ */ jsx11(MdFormatItalic, { size: 18 })
|
|
4216
4680
|
}
|
|
4217
4681
|
),
|
|
4218
|
-
/* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsx11(
|
|
4219
4683
|
"button",
|
|
4220
4684
|
{
|
|
4221
4685
|
className: `cms-toolbar-button ${isUnderline ? "active" : ""}`,
|
|
4222
4686
|
onClick: formatUnderline,
|
|
4223
4687
|
title: "Underline (Cmd+U)",
|
|
4224
4688
|
type: "button",
|
|
4225
|
-
children: /* @__PURE__ */
|
|
4689
|
+
children: /* @__PURE__ */ jsx11(MdFormatUnderlined, { size: 18 })
|
|
4226
4690
|
}
|
|
4227
4691
|
),
|
|
4228
|
-
/* @__PURE__ */
|
|
4692
|
+
/* @__PURE__ */ jsx11(
|
|
4229
4693
|
"button",
|
|
4230
4694
|
{
|
|
4231
4695
|
className: `cms-toolbar-button ${isStrikethrough ? "active" : ""}`,
|
|
4232
4696
|
onClick: formatStrikethrough,
|
|
4233
4697
|
title: "Strikethrough",
|
|
4234
4698
|
type: "button",
|
|
4235
|
-
children: /* @__PURE__ */
|
|
4699
|
+
children: /* @__PURE__ */ jsx11(MdFormatStrikethrough, { size: 18 })
|
|
4236
4700
|
}
|
|
4237
4701
|
),
|
|
4238
|
-
/* @__PURE__ */
|
|
4702
|
+
/* @__PURE__ */ jsx11(
|
|
4239
4703
|
"button",
|
|
4240
4704
|
{
|
|
4241
4705
|
className: `cms-toolbar-button ${isCode ? "active" : ""}`,
|
|
4242
4706
|
onClick: formatInlineCode,
|
|
4243
4707
|
title: "Inline Code",
|
|
4244
4708
|
type: "button",
|
|
4245
|
-
children: /* @__PURE__ */
|
|
4709
|
+
children: /* @__PURE__ */ jsx11(MdCode, { size: 18 })
|
|
4246
4710
|
}
|
|
4247
4711
|
),
|
|
4248
|
-
/* @__PURE__ */
|
|
4249
|
-
/* @__PURE__ */
|
|
4250
|
-
/* @__PURE__ */
|
|
4251
|
-
/* @__PURE__ */
|
|
4712
|
+
/* @__PURE__ */ jsx11(ColorPickerPlugin, {}),
|
|
4713
|
+
/* @__PURE__ */ jsx11(SpacingPlugin, {}),
|
|
4714
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4715
|
+
/* @__PURE__ */ jsx11(
|
|
4252
4716
|
"button",
|
|
4253
4717
|
{
|
|
4254
4718
|
className: "cms-toolbar-button",
|
|
4255
4719
|
onClick: formatBulletList,
|
|
4256
4720
|
title: "Bullet List",
|
|
4257
4721
|
type: "button",
|
|
4258
|
-
children: /* @__PURE__ */
|
|
4722
|
+
children: /* @__PURE__ */ jsx11(MdFormatListBulleted, { size: 18 })
|
|
4259
4723
|
}
|
|
4260
4724
|
),
|
|
4261
|
-
/* @__PURE__ */
|
|
4725
|
+
/* @__PURE__ */ jsx11(
|
|
4262
4726
|
"button",
|
|
4263
4727
|
{
|
|
4264
4728
|
className: "cms-toolbar-button",
|
|
4265
4729
|
onClick: formatNumberedList,
|
|
4266
4730
|
title: "Numbered List",
|
|
4267
4731
|
type: "button",
|
|
4268
|
-
children: /* @__PURE__ */
|
|
4732
|
+
children: /* @__PURE__ */ jsx11(MdFormatListNumbered, { size: 18 })
|
|
4269
4733
|
}
|
|
4270
4734
|
),
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4736
|
+
/* @__PURE__ */ jsx11(
|
|
4273
4737
|
"button",
|
|
4274
4738
|
{
|
|
4275
4739
|
className: "cms-toolbar-button",
|
|
4276
4740
|
onClick: formatAlignLeft,
|
|
4277
4741
|
title: "Align Left",
|
|
4278
4742
|
type: "button",
|
|
4279
|
-
children: /* @__PURE__ */
|
|
4743
|
+
children: /* @__PURE__ */ jsx11(MdFormatAlignLeft, { size: 18 })
|
|
4280
4744
|
}
|
|
4281
4745
|
),
|
|
4282
|
-
/* @__PURE__ */
|
|
4746
|
+
/* @__PURE__ */ jsx11(
|
|
4283
4747
|
"button",
|
|
4284
4748
|
{
|
|
4285
4749
|
className: "cms-toolbar-button",
|
|
4286
4750
|
onClick: formatAlignCenter,
|
|
4287
4751
|
title: "Align Center",
|
|
4288
4752
|
type: "button",
|
|
4289
|
-
children: /* @__PURE__ */
|
|
4753
|
+
children: /* @__PURE__ */ jsx11(MdFormatAlignCenter, { size: 18 })
|
|
4290
4754
|
}
|
|
4291
4755
|
),
|
|
4292
|
-
/* @__PURE__ */
|
|
4756
|
+
/* @__PURE__ */ jsx11(
|
|
4293
4757
|
"button",
|
|
4294
4758
|
{
|
|
4295
4759
|
className: "cms-toolbar-button",
|
|
4296
4760
|
onClick: formatAlignRight,
|
|
4297
4761
|
title: "Align Right",
|
|
4298
4762
|
type: "button",
|
|
4299
|
-
children: /* @__PURE__ */
|
|
4763
|
+
children: /* @__PURE__ */ jsx11(MdFormatAlignRight, { size: 18 })
|
|
4300
4764
|
}
|
|
4301
4765
|
),
|
|
4302
|
-
/* @__PURE__ */
|
|
4766
|
+
/* @__PURE__ */ jsx11(
|
|
4303
4767
|
"button",
|
|
4304
4768
|
{
|
|
4305
4769
|
className: "cms-toolbar-button",
|
|
4306
4770
|
onClick: formatAlignJustify,
|
|
4307
4771
|
title: "Justify",
|
|
4308
4772
|
type: "button",
|
|
4309
|
-
children: /* @__PURE__ */
|
|
4773
|
+
children: /* @__PURE__ */ jsx11(MdFormatAlignJustify, { size: 18 })
|
|
4310
4774
|
}
|
|
4311
4775
|
),
|
|
4312
|
-
/* @__PURE__ */
|
|
4313
|
-
/* @__PURE__ */
|
|
4776
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4777
|
+
/* @__PURE__ */ jsx11(
|
|
4314
4778
|
"button",
|
|
4315
4779
|
{
|
|
4316
4780
|
className: `cms-toolbar-button ${blockType === "quote" ? "active" : ""}`,
|
|
4317
4781
|
onClick: formatQuote,
|
|
4318
4782
|
title: "Quote",
|
|
4319
4783
|
type: "button",
|
|
4320
|
-
children: /* @__PURE__ */
|
|
4784
|
+
children: /* @__PURE__ */ jsx11(MdFormatQuote, { size: 18 })
|
|
4321
4785
|
}
|
|
4322
4786
|
),
|
|
4323
|
-
/* @__PURE__ */
|
|
4787
|
+
/* @__PURE__ */ jsx11(
|
|
4324
4788
|
"button",
|
|
4325
4789
|
{
|
|
4326
4790
|
className: `cms-toolbar-button ${blockType === "code" ? "active" : ""}`,
|
|
4327
4791
|
onClick: formatCode,
|
|
4328
4792
|
title: "Code Block",
|
|
4329
4793
|
type: "button",
|
|
4330
|
-
children: /* @__PURE__ */
|
|
4794
|
+
children: /* @__PURE__ */ jsx11(BiCodeBlock, { size: 18 })
|
|
4331
4795
|
}
|
|
4332
4796
|
),
|
|
4333
|
-
/* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4797
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4798
|
+
/* @__PURE__ */ jsx11(
|
|
4335
4799
|
"button",
|
|
4336
4800
|
{
|
|
4337
4801
|
className: "cms-toolbar-button",
|
|
4338
4802
|
onClick: insertLink,
|
|
4339
4803
|
title: "Insert Link",
|
|
4340
4804
|
type: "button",
|
|
4341
|
-
children: /* @__PURE__ */
|
|
4805
|
+
children: /* @__PURE__ */ jsx11(MdLink, { size: 18 })
|
|
4342
4806
|
}
|
|
4343
4807
|
),
|
|
4344
|
-
/* @__PURE__ */
|
|
4808
|
+
/* @__PURE__ */ jsx11(
|
|
4345
4809
|
"button",
|
|
4346
4810
|
{
|
|
4347
4811
|
className: "cms-toolbar-button",
|
|
4348
4812
|
onClick: handleImageUpload,
|
|
4349
4813
|
title: "Upload Image",
|
|
4350
4814
|
type: "button",
|
|
4351
|
-
children: /* @__PURE__ */
|
|
4815
|
+
children: /* @__PURE__ */ jsx11(MdImage, { size: 18 })
|
|
4352
4816
|
}
|
|
4353
4817
|
),
|
|
4354
|
-
/* @__PURE__ */
|
|
4355
|
-
/* @__PURE__ */
|
|
4356
|
-
/* @__PURE__ */
|
|
4357
|
-
/* @__PURE__ */
|
|
4358
|
-
/* @__PURE__ */
|
|
4359
|
-
/* @__PURE__ */
|
|
4360
|
-
/* @__PURE__ */
|
|
4818
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4819
|
+
/* @__PURE__ */ jsx11(ExportImportPlugin, {}),
|
|
4820
|
+
/* @__PURE__ */ jsx11(SectionCreatorPlugin, {}),
|
|
4821
|
+
/* @__PURE__ */ jsx11(TablePlugin, {}),
|
|
4822
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-toolbar-divider" }),
|
|
4823
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-plugin", children: [
|
|
4824
|
+
/* @__PURE__ */ jsx11(
|
|
4361
4825
|
"button",
|
|
4362
4826
|
{
|
|
4363
4827
|
className: "cms-toolbar-button",
|
|
4364
4828
|
onClick: toggleLayoutMenu,
|
|
4365
4829
|
title: "Insert Layout",
|
|
4366
4830
|
type: "button",
|
|
4367
|
-
children: /* @__PURE__ */
|
|
4831
|
+
children: /* @__PURE__ */ jsx11(MdViewColumn, { size: 18 })
|
|
4368
4832
|
}
|
|
4369
4833
|
),
|
|
4370
|
-
showLayoutMenu && /* @__PURE__ */
|
|
4834
|
+
showLayoutMenu && /* @__PURE__ */ jsxs11(
|
|
4371
4835
|
"div",
|
|
4372
4836
|
{
|
|
4373
4837
|
className: "cms-layout-menu",
|
|
@@ -4376,96 +4840,96 @@ function ToolbarPlugin() {
|
|
|
4376
4840
|
left: `${layoutMenuPosition.left}px`
|
|
4377
4841
|
},
|
|
4378
4842
|
children: [
|
|
4379
|
-
/* @__PURE__ */
|
|
4380
|
-
/* @__PURE__ */
|
|
4381
|
-
/* @__PURE__ */
|
|
4382
|
-
/* @__PURE__ */
|
|
4843
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-menu-title", children: "Choose Layout" }),
|
|
4844
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-menu-section", children: [
|
|
4845
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-menu-subtitle", children: "Columns (Flex)" }),
|
|
4846
|
+
/* @__PURE__ */ jsxs11(
|
|
4383
4847
|
"button",
|
|
4384
4848
|
{
|
|
4385
4849
|
className: "cms-layout-menu-item",
|
|
4386
4850
|
onClick: () => insertLayout("2-column"),
|
|
4387
4851
|
type: "button",
|
|
4388
4852
|
children: [
|
|
4389
|
-
/* @__PURE__ */
|
|
4390
|
-
/* @__PURE__ */
|
|
4391
|
-
/* @__PURE__ */
|
|
4853
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-preview cms-layout-preview-2col", children: [
|
|
4854
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4855
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" })
|
|
4392
4856
|
] }),
|
|
4393
|
-
/* @__PURE__ */
|
|
4857
|
+
/* @__PURE__ */ jsx11("span", { children: "2 Columns" })
|
|
4394
4858
|
]
|
|
4395
4859
|
}
|
|
4396
4860
|
),
|
|
4397
|
-
/* @__PURE__ */
|
|
4861
|
+
/* @__PURE__ */ jsxs11(
|
|
4398
4862
|
"button",
|
|
4399
4863
|
{
|
|
4400
4864
|
className: "cms-layout-menu-item",
|
|
4401
4865
|
onClick: () => insertLayout("3-column"),
|
|
4402
4866
|
type: "button",
|
|
4403
4867
|
children: [
|
|
4404
|
-
/* @__PURE__ */
|
|
4405
|
-
/* @__PURE__ */
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
/* @__PURE__ */
|
|
4868
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-preview cms-layout-preview-3col", children: [
|
|
4869
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4870
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4871
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" })
|
|
4408
4872
|
] }),
|
|
4409
|
-
/* @__PURE__ */
|
|
4873
|
+
/* @__PURE__ */ jsx11("span", { children: "3 Columns" })
|
|
4410
4874
|
]
|
|
4411
4875
|
}
|
|
4412
4876
|
),
|
|
4413
|
-
/* @__PURE__ */
|
|
4877
|
+
/* @__PURE__ */ jsxs11(
|
|
4414
4878
|
"button",
|
|
4415
4879
|
{
|
|
4416
4880
|
className: "cms-layout-menu-item",
|
|
4417
4881
|
onClick: () => insertLayout("4-column"),
|
|
4418
4882
|
type: "button",
|
|
4419
4883
|
children: [
|
|
4420
|
-
/* @__PURE__ */
|
|
4421
|
-
/* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4424
|
-
/* @__PURE__ */
|
|
4884
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-preview cms-layout-preview-4col", children: [
|
|
4885
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4886
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4887
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4888
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" })
|
|
4425
4889
|
] }),
|
|
4426
|
-
/* @__PURE__ */
|
|
4890
|
+
/* @__PURE__ */ jsx11("span", { children: "4 Columns" })
|
|
4427
4891
|
]
|
|
4428
4892
|
}
|
|
4429
4893
|
)
|
|
4430
4894
|
] }),
|
|
4431
|
-
/* @__PURE__ */
|
|
4432
|
-
/* @__PURE__ */
|
|
4433
|
-
/* @__PURE__ */
|
|
4895
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-menu-section", children: [
|
|
4896
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-menu-subtitle", children: "Grid" }),
|
|
4897
|
+
/* @__PURE__ */ jsxs11(
|
|
4434
4898
|
"button",
|
|
4435
4899
|
{
|
|
4436
4900
|
className: "cms-layout-menu-item",
|
|
4437
4901
|
onClick: () => insertLayout("grid-2x2"),
|
|
4438
4902
|
type: "button",
|
|
4439
4903
|
children: [
|
|
4440
|
-
/* @__PURE__ */
|
|
4441
|
-
/* @__PURE__ */
|
|
4442
|
-
/* @__PURE__ */
|
|
4443
|
-
/* @__PURE__ */
|
|
4444
|
-
/* @__PURE__ */
|
|
4904
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-preview cms-layout-preview-grid-2x2", children: [
|
|
4905
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4906
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4907
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4908
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" })
|
|
4445
4909
|
] }),
|
|
4446
|
-
/* @__PURE__ */
|
|
4910
|
+
/* @__PURE__ */ jsx11("span", { children: "2\xD72 Grid" })
|
|
4447
4911
|
]
|
|
4448
4912
|
}
|
|
4449
4913
|
),
|
|
4450
|
-
/* @__PURE__ */
|
|
4914
|
+
/* @__PURE__ */ jsxs11(
|
|
4451
4915
|
"button",
|
|
4452
4916
|
{
|
|
4453
4917
|
className: "cms-layout-menu-item",
|
|
4454
4918
|
onClick: () => insertLayout("grid-3x3"),
|
|
4455
4919
|
type: "button",
|
|
4456
4920
|
children: [
|
|
4457
|
-
/* @__PURE__ */
|
|
4458
|
-
/* @__PURE__ */
|
|
4459
|
-
/* @__PURE__ */
|
|
4460
|
-
/* @__PURE__ */
|
|
4461
|
-
/* @__PURE__ */
|
|
4462
|
-
/* @__PURE__ */
|
|
4463
|
-
/* @__PURE__ */
|
|
4464
|
-
/* @__PURE__ */
|
|
4465
|
-
/* @__PURE__ */
|
|
4466
|
-
/* @__PURE__ */
|
|
4921
|
+
/* @__PURE__ */ jsxs11("div", { className: "cms-layout-preview cms-layout-preview-grid-3x3", children: [
|
|
4922
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4923
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4924
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4925
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4926
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4927
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4928
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4929
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" }),
|
|
4930
|
+
/* @__PURE__ */ jsx11("div", { className: "cms-layout-preview-col" })
|
|
4467
4931
|
] }),
|
|
4468
|
-
/* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsx11("span", { children: "3\xD73 Grid" })
|
|
4469
4933
|
]
|
|
4470
4934
|
}
|
|
4471
4935
|
)
|
|
@@ -4479,14 +4943,14 @@ function ToolbarPlugin() {
|
|
|
4479
4943
|
|
|
4480
4944
|
// src/plugins/ImageUploadPlugin.tsx
|
|
4481
4945
|
import { useLexicalComposerContext as useLexicalComposerContext9 } from "@lexical/react/LexicalComposerContext";
|
|
4482
|
-
import { useEffect as
|
|
4946
|
+
import { useEffect as useEffect11 } from "react";
|
|
4483
4947
|
import { $getSelection as $getSelection7, $isRangeSelection as $isRangeSelection7, COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW3, DRAGOVER_COMMAND, DROP_COMMAND } from "lexical";
|
|
4484
4948
|
function ImageUploadPlugin({
|
|
4485
4949
|
onImageAdded,
|
|
4486
4950
|
useBase64Url = true
|
|
4487
4951
|
}) {
|
|
4488
4952
|
const [editor] = useLexicalComposerContext9();
|
|
4489
|
-
|
|
4953
|
+
useEffect11(() => {
|
|
4490
4954
|
const removeDragOverListener = editor.registerCommand(
|
|
4491
4955
|
DRAGOVER_COMMAND,
|
|
4492
4956
|
(event) => {
|
|
@@ -4547,26 +5011,104 @@ function ImageUploadPlugin({
|
|
|
4547
5011
|
return null;
|
|
4548
5012
|
}
|
|
4549
5013
|
|
|
4550
|
-
// src/plugins/
|
|
5014
|
+
// src/plugins/VideoUploadPlugin.tsx
|
|
4551
5015
|
import { useLexicalComposerContext as useLexicalComposerContext10 } from "@lexical/react/LexicalComposerContext";
|
|
4552
|
-
import { useEffect as
|
|
5016
|
+
import { useEffect as useEffect12 } from "react";
|
|
5017
|
+
import { $getSelection as $getSelection8, $isRangeSelection as $isRangeSelection8, COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW4, DRAGOVER_COMMAND as DRAGOVER_COMMAND2, DROP_COMMAND as DROP_COMMAND2 } from "lexical";
|
|
5018
|
+
function VideoUploadPlugin({
|
|
5019
|
+
onVideoAdded,
|
|
5020
|
+
useBase64Url = false
|
|
5021
|
+
}) {
|
|
5022
|
+
const [editor] = useLexicalComposerContext10();
|
|
5023
|
+
useEffect12(() => {
|
|
5024
|
+
const removeDragOverListener = editor.registerCommand(
|
|
5025
|
+
DRAGOVER_COMMAND2,
|
|
5026
|
+
(event) => {
|
|
5027
|
+
const files = event.dataTransfer?.files;
|
|
5028
|
+
if (files && files.length > 0) {
|
|
5029
|
+
const file = files[0];
|
|
5030
|
+
if (file.type.startsWith("video/")) {
|
|
5031
|
+
event.preventDefault();
|
|
5032
|
+
return true;
|
|
5033
|
+
}
|
|
5034
|
+
}
|
|
5035
|
+
return false;
|
|
5036
|
+
},
|
|
5037
|
+
COMMAND_PRIORITY_LOW4
|
|
5038
|
+
);
|
|
5039
|
+
const removeDropListener = editor.registerCommand(
|
|
5040
|
+
DROP_COMMAND2,
|
|
5041
|
+
//@ts-ignore
|
|
5042
|
+
async (event) => {
|
|
5043
|
+
const files = event.dataTransfer?.files;
|
|
5044
|
+
if (files && files.length > 0) {
|
|
5045
|
+
const file = files[0];
|
|
5046
|
+
if (file.type.startsWith("video/")) {
|
|
5047
|
+
event.preventDefault();
|
|
5048
|
+
let url;
|
|
5049
|
+
if (onVideoAdded) {
|
|
5050
|
+
try {
|
|
5051
|
+
url = await onVideoAdded(file);
|
|
5052
|
+
} catch (error) {
|
|
5053
|
+
console.error("Error uploading video:", error);
|
|
5054
|
+
alert("Failed to upload video. Please try again.");
|
|
5055
|
+
return false;
|
|
5056
|
+
}
|
|
5057
|
+
} else if (useBase64Url) {
|
|
5058
|
+
console.warn("Using base64 for video - this may cause performance issues");
|
|
5059
|
+
url = await new Promise((resolve) => {
|
|
5060
|
+
const reader = new FileReader();
|
|
5061
|
+
reader.onload = (e) => {
|
|
5062
|
+
resolve(e.target?.result);
|
|
5063
|
+
};
|
|
5064
|
+
reader.readAsDataURL(file);
|
|
5065
|
+
});
|
|
5066
|
+
} else {
|
|
5067
|
+
alert("Video upload handler not configured. Please provide onVideoAdded prop.");
|
|
5068
|
+
return false;
|
|
5069
|
+
}
|
|
5070
|
+
editor.update(() => {
|
|
5071
|
+
const selection = $getSelection8();
|
|
5072
|
+
if ($isRangeSelection8(selection)) {
|
|
5073
|
+
const videoNode = new VideoNode(url);
|
|
5074
|
+
selection.insertNodes([videoNode]);
|
|
5075
|
+
}
|
|
5076
|
+
});
|
|
5077
|
+
return true;
|
|
5078
|
+
}
|
|
5079
|
+
}
|
|
5080
|
+
return false;
|
|
5081
|
+
},
|
|
5082
|
+
COMMAND_PRIORITY_LOW4
|
|
5083
|
+
);
|
|
5084
|
+
return () => {
|
|
5085
|
+
removeDragOverListener();
|
|
5086
|
+
removeDropListener();
|
|
5087
|
+
};
|
|
5088
|
+
}, [editor, onVideoAdded, useBase64Url]);
|
|
5089
|
+
return null;
|
|
5090
|
+
}
|
|
5091
|
+
|
|
5092
|
+
// src/plugins/LinkPlugin.tsx
|
|
5093
|
+
import { useLexicalComposerContext as useLexicalComposerContext11 } from "@lexical/react/LexicalComposerContext";
|
|
5094
|
+
import { useEffect as useEffect13, useState as useState12, useCallback as useCallback10 } from "react";
|
|
4553
5095
|
import {
|
|
4554
|
-
$getSelection as $
|
|
4555
|
-
$isRangeSelection as $
|
|
4556
|
-
COMMAND_PRIORITY_LOW as
|
|
5096
|
+
$getSelection as $getSelection9,
|
|
5097
|
+
$isRangeSelection as $isRangeSelection9,
|
|
5098
|
+
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW5,
|
|
4557
5099
|
KEY_ESCAPE_COMMAND as KEY_ESCAPE_COMMAND2,
|
|
4558
5100
|
$createTextNode as $createTextNode2
|
|
4559
5101
|
} from "lexical";
|
|
4560
5102
|
import { $createLinkNode as $createLinkNode2, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
4561
|
-
import { jsx as
|
|
5103
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4562
5104
|
function LinkPlugin() {
|
|
4563
|
-
const [editor] =
|
|
4564
|
-
const [showModal, setShowModal] =
|
|
4565
|
-
const [linkUrl, setLinkUrl] =
|
|
4566
|
-
const [linkText, setLinkText] =
|
|
4567
|
-
const [linkTitle, setLinkTitle] =
|
|
4568
|
-
const [openInNewTab, setOpenInNewTab] =
|
|
4569
|
-
|
|
5105
|
+
const [editor] = useLexicalComposerContext11();
|
|
5106
|
+
const [showModal, setShowModal] = useState12(false);
|
|
5107
|
+
const [linkUrl, setLinkUrl] = useState12("");
|
|
5108
|
+
const [linkText, setLinkText] = useState12("");
|
|
5109
|
+
const [linkTitle, setLinkTitle] = useState12("");
|
|
5110
|
+
const [openInNewTab, setOpenInNewTab] = useState12(false);
|
|
5111
|
+
useEffect13(() => {
|
|
4570
5112
|
return editor.registerCommand(
|
|
4571
5113
|
KEY_ESCAPE_COMMAND2,
|
|
4572
5114
|
() => {
|
|
@@ -4576,13 +5118,13 @@ function LinkPlugin() {
|
|
|
4576
5118
|
}
|
|
4577
5119
|
return false;
|
|
4578
5120
|
},
|
|
4579
|
-
|
|
5121
|
+
COMMAND_PRIORITY_LOW5
|
|
4580
5122
|
);
|
|
4581
5123
|
}, [editor, showModal]);
|
|
4582
|
-
const handleInsertLink =
|
|
5124
|
+
const handleInsertLink = useCallback10(() => {
|
|
4583
5125
|
editor.update(() => {
|
|
4584
|
-
const selection = $
|
|
4585
|
-
if ($
|
|
5126
|
+
const selection = $getSelection9();
|
|
5127
|
+
if ($isRangeSelection9(selection)) {
|
|
4586
5128
|
const selectedText = selection.getTextContent();
|
|
4587
5129
|
setLinkText(selectedText || "");
|
|
4588
5130
|
setShowModal(true);
|
|
@@ -4593,8 +5135,8 @@ function LinkPlugin() {
|
|
|
4593
5135
|
e.preventDefault();
|
|
4594
5136
|
if (!linkUrl) return;
|
|
4595
5137
|
editor.update(() => {
|
|
4596
|
-
const selection = $
|
|
4597
|
-
if ($
|
|
5138
|
+
const selection = $getSelection9();
|
|
5139
|
+
if ($isRangeSelection9(selection)) {
|
|
4598
5140
|
if (selection.getTextContent()) {
|
|
4599
5141
|
editor.dispatchCommand(TOGGLE_LINK_COMMAND, {
|
|
4600
5142
|
url: linkUrl,
|
|
@@ -4627,17 +5169,17 @@ function LinkPlugin() {
|
|
|
4627
5169
|
setLinkTitle("");
|
|
4628
5170
|
setOpenInNewTab(false);
|
|
4629
5171
|
};
|
|
4630
|
-
|
|
5172
|
+
useEffect13(() => {
|
|
4631
5173
|
window.__insertLink = handleInsertLink;
|
|
4632
5174
|
return () => {
|
|
4633
5175
|
delete window.__insertLink;
|
|
4634
5176
|
};
|
|
4635
5177
|
}, [handleInsertLink]);
|
|
4636
5178
|
if (!showModal) return null;
|
|
4637
|
-
return /* @__PURE__ */
|
|
4638
|
-
/* @__PURE__ */
|
|
4639
|
-
/* @__PURE__ */
|
|
4640
|
-
/* @__PURE__ */
|
|
5179
|
+
return /* @__PURE__ */ jsx12("div", { className: "cms-link-modal-overlay", onClick: handleCancel, children: /* @__PURE__ */ jsxs12("div", { className: "cms-link-modal", onClick: (e) => e.stopPropagation(), children: [
|
|
5180
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-link-modal-header", children: [
|
|
5181
|
+
/* @__PURE__ */ jsx12("h3", { children: "Insert Link" }),
|
|
5182
|
+
/* @__PURE__ */ jsx12(
|
|
4641
5183
|
"button",
|
|
4642
5184
|
{
|
|
4643
5185
|
className: "cms-link-modal-close",
|
|
@@ -4647,10 +5189,10 @@ function LinkPlugin() {
|
|
|
4647
5189
|
}
|
|
4648
5190
|
)
|
|
4649
5191
|
] }),
|
|
4650
|
-
/* @__PURE__ */
|
|
4651
|
-
/* @__PURE__ */
|
|
4652
|
-
/* @__PURE__ */
|
|
4653
|
-
/* @__PURE__ */
|
|
5192
|
+
/* @__PURE__ */ jsxs12("form", { onSubmit: handleSubmit, className: "cms-link-modal-form", children: [
|
|
5193
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-link-modal-field", children: [
|
|
5194
|
+
/* @__PURE__ */ jsx12("label", { htmlFor: "link-text", children: "Link Text" }),
|
|
5195
|
+
/* @__PURE__ */ jsx12(
|
|
4654
5196
|
"input",
|
|
4655
5197
|
{
|
|
4656
5198
|
id: "link-text",
|
|
@@ -4662,9 +5204,9 @@ function LinkPlugin() {
|
|
|
4662
5204
|
}
|
|
4663
5205
|
)
|
|
4664
5206
|
] }),
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
5207
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-link-modal-field", children: [
|
|
5208
|
+
/* @__PURE__ */ jsx12("label", { htmlFor: "link-url", children: "URL *" }),
|
|
5209
|
+
/* @__PURE__ */ jsx12(
|
|
4668
5210
|
"input",
|
|
4669
5211
|
{
|
|
4670
5212
|
id: "link-url",
|
|
@@ -4676,9 +5218,9 @@ function LinkPlugin() {
|
|
|
4676
5218
|
}
|
|
4677
5219
|
)
|
|
4678
5220
|
] }),
|
|
4679
|
-
/* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
5221
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-link-modal-field", children: [
|
|
5222
|
+
/* @__PURE__ */ jsx12("label", { htmlFor: "link-title", children: "Title (optional)" }),
|
|
5223
|
+
/* @__PURE__ */ jsx12(
|
|
4682
5224
|
"input",
|
|
4683
5225
|
{
|
|
4684
5226
|
id: "link-title",
|
|
@@ -4689,8 +5231,8 @@ function LinkPlugin() {
|
|
|
4689
5231
|
}
|
|
4690
5232
|
)
|
|
4691
5233
|
] }),
|
|
4692
|
-
/* @__PURE__ */
|
|
4693
|
-
/* @__PURE__ */
|
|
5234
|
+
/* @__PURE__ */ jsx12("div", { className: "cms-link-modal-field cms-link-modal-checkbox", children: /* @__PURE__ */ jsxs12("label", { children: [
|
|
5235
|
+
/* @__PURE__ */ jsx12(
|
|
4694
5236
|
"input",
|
|
4695
5237
|
{
|
|
4696
5238
|
type: "checkbox",
|
|
@@ -4698,10 +5240,10 @@ function LinkPlugin() {
|
|
|
4698
5240
|
onChange: (e) => setOpenInNewTab(e.target.checked)
|
|
4699
5241
|
}
|
|
4700
5242
|
),
|
|
4701
|
-
/* @__PURE__ */
|
|
5243
|
+
/* @__PURE__ */ jsx12("span", { children: "Open in new tab" })
|
|
4702
5244
|
] }) }),
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
5245
|
+
/* @__PURE__ */ jsxs12("div", { className: "cms-link-modal-actions", children: [
|
|
5246
|
+
/* @__PURE__ */ jsx12(
|
|
4705
5247
|
"button",
|
|
4706
5248
|
{
|
|
4707
5249
|
type: "button",
|
|
@@ -4710,7 +5252,7 @@ function LinkPlugin() {
|
|
|
4710
5252
|
children: "Cancel"
|
|
4711
5253
|
}
|
|
4712
5254
|
),
|
|
4713
|
-
/* @__PURE__ */
|
|
5255
|
+
/* @__PURE__ */ jsx12(
|
|
4714
5256
|
"button",
|
|
4715
5257
|
{
|
|
4716
5258
|
type: "submit",
|
|
@@ -4725,14 +5267,14 @@ function LinkPlugin() {
|
|
|
4725
5267
|
}
|
|
4726
5268
|
|
|
4727
5269
|
// src/plugins/SectionEditorPlugin.tsx
|
|
4728
|
-
import { useLexicalComposerContext as
|
|
4729
|
-
import { useState as
|
|
5270
|
+
import { useLexicalComposerContext as useLexicalComposerContext12 } from "@lexical/react/LexicalComposerContext";
|
|
5271
|
+
import { useState as useState13, useCallback as useCallback11, useRef as useRef9, useEffect as useEffect14 } from "react";
|
|
4730
5272
|
import {
|
|
4731
|
-
$getSelection as $
|
|
4732
|
-
$isRangeSelection as $
|
|
5273
|
+
$getSelection as $getSelection10,
|
|
5274
|
+
$isRangeSelection as $isRangeSelection10,
|
|
4733
5275
|
$getNodeByKey,
|
|
4734
5276
|
SELECTION_CHANGE_COMMAND,
|
|
4735
|
-
COMMAND_PRIORITY_LOW as
|
|
5277
|
+
COMMAND_PRIORITY_LOW as COMMAND_PRIORITY_LOW6
|
|
4736
5278
|
} from "lexical";
|
|
4737
5279
|
import { MdSettings as MdSettings2, MdClose } from "react-icons/md";
|
|
4738
5280
|
import {
|
|
@@ -4741,7 +5283,7 @@ import {
|
|
|
4741
5283
|
FaAlignRight,
|
|
4742
5284
|
FaAlignJustify
|
|
4743
5285
|
} from "react-icons/fa";
|
|
4744
|
-
import { Fragment as
|
|
5286
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4745
5287
|
var PRESET_COLORS2 = [
|
|
4746
5288
|
"#ffffff",
|
|
4747
5289
|
"#f8f9fa",
|
|
@@ -4775,18 +5317,18 @@ var PRESET_COLORS2 = [
|
|
|
4775
5317
|
"#1dd1a1"
|
|
4776
5318
|
];
|
|
4777
5319
|
function SectionEditorPlugin() {
|
|
4778
|
-
const [editor] =
|
|
4779
|
-
const [selectedSection, setSelectedSection] =
|
|
4780
|
-
const [showEditor, setShowEditor] =
|
|
4781
|
-
const [editorPosition, setEditorPosition] =
|
|
4782
|
-
const editorRef =
|
|
4783
|
-
|
|
5320
|
+
const [editor] = useLexicalComposerContext12();
|
|
5321
|
+
const [selectedSection, setSelectedSection] = useState13(null);
|
|
5322
|
+
const [showEditor, setShowEditor] = useState13(false);
|
|
5323
|
+
const [editorPosition, setEditorPosition] = useState13({ top: 0, left: 0 });
|
|
5324
|
+
const editorRef = useRef9(null);
|
|
5325
|
+
useEffect14(() => {
|
|
4784
5326
|
return editor.registerCommand(
|
|
4785
5327
|
SELECTION_CHANGE_COMMAND,
|
|
4786
5328
|
() => {
|
|
4787
5329
|
editor.getEditorState().read(() => {
|
|
4788
|
-
const selection = $
|
|
4789
|
-
if ($
|
|
5330
|
+
const selection = $getSelection10();
|
|
5331
|
+
if ($isRangeSelection10(selection)) {
|
|
4790
5332
|
const nodes = selection.getNodes();
|
|
4791
5333
|
for (const node2 of nodes) {
|
|
4792
5334
|
let parent = node2.getParent();
|
|
@@ -4806,10 +5348,10 @@ function SectionEditorPlugin() {
|
|
|
4806
5348
|
});
|
|
4807
5349
|
return false;
|
|
4808
5350
|
},
|
|
4809
|
-
|
|
5351
|
+
COMMAND_PRIORITY_LOW6
|
|
4810
5352
|
);
|
|
4811
5353
|
}, [editor]);
|
|
4812
|
-
|
|
5354
|
+
useEffect14(() => {
|
|
4813
5355
|
const handleClickOutside = (event) => {
|
|
4814
5356
|
if (editorRef.current && !editorRef.current.contains(event.target)) {
|
|
4815
5357
|
setShowEditor(false);
|
|
@@ -4818,7 +5360,7 @@ function SectionEditorPlugin() {
|
|
|
4818
5360
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4819
5361
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
4820
5362
|
}, []);
|
|
4821
|
-
const toggleEditor =
|
|
5363
|
+
const toggleEditor = useCallback11((event) => {
|
|
4822
5364
|
if (!showEditor) {
|
|
4823
5365
|
const button = event.currentTarget;
|
|
4824
5366
|
const rect = button.getBoundingClientRect();
|
|
@@ -4829,7 +5371,7 @@ function SectionEditorPlugin() {
|
|
|
4829
5371
|
}
|
|
4830
5372
|
setShowEditor(!showEditor);
|
|
4831
5373
|
}, [showEditor]);
|
|
4832
|
-
const updateSection =
|
|
5374
|
+
const updateSection = useCallback11((updater) => {
|
|
4833
5375
|
if (!selectedSection) return;
|
|
4834
5376
|
editor.update(() => {
|
|
4835
5377
|
const node2 = $getNodeByKey(selectedSection.key);
|
|
@@ -4838,64 +5380,64 @@ function SectionEditorPlugin() {
|
|
|
4838
5380
|
}
|
|
4839
5381
|
});
|
|
4840
5382
|
}, [editor, selectedSection]);
|
|
4841
|
-
const setBackgroundColor =
|
|
5383
|
+
const setBackgroundColor = useCallback11((color) => {
|
|
4842
5384
|
updateSection((node2) => node2.setBackgroundColor(color));
|
|
4843
5385
|
}, [updateSection]);
|
|
4844
|
-
const setBackgroundImage =
|
|
5386
|
+
const setBackgroundImage = useCallback11((image) => {
|
|
4845
5387
|
updateSection((node2) => node2.setBackgroundImage(image));
|
|
4846
5388
|
}, [updateSection]);
|
|
4847
|
-
const setBackgroundSize =
|
|
5389
|
+
const setBackgroundSize = useCallback11((size) => {
|
|
4848
5390
|
updateSection((node2) => node2.setBackgroundSize(size));
|
|
4849
5391
|
}, [updateSection]);
|
|
4850
|
-
const setBackgroundPosition =
|
|
5392
|
+
const setBackgroundPosition = useCallback11((position) => {
|
|
4851
5393
|
updateSection((node2) => node2.setBackgroundPosition(position));
|
|
4852
5394
|
}, [updateSection]);
|
|
4853
|
-
const setBackgroundRepeat =
|
|
5395
|
+
const setBackgroundRepeat = useCallback11((repeat) => {
|
|
4854
5396
|
updateSection((node2) => node2.setBackgroundRepeat(repeat));
|
|
4855
5397
|
}, [updateSection]);
|
|
4856
|
-
const setGradientOverlay =
|
|
5398
|
+
const setGradientOverlay = useCallback11((gradient) => {
|
|
4857
5399
|
updateSection((node2) => node2.setGradientOverlay(gradient));
|
|
4858
5400
|
}, [updateSection]);
|
|
4859
|
-
const setOpacity =
|
|
5401
|
+
const setOpacity = useCallback11((opacity) => {
|
|
4860
5402
|
updateSection((node2) => node2.setOpacity(opacity));
|
|
4861
5403
|
}, [updateSection]);
|
|
4862
|
-
const removeBackgroundImage =
|
|
5404
|
+
const removeBackgroundImage = useCallback11(() => {
|
|
4863
5405
|
updateSection((node2) => {
|
|
4864
5406
|
node2.setBackgroundImage(void 0);
|
|
4865
5407
|
node2.setGradientOverlay(void 0);
|
|
4866
5408
|
});
|
|
4867
5409
|
}, [updateSection]);
|
|
4868
|
-
const setTextAlign =
|
|
5410
|
+
const setTextAlign = useCallback11((align) => {
|
|
4869
5411
|
updateSection((node2) => node2.setTextAlign(align));
|
|
4870
5412
|
}, [updateSection]);
|
|
4871
|
-
const setLayoutType =
|
|
5413
|
+
const setLayoutType = useCallback11((layout) => {
|
|
4872
5414
|
updateSection((node2) => node2.setLayoutType(layout));
|
|
4873
5415
|
}, [updateSection]);
|
|
4874
|
-
const setFlexDirection =
|
|
5416
|
+
const setFlexDirection = useCallback11((direction) => {
|
|
4875
5417
|
updateSection((node2) => node2.setFlexDirection(direction));
|
|
4876
5418
|
}, [updateSection]);
|
|
4877
|
-
const setFlexWrap =
|
|
5419
|
+
const setFlexWrap = useCallback11((wrap) => {
|
|
4878
5420
|
updateSection((node2) => node2.setFlexWrap(wrap));
|
|
4879
5421
|
}, [updateSection]);
|
|
4880
|
-
const setAlignItems =
|
|
5422
|
+
const setAlignItems = useCallback11((align) => {
|
|
4881
5423
|
updateSection((node2) => node2.setAlignItems(align));
|
|
4882
5424
|
}, [updateSection]);
|
|
4883
|
-
const setJustifyContent =
|
|
5425
|
+
const setJustifyContent = useCallback11((justify) => {
|
|
4884
5426
|
updateSection((node2) => node2.setJustifyContent(justify));
|
|
4885
5427
|
}, [updateSection]);
|
|
4886
|
-
const setGap =
|
|
5428
|
+
const setGap = useCallback11((gap) => {
|
|
4887
5429
|
updateSection((node2) => node2.setGap(gap));
|
|
4888
5430
|
}, [updateSection]);
|
|
4889
|
-
const setPadding =
|
|
5431
|
+
const setPadding = useCallback11((padding) => {
|
|
4890
5432
|
updateSection((node2) => node2.setPadding(padding));
|
|
4891
5433
|
}, [updateSection]);
|
|
4892
|
-
const setMargin =
|
|
5434
|
+
const setMargin = useCallback11((margin) => {
|
|
4893
5435
|
updateSection((node2) => node2.setMargin(margin));
|
|
4894
5436
|
}, [updateSection]);
|
|
4895
|
-
const setGridColumns =
|
|
5437
|
+
const setGridColumns = useCallback11((columns) => {
|
|
4896
5438
|
updateSection((node2) => node2.setGridTemplateColumns(columns));
|
|
4897
5439
|
}, [updateSection]);
|
|
4898
|
-
const setGridRows =
|
|
5440
|
+
const setGridRows = useCallback11((rows) => {
|
|
4899
5441
|
updateSection((node2) => node2.setGridTemplateRows(rows));
|
|
4900
5442
|
}, [updateSection]);
|
|
4901
5443
|
if (!selectedSection) {
|
|
@@ -4920,8 +5462,8 @@ function SectionEditorPlugin() {
|
|
|
4920
5462
|
const currentMargin = node.getMargin() || "0px";
|
|
4921
5463
|
const currentGridColumns = node.getGridTemplateColumns() || "repeat(3, 1fr)";
|
|
4922
5464
|
const currentGridRows = node.getGridTemplateRows() || "auto";
|
|
4923
|
-
return /* @__PURE__ */
|
|
4924
|
-
/* @__PURE__ */
|
|
5465
|
+
return /* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-plugin", ref: editorRef, children: [
|
|
5466
|
+
/* @__PURE__ */ jsxs13(
|
|
4925
5467
|
"button",
|
|
4926
5468
|
{
|
|
4927
5469
|
className: "cms-toolbar-button cms-section-edit-button",
|
|
@@ -4929,12 +5471,12 @@ function SectionEditorPlugin() {
|
|
|
4929
5471
|
title: "Edit Section",
|
|
4930
5472
|
type: "button",
|
|
4931
5473
|
children: [
|
|
4932
|
-
/* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
5474
|
+
/* @__PURE__ */ jsx13(MdSettings2, { size: 18 }),
|
|
5475
|
+
/* @__PURE__ */ jsx13("span", { className: "cms-section-indicator", children: "Section" })
|
|
4934
5476
|
]
|
|
4935
5477
|
}
|
|
4936
5478
|
),
|
|
4937
|
-
showEditor && /* @__PURE__ */
|
|
5479
|
+
showEditor && /* @__PURE__ */ jsxs13(
|
|
4938
5480
|
"div",
|
|
4939
5481
|
{
|
|
4940
5482
|
className: "cms-section-editor-menu",
|
|
@@ -4943,22 +5485,22 @@ function SectionEditorPlugin() {
|
|
|
4943
5485
|
left: `${editorPosition.left}px`
|
|
4944
5486
|
},
|
|
4945
5487
|
children: [
|
|
4946
|
-
/* @__PURE__ */
|
|
4947
|
-
/* @__PURE__ */
|
|
4948
|
-
/* @__PURE__ */
|
|
5488
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-header", children: [
|
|
5489
|
+
/* @__PURE__ */ jsx13("span", { children: "Section Settings" }),
|
|
5490
|
+
/* @__PURE__ */ jsx13(
|
|
4949
5491
|
"button",
|
|
4950
5492
|
{
|
|
4951
5493
|
className: "cms-close-button",
|
|
4952
5494
|
onClick: () => setShowEditor(false),
|
|
4953
5495
|
type: "button",
|
|
4954
|
-
children: /* @__PURE__ */
|
|
5496
|
+
children: /* @__PURE__ */ jsx13(MdClose, { size: 16 })
|
|
4955
5497
|
}
|
|
4956
5498
|
)
|
|
4957
5499
|
] }),
|
|
4958
|
-
/* @__PURE__ */
|
|
4959
|
-
/* @__PURE__ */
|
|
4960
|
-
/* @__PURE__ */
|
|
4961
|
-
/* @__PURE__ */
|
|
5500
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-content", children: [
|
|
5501
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5502
|
+
/* @__PURE__ */ jsx13("label", { children: "Background Color" }),
|
|
5503
|
+
/* @__PURE__ */ jsx13("div", { className: "cms-color-grid", children: PRESET_COLORS2.map((color) => /* @__PURE__ */ jsx13(
|
|
4962
5504
|
"button",
|
|
4963
5505
|
{
|
|
4964
5506
|
className: `cms-color-swatch ${currentBgColor === color ? "active" : ""}`,
|
|
@@ -4969,7 +5511,7 @@ function SectionEditorPlugin() {
|
|
|
4969
5511
|
},
|
|
4970
5512
|
color
|
|
4971
5513
|
)) }),
|
|
4972
|
-
/* @__PURE__ */
|
|
5514
|
+
/* @__PURE__ */ jsx13(
|
|
4973
5515
|
"input",
|
|
4974
5516
|
{
|
|
4975
5517
|
type: "color",
|
|
@@ -4979,9 +5521,9 @@ function SectionEditorPlugin() {
|
|
|
4979
5521
|
}
|
|
4980
5522
|
)
|
|
4981
5523
|
] }),
|
|
4982
|
-
/* @__PURE__ */
|
|
4983
|
-
/* @__PURE__ */
|
|
4984
|
-
/* @__PURE__ */
|
|
5524
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5525
|
+
/* @__PURE__ */ jsx13("label", { children: "Background Image" }),
|
|
5526
|
+
/* @__PURE__ */ jsx13(
|
|
4985
5527
|
"input",
|
|
4986
5528
|
{
|
|
4987
5529
|
type: "text",
|
|
@@ -4991,66 +5533,66 @@ function SectionEditorPlugin() {
|
|
|
4991
5533
|
className: "cms-text-input"
|
|
4992
5534
|
}
|
|
4993
5535
|
),
|
|
4994
|
-
currentBgImage && /* @__PURE__ */
|
|
4995
|
-
/* @__PURE__ */
|
|
4996
|
-
/* @__PURE__ */
|
|
4997
|
-
/* @__PURE__ */
|
|
4998
|
-
/* @__PURE__ */
|
|
5536
|
+
currentBgImage && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5537
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-bg-controls", children: [
|
|
5538
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-bg-control-item", children: [
|
|
5539
|
+
/* @__PURE__ */ jsx13("label", { children: "Size" }),
|
|
5540
|
+
/* @__PURE__ */ jsxs13(
|
|
4999
5541
|
"select",
|
|
5000
5542
|
{
|
|
5001
5543
|
value: currentBgSize,
|
|
5002
5544
|
onChange: (e) => setBackgroundSize(e.target.value),
|
|
5003
5545
|
className: "cms-select-small",
|
|
5004
5546
|
children: [
|
|
5005
|
-
/* @__PURE__ */
|
|
5006
|
-
/* @__PURE__ */
|
|
5007
|
-
/* @__PURE__ */
|
|
5008
|
-
/* @__PURE__ */
|
|
5547
|
+
/* @__PURE__ */ jsx13("option", { value: "cover", children: "Cover" }),
|
|
5548
|
+
/* @__PURE__ */ jsx13("option", { value: "contain", children: "Contain" }),
|
|
5549
|
+
/* @__PURE__ */ jsx13("option", { value: "auto", children: "Auto" }),
|
|
5550
|
+
/* @__PURE__ */ jsx13("option", { value: "100% 100%", children: "Stretch" })
|
|
5009
5551
|
]
|
|
5010
5552
|
}
|
|
5011
5553
|
)
|
|
5012
5554
|
] }),
|
|
5013
|
-
/* @__PURE__ */
|
|
5014
|
-
/* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5555
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-bg-control-item", children: [
|
|
5556
|
+
/* @__PURE__ */ jsx13("label", { children: "Position" }),
|
|
5557
|
+
/* @__PURE__ */ jsxs13(
|
|
5016
5558
|
"select",
|
|
5017
5559
|
{
|
|
5018
5560
|
value: currentBgPosition,
|
|
5019
5561
|
onChange: (e) => setBackgroundPosition(e.target.value),
|
|
5020
5562
|
className: "cms-select-small",
|
|
5021
5563
|
children: [
|
|
5022
|
-
/* @__PURE__ */
|
|
5023
|
-
/* @__PURE__ */
|
|
5024
|
-
/* @__PURE__ */
|
|
5025
|
-
/* @__PURE__ */
|
|
5026
|
-
/* @__PURE__ */
|
|
5027
|
-
/* @__PURE__ */
|
|
5028
|
-
/* @__PURE__ */
|
|
5029
|
-
/* @__PURE__ */
|
|
5030
|
-
/* @__PURE__ */
|
|
5564
|
+
/* @__PURE__ */ jsx13("option", { value: "center", children: "Center" }),
|
|
5565
|
+
/* @__PURE__ */ jsx13("option", { value: "top", children: "Top" }),
|
|
5566
|
+
/* @__PURE__ */ jsx13("option", { value: "bottom", children: "Bottom" }),
|
|
5567
|
+
/* @__PURE__ */ jsx13("option", { value: "left", children: "Left" }),
|
|
5568
|
+
/* @__PURE__ */ jsx13("option", { value: "right", children: "Right" }),
|
|
5569
|
+
/* @__PURE__ */ jsx13("option", { value: "top left", children: "Top Left" }),
|
|
5570
|
+
/* @__PURE__ */ jsx13("option", { value: "top right", children: "Top Right" }),
|
|
5571
|
+
/* @__PURE__ */ jsx13("option", { value: "bottom left", children: "Bottom Left" }),
|
|
5572
|
+
/* @__PURE__ */ jsx13("option", { value: "bottom right", children: "Bottom Right" })
|
|
5031
5573
|
]
|
|
5032
5574
|
}
|
|
5033
5575
|
)
|
|
5034
5576
|
] }),
|
|
5035
|
-
/* @__PURE__ */
|
|
5036
|
-
/* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5577
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-bg-control-item", children: [
|
|
5578
|
+
/* @__PURE__ */ jsx13("label", { children: "Repeat" }),
|
|
5579
|
+
/* @__PURE__ */ jsxs13(
|
|
5038
5580
|
"select",
|
|
5039
5581
|
{
|
|
5040
5582
|
value: currentBgRepeat,
|
|
5041
5583
|
onChange: (e) => setBackgroundRepeat(e.target.value),
|
|
5042
5584
|
className: "cms-select-small",
|
|
5043
5585
|
children: [
|
|
5044
|
-
/* @__PURE__ */
|
|
5045
|
-
/* @__PURE__ */
|
|
5046
|
-
/* @__PURE__ */
|
|
5047
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsx13("option", { value: "no-repeat", children: "No Repeat" }),
|
|
5587
|
+
/* @__PURE__ */ jsx13("option", { value: "repeat", children: "Repeat" }),
|
|
5588
|
+
/* @__PURE__ */ jsx13("option", { value: "repeat-x", children: "Repeat X" }),
|
|
5589
|
+
/* @__PURE__ */ jsx13("option", { value: "repeat-y", children: "Repeat Y" })
|
|
5048
5590
|
]
|
|
5049
5591
|
}
|
|
5050
5592
|
)
|
|
5051
5593
|
] })
|
|
5052
5594
|
] }),
|
|
5053
|
-
/* @__PURE__ */
|
|
5595
|
+
/* @__PURE__ */ jsx13(
|
|
5054
5596
|
"button",
|
|
5055
5597
|
{
|
|
5056
5598
|
onClick: removeBackgroundImage,
|
|
@@ -5061,10 +5603,10 @@ function SectionEditorPlugin() {
|
|
|
5061
5603
|
)
|
|
5062
5604
|
] })
|
|
5063
5605
|
] }),
|
|
5064
|
-
currentBgImage && /* @__PURE__ */
|
|
5065
|
-
/* @__PURE__ */
|
|
5066
|
-
/* @__PURE__ */
|
|
5067
|
-
/* @__PURE__ */
|
|
5606
|
+
currentBgImage && /* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5607
|
+
/* @__PURE__ */ jsx13("label", { children: "Gradient Overlay" }),
|
|
5608
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-gradient-presets", children: [
|
|
5609
|
+
/* @__PURE__ */ jsx13(
|
|
5068
5610
|
"button",
|
|
5069
5611
|
{
|
|
5070
5612
|
onClick: () => setGradientOverlay(""),
|
|
@@ -5073,7 +5615,7 @@ function SectionEditorPlugin() {
|
|
|
5073
5615
|
children: "None"
|
|
5074
5616
|
}
|
|
5075
5617
|
),
|
|
5076
|
-
/* @__PURE__ */
|
|
5618
|
+
/* @__PURE__ */ jsx13(
|
|
5077
5619
|
"button",
|
|
5078
5620
|
{
|
|
5079
5621
|
onClick: () => setGradientOverlay("linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.7))"),
|
|
@@ -5083,7 +5625,7 @@ function SectionEditorPlugin() {
|
|
|
5083
5625
|
type: "button"
|
|
5084
5626
|
}
|
|
5085
5627
|
),
|
|
5086
|
-
/* @__PURE__ */
|
|
5628
|
+
/* @__PURE__ */ jsx13(
|
|
5087
5629
|
"button",
|
|
5088
5630
|
{
|
|
5089
5631
|
onClick: () => setGradientOverlay("linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5))"),
|
|
@@ -5093,7 +5635,7 @@ function SectionEditorPlugin() {
|
|
|
5093
5635
|
type: "button"
|
|
5094
5636
|
}
|
|
5095
5637
|
),
|
|
5096
|
-
/* @__PURE__ */
|
|
5638
|
+
/* @__PURE__ */ jsx13(
|
|
5097
5639
|
"button",
|
|
5098
5640
|
{
|
|
5099
5641
|
onClick: () => setGradientOverlay("linear-gradient(rgba(102,126,234,0.8), rgba(118,75,162,0.8))"),
|
|
@@ -5103,7 +5645,7 @@ function SectionEditorPlugin() {
|
|
|
5103
5645
|
type: "button"
|
|
5104
5646
|
}
|
|
5105
5647
|
),
|
|
5106
|
-
/* @__PURE__ */
|
|
5648
|
+
/* @__PURE__ */ jsx13(
|
|
5107
5649
|
"button",
|
|
5108
5650
|
{
|
|
5109
5651
|
onClick: () => setGradientOverlay("linear-gradient(rgba(250,112,154,0.8), rgba(254,225,64,0.8))"),
|
|
@@ -5113,7 +5655,7 @@ function SectionEditorPlugin() {
|
|
|
5113
5655
|
type: "button"
|
|
5114
5656
|
}
|
|
5115
5657
|
),
|
|
5116
|
-
/* @__PURE__ */
|
|
5658
|
+
/* @__PURE__ */ jsx13(
|
|
5117
5659
|
"button",
|
|
5118
5660
|
{
|
|
5119
5661
|
onClick: () => setGradientOverlay("linear-gradient(rgba(67,233,123,0.8), rgba(56,249,215,0.8))"),
|
|
@@ -5124,7 +5666,7 @@ function SectionEditorPlugin() {
|
|
|
5124
5666
|
}
|
|
5125
5667
|
)
|
|
5126
5668
|
] }),
|
|
5127
|
-
/* @__PURE__ */
|
|
5669
|
+
/* @__PURE__ */ jsx13(
|
|
5128
5670
|
"input",
|
|
5129
5671
|
{
|
|
5130
5672
|
type: "text",
|
|
@@ -5135,13 +5677,13 @@ function SectionEditorPlugin() {
|
|
|
5135
5677
|
}
|
|
5136
5678
|
)
|
|
5137
5679
|
] }),
|
|
5138
|
-
/* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5680
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5681
|
+
/* @__PURE__ */ jsxs13("label", { children: [
|
|
5140
5682
|
"Opacity: ",
|
|
5141
5683
|
Math.round((currentOpacity || 1) * 100),
|
|
5142
5684
|
"%"
|
|
5143
5685
|
] }),
|
|
5144
|
-
/* @__PURE__ */
|
|
5686
|
+
/* @__PURE__ */ jsx13(
|
|
5145
5687
|
"input",
|
|
5146
5688
|
{
|
|
5147
5689
|
type: "range",
|
|
@@ -5153,62 +5695,62 @@ function SectionEditorPlugin() {
|
|
|
5153
5695
|
className: "cms-range-input"
|
|
5154
5696
|
}
|
|
5155
5697
|
),
|
|
5156
|
-
/* @__PURE__ */
|
|
5157
|
-
/* @__PURE__ */
|
|
5158
|
-
/* @__PURE__ */
|
|
5159
|
-
/* @__PURE__ */
|
|
5160
|
-
/* @__PURE__ */
|
|
5698
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-preset-buttons", children: [
|
|
5699
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setOpacity(0.25), type: "button", children: "25%" }),
|
|
5700
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setOpacity(0.5), type: "button", children: "50%" }),
|
|
5701
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setOpacity(0.75), type: "button", children: "75%" }),
|
|
5702
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setOpacity(1), type: "button", children: "100%" })
|
|
5161
5703
|
] })
|
|
5162
5704
|
] }),
|
|
5163
|
-
/* @__PURE__ */
|
|
5164
|
-
/* @__PURE__ */
|
|
5165
|
-
/* @__PURE__ */
|
|
5166
|
-
/* @__PURE__ */
|
|
5705
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5706
|
+
/* @__PURE__ */ jsx13("label", { children: "Text Alignment" }),
|
|
5707
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-button-group", children: [
|
|
5708
|
+
/* @__PURE__ */ jsx13(
|
|
5167
5709
|
"button",
|
|
5168
5710
|
{
|
|
5169
5711
|
className: `cms-icon-button ${currentTextAlign === "left" ? "active" : ""}`,
|
|
5170
5712
|
onClick: () => setTextAlign("left"),
|
|
5171
5713
|
title: "Align Left",
|
|
5172
5714
|
type: "button",
|
|
5173
|
-
children: /* @__PURE__ */
|
|
5715
|
+
children: /* @__PURE__ */ jsx13(FaAlignLeft, {})
|
|
5174
5716
|
}
|
|
5175
5717
|
),
|
|
5176
|
-
/* @__PURE__ */
|
|
5718
|
+
/* @__PURE__ */ jsx13(
|
|
5177
5719
|
"button",
|
|
5178
5720
|
{
|
|
5179
5721
|
className: `cms-icon-button ${currentTextAlign === "center" ? "active" : ""}`,
|
|
5180
5722
|
onClick: () => setTextAlign("center"),
|
|
5181
5723
|
title: "Align Center",
|
|
5182
5724
|
type: "button",
|
|
5183
|
-
children: /* @__PURE__ */
|
|
5725
|
+
children: /* @__PURE__ */ jsx13(FaAlignCenter, {})
|
|
5184
5726
|
}
|
|
5185
5727
|
),
|
|
5186
|
-
/* @__PURE__ */
|
|
5728
|
+
/* @__PURE__ */ jsx13(
|
|
5187
5729
|
"button",
|
|
5188
5730
|
{
|
|
5189
5731
|
className: `cms-icon-button ${currentTextAlign === "right" ? "active" : ""}`,
|
|
5190
5732
|
onClick: () => setTextAlign("right"),
|
|
5191
5733
|
title: "Align Right",
|
|
5192
5734
|
type: "button",
|
|
5193
|
-
children: /* @__PURE__ */
|
|
5735
|
+
children: /* @__PURE__ */ jsx13(FaAlignRight, {})
|
|
5194
5736
|
}
|
|
5195
5737
|
),
|
|
5196
|
-
/* @__PURE__ */
|
|
5738
|
+
/* @__PURE__ */ jsx13(
|
|
5197
5739
|
"button",
|
|
5198
5740
|
{
|
|
5199
5741
|
className: `cms-icon-button ${currentTextAlign === "justify" ? "active" : ""}`,
|
|
5200
5742
|
onClick: () => setTextAlign("justify"),
|
|
5201
5743
|
title: "Justify",
|
|
5202
5744
|
type: "button",
|
|
5203
|
-
children: /* @__PURE__ */
|
|
5745
|
+
children: /* @__PURE__ */ jsx13(FaAlignJustify, {})
|
|
5204
5746
|
}
|
|
5205
5747
|
)
|
|
5206
5748
|
] })
|
|
5207
5749
|
] }),
|
|
5208
|
-
/* @__PURE__ */
|
|
5209
|
-
/* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5211
|
-
/* @__PURE__ */
|
|
5750
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5751
|
+
/* @__PURE__ */ jsx13("label", { children: "Layout Type" }),
|
|
5752
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-button-group", children: [
|
|
5753
|
+
/* @__PURE__ */ jsx13(
|
|
5212
5754
|
"button",
|
|
5213
5755
|
{
|
|
5214
5756
|
className: `cms-layout-button ${currentLayout === "block" ? "active" : ""}`,
|
|
@@ -5217,7 +5759,7 @@ function SectionEditorPlugin() {
|
|
|
5217
5759
|
children: "Block"
|
|
5218
5760
|
}
|
|
5219
5761
|
),
|
|
5220
|
-
/* @__PURE__ */
|
|
5762
|
+
/* @__PURE__ */ jsx13(
|
|
5221
5763
|
"button",
|
|
5222
5764
|
{
|
|
5223
5765
|
className: `cms-layout-button ${currentLayout === "flex" ? "active" : ""}`,
|
|
@@ -5226,7 +5768,7 @@ function SectionEditorPlugin() {
|
|
|
5226
5768
|
children: "Flex"
|
|
5227
5769
|
}
|
|
5228
5770
|
),
|
|
5229
|
-
/* @__PURE__ */
|
|
5771
|
+
/* @__PURE__ */ jsx13(
|
|
5230
5772
|
"button",
|
|
5231
5773
|
{
|
|
5232
5774
|
className: `cms-layout-button ${currentLayout === "grid" ? "active" : ""}`,
|
|
@@ -5237,81 +5779,81 @@ function SectionEditorPlugin() {
|
|
|
5237
5779
|
)
|
|
5238
5780
|
] })
|
|
5239
5781
|
] }),
|
|
5240
|
-
currentLayout === "flex" && /* @__PURE__ */
|
|
5241
|
-
/* @__PURE__ */
|
|
5242
|
-
/* @__PURE__ */
|
|
5243
|
-
/* @__PURE__ */
|
|
5782
|
+
currentLayout === "flex" && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5783
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5784
|
+
/* @__PURE__ */ jsx13("label", { children: "Flex Direction" }),
|
|
5785
|
+
/* @__PURE__ */ jsxs13(
|
|
5244
5786
|
"select",
|
|
5245
5787
|
{
|
|
5246
5788
|
value: currentFlexDirection,
|
|
5247
5789
|
onChange: (e) => setFlexDirection(e.target.value),
|
|
5248
5790
|
className: "cms-select",
|
|
5249
5791
|
children: [
|
|
5250
|
-
/* @__PURE__ */
|
|
5251
|
-
/* @__PURE__ */
|
|
5252
|
-
/* @__PURE__ */
|
|
5253
|
-
/* @__PURE__ */
|
|
5792
|
+
/* @__PURE__ */ jsx13("option", { value: "row", children: "Row" }),
|
|
5793
|
+
/* @__PURE__ */ jsx13("option", { value: "column", children: "Column" }),
|
|
5794
|
+
/* @__PURE__ */ jsx13("option", { value: "row-reverse", children: "Row Reverse" }),
|
|
5795
|
+
/* @__PURE__ */ jsx13("option", { value: "column-reverse", children: "Column Reverse" })
|
|
5254
5796
|
]
|
|
5255
5797
|
}
|
|
5256
5798
|
)
|
|
5257
5799
|
] }),
|
|
5258
|
-
/* @__PURE__ */
|
|
5259
|
-
/* @__PURE__ */
|
|
5260
|
-
/* @__PURE__ */
|
|
5800
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5801
|
+
/* @__PURE__ */ jsx13("label", { children: "Flex Wrap" }),
|
|
5802
|
+
/* @__PURE__ */ jsxs13(
|
|
5261
5803
|
"select",
|
|
5262
5804
|
{
|
|
5263
5805
|
value: currentFlexWrap,
|
|
5264
5806
|
onChange: (e) => setFlexWrap(e.target.value),
|
|
5265
5807
|
className: "cms-select",
|
|
5266
5808
|
children: [
|
|
5267
|
-
/* @__PURE__ */
|
|
5268
|
-
/* @__PURE__ */
|
|
5269
|
-
/* @__PURE__ */
|
|
5809
|
+
/* @__PURE__ */ jsx13("option", { value: "nowrap", children: "No Wrap" }),
|
|
5810
|
+
/* @__PURE__ */ jsx13("option", { value: "wrap", children: "Wrap" }),
|
|
5811
|
+
/* @__PURE__ */ jsx13("option", { value: "wrap-reverse", children: "Wrap Reverse" })
|
|
5270
5812
|
]
|
|
5271
5813
|
}
|
|
5272
5814
|
)
|
|
5273
5815
|
] }),
|
|
5274
|
-
/* @__PURE__ */
|
|
5275
|
-
/* @__PURE__ */
|
|
5276
|
-
/* @__PURE__ */
|
|
5816
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5817
|
+
/* @__PURE__ */ jsx13("label", { children: "Align Items" }),
|
|
5818
|
+
/* @__PURE__ */ jsxs13(
|
|
5277
5819
|
"select",
|
|
5278
5820
|
{
|
|
5279
5821
|
value: currentAlignItems,
|
|
5280
5822
|
onChange: (e) => setAlignItems(e.target.value),
|
|
5281
5823
|
className: "cms-select",
|
|
5282
5824
|
children: [
|
|
5283
|
-
/* @__PURE__ */
|
|
5284
|
-
/* @__PURE__ */
|
|
5285
|
-
/* @__PURE__ */
|
|
5286
|
-
/* @__PURE__ */
|
|
5825
|
+
/* @__PURE__ */ jsx13("option", { value: "flex-start", children: "Start" }),
|
|
5826
|
+
/* @__PURE__ */ jsx13("option", { value: "center", children: "Center" }),
|
|
5827
|
+
/* @__PURE__ */ jsx13("option", { value: "flex-end", children: "End" }),
|
|
5828
|
+
/* @__PURE__ */ jsx13("option", { value: "stretch", children: "Stretch" })
|
|
5287
5829
|
]
|
|
5288
5830
|
}
|
|
5289
5831
|
)
|
|
5290
5832
|
] }),
|
|
5291
|
-
/* @__PURE__ */
|
|
5292
|
-
/* @__PURE__ */
|
|
5293
|
-
/* @__PURE__ */
|
|
5833
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5834
|
+
/* @__PURE__ */ jsx13("label", { children: "Justify Content" }),
|
|
5835
|
+
/* @__PURE__ */ jsxs13(
|
|
5294
5836
|
"select",
|
|
5295
5837
|
{
|
|
5296
5838
|
value: currentJustifyContent,
|
|
5297
5839
|
onChange: (e) => setJustifyContent(e.target.value),
|
|
5298
5840
|
className: "cms-select",
|
|
5299
5841
|
children: [
|
|
5300
|
-
/* @__PURE__ */
|
|
5301
|
-
/* @__PURE__ */
|
|
5302
|
-
/* @__PURE__ */
|
|
5303
|
-
/* @__PURE__ */
|
|
5304
|
-
/* @__PURE__ */
|
|
5305
|
-
/* @__PURE__ */
|
|
5842
|
+
/* @__PURE__ */ jsx13("option", { value: "flex-start", children: "Start" }),
|
|
5843
|
+
/* @__PURE__ */ jsx13("option", { value: "center", children: "Center" }),
|
|
5844
|
+
/* @__PURE__ */ jsx13("option", { value: "flex-end", children: "End" }),
|
|
5845
|
+
/* @__PURE__ */ jsx13("option", { value: "space-between", children: "Space Between" }),
|
|
5846
|
+
/* @__PURE__ */ jsx13("option", { value: "space-around", children: "Space Around" }),
|
|
5847
|
+
/* @__PURE__ */ jsx13("option", { value: "space-evenly", children: "Space Evenly" })
|
|
5306
5848
|
]
|
|
5307
5849
|
}
|
|
5308
5850
|
)
|
|
5309
5851
|
] })
|
|
5310
5852
|
] }),
|
|
5311
|
-
currentLayout === "grid" && /* @__PURE__ */
|
|
5312
|
-
/* @__PURE__ */
|
|
5313
|
-
/* @__PURE__ */
|
|
5314
|
-
/* @__PURE__ */
|
|
5853
|
+
currentLayout === "grid" && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5854
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5855
|
+
/* @__PURE__ */ jsx13("label", { children: "Grid Columns" }),
|
|
5856
|
+
/* @__PURE__ */ jsx13(
|
|
5315
5857
|
"input",
|
|
5316
5858
|
{
|
|
5317
5859
|
type: "text",
|
|
@@ -5321,16 +5863,16 @@ function SectionEditorPlugin() {
|
|
|
5321
5863
|
className: "cms-text-input"
|
|
5322
5864
|
}
|
|
5323
5865
|
),
|
|
5324
|
-
/* @__PURE__ */
|
|
5325
|
-
/* @__PURE__ */
|
|
5326
|
-
/* @__PURE__ */
|
|
5327
|
-
/* @__PURE__ */
|
|
5328
|
-
/* @__PURE__ */
|
|
5866
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-preset-buttons", children: [
|
|
5867
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGridColumns("1fr"), type: "button", children: "1 Col" }),
|
|
5868
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGridColumns("repeat(2, 1fr)"), type: "button", children: "2 Cols" }),
|
|
5869
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGridColumns("repeat(3, 1fr)"), type: "button", children: "3 Cols" }),
|
|
5870
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGridColumns("repeat(4, 1fr)"), type: "button", children: "4 Cols" })
|
|
5329
5871
|
] })
|
|
5330
5872
|
] }),
|
|
5331
|
-
/* @__PURE__ */
|
|
5332
|
-
/* @__PURE__ */
|
|
5333
|
-
/* @__PURE__ */
|
|
5873
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5874
|
+
/* @__PURE__ */ jsx13("label", { children: "Grid Rows" }),
|
|
5875
|
+
/* @__PURE__ */ jsx13(
|
|
5334
5876
|
"input",
|
|
5335
5877
|
{
|
|
5336
5878
|
type: "text",
|
|
@@ -5342,12 +5884,12 @@ function SectionEditorPlugin() {
|
|
|
5342
5884
|
)
|
|
5343
5885
|
] })
|
|
5344
5886
|
] }),
|
|
5345
|
-
(currentLayout === "flex" || currentLayout === "grid") && /* @__PURE__ */
|
|
5346
|
-
/* @__PURE__ */
|
|
5887
|
+
(currentLayout === "flex" || currentLayout === "grid") && /* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5888
|
+
/* @__PURE__ */ jsxs13("label", { children: [
|
|
5347
5889
|
"Gap: ",
|
|
5348
5890
|
currentGap
|
|
5349
5891
|
] }),
|
|
5350
|
-
/* @__PURE__ */
|
|
5892
|
+
/* @__PURE__ */ jsx13(
|
|
5351
5893
|
"input",
|
|
5352
5894
|
{
|
|
5353
5895
|
type: "range",
|
|
@@ -5358,17 +5900,17 @@ function SectionEditorPlugin() {
|
|
|
5358
5900
|
className: "cms-range-input"
|
|
5359
5901
|
}
|
|
5360
5902
|
),
|
|
5361
|
-
/* @__PURE__ */
|
|
5362
|
-
/* @__PURE__ */
|
|
5363
|
-
/* @__PURE__ */
|
|
5364
|
-
/* @__PURE__ */
|
|
5365
|
-
/* @__PURE__ */
|
|
5366
|
-
/* @__PURE__ */
|
|
5903
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-preset-buttons", children: [
|
|
5904
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGap("0px"), type: "button", children: "0" }),
|
|
5905
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGap("8px"), type: "button", children: "8" }),
|
|
5906
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGap("16px"), type: "button", children: "16" }),
|
|
5907
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGap("24px"), type: "button", children: "24" }),
|
|
5908
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setGap("32px"), type: "button", children: "32" })
|
|
5367
5909
|
] })
|
|
5368
5910
|
] }),
|
|
5369
|
-
/* @__PURE__ */
|
|
5370
|
-
/* @__PURE__ */
|
|
5371
|
-
/* @__PURE__ */
|
|
5911
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5912
|
+
/* @__PURE__ */ jsx13("label", { children: "Padding" }),
|
|
5913
|
+
/* @__PURE__ */ jsx13(
|
|
5372
5914
|
"input",
|
|
5373
5915
|
{
|
|
5374
5916
|
type: "text",
|
|
@@ -5378,17 +5920,17 @@ function SectionEditorPlugin() {
|
|
|
5378
5920
|
className: "cms-text-input"
|
|
5379
5921
|
}
|
|
5380
5922
|
),
|
|
5381
|
-
/* @__PURE__ */
|
|
5382
|
-
/* @__PURE__ */
|
|
5383
|
-
/* @__PURE__ */
|
|
5384
|
-
/* @__PURE__ */
|
|
5385
|
-
/* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5923
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-preset-buttons", children: [
|
|
5924
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setPadding("0px"), type: "button", children: "0" }),
|
|
5925
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setPadding("20px"), type: "button", children: "20" }),
|
|
5926
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setPadding("40px"), type: "button", children: "40" }),
|
|
5927
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setPadding("60px"), type: "button", children: "60" }),
|
|
5928
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setPadding("80px"), type: "button", children: "80" })
|
|
5387
5929
|
] })
|
|
5388
5930
|
] }),
|
|
5389
|
-
/* @__PURE__ */
|
|
5390
|
-
/* @__PURE__ */
|
|
5391
|
-
/* @__PURE__ */
|
|
5931
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-section-editor-group", children: [
|
|
5932
|
+
/* @__PURE__ */ jsx13("label", { children: "Margin" }),
|
|
5933
|
+
/* @__PURE__ */ jsx13(
|
|
5392
5934
|
"input",
|
|
5393
5935
|
{
|
|
5394
5936
|
type: "text",
|
|
@@ -5398,11 +5940,11 @@ function SectionEditorPlugin() {
|
|
|
5398
5940
|
className: "cms-text-input"
|
|
5399
5941
|
}
|
|
5400
5942
|
),
|
|
5401
|
-
/* @__PURE__ */
|
|
5402
|
-
/* @__PURE__ */
|
|
5403
|
-
/* @__PURE__ */
|
|
5404
|
-
/* @__PURE__ */
|
|
5405
|
-
/* @__PURE__ */
|
|
5943
|
+
/* @__PURE__ */ jsxs13("div", { className: "cms-preset-buttons", children: [
|
|
5944
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setMargin("0px"), type: "button", children: "0" }),
|
|
5945
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setMargin("20px 0"), type: "button", children: "20 V" }),
|
|
5946
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setMargin("40px 0"), type: "button", children: "40 V" }),
|
|
5947
|
+
/* @__PURE__ */ jsx13("button", { onClick: () => setMargin("0 auto"), type: "button", children: "Center" })
|
|
5406
5948
|
] })
|
|
5407
5949
|
] })
|
|
5408
5950
|
] })
|
|
@@ -5413,14 +5955,14 @@ function SectionEditorPlugin() {
|
|
|
5413
5955
|
}
|
|
5414
5956
|
|
|
5415
5957
|
// src/plugins/EmbedPlugin.tsx
|
|
5416
|
-
import { useLexicalComposerContext as
|
|
5417
|
-
import { useState as
|
|
5418
|
-
import { $getSelection as $
|
|
5958
|
+
import { useLexicalComposerContext as useLexicalComposerContext13 } from "@lexical/react/LexicalComposerContext";
|
|
5959
|
+
import { useState as useState15, useCallback as useCallback13, useRef as useRef11, useEffect as useEffect16 } from "react";
|
|
5960
|
+
import { $getSelection as $getSelection11, $isRangeSelection as $isRangeSelection11, $createParagraphNode as $createParagraphNode6 } from "lexical";
|
|
5419
5961
|
|
|
5420
5962
|
// src/blocks/EmbedNode.tsx
|
|
5421
|
-
import { DecoratorNode as
|
|
5422
|
-
import { useCallback as
|
|
5423
|
-
import { Fragment as
|
|
5963
|
+
import { DecoratorNode as DecoratorNode4 } from "lexical";
|
|
5964
|
+
import { useCallback as useCallback12, useEffect as useEffect15, useRef as useRef10, useState as useState14 } from "react";
|
|
5965
|
+
import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5424
5966
|
function detectEmbedType(url) {
|
|
5425
5967
|
if (url.includes("youtube.com") || url.includes("youtu.be")) return "youtube";
|
|
5426
5968
|
if (url.includes("facebook.com") || url.includes("fb.watch")) return "facebook";
|
|
@@ -5480,24 +6022,24 @@ function EmbedComponent({
|
|
|
5480
6022
|
nodeKey,
|
|
5481
6023
|
editor
|
|
5482
6024
|
}) {
|
|
5483
|
-
const wrapperRef =
|
|
5484
|
-
const [isResizing, setIsResizing] =
|
|
5485
|
-
const [isSelected, setIsSelected] =
|
|
5486
|
-
const [embedHtml, setEmbedHtml] =
|
|
6025
|
+
const wrapperRef = useRef10(null);
|
|
6026
|
+
const [isResizing, setIsResizing] = useState14(false);
|
|
6027
|
+
const [isSelected, setIsSelected] = useState14(false);
|
|
6028
|
+
const [embedHtml, setEmbedHtml] = useState14("");
|
|
5487
6029
|
const width = initialWidth || (type === "spotify" ? 300 : 560);
|
|
5488
6030
|
const height = initialHeight || (type === "spotify" ? 380 : 315);
|
|
5489
|
-
const [size, setSize] =
|
|
6031
|
+
const [size, setSize] = useState14({
|
|
5490
6032
|
width,
|
|
5491
6033
|
height
|
|
5492
6034
|
});
|
|
5493
|
-
|
|
6035
|
+
useEffect15(() => {
|
|
5494
6036
|
setSize({
|
|
5495
6037
|
width: initialWidth || (type === "spotify" ? 300 : 560),
|
|
5496
6038
|
height: initialHeight || (type === "spotify" ? 380 : 315)
|
|
5497
6039
|
});
|
|
5498
6040
|
}, [initialWidth, initialHeight, type]);
|
|
5499
6041
|
const embedUrl = getEmbedUrl(url, type);
|
|
5500
|
-
|
|
6042
|
+
useEffect15(() => {
|
|
5501
6043
|
if (type === "instagram" || type === "twitter" || type === "tiktok") {
|
|
5502
6044
|
loadOEmbed(url, type);
|
|
5503
6045
|
}
|
|
@@ -5527,7 +6069,7 @@ function EmbedComponent({
|
|
|
5527
6069
|
console.error("Failed to load oEmbed:", error);
|
|
5528
6070
|
}
|
|
5529
6071
|
};
|
|
5530
|
-
const onResizeStart =
|
|
6072
|
+
const onResizeStart = useCallback12((e, direction) => {
|
|
5531
6073
|
e.preventDefault();
|
|
5532
6074
|
e.stopPropagation();
|
|
5533
6075
|
setIsResizing(true);
|
|
@@ -5578,7 +6120,7 @@ function EmbedComponent({
|
|
|
5578
6120
|
}, [size, editor, nodeKey]);
|
|
5579
6121
|
const renderEmbed = () => {
|
|
5580
6122
|
if (embedHtml && (type === "instagram" || type === "twitter" || type === "tiktok")) {
|
|
5581
|
-
return /* @__PURE__ */
|
|
6123
|
+
return /* @__PURE__ */ jsx14(
|
|
5582
6124
|
"div",
|
|
5583
6125
|
{
|
|
5584
6126
|
dangerouslySetInnerHTML: { __html: embedHtml },
|
|
@@ -5587,7 +6129,7 @@ function EmbedComponent({
|
|
|
5587
6129
|
);
|
|
5588
6130
|
}
|
|
5589
6131
|
if (type === "youtube" || type === "vimeo" || type === "facebook" || type === "spotify" || type === "soundcloud") {
|
|
5590
|
-
return /* @__PURE__ */
|
|
6132
|
+
return /* @__PURE__ */ jsx14(
|
|
5591
6133
|
"iframe",
|
|
5592
6134
|
{
|
|
5593
6135
|
src: embedUrl,
|
|
@@ -5603,14 +6145,14 @@ function EmbedComponent({
|
|
|
5603
6145
|
}
|
|
5604
6146
|
);
|
|
5605
6147
|
}
|
|
5606
|
-
return /* @__PURE__ */
|
|
6148
|
+
return /* @__PURE__ */ jsxs14("div", { style: {
|
|
5607
6149
|
padding: "20px",
|
|
5608
6150
|
background: "#f8f9fa",
|
|
5609
6151
|
borderRadius: "8px",
|
|
5610
6152
|
textAlign: "center"
|
|
5611
6153
|
}, children: [
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
6154
|
+
/* @__PURE__ */ jsx14("p", { style: { margin: "0 0 10px 0", color: "#6c757d" }, children: "Embedded Content" }),
|
|
6155
|
+
/* @__PURE__ */ jsx14(
|
|
5614
6156
|
"a",
|
|
5615
6157
|
{
|
|
5616
6158
|
href: url,
|
|
@@ -5622,7 +6164,7 @@ function EmbedComponent({
|
|
|
5622
6164
|
)
|
|
5623
6165
|
] });
|
|
5624
6166
|
};
|
|
5625
|
-
return /* @__PURE__ */
|
|
6167
|
+
return /* @__PURE__ */ jsxs14(
|
|
5626
6168
|
"div",
|
|
5627
6169
|
{
|
|
5628
6170
|
ref: wrapperRef,
|
|
@@ -5642,8 +6184,8 @@ function EmbedComponent({
|
|
|
5642
6184
|
},
|
|
5643
6185
|
children: [
|
|
5644
6186
|
renderEmbed(),
|
|
5645
|
-
isSelected && (type === "youtube" || type === "vimeo" || type === "facebook" || type === "spotify" || type === "soundcloud") && /* @__PURE__ */
|
|
5646
|
-
/* @__PURE__ */
|
|
6187
|
+
isSelected && (type === "youtube" || type === "vimeo" || type === "facebook" || type === "spotify" || type === "soundcloud") && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
6188
|
+
/* @__PURE__ */ jsx14(
|
|
5647
6189
|
"div",
|
|
5648
6190
|
{
|
|
5649
6191
|
className: "embed-resize-handle embed-resize-handle-se",
|
|
@@ -5663,7 +6205,7 @@ function EmbedComponent({
|
|
|
5663
6205
|
}
|
|
5664
6206
|
}
|
|
5665
6207
|
),
|
|
5666
|
-
/* @__PURE__ */
|
|
6208
|
+
/* @__PURE__ */ jsx14(
|
|
5667
6209
|
"div",
|
|
5668
6210
|
{
|
|
5669
6211
|
className: "embed-resize-handle embed-resize-handle-ne",
|
|
@@ -5688,7 +6230,7 @@ function EmbedComponent({
|
|
|
5688
6230
|
}
|
|
5689
6231
|
);
|
|
5690
6232
|
}
|
|
5691
|
-
var EmbedNode = class _EmbedNode extends
|
|
6233
|
+
var EmbedNode = class _EmbedNode extends DecoratorNode4 {
|
|
5692
6234
|
static getType() {
|
|
5693
6235
|
return "embed";
|
|
5694
6236
|
}
|
|
@@ -5715,7 +6257,7 @@ var EmbedNode = class _EmbedNode extends DecoratorNode3 {
|
|
|
5715
6257
|
return false;
|
|
5716
6258
|
}
|
|
5717
6259
|
decorate(editor) {
|
|
5718
|
-
return /* @__PURE__ */
|
|
6260
|
+
return /* @__PURE__ */ jsx14(
|
|
5719
6261
|
EmbedComponent,
|
|
5720
6262
|
{
|
|
5721
6263
|
url: this.__url,
|
|
@@ -5752,13 +6294,13 @@ function $createEmbedNode(url, type, width, height) {
|
|
|
5752
6294
|
|
|
5753
6295
|
// src/plugins/EmbedPlugin.tsx
|
|
5754
6296
|
import { MdVideoLibrary } from "react-icons/md";
|
|
5755
|
-
import { Fragment as
|
|
6297
|
+
import { Fragment as Fragment9, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5756
6298
|
function EmbedPlugin() {
|
|
5757
|
-
const [editor] =
|
|
5758
|
-
const [showModal, setShowModal] =
|
|
5759
|
-
const [embedUrl, setEmbedUrl] =
|
|
5760
|
-
const modalRef =
|
|
5761
|
-
|
|
6299
|
+
const [editor] = useLexicalComposerContext13();
|
|
6300
|
+
const [showModal, setShowModal] = useState15(false);
|
|
6301
|
+
const [embedUrl, setEmbedUrl] = useState15("");
|
|
6302
|
+
const modalRef = useRef11(null);
|
|
6303
|
+
useEffect16(() => {
|
|
5762
6304
|
const handleClickOutside = (event) => {
|
|
5763
6305
|
if (modalRef.current && !modalRef.current.contains(event.target)) {
|
|
5764
6306
|
setShowModal(false);
|
|
@@ -5767,15 +6309,15 @@ function EmbedPlugin() {
|
|
|
5767
6309
|
document.addEventListener("mousedown", handleClickOutside);
|
|
5768
6310
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
5769
6311
|
}, []);
|
|
5770
|
-
const openModal =
|
|
6312
|
+
const openModal = useCallback13((event) => {
|
|
5771
6313
|
setShowModal(true);
|
|
5772
6314
|
setEmbedUrl("");
|
|
5773
6315
|
}, []);
|
|
5774
|
-
const insertEmbed =
|
|
6316
|
+
const insertEmbed = useCallback13(() => {
|
|
5775
6317
|
if (!embedUrl.trim()) return;
|
|
5776
6318
|
editor.update(() => {
|
|
5777
|
-
const selection = $
|
|
5778
|
-
if ($
|
|
6319
|
+
const selection = $getSelection11();
|
|
6320
|
+
if ($isRangeSelection11(selection)) {
|
|
5779
6321
|
const embedNode = $createEmbedNode(embedUrl.trim());
|
|
5780
6322
|
selection.insertNodes([embedNode]);
|
|
5781
6323
|
const paragraph = $createParagraphNode6();
|
|
@@ -5786,7 +6328,7 @@ function EmbedPlugin() {
|
|
|
5786
6328
|
setShowModal(false);
|
|
5787
6329
|
setEmbedUrl("");
|
|
5788
6330
|
}, [editor, embedUrl]);
|
|
5789
|
-
const handleKeyDown =
|
|
6331
|
+
const handleKeyDown = useCallback13((e) => {
|
|
5790
6332
|
if (e.key === "Enter") {
|
|
5791
6333
|
e.preventDefault();
|
|
5792
6334
|
insertEmbed();
|
|
@@ -5794,38 +6336,38 @@ function EmbedPlugin() {
|
|
|
5794
6336
|
setShowModal(false);
|
|
5795
6337
|
}
|
|
5796
6338
|
}, [insertEmbed]);
|
|
5797
|
-
return /* @__PURE__ */
|
|
5798
|
-
/* @__PURE__ */
|
|
6339
|
+
return /* @__PURE__ */ jsxs15("div", { className: "cms-embed-plugin", ref: modalRef, children: [
|
|
6340
|
+
/* @__PURE__ */ jsx15(
|
|
5799
6341
|
"button",
|
|
5800
6342
|
{
|
|
5801
6343
|
className: "cms-toolbar-button",
|
|
5802
6344
|
onClick: openModal,
|
|
5803
6345
|
title: "Insert Embed (YouTube, Facebook, Instagram, etc.)",
|
|
5804
6346
|
type: "button",
|
|
5805
|
-
children: /* @__PURE__ */
|
|
6347
|
+
children: /* @__PURE__ */ jsx15(MdVideoLibrary, { size: 18 })
|
|
5806
6348
|
}
|
|
5807
6349
|
),
|
|
5808
|
-
showModal && /* @__PURE__ */
|
|
5809
|
-
/* @__PURE__ */
|
|
5810
|
-
/* @__PURE__ */
|
|
5811
|
-
/* @__PURE__ */
|
|
5812
|
-
/* @__PURE__ */
|
|
5813
|
-
/* @__PURE__ */
|
|
5814
|
-
/* @__PURE__ */
|
|
5815
|
-
/* @__PURE__ */
|
|
5816
|
-
/* @__PURE__ */
|
|
5817
|
-
/* @__PURE__ */
|
|
5818
|
-
/* @__PURE__ */
|
|
5819
|
-
/* @__PURE__ */
|
|
5820
|
-
/* @__PURE__ */
|
|
5821
|
-
/* @__PURE__ */
|
|
5822
|
-
/* @__PURE__ */
|
|
5823
|
-
/* @__PURE__ */
|
|
6350
|
+
showModal && /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
6351
|
+
/* @__PURE__ */ jsx15("div", { className: "cms-modal-backdrop", onClick: () => setShowModal(false) }),
|
|
6352
|
+
/* @__PURE__ */ jsxs15("div", { className: "cms-embed-modal", children: [
|
|
6353
|
+
/* @__PURE__ */ jsx15("div", { className: "cms-embed-modal-header", children: /* @__PURE__ */ jsx15("span", { children: "Insert Embed" }) }),
|
|
6354
|
+
/* @__PURE__ */ jsxs15("div", { className: "cms-embed-modal-content", children: [
|
|
6355
|
+
/* @__PURE__ */ jsxs15("div", { className: "cms-embed-info", children: [
|
|
6356
|
+
/* @__PURE__ */ jsx15("p", { children: "Paste a link from:" }),
|
|
6357
|
+
/* @__PURE__ */ jsxs15("div", { className: "cms-embed-platforms", children: [
|
|
6358
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "YouTube" }),
|
|
6359
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "Facebook" }),
|
|
6360
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "Instagram" }),
|
|
6361
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "Twitter/X" }),
|
|
6362
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "TikTok" }),
|
|
6363
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "Vimeo" }),
|
|
6364
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "Spotify" }),
|
|
6365
|
+
/* @__PURE__ */ jsx15("span", { className: "cms-embed-platform", children: "SoundCloud" })
|
|
5824
6366
|
] })
|
|
5825
6367
|
] }),
|
|
5826
|
-
/* @__PURE__ */
|
|
5827
|
-
/* @__PURE__ */
|
|
5828
|
-
/* @__PURE__ */
|
|
6368
|
+
/* @__PURE__ */ jsxs15("div", { className: "cms-form-group", children: [
|
|
6369
|
+
/* @__PURE__ */ jsx15("label", { htmlFor: "embed-url", children: "URL" }),
|
|
6370
|
+
/* @__PURE__ */ jsx15(
|
|
5829
6371
|
"input",
|
|
5830
6372
|
{
|
|
5831
6373
|
id: "embed-url",
|
|
@@ -5839,20 +6381,20 @@ function EmbedPlugin() {
|
|
|
5839
6381
|
}
|
|
5840
6382
|
)
|
|
5841
6383
|
] }),
|
|
5842
|
-
/* @__PURE__ */
|
|
5843
|
-
/* @__PURE__ */
|
|
5844
|
-
/* @__PURE__ */
|
|
5845
|
-
/* @__PURE__ */
|
|
5846
|
-
/* @__PURE__ */
|
|
5847
|
-
/* @__PURE__ */
|
|
5848
|
-
/* @__PURE__ */
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
/* @__PURE__ */
|
|
5851
|
-
/* @__PURE__ */
|
|
6384
|
+
/* @__PURE__ */ jsxs15("div", { className: "cms-embed-examples", children: [
|
|
6385
|
+
/* @__PURE__ */ jsx15("p", { className: "cms-embed-examples-title", children: "Example URLs:" }),
|
|
6386
|
+
/* @__PURE__ */ jsxs15("ul", { className: "cms-embed-examples-list", children: [
|
|
6387
|
+
/* @__PURE__ */ jsx15("li", { children: "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }),
|
|
6388
|
+
/* @__PURE__ */ jsx15("li", { children: "https://www.facebook.com/username/posts/123456" }),
|
|
6389
|
+
/* @__PURE__ */ jsx15("li", { children: "https://www.instagram.com/p/ABC123/" }),
|
|
6390
|
+
/* @__PURE__ */ jsx15("li", { children: "https://twitter.com/username/status/123456" }),
|
|
6391
|
+
/* @__PURE__ */ jsx15("li", { children: "https://www.tiktok.com/@username/video/123456" }),
|
|
6392
|
+
/* @__PURE__ */ jsx15("li", { children: "https://vimeo.com/123456789" }),
|
|
6393
|
+
/* @__PURE__ */ jsx15("li", { children: "https://open.spotify.com/track/123456" })
|
|
5852
6394
|
] })
|
|
5853
6395
|
] }),
|
|
5854
|
-
/* @__PURE__ */
|
|
5855
|
-
/* @__PURE__ */
|
|
6396
|
+
/* @__PURE__ */ jsxs15("div", { className: "cms-modal-actions", children: [
|
|
6397
|
+
/* @__PURE__ */ jsx15(
|
|
5856
6398
|
"button",
|
|
5857
6399
|
{
|
|
5858
6400
|
onClick: () => setShowModal(false),
|
|
@@ -5861,7 +6403,7 @@ function EmbedPlugin() {
|
|
|
5861
6403
|
children: "Cancel"
|
|
5862
6404
|
}
|
|
5863
6405
|
),
|
|
5864
|
-
/* @__PURE__ */
|
|
6406
|
+
/* @__PURE__ */ jsx15(
|
|
5865
6407
|
"button",
|
|
5866
6408
|
{
|
|
5867
6409
|
onClick: insertEmbed,
|
|
@@ -5879,34 +6421,36 @@ function EmbedPlugin() {
|
|
|
5879
6421
|
}
|
|
5880
6422
|
|
|
5881
6423
|
// src/core/EditorShell.tsx
|
|
5882
|
-
import { jsx as
|
|
6424
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5883
6425
|
function EditorShell({
|
|
5884
6426
|
onChange,
|
|
5885
6427
|
onImageAdded,
|
|
6428
|
+
onVideoAdded,
|
|
5886
6429
|
useBase64Url
|
|
5887
6430
|
}) {
|
|
5888
|
-
return /* @__PURE__ */
|
|
5889
|
-
/* @__PURE__ */
|
|
5890
|
-
/* @__PURE__ */
|
|
6431
|
+
return /* @__PURE__ */ jsxs16("div", { className: "cms-editor-shell", children: [
|
|
6432
|
+
/* @__PURE__ */ jsx16(ToolbarPlugin, {}),
|
|
6433
|
+
/* @__PURE__ */ jsx16(
|
|
5891
6434
|
RichTextPlugin,
|
|
5892
6435
|
{
|
|
5893
|
-
contentEditable: /* @__PURE__ */
|
|
5894
|
-
placeholder: /* @__PURE__ */
|
|
6436
|
+
contentEditable: /* @__PURE__ */ jsx16(ContentEditable, { className: "cms-editor-content" }),
|
|
6437
|
+
placeholder: /* @__PURE__ */ jsx16("div", { className: "cms-editor-placeholder", children: "Start typing or press / for commands..." }),
|
|
5895
6438
|
ErrorBoundary: LexicalErrorBoundary
|
|
5896
6439
|
}
|
|
5897
6440
|
),
|
|
5898
|
-
/* @__PURE__ */
|
|
5899
|
-
/* @__PURE__ */
|
|
5900
|
-
/* @__PURE__ */
|
|
5901
|
-
/* @__PURE__ */
|
|
5902
|
-
/* @__PURE__ */
|
|
5903
|
-
/* @__PURE__ */
|
|
5904
|
-
/* @__PURE__ */
|
|
5905
|
-
/* @__PURE__ */
|
|
5906
|
-
/* @__PURE__ */
|
|
5907
|
-
/* @__PURE__ */
|
|
5908
|
-
/* @__PURE__ */
|
|
5909
|
-
|
|
6441
|
+
/* @__PURE__ */ jsx16(HistoryPlugin, {}),
|
|
6442
|
+
/* @__PURE__ */ jsx16(ListPlugin, {}),
|
|
6443
|
+
/* @__PURE__ */ jsx16(LexicalLinkPlugin, {}),
|
|
6444
|
+
/* @__PURE__ */ jsx16(LexicalTablePlugin, {}),
|
|
6445
|
+
/* @__PURE__ */ jsx16(SlashCommandPlugin, {}),
|
|
6446
|
+
/* @__PURE__ */ jsx16(ImageUploadPlugin, { onImageAdded, useBase64Url }),
|
|
6447
|
+
/* @__PURE__ */ jsx16(VideoUploadPlugin, { onVideoAdded, useBase64Url }),
|
|
6448
|
+
/* @__PURE__ */ jsx16(ImageEditorPlugin, {}),
|
|
6449
|
+
/* @__PURE__ */ jsx16(LinkPlugin, {}),
|
|
6450
|
+
/* @__PURE__ */ jsx16(SectionEditorPlugin, {}),
|
|
6451
|
+
/* @__PURE__ */ jsx16(EmbedPlugin, {}),
|
|
6452
|
+
/* @__PURE__ */ jsx16(TablePlugin, {}),
|
|
6453
|
+
onChange && /* @__PURE__ */ jsx16(
|
|
5910
6454
|
OnChangePlugin,
|
|
5911
6455
|
{
|
|
5912
6456
|
onChange: (editorState) => {
|
|
@@ -5953,6 +6497,7 @@ function createEditorConfig(value) {
|
|
|
5953
6497
|
TableCellNode,
|
|
5954
6498
|
TableRowNode,
|
|
5955
6499
|
ImageNode,
|
|
6500
|
+
VideoNode,
|
|
5956
6501
|
QuoteNode,
|
|
5957
6502
|
ColumnsNode,
|
|
5958
6503
|
ColumnNode,
|
|
@@ -5965,18 +6510,20 @@ function createEditorConfig(value) {
|
|
|
5965
6510
|
}
|
|
5966
6511
|
|
|
5967
6512
|
// src/core/CMSBlockEditor.tsx
|
|
5968
|
-
import { jsx as
|
|
6513
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
5969
6514
|
function CMSBlockEditor({
|
|
5970
6515
|
value,
|
|
5971
6516
|
onChange,
|
|
5972
6517
|
onImageAdded,
|
|
6518
|
+
onVideoAdded,
|
|
5973
6519
|
useBase64Url = true
|
|
5974
6520
|
}) {
|
|
5975
|
-
return /* @__PURE__ */
|
|
6521
|
+
return /* @__PURE__ */ jsx17(LexicalComposer, { initialConfig: createEditorConfig(value), children: /* @__PURE__ */ jsx17(
|
|
5976
6522
|
EditorShell,
|
|
5977
6523
|
{
|
|
5978
6524
|
onChange,
|
|
5979
6525
|
onImageAdded,
|
|
6526
|
+
onVideoAdded,
|
|
5980
6527
|
useBase64Url
|
|
5981
6528
|
}
|
|
5982
6529
|
) });
|
|
@@ -5987,12 +6534,12 @@ import { LexicalComposer as LexicalComposer2 } from "@lexical/react/LexicalCompo
|
|
|
5987
6534
|
import { RichTextPlugin as RichTextPlugin2 } from "@lexical/react/LexicalRichTextPlugin";
|
|
5988
6535
|
import { ContentEditable as ContentEditable2 } from "@lexical/react/LexicalContentEditable";
|
|
5989
6536
|
import LexicalErrorBoundary2 from "@lexical/react/LexicalErrorBoundary";
|
|
5990
|
-
import { useEffect as
|
|
5991
|
-
import { useLexicalComposerContext as
|
|
5992
|
-
import { jsx as
|
|
6537
|
+
import { useEffect as useEffect17 } from "react";
|
|
6538
|
+
import { useLexicalComposerContext as useLexicalComposerContext14 } from "@lexical/react/LexicalComposerContext";
|
|
6539
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5993
6540
|
function ReadOnlyPlugin() {
|
|
5994
|
-
const [editor] =
|
|
5995
|
-
|
|
6541
|
+
const [editor] = useLexicalComposerContext14();
|
|
6542
|
+
useEffect17(() => {
|
|
5996
6543
|
editor.setEditable(false);
|
|
5997
6544
|
}, [editor]);
|
|
5998
6545
|
return null;
|
|
@@ -6002,22 +6549,24 @@ function CMSRenderer({ content, className = "" }) {
|
|
|
6002
6549
|
...createEditorConfig(content),
|
|
6003
6550
|
editable: false
|
|
6004
6551
|
};
|
|
6005
|
-
return /* @__PURE__ */
|
|
6006
|
-
/* @__PURE__ */
|
|
6552
|
+
return /* @__PURE__ */ jsx18(LexicalComposer2, { initialConfig: config, children: /* @__PURE__ */ jsxs17("div", { className: `cms-renderer ${className}`, children: [
|
|
6553
|
+
/* @__PURE__ */ jsx18(
|
|
6007
6554
|
RichTextPlugin2,
|
|
6008
6555
|
{
|
|
6009
|
-
contentEditable: /* @__PURE__ */
|
|
6556
|
+
contentEditable: /* @__PURE__ */ jsx18(ContentEditable2, { className: "cms-renderer-content" }),
|
|
6010
6557
|
placeholder: null,
|
|
6011
6558
|
ErrorBoundary: LexicalErrorBoundary2
|
|
6012
6559
|
}
|
|
6013
6560
|
),
|
|
6014
|
-
/* @__PURE__ */
|
|
6561
|
+
/* @__PURE__ */ jsx18(ReadOnlyPlugin, {})
|
|
6015
6562
|
] }) });
|
|
6016
6563
|
}
|
|
6017
6564
|
export {
|
|
6018
6565
|
CMSBlockEditor,
|
|
6019
6566
|
CMSRenderer,
|
|
6567
|
+
ImageNode,
|
|
6020
6568
|
OPEN_IMAGE_EDITOR_COMMAND,
|
|
6569
|
+
VideoNode,
|
|
6021
6570
|
appendHTML,
|
|
6022
6571
|
copyMarkdownToClipboard,
|
|
6023
6572
|
downloadHTML,
|