mirror of
https://github.com/zotero/zotero.git
synced 2026-09-16 23:41:08 +00:00
Implemented redesigned citation dialog with library and list modes one can switch between. This dialog is a direct replacement of quickFormat and classic citation dialogs. In Library Mode: - items table has a new + button column to add items from the citation and rows of selected items are highlighted - open, cited and selected items appear in a section between the items table and bubbleInput. When there are no matches, a message is shown. - only top-level items are shown when citing items and only notes/notes' parents - when adding a note - selected items are gathered in a collapsible deck to save space. Click on the deck will expand it. All selected items can be added via "Add all" button. - when an item is added, bubble-input may increase in height and push itemTree lower. To try to preserve relative positioning of the mouse, itemTree will scroll to be over the row that was just clicked In List mode: - arrow up/down from the input will change the selected item with the focus remaining in the input - selected items are a collapsible list section Other behaviors and fixes: - one can add any locator (not just pages) by typing its full or short name in an input and pressing Enter (e.g. line 10, or l. 10, or chap. "test chapter") - Added a new preference to select if the citation dialog should always open in list mode, library mode or in the last mode that was used - bubbles whose items are selected in library or list mode are highlighted - arrow up/down from a bubble will focus the bubble above/below it for easier navigation across bubble-input - multi-select is supported on items in list mode or item cards in library mode via Shift-arrow or Cmd+click to select multiple items - Cmd/Ctrl + Enter will always accept the dialog no matter what is focused - when there are no bubbles, accept button is disabled - after an item is added, bubble-input is always refocused - added suppressed property to itemTreeMenubar to be able to hide if in list mode, where it is not relevant. Fixed menubar getting stuck or re-appearing on Alt keypress on Linux by setting height: 0 vs hiding it via hidden. - added initialFolder and onActivate prop to collectionTree to set which collection should be reopened when dialog opens and to be able to set a custom onActivate handler. - added getExtraField prop to itemTree to get data on if an item is in a citation or not Implementation details: - citationDialog.js is the main file. It relies on a number of helper files in citationDialog/* directory to keep the main file less cluttered. popupHandler.js contains the logic of opening/closing the item details popup to add locator/prefix/suffix/etc. keyboardHandler.js is responsible for overall keyboard navigation throughout the dialog. searchHandler.js contains the logic for running the search based on user's query. Finally, Helpers.js has general helper functions that don't handle any actual logic. - SearchHandler is set to run search in two ways: for cited/selected/open items (which are cached and do not involve any actual SQL query) and general search for items across all libraries. When layout.search runs, firstly cited/selected/open items are updated after which the SQL search runs. - bubbleInput.js is a customElement responsible for bubbles interface. bubbleInput.refresh takes a list of items and handles adding/removing/reordering of bubbles as needed. It always has two inputs on each side of a bubble, as opposed to having inputs inserted dynamically. It allows keyboardHandler.js to handle navigation with arrows within bubbleInput. - when user interacts with bubbleInput, it emits custom events that are handled by IOManager singleton in citationDialog.js, which may update the items information and pass them back to bubbleInput.refresh to have the list of bubbles updated - CitationDataManager singleton is responsible for storing items added into the citation in CitationDataManager.items in an object with both Zotero.Item and the actual citation item. It is easier to pass both items to other components and helpers, as opposed to sharing functions to convert items back and forth. |
||
|---|---|---|
| .. | ||
| components | ||
| content | ||
| resource | ||
| tests | ||
| chrome.manifest | ||
| runtests.sh | ||