@ohhwells/bridge 0.1.51-next.121 → 0.1.51-next.122
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 +23 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12296,7 +12296,7 @@ function OhhwellsBridge() {
|
|
|
12296
12296
|
if (selected === target || selected.contains(target)) return;
|
|
12297
12297
|
}
|
|
12298
12298
|
if (linkPopoverOpenRef.current) {
|
|
12299
|
-
|
|
12299
|
+
closeLinkPopoverRef.current();
|
|
12300
12300
|
return;
|
|
12301
12301
|
}
|
|
12302
12302
|
deselectRef.current();
|
|
@@ -13197,7 +13197,7 @@ function OhhwellsBridge() {
|
|
|
13197
13197
|
if (Date.now() < linkPopoverGraceUntilRef.current) return;
|
|
13198
13198
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
13199
13199
|
if (linkPopoverOpenRef.current) {
|
|
13200
|
-
|
|
13200
|
+
closeLinkPopoverRef.current();
|
|
13201
13201
|
return;
|
|
13202
13202
|
}
|
|
13203
13203
|
deselectRef.current();
|
|
@@ -13216,7 +13216,7 @@ function OhhwellsBridge() {
|
|
|
13216
13216
|
if (e.data?.type !== "ui:escape") return;
|
|
13217
13217
|
if (document.querySelector("[data-ohw-more-menu]")) return;
|
|
13218
13218
|
if (linkPopoverOpenRef.current) {
|
|
13219
|
-
|
|
13219
|
+
closeLinkPopoverRef.current();
|
|
13220
13220
|
return;
|
|
13221
13221
|
}
|
|
13222
13222
|
if (activeElRef.current) {
|
|
@@ -13279,7 +13279,7 @@ function OhhwellsBridge() {
|
|
|
13279
13279
|
return;
|
|
13280
13280
|
}
|
|
13281
13281
|
if (e.key === "Escape" && linkPopoverOpenRef.current) {
|
|
13282
|
-
|
|
13282
|
+
closeLinkPopoverRef.current();
|
|
13283
13283
|
return;
|
|
13284
13284
|
}
|
|
13285
13285
|
if (e.key === "Escape" && selectedElRef.current && !activeElRef.current) {
|
|
@@ -14037,10 +14037,25 @@ function OhhwellsBridge() {
|
|
|
14037
14037
|
}
|
|
14038
14038
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
14039
14039
|
}, [deactivate]);
|
|
14040
|
+
const reselectAfterLinkPopover = (0, import_react11.useCallback)(
|
|
14041
|
+
(hrefKey) => {
|
|
14042
|
+
requestAnimationFrame(() => {
|
|
14043
|
+
const el = resolveHrefKeyElement(hrefKey);
|
|
14044
|
+
if (el && isNavigationItem2(el)) selectRef.current(el);
|
|
14045
|
+
});
|
|
14046
|
+
},
|
|
14047
|
+
[resolveHrefKeyElement]
|
|
14048
|
+
);
|
|
14040
14049
|
const closeLinkPopover = (0, import_react11.useCallback)(() => {
|
|
14050
|
+
const session = linkPopoverSessionRef.current;
|
|
14041
14051
|
addNavAfterAnchorRef.current = null;
|
|
14042
14052
|
setLinkPopover(null);
|
|
14043
|
-
|
|
14053
|
+
if (session && session.intent !== "add-nav" && session.key) {
|
|
14054
|
+
reselectAfterLinkPopover(session.key);
|
|
14055
|
+
}
|
|
14056
|
+
}, [reselectAfterLinkPopover]);
|
|
14057
|
+
const closeLinkPopoverRef = (0, import_react11.useRef)(closeLinkPopover);
|
|
14058
|
+
closeLinkPopoverRef.current = closeLinkPopover;
|
|
14044
14059
|
const openLinkPopoverForActive = (0, import_react11.useCallback)(() => {
|
|
14045
14060
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
14046
14061
|
if (!hrefCtx) return;
|
|
@@ -14257,14 +14272,14 @@ function OhhwellsBridge() {
|
|
|
14257
14272
|
applyLinkByKey(key, target);
|
|
14258
14273
|
editContentRef.current = { ...editContentRef.current, [key]: target };
|
|
14259
14274
|
postToParent2({ type: "ow:change", nodes: [{ key, text: target }] });
|
|
14260
|
-
const anchor =
|
|
14275
|
+
const anchor = resolveHrefKeyElement(key);
|
|
14261
14276
|
if (target.trim()) {
|
|
14262
14277
|
if (anchor) maybeWarnNavLinkDropdownConflict(anchor);
|
|
14263
|
-
postToParent2({ type: "ow:toast", title: "Link
|
|
14278
|
+
postToParent2({ type: "ow:toast", title: "Link updated", toastType: "success" });
|
|
14264
14279
|
}
|
|
14265
14280
|
setLinkPopover(null);
|
|
14266
14281
|
},
|
|
14267
|
-
[maybeWarnNavLinkDropdownConflict, postToParent2, sitePages, sectionsByPath]
|
|
14282
|
+
[maybeWarnNavLinkDropdownConflict, postToParent2, resolveHrefKeyElement, sitePages, sectionsByPath]
|
|
14268
14283
|
);
|
|
14269
14284
|
const showEditLink = toolbarShowEditLink;
|
|
14270
14285
|
const currentSections = sectionsByPath[pathname] ?? [];
|