@flozy/editor 4.1.4 → 4.1.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/ChatEditor.js +12 -1
- package/dist/Editor/Editor.css +1 -1
- package/dist/Editor/Elements/AI/AIInput.js +1 -1
- package/dist/Editor/Elements/AI/Styles.js +5 -1
- package/dist/Editor/Elements/Form/FormElements/FormTextArea.js +3 -3
- package/dist/Editor/Elements/FreeGrid/styles.js +5 -0
- package/dist/Editor/Toolbar/PopupTool/FullViewCard.js +1 -1
- package/dist/Editor/Toolbar/PopupTool/PopupToolStyle.js +23 -8
- package/dist/Editor/common/FontLoader/FontLoader.js +10 -9
- package/dist/Editor/common/RnD/ElementSettings/OtherSettings/Settings.js +15 -1
- package/dist/Editor/common/RnD/VirtualElement/index.js +32 -21
- package/dist/Editor/common/StyleBuilder/fieldTypes/bannerSpacing.js +4 -4
- package/dist/Editor/utils/SlateUtilityFunctions.js +3 -3
- package/package.json +1 -1
@@ -248,6 +248,16 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
248
248
|
restVal
|
249
249
|
});
|
250
250
|
};
|
251
|
+
const handlePaste = event => {
|
252
|
+
const items = event.clipboardData.items;
|
253
|
+
for (let i = 0; i < items.length; i++) {
|
254
|
+
if (items[i].type.startsWith("image/")) {
|
255
|
+
event.preventDefault(); // Prevent the default paste behavior
|
256
|
+
return; // Exit early to keep the editor empty
|
257
|
+
}
|
258
|
+
}
|
259
|
+
};
|
260
|
+
|
251
261
|
return /*#__PURE__*/_jsx(EditorProvider, {
|
252
262
|
theme: theme,
|
253
263
|
editor: editor,
|
@@ -267,7 +277,8 @@ const ChatEditor = /*#__PURE__*/forwardRef((props, ref) => {
|
|
267
277
|
placeholder: "Start typing ...",
|
268
278
|
spellCheck: true,
|
269
279
|
onBlur: handleBlur,
|
270
|
-
onKeyDown: onKeyDown
|
280
|
+
onKeyDown: onKeyDown,
|
281
|
+
onPaste: handlePaste
|
271
282
|
}), !readOnly ? /*#__PURE__*/_jsx(MentionsPopup, {
|
272
283
|
ref: mentionsRef,
|
273
284
|
mentions: mentions,
|
package/dist/Editor/Editor.css
CHANGED
@@ -81,7 +81,7 @@ function AIInput({
|
|
81
81
|
const selectWrapper = refs?.length ? refs[1]?.current : null;
|
82
82
|
const slateWrapper = document.getElementById("slate-wrapper-scroll-container");
|
83
83
|
if (selectWrapper && slateWrapper) {
|
84
|
-
const height = slateWrapper.offsetHeight - selectWrapper.offsetHeight -
|
84
|
+
const height = slateWrapper.offsetHeight - selectWrapper.offsetHeight - 170;
|
85
85
|
setContentHeight(height + "px");
|
86
86
|
}
|
87
87
|
}, [refs, generatedText]);
|
@@ -32,6 +32,9 @@ const Styles = theme => ({
|
|
32
32
|
color: "#000",
|
33
33
|
fontSize: "14px !important",
|
34
34
|
fontFamily: '"Inter", sans-serif',
|
35
|
+
"&:focus-visible": {
|
36
|
+
border: "none !important"
|
37
|
+
},
|
35
38
|
"&::placeholder": {
|
36
39
|
color: "#94A3B8",
|
37
40
|
opacity: 1 /* Firefox */,
|
@@ -92,7 +95,8 @@ const Styles = theme => ({
|
|
92
95
|
generatedText: {
|
93
96
|
margin: "8px",
|
94
97
|
overflow: "auto",
|
95
|
-
fontSize: "inherit"
|
98
|
+
fontSize: "inherit",
|
99
|
+
color: `${theme?.palette?.editor?.textColor} !important`
|
96
100
|
},
|
97
101
|
customSelectWrapper: {
|
98
102
|
width: "fit-content",
|
@@ -37,14 +37,14 @@ const FormTextArea = props => {
|
|
37
37
|
...getTRBLBreakPoints(bannerSpacing)
|
38
38
|
},
|
39
39
|
height: height || "150px",
|
40
|
-
borderColor: borderColor || "transparent"
|
40
|
+
borderColor: `${borderColor || "transparent"} !important`,
|
41
41
|
borderWidth: borderWidth || "1px",
|
42
42
|
borderRadius: {
|
43
43
|
...getBreakPointsValue(borderRadius || {}, null, "overrideBorderRadius", true)
|
44
44
|
},
|
45
45
|
borderStyle: borderStyle || "solid",
|
46
|
-
color: textColor || "#000"
|
47
|
-
background: bgColor || "transparent"
|
46
|
+
color: `${textColor || "#000"} !important`,
|
47
|
+
background: `${bgColor || "transparent"} !important`,
|
48
48
|
fontSize: '14px'
|
49
49
|
}
|
50
50
|
})
|
@@ -211,6 +211,11 @@ const useFreeGridStyles = ({
|
|
211
211
|
backgroundColor: "#FFF",
|
212
212
|
overflow: "hidden"
|
213
213
|
},
|
214
|
+
"& .fgi_type_text": {
|
215
|
+
"& .edt-headings": {
|
216
|
+
margin: "0px"
|
217
|
+
}
|
218
|
+
},
|
214
219
|
/** element toolbar hide */
|
215
220
|
"& .element-toolbar": {
|
216
221
|
display: "none"
|
@@ -35,7 +35,7 @@ const FullViewCard = props => {
|
|
35
35
|
sx: classes.paperOverrides,
|
36
36
|
className: "paperOverrides",
|
37
37
|
children: /*#__PURE__*/_jsx(Box, {
|
38
|
-
sx: classes.
|
38
|
+
sx: classes.fullViewCardMediaWrpr,
|
39
39
|
onClick: onSelectTemplate(m),
|
40
40
|
children: /*#__PURE__*/_jsx("div", {
|
41
41
|
className: "img-wrapper",
|
@@ -511,17 +511,17 @@ const usePopupStyle = theme => ({
|
|
511
511
|
}
|
512
512
|
},
|
513
513
|
buttonCardMediaWrpr: {
|
514
|
-
padding:
|
514
|
+
padding: '5px',
|
515
515
|
position: "relative",
|
516
516
|
margin: "8px",
|
517
|
-
|
518
|
-
|
517
|
+
height: "50px",
|
518
|
+
'& .img-wrapper': {
|
519
519
|
"&:hover": {
|
520
|
-
padding:
|
521
|
-
backgroundColor:
|
522
|
-
border:
|
523
|
-
borderRadius:
|
524
|
-
height: "100%",
|
520
|
+
padding: '0px 2px 0px 2px',
|
521
|
+
backgroundColor: '#E9F3FE',
|
522
|
+
border: '1px solid #2563EB40',
|
523
|
+
borderRadius: '5px',
|
524
|
+
// height: "100%",
|
525
525
|
margin: "0px"
|
526
526
|
// "& .template-card-action": {
|
527
527
|
// display: "flex",
|
@@ -643,6 +643,21 @@ const usePopupStyle = theme => ({
|
|
643
643
|
"& fieldset": {
|
644
644
|
border: "none !important"
|
645
645
|
}
|
646
|
+
},
|
647
|
+
fullViewCardMediaWrpr: {
|
648
|
+
padding: '5px',
|
649
|
+
position: "relative",
|
650
|
+
margin: "8px",
|
651
|
+
height: "140px",
|
652
|
+
'& .img-wrapper': {
|
653
|
+
"&:hover": {
|
654
|
+
padding: '0px 2px 0px 2px',
|
655
|
+
backgroundColor: '#E9F3FE',
|
656
|
+
border: '1px solid #2563EB40',
|
657
|
+
borderRadius: '5px',
|
658
|
+
margin: "0px"
|
659
|
+
}
|
660
|
+
}
|
646
661
|
}
|
647
662
|
});
|
648
663
|
export default usePopupStyle;
|
@@ -14,16 +14,17 @@ const FontLoader = props => {
|
|
14
14
|
let currentIndex = 0;
|
15
15
|
let retryCount = 0;
|
16
16
|
function loadNextBatch() {
|
17
|
-
if (currentIndex >= families
|
17
|
+
if (currentIndex >= families?.length) {
|
18
18
|
console.log('All fonts have been loaded');
|
19
19
|
return;
|
20
20
|
}
|
21
|
-
const batch = families
|
21
|
+
const batch = families?.slice(currentIndex, currentIndex + batchSize);
|
22
22
|
const batchWithWeights = batch.map(font => `${font}:300,400,600,700`);
|
23
23
|
WebFont.load({
|
24
24
|
google: {
|
25
25
|
families: [...batchWithWeights]
|
26
26
|
},
|
27
|
+
classes: false,
|
27
28
|
active: () => {
|
28
29
|
console.log(`Fonts loaded successfully: ${batch}`);
|
29
30
|
currentIndex += batchSize;
|
@@ -52,11 +53,11 @@ const FontLoader = props => {
|
|
52
53
|
return fontFamily.replace(/\\/g, '').replace(/['"]/g, '');
|
53
54
|
};
|
54
55
|
useEffect(() => {
|
55
|
-
let families = [
|
56
|
+
let families = [...defaultFonts];
|
56
57
|
if (!readOnly) {
|
57
|
-
otherProps
|
58
|
-
families = [...
|
59
|
-
const filteredfamilies = families
|
58
|
+
otherProps?.services("listGoogleFont", []).then(data => {
|
59
|
+
families = [...families, ...(data?.data || [])];
|
60
|
+
const filteredfamilies = families?.filter(font => !font?.includes("Material"));
|
60
61
|
setFontFamilies({
|
61
62
|
id: 1,
|
62
63
|
format: "fontFamily",
|
@@ -68,11 +69,11 @@ const FontLoader = props => {
|
|
68
69
|
console.log(err);
|
69
70
|
});
|
70
71
|
} else {
|
71
|
-
const elements = Array.from(document
|
72
|
+
const elements = Array.from(document?.querySelectorAll("*"));
|
72
73
|
const fontSet = new Set();
|
73
74
|
elements.forEach(element => {
|
74
|
-
const computedStyles = window
|
75
|
-
fontSet.add(sanitizeFontFamily(computedStyles
|
75
|
+
const computedStyles = window?.getComputedStyle(element);
|
76
|
+
fontSet.add(sanitizeFontFamily(computedStyles?.fontFamily));
|
76
77
|
});
|
77
78
|
families = Array.from(fontSet);
|
78
79
|
loadFontsInBatches(families);
|
@@ -25,8 +25,22 @@ const Settings = props => {
|
|
25
25
|
children: /*#__PURE__*/_jsx(Popper, {
|
26
26
|
open: open,
|
27
27
|
anchorEl: anchorEl,
|
28
|
-
placement:
|
28
|
+
placement: "auto-start",
|
29
29
|
sx: classes.root,
|
30
|
+
modifiers: [{
|
31
|
+
name: "flip",
|
32
|
+
enabled: true,
|
33
|
+
options: {
|
34
|
+
altBoundary: true,
|
35
|
+
rootBoundary: "viewport"
|
36
|
+
}
|
37
|
+
}, {
|
38
|
+
name: "preventOverflow",
|
39
|
+
enabled: true,
|
40
|
+
options: {
|
41
|
+
padding: 8
|
42
|
+
}
|
43
|
+
}],
|
30
44
|
children: /*#__PURE__*/_jsxs(Paper, {
|
31
45
|
className: "papper-root",
|
32
46
|
children: [/*#__PURE__*/_jsxs(Typography, {
|
@@ -18,43 +18,54 @@ const VirtualElement = props => {
|
|
18
18
|
useEffect(() => {
|
19
19
|
if (virtualRef?.current) {
|
20
20
|
setTimeout(() => {
|
21
|
-
calculateProps();
|
21
|
+
const allData = calculateProps(path, virtualRef?.current, ROOT_ITEM_CLASS, []);
|
22
|
+
console.log(allData);
|
23
|
+
// it should trigger by auto alignment or on clicking mobile view change
|
24
|
+
updateAutoProps(editor, allData, "xs");
|
22
25
|
}, 0);
|
23
26
|
}
|
24
27
|
}, [updated_at, virtualRef?.current]);
|
25
|
-
const calculateProps = () => {
|
26
|
-
const rect =
|
28
|
+
const calculateProps = (curPath, dom, domClass, allData) => {
|
29
|
+
const rect = dom?.getBoundingClientRect();
|
30
|
+
const sectionRect = virtualRef?.current?.getBoundingClientRect();
|
27
31
|
const sectionProps = {
|
28
|
-
path,
|
32
|
+
path: curPath,
|
29
33
|
props: {
|
30
34
|
height: rect.height
|
31
35
|
}
|
32
36
|
};
|
33
37
|
const itemsData = [];
|
34
|
-
const items =
|
38
|
+
const items = dom.querySelectorAll(domClass);
|
35
39
|
let sectionHeight = 0;
|
36
40
|
for (let i = 0; i < items.length; i++) {
|
37
41
|
const itemRect = items[i]?.getBoundingClientRect();
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
if (items[i]?.classList.contains("type_box")) {
|
43
|
+
allData = calculateProps(items[i]?.dataset.path, items[i], ".freegrid-item", allData);
|
44
|
+
} else {
|
45
|
+
const y = Math.abs(rect.top - itemRect?.top);
|
46
|
+
itemsData.push({
|
47
|
+
path: items[i]?.dataset.path,
|
48
|
+
props: {
|
49
|
+
top: y,
|
50
|
+
left: 24,
|
51
|
+
marginTop: 12,
|
52
|
+
width: itemRect?.width,
|
53
|
+
height: itemRect?.height,
|
54
|
+
gridArea: calculateGridArea(y)
|
55
|
+
}
|
56
|
+
});
|
57
|
+
sectionHeight += itemRect?.height;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
if (dom?.classList.contains("type_box")) {
|
61
|
+
const y = Math.abs(sectionRect.top - rect?.top);
|
62
|
+
sectionProps.props.gridArea = calculateGridArea(y);
|
51
63
|
}
|
52
64
|
if (sectionHeight > sectionProps?.props?.height) {
|
53
65
|
sectionProps.props.height = sectionHeight;
|
54
66
|
}
|
55
|
-
|
56
|
-
|
57
|
-
updateAutoProps(editor, allData, "xs");
|
67
|
+
allData = [sectionProps, [...allData, ...itemsData]]?.flat();
|
68
|
+
return allData;
|
58
69
|
};
|
59
70
|
const getItems = () => {
|
60
71
|
const items = cloneNode?.querySelectorAll(ROOT_ITEM_CLASS) || [];
|
@@ -136,7 +136,7 @@ const BannerSpacing = props => {
|
|
136
136
|
type: "number",
|
137
137
|
name: "top",
|
138
138
|
value: pro_value?.top,
|
139
|
-
className: "borderInput",
|
139
|
+
className: "borderInput removeScroll",
|
140
140
|
style: {
|
141
141
|
...squreStyle.topRight
|
142
142
|
},
|
@@ -149,7 +149,7 @@ const BannerSpacing = props => {
|
|
149
149
|
type: "number",
|
150
150
|
name: "right",
|
151
151
|
value: pro_value?.right,
|
152
|
-
className: "borderInput",
|
152
|
+
className: "borderInput removeScroll",
|
153
153
|
style: {
|
154
154
|
...squreStyle.bottomLeft
|
155
155
|
},
|
@@ -162,7 +162,7 @@ const BannerSpacing = props => {
|
|
162
162
|
type: "number",
|
163
163
|
name: "bottom",
|
164
164
|
value: pro_value?.bottom,
|
165
|
-
className: "borderInput",
|
165
|
+
className: "borderInput removeScroll",
|
166
166
|
style: {
|
167
167
|
...squreStyle.bottomRight
|
168
168
|
},
|
@@ -174,8 +174,8 @@ const BannerSpacing = props => {
|
|
174
174
|
children: /*#__PURE__*/_jsx("input", {
|
175
175
|
type: "number",
|
176
176
|
name: "left",
|
177
|
-
className: "borderInput",
|
178
177
|
value: pro_value?.left,
|
178
|
+
className: "borderInput removeScroll",
|
179
179
|
style: {
|
180
180
|
...squreStyle.topLeft
|
181
181
|
},
|
@@ -257,7 +257,7 @@ export const getBlock = props => {
|
|
257
257
|
return /*#__PURE__*/_jsx("h1", {
|
258
258
|
...attributes,
|
259
259
|
...element.attr,
|
260
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
260
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
261
261
|
placeholder: "Heading 1",
|
262
262
|
children: children
|
263
263
|
});
|
@@ -265,7 +265,7 @@ export const getBlock = props => {
|
|
265
265
|
return /*#__PURE__*/_jsx("h2", {
|
266
266
|
...attributes,
|
267
267
|
...element.attr,
|
268
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
268
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
269
269
|
placeholder: "Heading 2",
|
270
270
|
children: children
|
271
271
|
});
|
@@ -273,7 +273,7 @@ export const getBlock = props => {
|
|
273
273
|
return /*#__PURE__*/_jsx("h3", {
|
274
274
|
...attributes,
|
275
275
|
...element.attr,
|
276
|
-
className: `content-editable ${isEmpty ? "empty" : ""}`,
|
276
|
+
className: `edt-headings content-editable ${isEmpty ? "empty" : ""}`,
|
277
277
|
placeholder: "Heading 3",
|
278
278
|
children: children
|
279
279
|
});
|