From 91c6bfbb04ca12e6b4b466e961de39aeef1d1c27 Mon Sep 17 00:00:00 2001 From: PluTiper Date: Wed, 18 Sep 2024 16:33:24 +0300 Subject: [PATCH 1/2] added missing classes to anchor docs --- packages/docs/src/en/plugins/anchor.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/src/en/plugins/anchor.md b/packages/docs/src/en/plugins/anchor.md index b7c3b94c7..d221d6e66 100644 --- a/packages/docs/src/en/plugins/anchor.md +++ b/packages/docs/src/en/plugins/anchor.md @@ -205,7 +205,7 @@ Because `x-anchor` accepts a reference to any DOM element, you can use utilities -
+
Dropdown content
From 00d023488194eb40ef5239d02e3810eb2e34232a Mon Sep 17 00:00:00 2001 From: PluTiper Date: Wed, 18 Sep 2024 19:29:54 +0300 Subject: [PATCH 2/2] fixed anchor position caching --- packages/anchor/src/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/anchor/src/index.js b/packages/anchor/src/index.js index cbfdcb9c5..988d1c0da 100644 --- a/packages/anchor/src/index.js +++ b/packages/anchor/src/index.js @@ -22,9 +22,8 @@ export default function (Alpine) { if (! reference) throw 'Alpine: no element provided to x-anchor...' + let previousValue let compute = () => { - let previousValue - computePosition(reference, el, { placement, middleware: [flip(), shift({padding: 5}), offset(offsetValue)], @@ -35,9 +34,8 @@ export default function (Alpine) { if (JSON.stringify({ x, y }) !== previousValue) { el._x_anchor.x = x el._x_anchor.y = y + previousValue = JSON.stringify({ x, y }) } - - previousValue = JSON.stringify({ x, y }) }) }