mirror of
https://github.com/zotero/zotero.git
synced 2026-10-08 03:08:19 +00:00
citation dlg: first run guidance on 1st added item
Display the first run guidance panel when the first item is added to the citation vs on initial open.
This commit is contained in:
parent
714d4416f8
commit
44aedf8652
3 changed files with 22 additions and 16 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</xul:panel>
|
||||
<xul:guidance-panel about="citationDialog" for="z-icon-container" x="5"/>
|
||||
<xul:guidance-panel about="citationDialog" for="first-bubble"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -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 }.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue