@flozy/editor 3.3.8 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,7 +26,8 @@ const Form = props => {
|
|
26
26
|
readOnly,
|
27
27
|
site_id,
|
28
28
|
page_id,
|
29
|
-
onFormSubmit = () => {}
|
29
|
+
onFormSubmit = () => {},
|
30
|
+
tagName = "Pages"
|
30
31
|
} = customProps;
|
31
32
|
const {
|
32
33
|
buttonProps,
|
@@ -78,8 +79,6 @@ const Form = props => {
|
|
78
79
|
if (event) {
|
79
80
|
event.preventDefault();
|
80
81
|
}
|
81
|
-
let headerHtml = document?.getElementsByClassName('app-logo');
|
82
|
-
headerHtml = headerHtml[0]?.outerHTML;
|
83
82
|
if ((readOnly || test) && formEle && formEle?.current) {
|
84
83
|
const formData = new FormData(formEle?.current);
|
85
84
|
setLoading(true);
|
@@ -99,7 +98,7 @@ const Form = props => {
|
|
99
98
|
[isMetaKey?.element_metadatakey]: pair[1],
|
100
99
|
type: "board",
|
101
100
|
metadatamapping: element?.metadatamapping,
|
102
|
-
|
101
|
+
tagName: tagName
|
103
102
|
});
|
104
103
|
}
|
105
104
|
const fieldData = getFieldProps("name", pair[0]);
|
@@ -132,8 +131,7 @@ const Form = props => {
|
|
132
131
|
fieldKey: pair[0],
|
133
132
|
[pair[0]]: pair[1],
|
134
133
|
placeholder: placeholder,
|
135
|
-
form_name: formName
|
136
|
-
headerHtml: headerHtml
|
134
|
+
form_name: formName
|
137
135
|
});
|
138
136
|
}
|
139
137
|
let params = {
|
@@ -9,7 +9,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
10
|
const SimpleText = props => {
|
11
11
|
const {
|
12
|
-
theme
|
12
|
+
theme,
|
13
|
+
openAI
|
13
14
|
} = useEditorContext() || {};
|
14
15
|
const editor = useSlateStatic();
|
15
16
|
const {
|
@@ -42,7 +43,7 @@ const SimpleText = props => {
|
|
42
43
|
...attributes,
|
43
44
|
className: `simple-text`,
|
44
45
|
sx: classes.root,
|
45
|
-
children: [children, /*#__PURE__*/_jsx("span", {
|
46
|
+
children: [children, openAI ? null : /*#__PURE__*/_jsx("span", {
|
46
47
|
className: "placeholder-simple-text",
|
47
48
|
children: isEmptyEditor ? editorPlaceholder || "Write Something..." : showPlaceHolder ? opacity && selected ? "Type / to browse elements" : "" : ""
|
48
49
|
})]
|
@@ -3,6 +3,7 @@ import { Button, Grid, Radio, RadioGroup, TextField, FormControl, FormLabel, For
|
|
3
3
|
import DeleteIcon from "@mui/icons-material/Delete";
|
4
4
|
import Settings from "@mui/icons-material/Settings";
|
5
5
|
import LinkSettings from "../../LinkSettings";
|
6
|
+
import { getLinkType } from "../../../utils/helper";
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
9
|
const MenusArray = props => {
|
@@ -182,7 +183,7 @@ const MenusArray = props => {
|
|
182
183
|
});
|
183
184
|
setOpenNav(false);
|
184
185
|
},
|
185
|
-
navType: selectedMenu?.linkType,
|
186
|
+
navType: getLinkType(selectedMenu?.linkType, selectedMenu?.url),
|
186
187
|
navValue: selectedMenu?.url,
|
187
188
|
openInNewTab: selectedMenu?.target === "_blank",
|
188
189
|
customProps: customProps
|
@@ -0,0 +1,181 @@
|
|
1
|
+
import { MenuItem, Select, useTheme } from "@mui/material";
|
2
|
+
import { fontOptions } from "../utils/font";
|
3
|
+
import { toolbarGroups } from "../Toolbar/toolbarGroups";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
6
|
+
const themes = [{
|
7
|
+
label: "Theme 1",
|
8
|
+
colors: ["#c90c1f", "#ff5d05"]
|
9
|
+
}, {
|
10
|
+
label: "Theme 2",
|
11
|
+
colors: ["#4c0be3", "#43f7ee"]
|
12
|
+
}, {
|
13
|
+
label: "Theme 3",
|
14
|
+
colors: ["#22f20f", "#fff705"]
|
15
|
+
}];
|
16
|
+
const allTools = toolbarGroups.flat();
|
17
|
+
function ThemeList(props) {
|
18
|
+
const {
|
19
|
+
selectedTheme,
|
20
|
+
setSelectedTheme
|
21
|
+
} = props;
|
22
|
+
const fontWeight = allTools.find(f => f.format === "fontWeight");
|
23
|
+
const fontStyles = [{
|
24
|
+
text: "Bold",
|
25
|
+
value: "bold",
|
26
|
+
styleField: "fontWeight"
|
27
|
+
}, {
|
28
|
+
text: "Italic",
|
29
|
+
value: "italic",
|
30
|
+
styleField: "fontStyle"
|
31
|
+
}
|
32
|
+
// {
|
33
|
+
// text: "Underline",
|
34
|
+
// value: "underline",
|
35
|
+
// styleField: "textDecoration",
|
36
|
+
// },
|
37
|
+
// {
|
38
|
+
// text: "Line through",
|
39
|
+
// value: "line-through",
|
40
|
+
// styleField: "textDecoration",
|
41
|
+
// },
|
42
|
+
];
|
43
|
+
|
44
|
+
const theme = useTheme();
|
45
|
+
const colorVars = theme?.vars?.colors || {};
|
46
|
+
const handleTypographyTheme = (key, value, elementType) => {
|
47
|
+
setSelectedTheme(prev => {
|
48
|
+
const newValue = {
|
49
|
+
...prev,
|
50
|
+
typography: {
|
51
|
+
...(prev.typography || {}),
|
52
|
+
[elementType]: {
|
53
|
+
...(prev?.typography?.[elementType] || {}),
|
54
|
+
[key]: value
|
55
|
+
}
|
56
|
+
}
|
57
|
+
};
|
58
|
+
if (!value) {
|
59
|
+
delete newValue?.typography?.[elementType]?.[key];
|
60
|
+
}
|
61
|
+
return newValue;
|
62
|
+
});
|
63
|
+
};
|
64
|
+
return /*#__PURE__*/_jsxs("div", {
|
65
|
+
children: [themes.map((theme, i) => {
|
66
|
+
return /*#__PURE__*/_jsxs("button", {
|
67
|
+
style: {
|
68
|
+
margin: "10px"
|
69
|
+
},
|
70
|
+
onClick: () => setSelectedTheme(prev => ({
|
71
|
+
...prev,
|
72
|
+
colors: theme.colors
|
73
|
+
})),
|
74
|
+
children: [theme.label, /*#__PURE__*/_jsx("div", {
|
75
|
+
children: theme.colors.map((c, j) => {
|
76
|
+
return /*#__PURE__*/_jsx("div", {
|
77
|
+
style: {
|
78
|
+
width: "20px",
|
79
|
+
height: "20px",
|
80
|
+
background: c,
|
81
|
+
margin: "10px"
|
82
|
+
}
|
83
|
+
}, j);
|
84
|
+
})
|
85
|
+
})]
|
86
|
+
}, i);
|
87
|
+
}), /*#__PURE__*/_jsxs("div", {
|
88
|
+
children: ["Heading 1 Font Family", /*#__PURE__*/_jsx(Select
|
89
|
+
// value={""}
|
90
|
+
, {
|
91
|
+
label: "Font Family",
|
92
|
+
onChange: e => {
|
93
|
+
handleTypographyTheme("fontFamily", e.target.value, "h1");
|
94
|
+
},
|
95
|
+
children: fontOptions.map((font, i) => {
|
96
|
+
const {
|
97
|
+
text,
|
98
|
+
value
|
99
|
+
} = font;
|
100
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
101
|
+
value: value,
|
102
|
+
children: text
|
103
|
+
}, i);
|
104
|
+
})
|
105
|
+
}), "Font Weight", /*#__PURE__*/_jsx(Select
|
106
|
+
// value={""}
|
107
|
+
, {
|
108
|
+
label: "Font Weight",
|
109
|
+
onChange: e => {
|
110
|
+
handleTypographyTheme("fontWeight", e.target.value, "h1");
|
111
|
+
},
|
112
|
+
children: fontWeight.options.map((option, i) => {
|
113
|
+
const {
|
114
|
+
text,
|
115
|
+
value
|
116
|
+
} = option;
|
117
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
118
|
+
value: value,
|
119
|
+
children: text
|
120
|
+
}, i);
|
121
|
+
})
|
122
|
+
}), /*#__PURE__*/_jsx("input", {
|
123
|
+
type: "number",
|
124
|
+
placeholder: "font size",
|
125
|
+
onChange: e => {
|
126
|
+
handleTypographyTheme("fontSize", e.target.value, "h1");
|
127
|
+
}
|
128
|
+
}), /*#__PURE__*/_jsxs("div", {
|
129
|
+
children: ["Text", /*#__PURE__*/_jsx("br", {}), "Theme color", Object.values(colorVars).map((colorVar, i) => {
|
130
|
+
return /*#__PURE__*/_jsx("button", {
|
131
|
+
style: {
|
132
|
+
width: "20px",
|
133
|
+
height: "20px",
|
134
|
+
background: colorVar,
|
135
|
+
margin: "10px",
|
136
|
+
outline: "none"
|
137
|
+
},
|
138
|
+
onClick: () => handleTypographyTheme("color", colorVar, "h1")
|
139
|
+
}, i);
|
140
|
+
}), "normal color", /*#__PURE__*/_jsx("button", {
|
141
|
+
style: {
|
142
|
+
width: "20px",
|
143
|
+
height: "20px",
|
144
|
+
background: "#ff00e1",
|
145
|
+
margin: "10px",
|
146
|
+
outline: "none"
|
147
|
+
},
|
148
|
+
onClick: () => handleTypographyTheme("color", "#ff00e1", "h1")
|
149
|
+
})]
|
150
|
+
}), /*#__PURE__*/_jsxs("div", {
|
151
|
+
children: ["Font styles", fontStyles.map((option, i) => {
|
152
|
+
const styles = selectedTheme?.typography?.h1 || {};
|
153
|
+
const {
|
154
|
+
text,
|
155
|
+
value,
|
156
|
+
styleField
|
157
|
+
} = option;
|
158
|
+
return /*#__PURE__*/_jsxs("button", {
|
159
|
+
onClick: () => {
|
160
|
+
handleTypographyTheme(styleField, styles[styleField] === value ? null : value, "h1");
|
161
|
+
},
|
162
|
+
children: [text, " ", styles[styleField] === value]
|
163
|
+
}, i);
|
164
|
+
})]
|
165
|
+
}), /*#__PURE__*/_jsx("input", {
|
166
|
+
type: "number",
|
167
|
+
placeholder: "Margin text Spacing",
|
168
|
+
onChange: e => {
|
169
|
+
handleTypographyTheme("letterSpacing", e.target.value, "h1");
|
170
|
+
}
|
171
|
+
}), /*#__PURE__*/_jsx("input", {
|
172
|
+
type: "number",
|
173
|
+
placeholder: "Line spacing",
|
174
|
+
onChange: e => {
|
175
|
+
handleTypographyTheme("lineHeight", e.target.value, "h1");
|
176
|
+
}
|
177
|
+
})]
|
178
|
+
})]
|
179
|
+
});
|
180
|
+
}
|
181
|
+
export default ThemeList;
|
@@ -207,6 +207,9 @@ export const decodeAndParseBase64 = encodedString => {
|
|
207
207
|
export const hasVerticalScrollbar = (element = {}) => {
|
208
208
|
return element.scrollHeight > element.clientHeight;
|
209
209
|
};
|
210
|
+
const isHomePage = page => {
|
211
|
+
return page === "home" || page === "iframe.html" || !page;
|
212
|
+
};
|
210
213
|
export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick = () => {}) => {
|
211
214
|
const props = {};
|
212
215
|
if (!readOnly) {
|
@@ -214,13 +217,7 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
214
217
|
component: "button"
|
215
218
|
};
|
216
219
|
}
|
217
|
-
|
218
|
-
if (url?.includes("http")) {
|
219
|
-
linkType = "webAddress";
|
220
|
-
} else {
|
221
|
-
linkType = "page";
|
222
|
-
}
|
223
|
-
}
|
220
|
+
linkType = getLinkType(linkType, url);
|
224
221
|
switch (linkType) {
|
225
222
|
case "webAddress":
|
226
223
|
const refUrl = url ? url.includes("http") ? url : `//${url}` : "Link";
|
@@ -245,10 +242,13 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
245
242
|
props.component = "a";
|
246
243
|
const [page, section] = url?.split("#") || [];
|
247
244
|
const sec = section ? `#${section}` : "";
|
248
|
-
|
249
|
-
props.href = isHome ? `${sec}` : `./${url}`;
|
245
|
+
props.href = isHomePage(page) ? `./home${sec}` : `./${url}`;
|
250
246
|
if (openInNewTab) {
|
251
|
-
|
247
|
+
if (isCurrentPage(page)) {
|
248
|
+
// temp fix, if user is presented in current page, open in new tab option is restricted, we will scroll to the element in current page
|
249
|
+
} else {
|
250
|
+
props.target = "_blank";
|
251
|
+
}
|
252
252
|
}
|
253
253
|
break;
|
254
254
|
case "email":
|
@@ -304,4 +304,21 @@ export const handleLinkType = (url, linkType, readOnly, openInNewTab, onClick =
|
|
304
304
|
}
|
305
305
|
return props;
|
306
306
|
};
|
307
|
+
const isCurrentPage = page => {
|
308
|
+
const paths = window.location.pathname.split("/");
|
309
|
+
let currentUserPage = paths[paths?.length - 1];
|
310
|
+
currentUserPage = isHomePage(currentUserPage) ? "home" : currentUserPage;
|
311
|
+
const buttonPage = isHomePage(page) ? "home" : page;
|
312
|
+
return currentUserPage === buttonPage;
|
313
|
+
};
|
314
|
+
export const getLinkType = (linkType, url) => {
|
315
|
+
if (!linkType && url) {
|
316
|
+
if (url?.includes("http")) {
|
317
|
+
linkType = "webAddress";
|
318
|
+
} else {
|
319
|
+
linkType = "page";
|
320
|
+
}
|
321
|
+
}
|
322
|
+
return linkType;
|
323
|
+
};
|
307
324
|
export const allowedDomains = ["youtube.com", "lemcal.com", "facebook.com", "calendly.com"];
|