@ohhwells/bridge 0.1.8 → 0.1.9
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 +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3907,6 +3907,10 @@ function OhhwellsBridge() {
|
|
|
3907
3907
|
const activate = useCallback((el) => {
|
|
3908
3908
|
if (activeElRef.current === el) return;
|
|
3909
3909
|
deactivate();
|
|
3910
|
+
if (hoveredImageRef.current) {
|
|
3911
|
+
hoveredImageRef.current = null;
|
|
3912
|
+
postToParentRef.current({ type: "ow:image-unhover" });
|
|
3913
|
+
}
|
|
3910
3914
|
el.setAttribute("contenteditable", "true");
|
|
3911
3915
|
el.removeAttribute("data-ohw-hovered");
|
|
3912
3916
|
activeElRef.current = el;
|
|
@@ -4225,7 +4229,8 @@ function OhhwellsBridge() {
|
|
|
4225
4229
|
}
|
|
4226
4230
|
return smallest;
|
|
4227
4231
|
};
|
|
4228
|
-
const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false
|
|
4232
|
+
const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
|
|
4233
|
+
if (activeElRef.current) return;
|
|
4229
4234
|
const toggleEl = document.querySelector("[data-ohw-state-toggle]");
|
|
4230
4235
|
if (toggleEl) {
|
|
4231
4236
|
const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
|
|
@@ -4253,7 +4258,6 @@ function OhhwellsBridge() {
|
|
|
4253
4258
|
}
|
|
4254
4259
|
const topEditable = topEl?.closest("[data-ohw-editable]");
|
|
4255
4260
|
if (topEditable && topEditable.dataset.ohwEditable !== "image" && topEditable.dataset.ohwEditable !== "bg-image") {
|
|
4256
|
-
if (topEditable.hasAttribute("contenteditable") && fromOverlay) return;
|
|
4257
4261
|
if (hoveredImageRef.current) {
|
|
4258
4262
|
hoveredImageRef.current = null;
|
|
4259
4263
|
resumeAnimTracks();
|
|
@@ -4325,9 +4329,9 @@ function OhhwellsBridge() {
|
|
|
4325
4329
|
};
|
|
4326
4330
|
const handlePointerSync = (e) => {
|
|
4327
4331
|
if (e.data?.type !== "ow:pointer-sync") return;
|
|
4328
|
-
const { clientX, clientY
|
|
4332
|
+
const { clientX, clientY } = e.data;
|
|
4329
4333
|
if (typeof clientX !== "number" || typeof clientY !== "number") return;
|
|
4330
|
-
probeImageAt(clientX, clientY
|
|
4334
|
+
probeImageAt(clientX, clientY);
|
|
4331
4335
|
probeHoverCardsAt(clientX, clientY);
|
|
4332
4336
|
};
|
|
4333
4337
|
const handleDragOver = (e) => {
|