fix: permanent tabs back

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-26 06:40:11 +02:00
parent ad8d13cb69
commit 29922b8058
4 changed files with 124 additions and 20 deletions

View File

@@ -3,8 +3,36 @@ document.addEventListener("DOMContentLoaded", () => {
.querySelector("meta[name='csrf-token']")
.getAttribute("content");
const Hooks = {
SidebarInteractions: {
mounted() {
this.handleDblClick = (event) => {
const button = event.target.closest("[data-testid='sidebar-open-item']");
if (!button || !this.el.contains(button)) {
return;
}
this.pushEvent("pin_sidebar_item", {
route: button.dataset.route,
id: button.dataset.itemId,
title: button.dataset.openTitle || "",
subtitle: button.dataset.openSubtitle || ""
});
};
this.el.addEventListener("dblclick", this.handleDblClick);
},
destroyed() {
this.el.removeEventListener("dblclick", this.handleDblClick);
}
}
};
const liveSocket = new LiveView.LiveSocket("/live", Phoenix.Socket, {
params: { _csrf_token: csrfToken }
params: { _csrf_token: csrfToken },
hooks: Hooks
});
liveSocket.connect();