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:
Ricardo
2026-03-14 21:43:33 +01:00
parent 0fe6ab0195
commit 02546950bf

View File

@@ -634,15 +634,12 @@
// Find the commentsSection Alpine component and call startReply
var commentsEl = document.querySelector('[x-data*="commentsSection"]');
if (commentsEl && commentsEl.__x) {
commentsEl.__x.$data.startReply(replyUrl, platform, replyUrl, syndicateTo);
if (commentsEl && window.Alpine) {
var data = Alpine.$data(commentsEl);
if (data && data.startReply) {
data.startReply(replyUrl, platform, replyUrl, syndicateTo);
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);
}
}
});
});