@flozy/editor 4.1.4 → 4.1.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Editor/Editor.css +1 -1
- package/dist/Editor/Elements/AI/Styles.js +3 -0
- 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 +9 -9
- 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
package/dist/Editor/Editor.css
CHANGED
@@ -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,11 +14,11 @@ 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: {
|
@@ -52,11 +52,11 @@ const FontLoader = props => {
|
|
52
52
|
return fontFamily.replace(/\\/g, '').replace(/['"]/g, '');
|
53
53
|
};
|
54
54
|
useEffect(() => {
|
55
|
-
let families = [
|
55
|
+
let families = [...defaultFonts];
|
56
56
|
if (!readOnly) {
|
57
|
-
otherProps
|
58
|
-
families = [...
|
59
|
-
const filteredfamilies = families
|
57
|
+
otherProps?.services("listGoogleFont", []).then(data => {
|
58
|
+
families = [...families, ...(data?.data || [])];
|
59
|
+
const filteredfamilies = families?.filter(font => !font?.includes("Material"));
|
60
60
|
setFontFamilies({
|
61
61
|
id: 1,
|
62
62
|
format: "fontFamily",
|
@@ -68,11 +68,11 @@ const FontLoader = props => {
|
|
68
68
|
console.log(err);
|
69
69
|
});
|
70
70
|
} else {
|
71
|
-
const elements = Array.from(document
|
71
|
+
const elements = Array.from(document?.querySelectorAll("*"));
|
72
72
|
const fontSet = new Set();
|
73
73
|
elements.forEach(element => {
|
74
|
-
const computedStyles = window
|
75
|
-
fontSet.add(sanitizeFontFamily(computedStyles
|
74
|
+
const computedStyles = window?.getComputedStyle(element);
|
75
|
+
fontSet.add(sanitizeFontFamily(computedStyles?.fontFamily));
|
76
76
|
});
|
77
77
|
families = Array.from(fontSet);
|
78
78
|
loadFontsInBatches(families);
|
@@ -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
|
});
|