mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user