@ohhwells/bridge 0.1.143 → 0.1.145
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 +203 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +203 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1522,6 +1522,52 @@ function assignmentFor(el, content, tokens) {
|
|
|
1522
1522
|
function labelElement(el) {
|
|
1523
1523
|
return el.querySelector('[data-ohw-editable="text"], [data-ohw-editable="plain"]') ?? (el.matches('[data-ohw-editable="text"], [data-ohw-editable="plain"]') ? el : null);
|
|
1524
1524
|
}
|
|
1525
|
+
var BRAND_TRACK_PRECEDENCE = {
|
|
1526
|
+
background: ["primary", "accent", "background", "surface", "on-primary", "text", "border", "text-muted"],
|
|
1527
|
+
color: ["on-primary", "text", "primary", "accent", "text-muted", "background", "surface", "border"],
|
|
1528
|
+
borderColor: ["border", "primary", "accent", "text", "on-primary", "background", "surface", "text-muted"]
|
|
1529
|
+
};
|
|
1530
|
+
var FONT_TRACK_VARS = ["--font-body", "--font-heading", "--font-display", "--brand-font-body", "--brand-font-heading"];
|
|
1531
|
+
function readRootVar(doc, name) {
|
|
1532
|
+
const root = doc.documentElement;
|
|
1533
|
+
return root.style.getPropertyValue(name).trim() || getComputedStyle(root).getPropertyValue(name).trim();
|
|
1534
|
+
}
|
|
1535
|
+
function sameColor(a, b) {
|
|
1536
|
+
return Math.round(a.r) === Math.round(b.r) && Math.round(a.g) === Math.round(b.g) && Math.round(a.b) === Math.round(b.b) && Math.abs(a.a - b.a) < 0.02;
|
|
1537
|
+
}
|
|
1538
|
+
function brandTrackedColor(doc, color, roles) {
|
|
1539
|
+
if (!color || color.includes("var(")) return color;
|
|
1540
|
+
const parsed = parseColor(color);
|
|
1541
|
+
if (!parsed || isTransparent(parsed)) return color;
|
|
1542
|
+
for (const role of roles) {
|
|
1543
|
+
const name = `--brand-${role}`;
|
|
1544
|
+
const token = parseColor(readRootVar(doc, name));
|
|
1545
|
+
if (token && !isTransparent(token) && sameColor(parsed, token)) return `var(${name}, ${color})`;
|
|
1546
|
+
}
|
|
1547
|
+
return color;
|
|
1548
|
+
}
|
|
1549
|
+
function brandTrackedChrome(doc, chrome) {
|
|
1550
|
+
return {
|
|
1551
|
+
...chrome,
|
|
1552
|
+
background: brandTrackedColor(doc, chrome.background, BRAND_TRACK_PRECEDENCE.background),
|
|
1553
|
+
color: brandTrackedColor(doc, chrome.color, BRAND_TRACK_PRECEDENCE.color),
|
|
1554
|
+
borderColor: brandTrackedColor(doc, chrome.borderColor, BRAND_TRACK_PRECEDENCE.borderColor)
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
function firstFamily(stack) {
|
|
1558
|
+
const first = stack.split(",")[0]?.trim() ?? "";
|
|
1559
|
+
return first.replace(/^['"]|['"]$/g, "").toLowerCase();
|
|
1560
|
+
}
|
|
1561
|
+
function brandTrackedFontFamily(doc, stack) {
|
|
1562
|
+
if (!stack || stack.includes("var(")) return stack;
|
|
1563
|
+
const family = firstFamily(stack);
|
|
1564
|
+
if (!family) return stack;
|
|
1565
|
+
for (const name of FONT_TRACK_VARS) {
|
|
1566
|
+
const raw = readRootVar(doc, name);
|
|
1567
|
+
if (raw && firstFamily(raw) === family) return `var(${name}, ${stack})`;
|
|
1568
|
+
}
|
|
1569
|
+
return stack;
|
|
1570
|
+
}
|
|
1525
1571
|
var paintLockByEl = /* @__PURE__ */ new WeakMap();
|
|
1526
1572
|
var paintObserverByEl = /* @__PURE__ */ new WeakMap();
|
|
1527
1573
|
var paintingButton = false;
|
|
@@ -1548,7 +1594,7 @@ function paintButtonChrome(el, assignment, tokens) {
|
|
|
1548
1594
|
el.style.borderRadius = px(origin.size.borderRadius);
|
|
1549
1595
|
el.style.gap = geometry.gap;
|
|
1550
1596
|
el.style.height = px(geometry.height);
|
|
1551
|
-
el.style.fontFamily = typography.fontFamily;
|
|
1597
|
+
el.style.fontFamily = brandTrackedFontFamily(el.ownerDocument, typography.fontFamily);
|
|
1552
1598
|
el.style.fontWeight = typography.fontWeight;
|
|
1553
1599
|
el.style.letterSpacing = typography.letterSpacing;
|
|
1554
1600
|
el.style.textTransform = typography.textTransform;
|
|
@@ -1577,9 +1623,18 @@ function paintedTokensOf(el) {
|
|
|
1577
1623
|
return paintLockByEl.get(el)?.tokens ?? null;
|
|
1578
1624
|
}
|
|
1579
1625
|
function applyButtonStyle(el, assignment, tokens) {
|
|
1580
|
-
|
|
1626
|
+
const doc = el.ownerDocument;
|
|
1627
|
+
const tracked = {
|
|
1628
|
+
...tokens,
|
|
1629
|
+
variants: {
|
|
1630
|
+
primary: brandTrackedChrome(doc, tokens.variants.primary),
|
|
1631
|
+
secondary: brandTrackedChrome(doc, tokens.variants.secondary),
|
|
1632
|
+
ghost: brandTrackedChrome(doc, tokens.variants.ghost)
|
|
1633
|
+
}
|
|
1634
|
+
};
|
|
1635
|
+
paintLockByEl.set(el, { assignment, tokens: tracked });
|
|
1581
1636
|
paintingButton = true;
|
|
1582
|
-
paintButtonChrome(el, assignment,
|
|
1637
|
+
paintButtonChrome(el, assignment, tracked);
|
|
1583
1638
|
paintingButton = false;
|
|
1584
1639
|
guardTemplateHover(el);
|
|
1585
1640
|
}
|
|
@@ -2479,6 +2534,49 @@ function socialHrefKey(item) {
|
|
|
2479
2534
|
function socialIconKey(item) {
|
|
2480
2535
|
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
2481
2536
|
}
|
|
2537
|
+
var SOCIAL_PLATFORM_LABELS = {
|
|
2538
|
+
instagram: "Instagram",
|
|
2539
|
+
facebook: "Facebook",
|
|
2540
|
+
x: "X",
|
|
2541
|
+
twitter: "X",
|
|
2542
|
+
tiktok: "TikTok",
|
|
2543
|
+
youtube: "YouTube",
|
|
2544
|
+
linkedin: "LinkedIn",
|
|
2545
|
+
pinterest: "Pinterest",
|
|
2546
|
+
whatsapp: "WhatsApp",
|
|
2547
|
+
telegram: "Telegram",
|
|
2548
|
+
spotify: "Spotify",
|
|
2549
|
+
threads: "Threads",
|
|
2550
|
+
vimeo: "Vimeo",
|
|
2551
|
+
discord: "Discord",
|
|
2552
|
+
medium: "Medium",
|
|
2553
|
+
website: "Website"
|
|
2554
|
+
};
|
|
2555
|
+
function socialPlatformLabel(item, content) {
|
|
2556
|
+
const iconKey = socialIconKey(item);
|
|
2557
|
+
const chosen = iconKey ? (content[socialPlatformKey(iconKey)] ?? "").trim().toLowerCase() : "";
|
|
2558
|
+
if (chosen) return SOCIAL_PLATFORM_LABELS[chosen] ?? chosen.charAt(0).toUpperCase() + chosen.slice(1);
|
|
2559
|
+
const label = socialLabelElement(item);
|
|
2560
|
+
const words = label && !label.hasAttribute(SOCIALS_EMPTY_LABEL_ATTR) ? (label.textContent ?? "").replace(/\s+/g, " ").trim() : "";
|
|
2561
|
+
if (words) return words;
|
|
2562
|
+
const link = item.matches("a") ? item : item.querySelector("a");
|
|
2563
|
+
const aria = (link?.getAttribute("aria-label") ?? item.getAttribute("aria-label") ?? "").trim();
|
|
2564
|
+
if (aria) return aria;
|
|
2565
|
+
const href = (link?.getAttribute("href") ?? "").trim();
|
|
2566
|
+
if (/^https?:\/\//i.test(href)) {
|
|
2567
|
+
let host = "";
|
|
2568
|
+
try {
|
|
2569
|
+
host = new URL(href).hostname.replace(/^www\./i, "").toLowerCase();
|
|
2570
|
+
} catch {
|
|
2571
|
+
host = "";
|
|
2572
|
+
}
|
|
2573
|
+
if (host.includes("x.com") || host.includes("twitter.com")) return "X";
|
|
2574
|
+
for (const [id, name] of Object.entries(SOCIAL_PLATFORM_LABELS)) {
|
|
2575
|
+
if (host.includes(id)) return name;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
return "Social";
|
|
2579
|
+
}
|
|
2482
2580
|
var SOCIALS_ORDER_KEY = "__ohw_socials_order";
|
|
2483
2581
|
function fromMarkup(markup) {
|
|
2484
2582
|
const holder = document.createElement("div");
|
|
@@ -7060,8 +7158,8 @@ function applyBrandToDom(kit) {
|
|
|
7060
7158
|
if (kit.fonts) {
|
|
7061
7159
|
appliedFonts = applyFonts ? kit.fonts : null;
|
|
7062
7160
|
}
|
|
7161
|
+
for (const name of BUTTON_VAR_NAMES) root.style.removeProperty(name);
|
|
7063
7162
|
if (kit.buttons) {
|
|
7064
|
-
for (const name of BUTTON_VAR_NAMES) root.style.removeProperty(name);
|
|
7065
7163
|
for (const [name, value] of Object.entries(buttonStyleVars({ ...kit, buttons: kit.buttons }))) root.style.setProperty(name, value);
|
|
7066
7164
|
}
|
|
7067
7165
|
syncButtonRules(kit.buttons ? kit : null);
|
|
@@ -10462,7 +10560,7 @@ function isChromeSection2(el) {
|
|
|
10462
10560
|
if (CHROME_SECTION_IDS.has(el.getAttribute("data-ohw-section") ?? "")) return true;
|
|
10463
10561
|
return el.tagName === "HEADER" || el.tagName === "FOOTER";
|
|
10464
10562
|
}
|
|
10465
|
-
function
|
|
10563
|
+
function readRootVar2(name) {
|
|
10466
10564
|
if (typeof document === "undefined") return "";
|
|
10467
10565
|
return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
10468
10566
|
}
|
|
@@ -10502,14 +10600,14 @@ function humanizeFontFamily(name) {
|
|
|
10502
10600
|
return name.replace(/^__/, "").replace(/_[0-9a-f]{6}$/i, "").replace(/_/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().replace(/\s+/g, " ").replace(/(^|\s)([a-z])/g, (_, sep, c) => sep + c.toUpperCase());
|
|
10503
10601
|
}
|
|
10504
10602
|
function readFontVar(name) {
|
|
10505
|
-
return humanizeFontFamily(primaryFontFamily(
|
|
10603
|
+
return humanizeFontFamily(primaryFontFamily(readRootVar2(name)));
|
|
10506
10604
|
}
|
|
10507
10605
|
function deriveBrandOverride() {
|
|
10508
|
-
const dark =
|
|
10509
|
-
const primary =
|
|
10510
|
-
const light =
|
|
10606
|
+
const dark = readRootVar2("--ohw-brand-dark");
|
|
10607
|
+
const primary = readRootVar2("--ohw-brand-primary");
|
|
10608
|
+
const light = readRootVar2("--ohw-brand-light");
|
|
10511
10609
|
if (!dark || !primary || !light) return null;
|
|
10512
|
-
const accent =
|
|
10610
|
+
const accent = readRootVar2("--ohw-brand-accent");
|
|
10513
10611
|
const heading = readFontVar("--font-heading") || readFontVar("--font-display");
|
|
10514
10612
|
const body = readFontVar("--font-body");
|
|
10515
10613
|
return {
|
|
@@ -10521,11 +10619,11 @@ function deriveBrandOverride() {
|
|
|
10521
10619
|
};
|
|
10522
10620
|
}
|
|
10523
10621
|
function deriveTemplateBrandLive() {
|
|
10524
|
-
const primary =
|
|
10525
|
-
const dark =
|
|
10526
|
-
const light =
|
|
10622
|
+
const primary = readRootVar2("--brand-primary") || readRootVar2("--color-primary");
|
|
10623
|
+
const dark = readRootVar2("--brand-text") || readRootVar2("--color-dark");
|
|
10624
|
+
const light = readRootVar2("--brand-background") || readRootVar2("--color-light");
|
|
10527
10625
|
if (!dark || !primary || !light) return null;
|
|
10528
|
-
const accent =
|
|
10626
|
+
const accent = readRootVar2("--brand-accent") || readRootVar2("--color-accent");
|
|
10529
10627
|
const heading = readFontVar("--brand-font-heading") || readFontVar("--font-heading") || readFontVar("--font-display");
|
|
10530
10628
|
const body = readFontVar("--brand-font-body") || readFontVar("--font-body");
|
|
10531
10629
|
return {
|
|
@@ -25120,36 +25218,72 @@ function OhhwellsBridge() {
|
|
|
25120
25218
|
const [selectedMedia, setSelectedMedia] = (0, import_react21.useState)(null);
|
|
25121
25219
|
const selectedMediaElRef = (0, import_react21.useRef)(null);
|
|
25122
25220
|
const mediaKeyDropTokenRef = (0, import_react21.useRef)(0);
|
|
25221
|
+
const selectedIconElRef = (0, import_react21.useRef)(null);
|
|
25222
|
+
const selectedSocialElRef = (0, import_react21.useRef)(null);
|
|
25223
|
+
const queueSectionKeyDrop = (0, import_react21.useCallback)((prev) => {
|
|
25224
|
+
const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
|
|
25225
|
+
if (!sectionEl) return;
|
|
25226
|
+
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
25227
|
+
if (!sectionInstanceId) return;
|
|
25228
|
+
const token = ++mediaKeyDropTokenRef.current;
|
|
25229
|
+
const onQueueDrained = (e) => {
|
|
25230
|
+
if (e.source !== window || e.data?.type !== "ow:media-key-drop" || e.data.token !== token) return;
|
|
25231
|
+
window.removeEventListener("message", onQueueDrained);
|
|
25232
|
+
if (aiSectionApiRef.current?.getSelectedId() !== sectionInstanceId) return;
|
|
25233
|
+
if (selectedMediaElRef.current || selectedIconElRef.current || selectedSocialElRef.current) return;
|
|
25234
|
+
postToParentRef.current({
|
|
25235
|
+
type: "ow:section-selected",
|
|
25236
|
+
sectionId: sectionEl.dataset.ohwSection ?? null,
|
|
25237
|
+
sectionLabel: sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? ""),
|
|
25238
|
+
key: null
|
|
25239
|
+
});
|
|
25240
|
+
};
|
|
25241
|
+
window.addEventListener("message", onQueueDrained);
|
|
25242
|
+
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
25243
|
+
}, []);
|
|
25123
25244
|
const clearMediaSelection = (0, import_react21.useCallback)(() => {
|
|
25124
25245
|
const prev = selectedMediaElRef.current;
|
|
25125
25246
|
selectedMediaElRef.current = null;
|
|
25126
25247
|
setSelectedMedia(null);
|
|
25127
|
-
|
|
25128
|
-
|
|
25129
|
-
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
25130
|
-
if (!sectionInstanceId) return;
|
|
25131
|
-
const token = ++mediaKeyDropTokenRef.current;
|
|
25132
|
-
const onQueueDrained = (e) => {
|
|
25133
|
-
if (e.source !== window || e.data?.type !== "ow:media-key-drop" || e.data.token !== token) return;
|
|
25134
|
-
window.removeEventListener("message", onQueueDrained);
|
|
25135
|
-
if (aiSectionApiRef.current?.getSelectedId() !== sectionInstanceId) return;
|
|
25136
|
-
if (selectedMediaElRef.current) return;
|
|
25137
|
-
postToParentRef.current({
|
|
25138
|
-
type: "ow:section-selected",
|
|
25139
|
-
sectionId: sectionEl.dataset.ohwSection ?? null,
|
|
25140
|
-
sectionLabel: sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? ""),
|
|
25141
|
-
key: null
|
|
25142
|
-
});
|
|
25143
|
-
};
|
|
25144
|
-
window.addEventListener("message", onQueueDrained);
|
|
25145
|
-
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
25146
|
-
}
|
|
25147
|
-
}, []);
|
|
25248
|
+
queueSectionKeyDrop(prev);
|
|
25249
|
+
}, [queueSectionKeyDrop]);
|
|
25148
25250
|
const clearMediaSelectionRef = (0, import_react21.useRef)(clearMediaSelection);
|
|
25149
25251
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
25252
|
+
const clearIconSelection = (0, import_react21.useCallback)(() => {
|
|
25253
|
+
const prev = selectedIconElRef.current;
|
|
25254
|
+
if (!prev) return;
|
|
25255
|
+
selectedIconElRef.current = null;
|
|
25256
|
+
queueSectionKeyDrop(prev);
|
|
25257
|
+
}, [queueSectionKeyDrop]);
|
|
25258
|
+
const clearIconSelectionRef = (0, import_react21.useRef)(clearIconSelection);
|
|
25259
|
+
clearIconSelectionRef.current = clearIconSelection;
|
|
25260
|
+
const clearSocialSelection = (0, import_react21.useCallback)(() => {
|
|
25261
|
+
const prev = selectedSocialElRef.current;
|
|
25262
|
+
if (!prev) return;
|
|
25263
|
+
selectedSocialElRef.current = null;
|
|
25264
|
+
queueSectionKeyDrop(prev);
|
|
25265
|
+
}, [queueSectionKeyDrop]);
|
|
25266
|
+
const clearSocialSelectionRef = (0, import_react21.useRef)(clearSocialSelection);
|
|
25267
|
+
clearSocialSelectionRef.current = clearSocialSelection;
|
|
25268
|
+
const selectIconElement = (0, import_react21.useCallback)((el) => {
|
|
25269
|
+
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
25270
|
+
selectedIconElRef.current = el;
|
|
25271
|
+
const sectionEl = el.closest("[data-ohw-section]");
|
|
25272
|
+
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
25273
|
+
postToParentRef.current({
|
|
25274
|
+
type: "ow:section-selected",
|
|
25275
|
+
sectionId: sectionEl?.dataset.ohwSection ?? null,
|
|
25276
|
+
sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
|
|
25277
|
+
key: el.dataset.ohwKey ?? null,
|
|
25278
|
+
keyLabel: "Icon"
|
|
25279
|
+
});
|
|
25280
|
+
}, []);
|
|
25281
|
+
const selectIconElementRef = (0, import_react21.useRef)(selectIconElement);
|
|
25282
|
+
selectIconElementRef.current = selectIconElement;
|
|
25150
25283
|
const selectMediaElement = (0, import_react21.useCallback)((el) => {
|
|
25151
25284
|
const r2 = el.getBoundingClientRect();
|
|
25152
25285
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
25286
|
+
selectedIconElRef.current = null;
|
|
25153
25287
|
selectedMediaElRef.current = el;
|
|
25154
25288
|
setSelectedMedia({
|
|
25155
25289
|
key: el.dataset.ohwKey ?? "",
|
|
@@ -25803,6 +25937,7 @@ function OhhwellsBridge() {
|
|
|
25803
25937
|
selectedElRef.current = null;
|
|
25804
25938
|
selectedHrefKeyRef.current = null;
|
|
25805
25939
|
selectedFooterColAttrRef.current = null;
|
|
25940
|
+
clearSocialSelectionRef.current();
|
|
25806
25941
|
setSelectedIsCta(false);
|
|
25807
25942
|
setSelectedIsSocial(false);
|
|
25808
25943
|
setSelectedIsSocialsRow(false);
|
|
@@ -26704,7 +26839,22 @@ function OhhwellsBridge() {
|
|
|
26704
26839
|
const select = (0, import_react21.useCallback)((anchor) => {
|
|
26705
26840
|
if (!isNavigationItem2(anchor)) return;
|
|
26706
26841
|
if (activeElRef.current) deactivate();
|
|
26707
|
-
|
|
26842
|
+
clearSocialSelectionRef.current();
|
|
26843
|
+
const socialItem = getSocialItem(anchor);
|
|
26844
|
+
if (socialItem) {
|
|
26845
|
+
selectedSocialElRef.current = socialItem;
|
|
26846
|
+
const sectionEl = socialItem.closest("[data-ohw-section]");
|
|
26847
|
+
aiSectionApiRef.current?.selectFromElement(anchor, { report: false });
|
|
26848
|
+
postToParentRef.current({
|
|
26849
|
+
type: "ow:section-selected",
|
|
26850
|
+
sectionId: sectionEl?.dataset.ohwSection ?? null,
|
|
26851
|
+
sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
|
|
26852
|
+
key: socialIconKey(socialItem) ?? socialItem.getAttribute("data-ohw-href-key"),
|
|
26853
|
+
keyLabel: socialPlatformLabel(socialItem, editContentRef.current)
|
|
26854
|
+
});
|
|
26855
|
+
} else {
|
|
26856
|
+
aiSectionApiRef.current?.selectFromElement(anchor);
|
|
26857
|
+
}
|
|
26708
26858
|
selectedElRef.current = anchor;
|
|
26709
26859
|
selectedHrefKeyRef.current = anchor.getAttribute("data-ohw-href-key");
|
|
26710
26860
|
selectedFooterColAttrRef.current = null;
|
|
@@ -27842,8 +27992,11 @@ function OhhwellsBridge() {
|
|
|
27842
27992
|
display: none !important;
|
|
27843
27993
|
}
|
|
27844
27994
|
/* Body text (no item-action toolbar) \u2014 first click enters text edit \u2192 I-beam.
|
|
27845
|
-
Exclude select-first nav/footer labels so grab/default on [data-ohw-href-key] can win.
|
|
27846
|
-
|
|
27995
|
+
Exclude select-first nav/footer labels so grab/default on [data-ohw-href-key] can win.
|
|
27996
|
+
Icons are excluded too: a glyph is replaced by a click, never typed into (OHH-623),
|
|
27997
|
+
so it takes the picker's pointer below, not an I-beam \u2014 this blanket !important used
|
|
27998
|
+
to beat the stylesheet's own non-!important icon rule (OHH-718). */
|
|
27999
|
+
[data-ohw-editable]:not([contenteditable]):not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"]):not([data-ohw-editable="link"]):not([data-ohw-editable="icon"]):not(:is([data-ohw-href-key] *)) {
|
|
27847
28000
|
cursor: text !important;
|
|
27848
28001
|
}
|
|
27849
28002
|
/* Select-first items: default arrow; grab only when drag-start is allowed (data-ohw-can-drag). */
|
|
@@ -27864,6 +28017,7 @@ function OhhwellsBridge() {
|
|
|
27864
28017
|
[data-ohw-editable="video"], [data-ohw-editable="video"] *,
|
|
27865
28018
|
[data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
|
|
27866
28019
|
[data-ohw-editable="link"], [data-ohw-editable="link"] * { cursor: pointer !important; }
|
|
28020
|
+
[data-ohw-editable="icon"], [data-ohw-editable="icon"] * { cursor: pointer !important; }
|
|
27867
28021
|
/* A text/plain editable nested inside a media editable (e.g. a placeholder's fallback
|
|
27868
28022
|
label inside its bg-image box) is its own click target, not the media picker \u2014 the
|
|
27869
28023
|
blanket media cursor rule above would otherwise show pointer where a click actually
|
|
@@ -28015,6 +28169,9 @@ function OhhwellsBridge() {
|
|
|
28015
28169
|
if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
|
|
28016
28170
|
clearMediaSelectionRef.current();
|
|
28017
28171
|
}
|
|
28172
|
+
if (selectedIconElRef.current && !selectedIconElRef.current.contains(target)) {
|
|
28173
|
+
clearIconSelectionRef.current();
|
|
28174
|
+
}
|
|
28018
28175
|
if (selectedMediaElRef.current && target.closest("[data-ohw-media-overlay]") && !findClosestButtonLike(target)) {
|
|
28019
28176
|
const hit = findImageAtPoint(e.clientX, e.clientY, false);
|
|
28020
28177
|
if (hit && hit !== selectedMediaElRef.current) {
|
|
@@ -28192,7 +28349,7 @@ function OhhwellsBridge() {
|
|
|
28192
28349
|
if (isIconEditable(editable) && !getSocialItem(editable)) {
|
|
28193
28350
|
e.preventDefault();
|
|
28194
28351
|
e.stopPropagation();
|
|
28195
|
-
|
|
28352
|
+
selectIconElementRef.current(editable);
|
|
28196
28353
|
const aiIcon = editable.hasAttribute("data-ai-icon");
|
|
28197
28354
|
const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
|
|
28198
28355
|
postToParentRef.current({
|
|
@@ -29816,6 +29973,7 @@ function OhhwellsBridge() {
|
|
|
29816
29973
|
deactivateRef.current();
|
|
29817
29974
|
deselectRef.current();
|
|
29818
29975
|
clearMediaSelectionRef.current();
|
|
29976
|
+
clearIconSelectionRef.current();
|
|
29819
29977
|
};
|
|
29820
29978
|
clearInteractionChromeRef.current = clearInteractionChrome;
|
|
29821
29979
|
const applyTreeToLocalState = (payload) => {
|
|
@@ -30233,6 +30391,7 @@ function OhhwellsBridge() {
|
|
|
30233
30391
|
deselectRef.current();
|
|
30234
30392
|
deactivateRef.current();
|
|
30235
30393
|
clearMediaSelectionRef.current();
|
|
30394
|
+
clearIconSelectionRef.current();
|
|
30236
30395
|
};
|
|
30237
30396
|
window.addEventListener("message", handleDeactivate);
|
|
30238
30397
|
const handleToastAction = (e) => {
|
|
@@ -30322,6 +30481,10 @@ function OhhwellsBridge() {
|
|
|
30322
30481
|
clearMediaSelectionRef.current();
|
|
30323
30482
|
return;
|
|
30324
30483
|
}
|
|
30484
|
+
if (e.key === "Escape" && selectedIconElRef.current) {
|
|
30485
|
+
clearIconSelectionRef.current();
|
|
30486
|
+
return;
|
|
30487
|
+
}
|
|
30325
30488
|
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "a" && activeElRef.current) {
|
|
30326
30489
|
e.preventDefault();
|
|
30327
30490
|
selectAllTextInEditable(activeElRef.current);
|
|
@@ -31343,7 +31506,7 @@ function OhhwellsBridge() {
|
|
|
31343
31506
|
postToParent2({
|
|
31344
31507
|
type: "ow:ready",
|
|
31345
31508
|
version: "1",
|
|
31346
|
-
bridgeVersion: "0.1.
|
|
31509
|
+
bridgeVersion: "0.1.144",
|
|
31347
31510
|
path: pathname,
|
|
31348
31511
|
nodes: collectEditableNodes(editContentRef.current),
|
|
31349
31512
|
sections
|