@ohhwells/bridge 0.1.55-next.160 → 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 CHANGED
@@ -7160,7 +7160,10 @@ function AiSectionOverlay({
7160
7160
  border: `2px solid ${PRIMARY2}`,
7161
7161
  borderRadius: edgeAwareRadius(reviewRect),
7162
7162
  zIndex: 2147483200,
7163
- // The veil itself: swallows clicks so the section stays locked until decided.
7163
+ // The veil itself: swallows clicks so the section stays locked until decided. This
7164
+ // stopPropagation only guards the bubble phase; the bridge's capture-phase click
7165
+ // handlers additionally bail on `[data-ohw-ai-review]`, without which a click on
7166
+ // Accept/Discard resolves to the media beneath and opens the file picker.
7164
7167
  background: "rgba(8, 133, 254, 0.04)",
7165
7168
  pointerEvents: "auto",
7166
7169
  cursor: "default"
@@ -9799,6 +9802,10 @@ function isSocialsRow(el) {
9799
9802
  const anchors = Array.from(el.querySelectorAll("a"));
9800
9803
  return anchors.length > 0 && anchors.every((anchor) => isSocialItem(anchor));
9801
9804
  }
9805
+ var MAX_SOCIAL_ITEMS_PER_ROW = 7;
9806
+ function canAddSocialItem(row) {
9807
+ return listSocialItems(row).length < MAX_SOCIAL_ITEMS_PER_ROW;
9808
+ }
9802
9809
  function listSocialItems(row) {
9803
9810
  return Array.from(row.children).map((child) => {
9804
9811
  if (!(child instanceof HTMLElement)) return null;
@@ -14706,6 +14713,14 @@ function OhhwellsBridge() {
14706
14713
  if (!selected) return;
14707
14714
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
14708
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
+ }
14709
14724
  const after = getSocialItem(selected);
14710
14725
  const result2 = insertSocialItem(socialsRow, after, editContentRef.current);
14711
14726
  if (!result2) return;
@@ -15923,6 +15938,7 @@ function OhhwellsBridge() {
15923
15938
  return;
15924
15939
  }
15925
15940
  const target = e.target;
15941
+ if (target.closest("[data-ohw-ai-review]")) return;
15926
15942
  if (target.closest("[data-ohw-toolbar]")) return;
15927
15943
  if (target.closest("[data-ohw-state-toggle]")) return;
15928
15944
  if (target.closest("[data-ohw-max-badge]")) return;
@@ -16154,6 +16170,7 @@ function OhhwellsBridge() {
16154
16170
  };
16155
16171
  const handleDblClick = (e) => {
16156
16172
  const target = e.target;
16173
+ if (target.closest("[data-ohw-ai-review]")) return;
16157
16174
  if (target.closest("[data-ohw-toolbar]")) return;
16158
16175
  if (target.closest("[data-ohw-state-toggle]")) return;
16159
16176
  if (target.closest("[data-ohw-max-badge]")) return;
@@ -18709,7 +18726,10 @@ function OhhwellsBridge() {
18709
18726
  onSelectParent: handleSelectParent,
18710
18727
  onDuplicate: handleDuplicateSelected,
18711
18728
  onDelete: handleDeleteSelected,
18712
- 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
+ })(),
18713
18733
  editLinkDisabled: false,
18714
18734
  moreDisabled: false,
18715
18735
  duplicateDisabled: isFooterFrameSelection || selectedIsSocialsRow,