@flozy/editor 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor/CommonEditor.js +7 -4
- package/dist/Editor/Editor.css +25 -3
- package/dist/Editor/Elements/Button/EditorButton.js +9 -1
- package/dist/Editor/Elements/Embed/EmbedPopup.js +4 -3
- package/dist/Editor/Elements/Embed/Image.js +45 -11
- package/dist/Editor/Elements/Embed/Video.js +70 -11
- package/dist/Editor/Elements/Grid/Grid.js +39 -17
- package/dist/Editor/Elements/Grid/GridButton.js +36 -12
- package/dist/Editor/Elements/Grid/GridItem.js +27 -11
- package/dist/Editor/Elements/Grid/full_grid.png +0 -0
- package/dist/Editor/Elements/Grid/templates/image_banner_text.js +56 -0
- package/dist/Editor/Elements/Grid/templates/index.js +13 -1
- package/dist/Editor/Elements/Grid/templates/right_image_left_text.js +81 -0
- package/dist/Editor/Elements/Grid/templates/white_LTRI.js +116 -0
- package/dist/Editor/Elements/Mentions/Mentions.js +2 -2
- package/dist/Editor/Toolbar/Toolbar.js +2 -1
- package/dist/Editor/common/MentionsPopup.js +1 -1
- package/dist/Editor/common/StyleBuilder/buttonStyle.js +9 -0
- package/dist/Editor/common/StyleBuilder/embedImageStyle.js +8 -0
- package/dist/Editor/common/StyleBuilder/embedVideoStyle.js +10 -0
- package/dist/Editor/common/StyleBuilder/fieldTypes/index.js +3 -1
- package/dist/Editor/common/StyleBuilder/fieldTypes/saveAsTemplate.js +163 -0
- package/dist/Editor/common/StyleBuilder/gridStyle.js +13 -0
- package/dist/Editor/common/StyleBuilder/index.js +17 -5
- package/dist/Editor/hooks/withCommon.js +2 -2
- package/dist/Editor/utils/grid.js +10 -4
- package/dist/Editor/utils/gridItem.js +3 -2
- package/dist/Editor/utils/insertAppHeader.js +28 -23
- package/package.json +1 -1
|
@@ -58,11 +58,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
58
58
|
const {
|
|
59
59
|
defaultBG,
|
|
60
60
|
needDotsBG,
|
|
61
|
-
footer
|
|
61
|
+
footer,
|
|
62
|
+
needLayout = true,
|
|
63
|
+
CHARACTERS = []
|
|
62
64
|
} = otherProps || {};
|
|
63
65
|
const editor = useMemo(() => {
|
|
64
66
|
if (collaborativeEditor) return collaborativeEditor;
|
|
65
|
-
return withCommon(createEditor()
|
|
67
|
+
return withCommon(createEditor(), {
|
|
68
|
+
needLayout
|
|
69
|
+
});
|
|
66
70
|
}, [collaborativeEditor]);
|
|
67
71
|
const pageSettings = editor?.children?.find(f => f.type === "page-settings");
|
|
68
72
|
const {
|
|
@@ -169,7 +173,7 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
169
173
|
target,
|
|
170
174
|
index
|
|
171
175
|
} = mentions;
|
|
172
|
-
const chars = CHARACTERS.filter(c => c.toLowerCase().startsWith(search?.toLowerCase())).slice(0, 10);
|
|
176
|
+
const chars = CHARACTERS.filter(c => c.name.toLowerCase().startsWith(search?.toLowerCase())).slice(0, 10);
|
|
173
177
|
const handleEditorChange = newValue => {
|
|
174
178
|
setValue(newValue);
|
|
175
179
|
if (!isInteracted) {
|
|
@@ -285,5 +289,4 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
285
289
|
});
|
|
286
290
|
});
|
|
287
291
|
CommonEditor.displayName = "CommonEditor";
|
|
288
|
-
const CHARACTERS = ["Aayla Secura", "Adi Gallia"];
|
|
289
292
|
export default CommonEditor;
|
package/dist/Editor/Editor.css
CHANGED
|
@@ -86,9 +86,9 @@ blockquote{
|
|
|
86
86
|
|
|
87
87
|
.grid-container {
|
|
88
88
|
display: flex;
|
|
89
|
-
border-radius:
|
|
90
|
-
background-color:
|
|
91
|
-
border:
|
|
89
|
+
border-radius: 0px;
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
border: 0px solid #E5EAF2;
|
|
92
92
|
padding: 16px;
|
|
93
93
|
position: relative;
|
|
94
94
|
flex-wrap: wrap;
|
|
@@ -438,4 +438,26 @@ blockquote{
|
|
|
438
438
|
|
|
439
439
|
.MuiIconButton-root.btnActive {
|
|
440
440
|
background-color: #ccc;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.embed .element-toolbar {
|
|
444
|
+
left: 0;
|
|
445
|
+
right: 0;
|
|
446
|
+
bottom: 0;
|
|
447
|
+
top: auto;
|
|
448
|
+
width: fit-content;
|
|
449
|
+
height: fit-content;
|
|
450
|
+
margin: auto;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.resize-br {
|
|
454
|
+
position: absolute !important;
|
|
455
|
+
bottom: 2px;
|
|
456
|
+
right: 2px;
|
|
457
|
+
}
|
|
458
|
+
.visible-on-hover {
|
|
459
|
+
display: none !important;
|
|
460
|
+
}
|
|
461
|
+
.has-hover:hover .visible-on-hover {
|
|
462
|
+
display: flex !important;
|
|
441
463
|
}
|
|
@@ -106,6 +106,12 @@ const EditorButton = props => {
|
|
|
106
106
|
const onClose = () => {
|
|
107
107
|
setEdit(false);
|
|
108
108
|
};
|
|
109
|
+
const borderStyle = borderColor?.indexOf("linear") >= 0 ? {
|
|
110
|
+
borderImageSource: borderColor,
|
|
111
|
+
borderImageSlice: 1
|
|
112
|
+
} : {
|
|
113
|
+
borderColor: borderColor || "none"
|
|
114
|
+
};
|
|
109
115
|
return /*#__PURE__*/_jsxs("div", {
|
|
110
116
|
className: "editor-btn-wrapper",
|
|
111
117
|
...attributes,
|
|
@@ -116,7 +122,9 @@ const EditorButton = props => {
|
|
|
116
122
|
className: "editor-btn",
|
|
117
123
|
style: {
|
|
118
124
|
background: bgColor || "rgb(30, 75, 122)",
|
|
119
|
-
|
|
125
|
+
borderWidth: "1px",
|
|
126
|
+
borderBlockStyle: "solid",
|
|
127
|
+
...borderStyle,
|
|
120
128
|
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`,
|
|
121
129
|
paddingLeft: `${left || 8}px`,
|
|
122
130
|
paddingRight: `${right || 8}px`,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import StyleBuilder from "../../common/StyleBuilder";
|
|
3
3
|
import embedImageStyle from "../../common/StyleBuilder/embedImageStyle";
|
|
4
|
+
import embedVideoStyle from "../../common/StyleBuilder/embedVideoStyle";
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
const EmbedPopup = props => {
|
|
6
7
|
const {
|
|
@@ -11,12 +12,12 @@ const EmbedPopup = props => {
|
|
|
11
12
|
format
|
|
12
13
|
} = props;
|
|
13
14
|
return /*#__PURE__*/_jsx(StyleBuilder, {
|
|
14
|
-
title: "Image",
|
|
15
|
-
type: format === "image" ? "embedImageStyle" : "
|
|
15
|
+
title: format === "image" ? "Image" : "Video",
|
|
16
|
+
type: format === "image" ? "embedImageStyle" : "embedVideoStyle",
|
|
16
17
|
element: element,
|
|
17
18
|
onSave: onSave,
|
|
18
19
|
onClose: onClose,
|
|
19
|
-
renderTabs: format === "image" ? embedImageStyle :
|
|
20
|
+
renderTabs: format === "image" ? embedImageStyle : embedVideoStyle,
|
|
20
21
|
customProps: customProps
|
|
21
22
|
});
|
|
22
23
|
};
|
|
@@ -5,7 +5,10 @@ import AspectRatioIcon from "@mui/icons-material/AspectRatio";
|
|
|
5
5
|
import useResize from "../../utils/customHooks/useResize";
|
|
6
6
|
import { insertImageText } from "../../utils/imageText";
|
|
7
7
|
import EmbedPopup from "./EmbedPopup";
|
|
8
|
-
import { IconButton } from "@mui/material";
|
|
8
|
+
import { IconButton, Tooltip } from "@mui/material";
|
|
9
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
10
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
|
11
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
9
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
14
|
const Image = ({
|
|
@@ -20,7 +23,8 @@ const Image = ({
|
|
|
20
23
|
bannerSpacing,
|
|
21
24
|
alignment,
|
|
22
25
|
bgColor,
|
|
23
|
-
borderColor
|
|
26
|
+
borderColor,
|
|
27
|
+
borderRadius
|
|
24
28
|
} = element;
|
|
25
29
|
const {
|
|
26
30
|
readOnly
|
|
@@ -31,6 +35,12 @@ const Image = ({
|
|
|
31
35
|
right,
|
|
32
36
|
bottom
|
|
33
37
|
} = bannerSpacing || {};
|
|
38
|
+
const {
|
|
39
|
+
topLeft,
|
|
40
|
+
topRight,
|
|
41
|
+
bottomLeft,
|
|
42
|
+
bottomRight
|
|
43
|
+
} = borderRadius || {};
|
|
34
44
|
const {
|
|
35
45
|
vertical,
|
|
36
46
|
horizantal
|
|
@@ -89,6 +99,11 @@ const Image = ({
|
|
|
89
99
|
const onClose = () => {
|
|
90
100
|
setOpenSettings(false);
|
|
91
101
|
};
|
|
102
|
+
const onDelete = () => {
|
|
103
|
+
Transforms.removeNodes(editor, {
|
|
104
|
+
at: path
|
|
105
|
+
});
|
|
106
|
+
};
|
|
92
107
|
const onAddText = () => {
|
|
93
108
|
Transforms.wrapNodes(editor, {
|
|
94
109
|
type: "image-text-wrapper",
|
|
@@ -100,19 +115,34 @@ const Image = ({
|
|
|
100
115
|
return selected ? /*#__PURE__*/_jsxs("div", {
|
|
101
116
|
className: "element-toolbar",
|
|
102
117
|
contentEditable: false,
|
|
103
|
-
children: [/*#__PURE__*/_jsx(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
118
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
119
|
+
title: "Add Text",
|
|
120
|
+
arrow: true,
|
|
121
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
122
|
+
onClick: onAddText,
|
|
123
|
+
children: /*#__PURE__*/_jsx(AddIcon, {})
|
|
124
|
+
})
|
|
125
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
126
|
+
title: "Settings",
|
|
127
|
+
arrow: true,
|
|
128
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
129
|
+
onClick: onSettings,
|
|
130
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
|
131
|
+
})
|
|
132
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
133
|
+
title: "Delete",
|
|
134
|
+
arrow: true,
|
|
135
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
136
|
+
onClick: onDelete,
|
|
137
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
138
|
+
})
|
|
109
139
|
})]
|
|
110
140
|
}) : null;
|
|
111
141
|
};
|
|
112
142
|
const totalMinus = (parseInt(left) || 0) + (parseInt(right) || 0);
|
|
113
143
|
return /*#__PURE__*/_jsxs("div", {
|
|
114
144
|
...attributes,
|
|
115
|
-
className: "embed",
|
|
145
|
+
className: "embed has-hover",
|
|
116
146
|
style: {
|
|
117
147
|
display: "flex",
|
|
118
148
|
width: `calc(100% - ${totalMinus}px)`,
|
|
@@ -131,7 +161,8 @@ const Image = ({
|
|
|
131
161
|
element: element,
|
|
132
162
|
onSave: onSave,
|
|
133
163
|
onClose: onClose,
|
|
134
|
-
customProps: customProps
|
|
164
|
+
customProps: customProps,
|
|
165
|
+
format: "image"
|
|
135
166
|
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
136
167
|
contentEditable: false,
|
|
137
168
|
style: {
|
|
@@ -140,6 +171,9 @@ const Image = ({
|
|
|
140
171
|
height: `${size.height}px`
|
|
141
172
|
},
|
|
142
173
|
children: [!readOnly && /*#__PURE__*/_jsx(ToolBar, {}), /*#__PURE__*/_jsx("img", {
|
|
174
|
+
style: {
|
|
175
|
+
borderRadius: `${topLeft}px ${topRight}px ${bottomLeft}px ${bottomRight}px`
|
|
176
|
+
},
|
|
143
177
|
alt: alt,
|
|
144
178
|
src: url,
|
|
145
179
|
onClick: handleImageClick
|
|
@@ -149,7 +183,7 @@ const Image = ({
|
|
|
149
183
|
opacity: 1,
|
|
150
184
|
background: "#FFF"
|
|
151
185
|
},
|
|
152
|
-
className: "resize",
|
|
186
|
+
className: "resize-br visible-on-hover",
|
|
153
187
|
children: /*#__PURE__*/_jsx(AspectRatioIcon, {})
|
|
154
188
|
})]
|
|
155
189
|
}), children]
|
|
@@ -4,13 +4,18 @@ import { Node, Transforms } from "slate";
|
|
|
4
4
|
import AspectRatioIcon from "@mui/icons-material/AspectRatio";
|
|
5
5
|
import Icon from "../../common/Icon";
|
|
6
6
|
import useResize from "../../utils/customHooks/useResize";
|
|
7
|
-
import { IconButton } from "@mui/material";
|
|
7
|
+
import { IconButton, Tooltip } from "@mui/material";
|
|
8
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
9
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
|
10
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
11
|
+
import EmbedPopup from "./EmbedPopup";
|
|
8
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
14
|
const Video = ({
|
|
11
15
|
attributes,
|
|
12
16
|
element,
|
|
13
|
-
children
|
|
17
|
+
children,
|
|
18
|
+
customProps
|
|
14
19
|
}) => {
|
|
15
20
|
const {
|
|
16
21
|
url,
|
|
@@ -19,13 +24,18 @@ const Video = ({
|
|
|
19
24
|
const editor = useSlateStatic();
|
|
20
25
|
const selected = useSelected();
|
|
21
26
|
const focused = useFocused();
|
|
27
|
+
const [openSetttings, setOpenSettings] = useState(false);
|
|
22
28
|
const [parentDOM, setParentDOM] = useState(null);
|
|
29
|
+
const {
|
|
30
|
+
readOnly
|
|
31
|
+
} = customProps;
|
|
23
32
|
const [size, onMouseDown, resizing, onLoad] = useResize({
|
|
24
33
|
parentDOM,
|
|
25
34
|
size: element?.size
|
|
26
35
|
});
|
|
27
36
|
const arr = Array.from(Node.elements(editor));
|
|
28
37
|
const ele = arr.find(([elem]) => element === elem);
|
|
38
|
+
const path = ReactEditor.findPath(editor, element);
|
|
29
39
|
useEffect(() => {
|
|
30
40
|
if (editor && ele[1] !== undefined) {
|
|
31
41
|
const dom = ReactEditor.toDOMNode(editor, Node.get(editor, ele[1]));
|
|
@@ -40,9 +50,53 @@ const Video = ({
|
|
|
40
50
|
});
|
|
41
51
|
}
|
|
42
52
|
}, [resizing]);
|
|
53
|
+
const ToolBar = () => {
|
|
54
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
55
|
+
className: "element-toolbar visible-on-hover",
|
|
56
|
+
contentEditable: false,
|
|
57
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
58
|
+
title: "Settings",
|
|
59
|
+
arrow: true,
|
|
60
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
61
|
+
onClick: onSettings,
|
|
62
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
|
63
|
+
})
|
|
64
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
65
|
+
title: "Delete",
|
|
66
|
+
arrow: true,
|
|
67
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
68
|
+
onClick: onDelete,
|
|
69
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
70
|
+
})
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const onSettings = () => {
|
|
75
|
+
setOpenSettings(true);
|
|
76
|
+
};
|
|
77
|
+
const onSave = data => {
|
|
78
|
+
const updateData = {
|
|
79
|
+
...data
|
|
80
|
+
};
|
|
81
|
+
delete updateData.children;
|
|
82
|
+
Transforms.setNodes(editor, {
|
|
83
|
+
...updateData
|
|
84
|
+
}, {
|
|
85
|
+
at: path
|
|
86
|
+
});
|
|
87
|
+
onClose();
|
|
88
|
+
};
|
|
89
|
+
const onClose = () => {
|
|
90
|
+
setOpenSettings(false);
|
|
91
|
+
};
|
|
92
|
+
const onDelete = () => {
|
|
93
|
+
Transforms.removeNodes(editor, {
|
|
94
|
+
at: path
|
|
95
|
+
});
|
|
96
|
+
};
|
|
43
97
|
return /*#__PURE__*/_jsxs("div", {
|
|
44
98
|
...attributes,
|
|
45
|
-
className: "embed",
|
|
99
|
+
className: "embed has-hover",
|
|
46
100
|
style: {
|
|
47
101
|
display: "flex",
|
|
48
102
|
width: "100%",
|
|
@@ -50,14 +104,20 @@ const Video = ({
|
|
|
50
104
|
boxShadow: selected && focused && "0 0 3px 3px lightgray"
|
|
51
105
|
},
|
|
52
106
|
...element.attr,
|
|
53
|
-
children: [/*#__PURE__*/
|
|
107
|
+
children: [openSetttings ? /*#__PURE__*/_jsx(EmbedPopup, {
|
|
108
|
+
element: element,
|
|
109
|
+
onSave: onSave,
|
|
110
|
+
onClose: onClose,
|
|
111
|
+
customProps: customProps,
|
|
112
|
+
format: "video"
|
|
113
|
+
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
54
114
|
contentEditable: false,
|
|
55
115
|
style: {
|
|
56
116
|
position: "relative",
|
|
57
117
|
width: size.widthInPercent ? `${size.widthInPercent}%` : `${size.width}px`,
|
|
58
118
|
height: `${size.height}px`
|
|
59
119
|
},
|
|
60
|
-
children: [
|
|
120
|
+
children: [/*#__PURE__*/_jsx(ToolBar, {}),
|
|
61
121
|
// The iframe reloads on each re-render and hence it stutters and the document doesn't detect mouse-up event leading to unwanted behaviour
|
|
62
122
|
// So during resize replace the iframe with a simple div
|
|
63
123
|
resizing ? /*#__PURE__*/_jsx("div", {
|
|
@@ -72,22 +132,21 @@ const Video = ({
|
|
|
72
132
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
73
133
|
icon: "videoPlayer"
|
|
74
134
|
})
|
|
75
|
-
}) : /*#__PURE__*/_jsx("
|
|
135
|
+
}) : /*#__PURE__*/_jsx("iframe", {
|
|
136
|
+
className: "embedd-iframe",
|
|
76
137
|
style: {
|
|
77
138
|
border: "none",
|
|
78
139
|
width: "100%",
|
|
79
140
|
height: "100%"
|
|
80
141
|
},
|
|
81
142
|
src: url,
|
|
82
|
-
title: alt
|
|
83
|
-
|
|
84
|
-
}), selected && /*#__PURE__*/_jsx(IconButton, {
|
|
143
|
+
title: alt
|
|
144
|
+
}), /*#__PURE__*/_jsx(IconButton, {
|
|
85
145
|
onPointerDown: onMouseDown,
|
|
86
146
|
style: {
|
|
87
|
-
opacity: 1,
|
|
88
147
|
background: "#FFF"
|
|
89
148
|
},
|
|
90
|
-
className: "resize",
|
|
149
|
+
className: "resize-br visible-on-hover",
|
|
91
150
|
children: /*#__PURE__*/_jsx(AspectRatioIcon, {})
|
|
92
151
|
})]
|
|
93
152
|
}), children]
|
|
@@ -3,6 +3,10 @@ import { Transforms, Path } from "slate";
|
|
|
3
3
|
import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
|
|
4
4
|
import { gridItem } from "../../utils/gridItem";
|
|
5
5
|
import GridPopup from "./GridPopup";
|
|
6
|
+
import { IconButton, Tooltip } from "@mui/material";
|
|
7
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
8
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
|
9
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
6
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
12
|
const Grid = props => {
|
|
@@ -90,15 +94,27 @@ const Grid = props => {
|
|
|
90
94
|
return selected ? /*#__PURE__*/_jsxs("div", {
|
|
91
95
|
className: "grid-container-toolbar",
|
|
92
96
|
contentEditable: false,
|
|
93
|
-
children: [/*#__PURE__*/_jsx(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
98
|
+
title: "Grid Settings",
|
|
99
|
+
arrow: true,
|
|
100
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
101
|
+
onClick: onSettings,
|
|
102
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
|
103
|
+
})
|
|
104
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
105
|
+
title: "Add Grid Item",
|
|
106
|
+
arrow: true,
|
|
107
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
108
|
+
onClick: onAddGridItem,
|
|
109
|
+
children: /*#__PURE__*/_jsx(AddIcon, {})
|
|
110
|
+
})
|
|
111
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
112
|
+
title: "Delete Grid",
|
|
113
|
+
arrow: true,
|
|
114
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
115
|
+
onClick: onDelete,
|
|
116
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
117
|
+
})
|
|
102
118
|
})]
|
|
103
119
|
}) : null;
|
|
104
120
|
};
|
|
@@ -106,14 +122,9 @@ const Grid = props => {
|
|
|
106
122
|
className: `grid-container ${grid}`,
|
|
107
123
|
...attributes,
|
|
108
124
|
style: {
|
|
109
|
-
|
|
110
|
-
paddingRight: `${right}px`,
|
|
111
|
-
paddingTop: `${top}px`,
|
|
112
|
-
paddingBottom: `${bottom}px`,
|
|
113
|
-
backgroundColor: bgColor,
|
|
114
|
-
justifyContent: horizantal,
|
|
125
|
+
background: bgColor,
|
|
115
126
|
alignContent: vertical,
|
|
116
|
-
backgroundImage: backgroundImage ? `url(${backgroundImage})` : "none",
|
|
127
|
+
backgroundImage: backgroundImage && backgroundImage !== "none" ? `url(${backgroundImage})` : "none",
|
|
117
128
|
border: `1px solid ${borderColor}`
|
|
118
129
|
},
|
|
119
130
|
children: [!readOnly && /*#__PURE__*/_jsx(GridToolBar, {}), openSetttings ? /*#__PURE__*/_jsx(GridPopup, {
|
|
@@ -121,7 +132,18 @@ const Grid = props => {
|
|
|
121
132
|
onSave: onSave,
|
|
122
133
|
onClose: onClose,
|
|
123
134
|
customProps: customProps
|
|
124
|
-
}) : null,
|
|
135
|
+
}) : null, /*#__PURE__*/_jsx("div", {
|
|
136
|
+
style: {
|
|
137
|
+
display: "flex",
|
|
138
|
+
paddingLeft: `${left}px`,
|
|
139
|
+
paddingRight: `${right}px`,
|
|
140
|
+
paddingTop: `${top}px`,
|
|
141
|
+
paddingBottom: `${bottom}px`,
|
|
142
|
+
justifyContent: horizantal,
|
|
143
|
+
width: "100%"
|
|
144
|
+
},
|
|
145
|
+
children: children
|
|
146
|
+
})]
|
|
125
147
|
});
|
|
126
148
|
};
|
|
127
149
|
export default Grid;
|
|
@@ -1,27 +1,49 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Dialog, DialogContent, DialogTitle, IconButton, Tooltip } from "@mui/material";
|
|
2
|
+
import { Dialog, DialogContent, DialogTitle, IconButton, ImageListItemBar, Tooltip } from "@mui/material";
|
|
3
3
|
import { insertGrid } from "../../utils/grid";
|
|
4
4
|
import { GridIcon } from "../../common/iconslist";
|
|
5
5
|
import { ImageList, ImageListItem } from "@mui/material";
|
|
6
|
-
import GRID_TEMPLATES from "./templates";
|
|
7
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
9
|
const GridButton = props => {
|
|
11
10
|
const {
|
|
12
|
-
editor
|
|
11
|
+
editor,
|
|
12
|
+
customProps
|
|
13
13
|
} = props;
|
|
14
|
+
const {
|
|
15
|
+
services
|
|
16
|
+
} = customProps;
|
|
14
17
|
const [open, setOpen] = useState(false);
|
|
15
|
-
const
|
|
18
|
+
const [templates, setTemplates] = useState({
|
|
19
|
+
loading: false,
|
|
20
|
+
list: []
|
|
21
|
+
});
|
|
22
|
+
const onButtonClick = async () => {
|
|
23
|
+
setTemplates({
|
|
24
|
+
...templates,
|
|
25
|
+
loading: true
|
|
26
|
+
});
|
|
16
27
|
setOpen(true);
|
|
28
|
+
const result = await services("listTemplates", {});
|
|
29
|
+
console.log(result);
|
|
30
|
+
setTemplates({
|
|
31
|
+
...templates,
|
|
32
|
+
list: result?.data || []
|
|
33
|
+
});
|
|
17
34
|
};
|
|
18
|
-
const handleInsertGrid =
|
|
19
|
-
insertGrid(editor
|
|
35
|
+
const handleInsertGrid = item => () => {
|
|
36
|
+
insertGrid(editor, {
|
|
37
|
+
...item.content
|
|
38
|
+
});
|
|
20
39
|
handleClose();
|
|
21
40
|
};
|
|
22
41
|
const handleClose = () => {
|
|
23
42
|
setOpen(false);
|
|
24
43
|
};
|
|
44
|
+
const {
|
|
45
|
+
list
|
|
46
|
+
} = templates;
|
|
25
47
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
26
48
|
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
27
49
|
title: "Grid",
|
|
@@ -40,16 +62,18 @@ const GridButton = props => {
|
|
|
40
62
|
children: /*#__PURE__*/_jsx(ImageList, {
|
|
41
63
|
variant: "quilted",
|
|
42
64
|
cols: 1,
|
|
43
|
-
children:
|
|
44
|
-
return /*#__PURE__*/
|
|
65
|
+
children: list.map(item => {
|
|
66
|
+
return /*#__PURE__*/_jsxs(ImageListItem, {
|
|
45
67
|
onClick: handleInsertGrid(item),
|
|
46
|
-
children: /*#__PURE__*/_jsx("img", {
|
|
47
|
-
src: item.
|
|
68
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
69
|
+
src: item.thumbnail,
|
|
48
70
|
alt: item.title,
|
|
49
71
|
width: "auto",
|
|
50
72
|
height: "250px"
|
|
51
|
-
})
|
|
52
|
-
|
|
73
|
+
}), /*#__PURE__*/_jsx(ImageListItemBar, {
|
|
74
|
+
title: item.title
|
|
75
|
+
})]
|
|
76
|
+
}, item.thumbnail);
|
|
53
77
|
})
|
|
54
78
|
})
|
|
55
79
|
})]
|
|
@@ -2,6 +2,9 @@ import React, { useState } from "react";
|
|
|
2
2
|
import { Transforms } from "slate";
|
|
3
3
|
import { useSelected, useSlateStatic, ReactEditor } from "slate-react";
|
|
4
4
|
import GridItemPopup from "./GridItemPopup";
|
|
5
|
+
import { IconButton, Tooltip } from "@mui/material";
|
|
6
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
7
|
+
import SettingsIcon from "@mui/icons-material/Settings";
|
|
5
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
10
|
const GridItem = props => {
|
|
@@ -42,12 +45,21 @@ const GridItem = props => {
|
|
|
42
45
|
style: {
|
|
43
46
|
top: "0px"
|
|
44
47
|
},
|
|
45
|
-
children: [/*#__PURE__*/_jsx(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
children: [/*#__PURE__*/_jsx(Tooltip, {
|
|
49
|
+
title: "Grid Settings",
|
|
50
|
+
arrow: true,
|
|
51
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
52
|
+
size: "small",
|
|
53
|
+
onClick: onSettings,
|
|
54
|
+
children: /*#__PURE__*/_jsx(SettingsIcon, {})
|
|
55
|
+
})
|
|
56
|
+
}), /*#__PURE__*/_jsx(Tooltip, {
|
|
57
|
+
title: "Delete Grid",
|
|
58
|
+
arrow: true,
|
|
59
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
60
|
+
onClick: onDelete,
|
|
61
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
62
|
+
})
|
|
51
63
|
})]
|
|
52
64
|
}) : null;
|
|
53
65
|
};
|
|
@@ -82,17 +94,21 @@ const GridItem = props => {
|
|
|
82
94
|
style: {
|
|
83
95
|
display: "flex",
|
|
84
96
|
flexDirection: "column",
|
|
85
|
-
paddingLeft: `${left}px`,
|
|
86
|
-
paddingRight: `${right}px`,
|
|
87
|
-
paddingTop: `${top}px`,
|
|
88
|
-
paddingBottom: `${bottom}px`,
|
|
89
97
|
backgroundColor: bgColor,
|
|
90
98
|
alignItems: horizantal,
|
|
91
99
|
alignContent: vertical,
|
|
92
100
|
width: `${itemWidth}%`,
|
|
93
101
|
margin: "0px"
|
|
94
102
|
},
|
|
95
|
-
children: [
|
|
103
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
104
|
+
style: {
|
|
105
|
+
paddingLeft: `${left}px`,
|
|
106
|
+
paddingRight: `${right}px`,
|
|
107
|
+
paddingTop: `${top}px`,
|
|
108
|
+
paddingBottom: `${bottom}px`
|
|
109
|
+
},
|
|
110
|
+
children: children
|
|
111
|
+
}), !readOnly && /*#__PURE__*/_jsx(GridItemToolbar, {}), openSetttings ? /*#__PURE__*/_jsx(GridItemPopup, {
|
|
96
112
|
element: element,
|
|
97
113
|
onSave: onSave,
|
|
98
114
|
onClose: onClose
|
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const image_banner_text = {
|
|
2
|
+
type: "grid",
|
|
3
|
+
grid: "container",
|
|
4
|
+
backgroundImage: "https://t4.ftcdn.net/jpg/05/06/47/83/360_F_506478399_l0jgZ5ZWj80o8XYdEJtYfQhVYMU56qDJ.jpg",
|
|
5
|
+
children: [{
|
|
6
|
+
type: "grid-item",
|
|
7
|
+
grid: 6,
|
|
8
|
+
children: [{
|
|
9
|
+
type: "paragraph",
|
|
10
|
+
children: [{
|
|
11
|
+
text: ""
|
|
12
|
+
}]
|
|
13
|
+
}, {
|
|
14
|
+
type: "paragraph",
|
|
15
|
+
children: [{
|
|
16
|
+
text: ""
|
|
17
|
+
}]
|
|
18
|
+
}, {
|
|
19
|
+
type: "paragraph",
|
|
20
|
+
children: [{
|
|
21
|
+
text: "About Us",
|
|
22
|
+
fontSize: "huge",
|
|
23
|
+
color: "#ffffff"
|
|
24
|
+
}]
|
|
25
|
+
}, {
|
|
26
|
+
type: "paragraph",
|
|
27
|
+
children: [{
|
|
28
|
+
fontSize: "medium",
|
|
29
|
+
text: "",
|
|
30
|
+
color: "#ffffff"
|
|
31
|
+
}]
|
|
32
|
+
}, {
|
|
33
|
+
type: "paragraph",
|
|
34
|
+
children: [{
|
|
35
|
+
fontSize: "medium",
|
|
36
|
+
text: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type.",
|
|
37
|
+
color: "#ffffff"
|
|
38
|
+
}]
|
|
39
|
+
}, {
|
|
40
|
+
type: "paragraph",
|
|
41
|
+
children: [{
|
|
42
|
+
text: ""
|
|
43
|
+
}]
|
|
44
|
+
}, {
|
|
45
|
+
type: "paragraph",
|
|
46
|
+
children: [{
|
|
47
|
+
text: ""
|
|
48
|
+
}]
|
|
49
|
+
}],
|
|
50
|
+
bgColor: "rgba(255, 255, 255, 0)"
|
|
51
|
+
}],
|
|
52
|
+
alignment: {
|
|
53
|
+
horizantal: "center"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export default image_banner_text;
|