fix: use Alpine.js v3 API for reply button click handler
Alpine v3 uses Alpine.$data(el) instead of el.__x.$data. The old v2 pattern silently failed, making Reply buttons non-functional. Confab-Link: http://localhost:8080/sessions/184584f4-67e1-485a-aba8-02ac34a600fe
This commit is contained in:
+5
-8
@@ -634,15 +634,12 @@
|
|||||||
|
|
||||||
// Find the commentsSection Alpine component and call startReply
|
// Find the commentsSection Alpine component and call startReply
|
||||||
var commentsEl = document.querySelector('[x-data*="commentsSection"]');
|
var commentsEl = document.querySelector('[x-data*="commentsSection"]');
|
||||||
if (commentsEl && commentsEl.__x) {
|
if (commentsEl && window.Alpine) {
|
||||||
commentsEl.__x.$data.startReply(replyUrl, platform, replyUrl, syndicateTo);
|
var data = Alpine.$data(commentsEl);
|
||||||
|
if (data && data.startReply) {
|
||||||
|
data.startReply(replyUrl, platform, replyUrl, syndicateTo);
|
||||||
commentsEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
commentsEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||||
} else if (window.Alpine) {
|
}
|
||||||
var evt = new CustomEvent('owner-reply', {
|
|
||||||
detail: { replyUrl: replyUrl, platform: platform, syndicateTo: syndicateTo },
|
|
||||||
bubbles: true
|
|
||||||
});
|
|
||||||
btn.dispatchEvent(evt);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user