diff --git a/chrome/content/zotero/integration/citationDialog.js b/chrome/content/zotero/integration/citationDialog.js index 38e2d16bb9..c54d5d6b87 100644 --- a/chrome/content/zotero/integration/citationDialog.js +++ b/chrome/content/zotero/integration/citationDialog.js @@ -144,18 +144,6 @@ async function onLoad() { } }); - // - // Show guidance panel on the first run. Noop on subsequent runs. - // - // Use localized locator string (e.g., "p10") - let locatorString = Zotero.Cite.getLocatorString("page", "short").toLowerCase() - // Strip trailing period ("p." → "p") - .replace(/\.$/, '') - + "10"; - doc.querySelector("guidance-panel").show({ l10nArgs: { locator: locatorString } }); - // Hide guidance panel on any keypress - doc.addEventListener("keydown", () => doc.querySelector("guidance-panel").hide(), { capture: true, once: true }); - DIALOG_STATE.loaded = true; let initTime = timer.stop(); Zotero.debug(`Citation Dialog: initialized in ${initTime} s`); @@ -1395,6 +1383,15 @@ const IOManager = { } this.updateBubbleInput(); + + // Show guidance panel on the first run + if (DIALOG_STATE.isCitingItems() && !Zotero.Prefs.get("firstRunGuidanceShown.citationDialog")) { + doc.querySelector(".bubble").id = "first-bubble"; + // Center the panel on the first bubble + let width = doc.querySelector(".bubble").getBoundingClientRect().width; + doc.querySelector("guidance-panel").setAttribute("x", Math.round(width / 2)); + IOManager.showFirstRunDialog(); + } // Always refresh items list to make sure the opened and selected items are up to date await currentLayout.refreshItemsList(); if (!noInputRefocus) { @@ -1581,6 +1578,17 @@ const IOManager = { } return desiredMode; }, + + showFirstRunDialog() { + let locatorString = Zotero.Cite.getLocatorString("page", "short").toLowerCase() + // Strip trailing period ("p." → "p") + .replace(/\.$/, '') + + "10"; + // Use localized locator string (e.g., "p10") + doc.querySelector("guidance-panel").show({ l10nArgs: { locator: locatorString } }); + // Hide guidance panel on any keypress + doc.addEventListener("keydown", () => doc.querySelector("guidance-panel").hide(), { capture: true, once: true }); + }, // handle drag start of item nodes into bubble-input _handleItemDragStart(event) { diff --git a/chrome/content/zotero/integration/citationDialog.xhtml b/chrome/content/zotero/integration/citationDialog.xhtml index c6d039a22e..722af2ae97 100644 --- a/chrome/content/zotero/integration/citationDialog.xhtml +++ b/chrome/content/zotero/integration/citationDialog.xhtml @@ -183,7 +183,7 @@ - + diff --git a/chrome/locale/en-US/zotero/integration.ftl b/chrome/locale/en-US/zotero/integration.ftl index c9f9620e8e..a555e151da 100644 --- a/chrome/locale/en-US/zotero/integration.ftl +++ b/chrome/locale/en-US/zotero/integration.ftl @@ -133,9 +133,7 @@ integration-warning-discard-changes = Discard Changes integration-warning-command-is-running = A word processor integration command is already running. -first-run-guidance-citationDialog = Type a title, author, and/or year to search for a reference. - - After you’ve made your selection, click the bubble or select it via the keyboard and press ↓/Space to show citation options such as page number, prefix, and suffix. +first-run-guidance-citationDialog = Click the bubble or select it via the ← key and press ↓/Space to customize citation options such as page number, prefix, and suffix. You can also add a page number or other locator by including it with your search terms (e.g., “history { $locator }”) or by typing it after the bubble and pressing { return-or-enter }.