From b955d382e3a37f675338bd778e72bb32ff6aa128 Mon Sep 17 00:00:00 2001 From: Saberlve Date: Wed, 15 Apr 2026 16:33:41 +0800 Subject: [PATCH] fix: add missing cancelAbstractPreview function and related state The openImportWindow and closeImportWindow functions referenced cancelAbstractPreview which was not defined. Added: - hoverTimerId, hoveredItemKey, previewItemKey to state - previewPopover to elements object - cancelAbstractPreview function Co-Authored-By: Claude Opus 4.6 --- src/zotero_kb/templates/index.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/zotero_kb/templates/index.html b/src/zotero_kb/templates/index.html index 863f321..6b0ede0 100644 --- a/src/zotero_kb/templates/index.html +++ b/src/zotero_kb/templates/index.html @@ -492,6 +492,9 @@ loadingCollectionKey: null, nextCollectionItemsRequestToken: 0, activeCollectionItemsRequestToken: 0, + hoveredItemKey: null, + hoverTimerId: null, + previewItemKey: null, }; const elements = { @@ -514,6 +517,7 @@ windowCollectionStatus: document.getElementById("window-collection-status"), windowCollectionTree: document.getElementById("window-collection-tree"), windowCollectionItems: document.getElementById("window-collection-items"), + previewPopover: document.getElementById("item-preview-popover"), currentProjectLabel: document.getElementById("current-project-label"), cardList: document.getElementById("card-list"), cardDetail: document.getElementById("card-detail"), @@ -667,6 +671,20 @@ persistWindowSessionState(); } + function cancelAbstractPreview() { + if (state.hoverTimerId !== null) { + window.clearTimeout(state.hoverTimerId); + state.hoverTimerId = null; + } + state.hoveredItemKey = null; + state.previewItemKey = null; + elements.previewPopover.hidden = true; + elements.previewPopover.setAttribute("aria-hidden", "true"); + elements.previewPopover.textContent = ""; + elements.previewPopover.style.top = ""; + elements.previewPopover.style.left = ""; + } + function setStatus(target, message, isError = false) { target.textContent = message || ""; target.classList.toggle("error", Boolean(isError));