@ohhwells/bridge 0.1.55-next.161 → 0.1.55-next.163
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/index.cjs +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9802,6 +9802,10 @@ function isSocialsRow(el) {
|
|
|
9802
9802
|
const anchors = Array.from(el.querySelectorAll("a"));
|
|
9803
9803
|
return anchors.length > 0 && anchors.every((anchor) => isSocialItem(anchor));
|
|
9804
9804
|
}
|
|
9805
|
+
var MAX_SOCIAL_ITEMS_PER_ROW = 7;
|
|
9806
|
+
function canAddSocialItem(row) {
|
|
9807
|
+
return listSocialItems(row).length < MAX_SOCIAL_ITEMS_PER_ROW;
|
|
9808
|
+
}
|
|
9805
9809
|
function listSocialItems(row) {
|
|
9806
9810
|
return Array.from(row.children).map((child) => {
|
|
9807
9811
|
if (!(child instanceof HTMLElement)) return null;
|
|
@@ -14709,6 +14713,14 @@ function OhhwellsBridge() {
|
|
|
14709
14713
|
if (!selected) return;
|
|
14710
14714
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
14711
14715
|
if (socialsRow) {
|
|
14716
|
+
if (!canAddSocialItem(socialsRow)) {
|
|
14717
|
+
postToParent2({
|
|
14718
|
+
type: "ow:toast",
|
|
14719
|
+
title: `Maximum ${MAX_SOCIAL_ITEMS_PER_ROW} social icons`,
|
|
14720
|
+
toastType: "error"
|
|
14721
|
+
});
|
|
14722
|
+
return;
|
|
14723
|
+
}
|
|
14712
14724
|
const after = getSocialItem(selected);
|
|
14713
14725
|
const result2 = insertSocialItem(socialsRow, after, editContentRef.current);
|
|
14714
14726
|
if (!result2) return;
|
|
@@ -18714,7 +18726,10 @@ function OhhwellsBridge() {
|
|
|
18714
18726
|
onSelectParent: handleSelectParent,
|
|
18715
18727
|
onDuplicate: handleDuplicateSelected,
|
|
18716
18728
|
onDelete: handleDeleteSelected,
|
|
18717
|
-
addItemDisabled: isFooterFrameSelection && isFooterAddItemDisabled(selectedElRef.current)
|
|
18729
|
+
addItemDisabled: isFooterFrameSelection && isFooterAddItemDisabled(selectedElRef.current) || selectedElRef.current !== null && (() => {
|
|
18730
|
+
const row = isSocialsRow(selectedElRef.current) ? selectedElRef.current : findSocialsRow(selectedElRef.current);
|
|
18731
|
+
return row ? !canAddSocialItem(row) : false;
|
|
18732
|
+
})(),
|
|
18718
18733
|
editLinkDisabled: false,
|
|
18719
18734
|
moreDisabled: false,
|
|
18720
18735
|
duplicateDisabled: isFooterFrameSelection || selectedIsSocialsRow,
|