@gem-sdk/core 1.27.11 → 1.27.15
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/cjs/components/ComponentToolbarPreview.js +41 -29
- package/dist/cjs/components/resize/Spacing.js +37 -0
- package/dist/cjs/helpers/background.js +2 -0
- package/dist/esm/components/ComponentToolbarPreview.js +41 -29
- package/dist/esm/components/resize/Spacing.js +38 -1
- package/dist/esm/helpers/background.js +2 -0
- package/package.json +2 -2
|
@@ -25,24 +25,6 @@ const isSection = (el)=>{
|
|
|
25
25
|
const tag = el.getAttribute('data-component-tag');
|
|
26
26
|
return tag === 'Section';
|
|
27
27
|
};
|
|
28
|
-
const isOverToolbarPosition = (el, parent)=>{
|
|
29
|
-
const rect = el.getBoundingClientRect();
|
|
30
|
-
const rectP = parent.getBoundingClientRect();
|
|
31
|
-
// 32px = toolbar active height
|
|
32
|
-
return rect.top - rectP.top < 32 + 1;
|
|
33
|
-
};
|
|
34
|
-
const findOverflowParent = (element, initEl)=>{
|
|
35
|
-
const thisEl = element;
|
|
36
|
-
const origEl = initEl || thisEl;
|
|
37
|
-
if (!thisEl) return;
|
|
38
|
-
if (isSection(thisEl)) return;
|
|
39
|
-
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
40
|
-
if (thisEl.parentElement) {
|
|
41
|
-
return findOverflowParent(thisEl.parentElement, origEl);
|
|
42
|
-
} else {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
28
|
const ComponentToolbarPreview = ({ ...props })=>{
|
|
47
29
|
const isThemeSection = props.isThemeSection;
|
|
48
30
|
const editingPageType = ShopContext.useShopStore((s)=>s.pageType);
|
|
@@ -53,13 +35,32 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
53
35
|
const [isShowParent, setIsShowParent] = react.useState(false);
|
|
54
36
|
const [isShowParentRevert, setIsShowParentRevert] = react.useState(false);
|
|
55
37
|
const [parents, setParents] = react.useState([]);
|
|
38
|
+
const isOverToolbarPosition = (el, parent)=>{
|
|
39
|
+
const parentLenght = parents.length;
|
|
40
|
+
const rect = el.getBoundingClientRect();
|
|
41
|
+
const rectP = parent.getBoundingClientRect();
|
|
42
|
+
// 36px = toolbar active height + 4 spaces
|
|
43
|
+
return rect.top - rectP.top < parentLenght * 36;
|
|
44
|
+
};
|
|
45
|
+
const findOverflowParent = (element, initEl)=>{
|
|
46
|
+
const thisEl = element;
|
|
47
|
+
const origEl = initEl || thisEl;
|
|
48
|
+
if (!thisEl) return;
|
|
49
|
+
if (isSection(thisEl)) return;
|
|
50
|
+
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
51
|
+
if (thisEl.parentElement) {
|
|
52
|
+
return findOverflowParent(thisEl.parentElement, origEl);
|
|
53
|
+
} else {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
56
57
|
// Get parents
|
|
57
58
|
const onActiveComponent = react.useCallback((e)=>{
|
|
58
59
|
const detail = e.detail;
|
|
59
60
|
if (detail?.componentUid == props.uid) {
|
|
60
61
|
const currentParents = getParents(props.uid).filter((parent)=>{
|
|
61
62
|
if (parent.uid === 'ROOT') return false;
|
|
62
|
-
if (parent.tag === 'Section') return false;
|
|
63
|
+
if (parent.tag === 'Section' && isThemeSectionEditor) return false;
|
|
63
64
|
if (parent.editorConfigs?.toolbar?.hide) return false;
|
|
64
65
|
if (parent.editorConfigs?.component?.noSetting) return false;
|
|
65
66
|
return true;
|
|
@@ -72,7 +73,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
72
73
|
}, [
|
|
73
74
|
setParents,
|
|
74
75
|
getParents,
|
|
75
|
-
props.uid
|
|
76
|
+
props.uid,
|
|
77
|
+
isThemeSectionEditor
|
|
76
78
|
]);
|
|
77
79
|
react.useEffect(()=>{
|
|
78
80
|
window.addEventListener('editor:active-component', onActiveComponent);
|
|
@@ -115,7 +117,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
115
117
|
setIsShowParentRevert(true);
|
|
116
118
|
} else {
|
|
117
119
|
const rect = $toolbar.getBoundingClientRect();
|
|
118
|
-
if (rect.top < parents.length *
|
|
120
|
+
if (rect.top < parents.length * 36) {
|
|
119
121
|
setIsShowParentRevert(true);
|
|
120
122
|
} else {
|
|
121
123
|
setIsShowParentRevert(false);
|
|
@@ -281,12 +283,21 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
281
283
|
})
|
|
282
284
|
]
|
|
283
285
|
}),
|
|
284
|
-
isShowParent && parents.map((parent, index)
|
|
286
|
+
isShowParent && parents.map((parent, index)=>{
|
|
287
|
+
// Update count columns of Row
|
|
288
|
+
const parentLength = parent?.childrens?.length ?? 0;
|
|
289
|
+
let parent_label = parent.label;
|
|
290
|
+
if (parent.label === 'Row') {
|
|
291
|
+
parent_label = parentLength <= 1 ? parent.label + ' ' + parentLength + ' col' : parent.label + ' ' + parentLength + ' cols';
|
|
292
|
+
}
|
|
293
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
285
294
|
"data-toolbar-parent": true,
|
|
286
295
|
"data-parent-uid": parent.uid,
|
|
287
296
|
"data-toolbar-theme-section": isThemeSectionEditor,
|
|
297
|
+
"data-toolbar-parent-revert": isShowParentRevert,
|
|
288
298
|
style: {
|
|
289
|
-
top: !isShowParentRevert ? `${-
|
|
299
|
+
top: !isShowParentRevert ? `${-36 * (index + 1)}px` // 32 height + 4 spacing
|
|
300
|
+
: `${36 * (index + 1)}px`
|
|
290
301
|
},
|
|
291
302
|
children: [
|
|
292
303
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
@@ -326,10 +337,11 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
326
337
|
}),
|
|
327
338
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
328
339
|
"data-toolbar-name": true,
|
|
329
|
-
children:
|
|
340
|
+
children: parent_label
|
|
330
341
|
})
|
|
331
342
|
]
|
|
332
|
-
}, parent.uid)
|
|
343
|
+
}, parent.uid);
|
|
344
|
+
}),
|
|
333
345
|
props.tag === 'Section' && !props.isThemeSection && editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsxRuntime.jsx(CreateThemeSection.CreateThemeSection, {
|
|
334
346
|
...props
|
|
335
347
|
}),
|
|
@@ -417,8 +429,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
417
429
|
viewBox: "0 0 16 16",
|
|
418
430
|
fill: "none",
|
|
419
431
|
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
420
|
-
d: "M8.
|
|
421
|
-
fill: "
|
|
432
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
433
|
+
fill: "#212121"
|
|
422
434
|
})
|
|
423
435
|
})
|
|
424
436
|
}),
|
|
@@ -437,8 +449,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
437
449
|
viewBox: "0 0 16 16",
|
|
438
450
|
fill: "none",
|
|
439
451
|
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
440
|
-
d: "M8.
|
|
441
|
-
fill: "
|
|
452
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
453
|
+
fill: "#212121"
|
|
442
454
|
})
|
|
443
455
|
})
|
|
444
456
|
})
|
|
@@ -102,6 +102,43 @@ function Spacing(props) {
|
|
|
102
102
|
const onMouseUp = ()=>{
|
|
103
103
|
endDrag();
|
|
104
104
|
};
|
|
105
|
+
const getChildrenByAttrSelector = ($el, attrSelector)=>{
|
|
106
|
+
const childLen = $el.children.length;
|
|
107
|
+
if (childLen) {
|
|
108
|
+
for(let i = 0; i < childLen; i++){
|
|
109
|
+
const children = $el.children[i];
|
|
110
|
+
if (children) {
|
|
111
|
+
const is = children.getAttribute(attrSelector);
|
|
112
|
+
if (is) {
|
|
113
|
+
return children;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const onUpdateMarginBottom = react.useCallback((e)=>{
|
|
120
|
+
if (isDragging.current) return;
|
|
121
|
+
const detail = e.detail;
|
|
122
|
+
const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
|
|
123
|
+
const toolbar = $component && getChildrenByAttrSelector($component, 'data-toolbar');
|
|
124
|
+
const isActive = toolbar && toolbar.getAttribute('data-toolbar-active');
|
|
125
|
+
if (isActive && detail?.marginBottom) {
|
|
126
|
+
const currentValue = isNaN(parseInt(detail?.marginBottom)) ? 0 : Math.max(parseInt(detail?.marginBottom), 0);
|
|
127
|
+
const newValue = `${currentValue}px`;
|
|
128
|
+
if ($bottomDrag.current && $bottomBg.current) {
|
|
129
|
+
$bottomBg.current.style.height = newValue;
|
|
130
|
+
$bottomDrag.current.style.top = newValue;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}, []);
|
|
134
|
+
react.useEffect(()=>{
|
|
135
|
+
window.addEventListener('editor:toolbar:update-margin-bottom', onUpdateMarginBottom);
|
|
136
|
+
return ()=>{
|
|
137
|
+
window.removeEventListener('editor:toolbar:update-margin-bottom', onUpdateMarginBottom);
|
|
138
|
+
};
|
|
139
|
+
}, [
|
|
140
|
+
onUpdateMarginBottom
|
|
141
|
+
]);
|
|
105
142
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
106
143
|
children: props.tag !== 'Section' && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
107
144
|
"data-spacing": true,
|
|
@@ -157,6 +157,8 @@ const makeFixedBgAttachmentByDevice = (device, bgAttachment)=>{
|
|
|
157
157
|
[`--pos${subfix}`]: 'absolute'
|
|
158
158
|
},
|
|
159
159
|
content: {
|
|
160
|
+
[`--w${subfix}`]: 'inherit',
|
|
161
|
+
[`--h${subfix}`]: 'inherit',
|
|
160
162
|
[`--pos${subfix}`]: 'absolute',
|
|
161
163
|
[`--bga${subfix}`]: bgAttachment
|
|
162
164
|
}
|
|
@@ -23,24 +23,6 @@ const isSection = (el)=>{
|
|
|
23
23
|
const tag = el.getAttribute('data-component-tag');
|
|
24
24
|
return tag === 'Section';
|
|
25
25
|
};
|
|
26
|
-
const isOverToolbarPosition = (el, parent)=>{
|
|
27
|
-
const rect = el.getBoundingClientRect();
|
|
28
|
-
const rectP = parent.getBoundingClientRect();
|
|
29
|
-
// 32px = toolbar active height
|
|
30
|
-
return rect.top - rectP.top < 32 + 1;
|
|
31
|
-
};
|
|
32
|
-
const findOverflowParent = (element, initEl)=>{
|
|
33
|
-
const thisEl = element;
|
|
34
|
-
const origEl = initEl || thisEl;
|
|
35
|
-
if (!thisEl) return;
|
|
36
|
-
if (isSection(thisEl)) return;
|
|
37
|
-
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
38
|
-
if (thisEl.parentElement) {
|
|
39
|
-
return findOverflowParent(thisEl.parentElement, origEl);
|
|
40
|
-
} else {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
26
|
const ComponentToolbarPreview = ({ ...props })=>{
|
|
45
27
|
const isThemeSection = props.isThemeSection;
|
|
46
28
|
const editingPageType = useShopStore((s)=>s.pageType);
|
|
@@ -51,13 +33,32 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
51
33
|
const [isShowParent, setIsShowParent] = useState(false);
|
|
52
34
|
const [isShowParentRevert, setIsShowParentRevert] = useState(false);
|
|
53
35
|
const [parents, setParents] = useState([]);
|
|
36
|
+
const isOverToolbarPosition = (el, parent)=>{
|
|
37
|
+
const parentLenght = parents.length;
|
|
38
|
+
const rect = el.getBoundingClientRect();
|
|
39
|
+
const rectP = parent.getBoundingClientRect();
|
|
40
|
+
// 36px = toolbar active height + 4 spaces
|
|
41
|
+
return rect.top - rectP.top < parentLenght * 36;
|
|
42
|
+
};
|
|
43
|
+
const findOverflowParent = (element, initEl)=>{
|
|
44
|
+
const thisEl = element;
|
|
45
|
+
const origEl = initEl || thisEl;
|
|
46
|
+
if (!thisEl) return;
|
|
47
|
+
if (isSection(thisEl)) return;
|
|
48
|
+
if (notVisible(thisEl) && isOverToolbarPosition(initEl, thisEl)) return thisEl;
|
|
49
|
+
if (thisEl.parentElement) {
|
|
50
|
+
return findOverflowParent(thisEl.parentElement, origEl);
|
|
51
|
+
} else {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
54
55
|
// Get parents
|
|
55
56
|
const onActiveComponent = useCallback((e)=>{
|
|
56
57
|
const detail = e.detail;
|
|
57
58
|
if (detail?.componentUid == props.uid) {
|
|
58
59
|
const currentParents = getParents(props.uid).filter((parent)=>{
|
|
59
60
|
if (parent.uid === 'ROOT') return false;
|
|
60
|
-
if (parent.tag === 'Section') return false;
|
|
61
|
+
if (parent.tag === 'Section' && isThemeSectionEditor) return false;
|
|
61
62
|
if (parent.editorConfigs?.toolbar?.hide) return false;
|
|
62
63
|
if (parent.editorConfigs?.component?.noSetting) return false;
|
|
63
64
|
return true;
|
|
@@ -70,7 +71,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
70
71
|
}, [
|
|
71
72
|
setParents,
|
|
72
73
|
getParents,
|
|
73
|
-
props.uid
|
|
74
|
+
props.uid,
|
|
75
|
+
isThemeSectionEditor
|
|
74
76
|
]);
|
|
75
77
|
useEffect(()=>{
|
|
76
78
|
window.addEventListener('editor:active-component', onActiveComponent);
|
|
@@ -113,7 +115,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
113
115
|
setIsShowParentRevert(true);
|
|
114
116
|
} else {
|
|
115
117
|
const rect = $toolbar.getBoundingClientRect();
|
|
116
|
-
if (rect.top < parents.length *
|
|
118
|
+
if (rect.top < parents.length * 36) {
|
|
117
119
|
setIsShowParentRevert(true);
|
|
118
120
|
} else {
|
|
119
121
|
setIsShowParentRevert(false);
|
|
@@ -279,12 +281,21 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
279
281
|
})
|
|
280
282
|
]
|
|
281
283
|
}),
|
|
282
|
-
isShowParent && parents.map((parent, index)
|
|
284
|
+
isShowParent && parents.map((parent, index)=>{
|
|
285
|
+
// Update count columns of Row
|
|
286
|
+
const parentLength = parent?.childrens?.length ?? 0;
|
|
287
|
+
let parent_label = parent.label;
|
|
288
|
+
if (parent.label === 'Row') {
|
|
289
|
+
parent_label = parentLength <= 1 ? parent.label + ' ' + parentLength + ' col' : parent.label + ' ' + parentLength + ' cols';
|
|
290
|
+
}
|
|
291
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
283
292
|
"data-toolbar-parent": true,
|
|
284
293
|
"data-parent-uid": parent.uid,
|
|
285
294
|
"data-toolbar-theme-section": isThemeSectionEditor,
|
|
295
|
+
"data-toolbar-parent-revert": isShowParentRevert,
|
|
286
296
|
style: {
|
|
287
|
-
top: !isShowParentRevert ? `${-
|
|
297
|
+
top: !isShowParentRevert ? `${-36 * (index + 1)}px` // 32 height + 4 spacing
|
|
298
|
+
: `${36 * (index + 1)}px`
|
|
288
299
|
},
|
|
289
300
|
children: [
|
|
290
301
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -324,10 +335,11 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
324
335
|
}),
|
|
325
336
|
/*#__PURE__*/ jsx("div", {
|
|
326
337
|
"data-toolbar-name": true,
|
|
327
|
-
children:
|
|
338
|
+
children: parent_label
|
|
328
339
|
})
|
|
329
340
|
]
|
|
330
|
-
}, parent.uid)
|
|
341
|
+
}, parent.uid);
|
|
342
|
+
}),
|
|
331
343
|
props.tag === 'Section' && !props.isThemeSection && editingPageType !== 'STATIC' && getIndexSection() < SECTION_LIMIT && /*#__PURE__*/ jsx(CreateThemeSection, {
|
|
332
344
|
...props
|
|
333
345
|
}),
|
|
@@ -415,8 +427,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
415
427
|
viewBox: "0 0 16 16",
|
|
416
428
|
fill: "none",
|
|
417
429
|
children: /*#__PURE__*/ jsx("path", {
|
|
418
|
-
d: "M8.
|
|
419
|
-
fill: "
|
|
430
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
431
|
+
fill: "#212121"
|
|
420
432
|
})
|
|
421
433
|
})
|
|
422
434
|
}),
|
|
@@ -435,8 +447,8 @@ const ComponentToolbarPreview = ({ ...props })=>{
|
|
|
435
447
|
viewBox: "0 0 16 16",
|
|
436
448
|
fill: "none",
|
|
437
449
|
children: /*#__PURE__*/ jsx("path", {
|
|
438
|
-
d: "M8.
|
|
439
|
-
fill: "
|
|
450
|
+
d: "M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",
|
|
451
|
+
fill: "#212121"
|
|
440
452
|
})
|
|
441
453
|
})
|
|
442
454
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useRef } from 'react';
|
|
2
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
3
3
|
import 'zustand';
|
|
4
4
|
import { useBuilderPreviewStore } from '../../contexts/BuilderPreviewContext.js';
|
|
5
5
|
import 'swr';
|
|
@@ -98,6 +98,43 @@ function Spacing(props) {
|
|
|
98
98
|
const onMouseUp = ()=>{
|
|
99
99
|
endDrag();
|
|
100
100
|
};
|
|
101
|
+
const getChildrenByAttrSelector = ($el, attrSelector)=>{
|
|
102
|
+
const childLen = $el.children.length;
|
|
103
|
+
if (childLen) {
|
|
104
|
+
for(let i = 0; i < childLen; i++){
|
|
105
|
+
const children = $el.children[i];
|
|
106
|
+
if (children) {
|
|
107
|
+
const is = children.getAttribute(attrSelector);
|
|
108
|
+
if (is) {
|
|
109
|
+
return children;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const onUpdateMarginBottom = useCallback((e)=>{
|
|
116
|
+
if (isDragging.current) return;
|
|
117
|
+
const detail = e.detail;
|
|
118
|
+
const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
|
|
119
|
+
const toolbar = $component && getChildrenByAttrSelector($component, 'data-toolbar');
|
|
120
|
+
const isActive = toolbar && toolbar.getAttribute('data-toolbar-active');
|
|
121
|
+
if (isActive && detail?.marginBottom) {
|
|
122
|
+
const currentValue = isNaN(parseInt(detail?.marginBottom)) ? 0 : Math.max(parseInt(detail?.marginBottom), 0);
|
|
123
|
+
const newValue = `${currentValue}px`;
|
|
124
|
+
if ($bottomDrag.current && $bottomBg.current) {
|
|
125
|
+
$bottomBg.current.style.height = newValue;
|
|
126
|
+
$bottomDrag.current.style.top = newValue;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, []);
|
|
130
|
+
useEffect(()=>{
|
|
131
|
+
window.addEventListener('editor:toolbar:update-margin-bottom', onUpdateMarginBottom);
|
|
132
|
+
return ()=>{
|
|
133
|
+
window.removeEventListener('editor:toolbar:update-margin-bottom', onUpdateMarginBottom);
|
|
134
|
+
};
|
|
135
|
+
}, [
|
|
136
|
+
onUpdateMarginBottom
|
|
137
|
+
]);
|
|
101
138
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
102
139
|
children: props.tag !== 'Section' && /*#__PURE__*/ jsx("div", {
|
|
103
140
|
"data-spacing": true,
|
|
@@ -155,6 +155,8 @@ const makeFixedBgAttachmentByDevice = (device, bgAttachment)=>{
|
|
|
155
155
|
[`--pos${subfix}`]: 'absolute'
|
|
156
156
|
},
|
|
157
157
|
content: {
|
|
158
|
+
[`--w${subfix}`]: 'inherit',
|
|
159
|
+
[`--h${subfix}`]: 'inherit',
|
|
158
160
|
[`--pos${subfix}`]: 'absolute',
|
|
159
161
|
[`--bga${subfix}`]: bgAttachment
|
|
160
162
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@gem-sdk/adapter-shopify": "1.25.0",
|
|
28
|
-
"@gem-sdk/styles": "1.27.
|
|
28
|
+
"@gem-sdk/styles": "1.27.14"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"react-error-boundary": "4.0.10",
|