diff --git a/chrome/content/zotero/integration/citationDialog.js b/chrome/content/zotero/integration/citationDialog.js index fdf31000bc..c3333f7777 100644 --- a/chrome/content/zotero/integration/citationDialog.js +++ b/chrome/content/zotero/integration/citationDialog.js @@ -1322,8 +1322,16 @@ class ListLayout extends Layout { } } - // Hide padding of list layout if there is not a single item to show - _id("list-layout").classList.toggle("empty", this._listRows.length === 0); + // Insert message when there are no matching results - only + // when window resizing is not skipped, meaning library search has ran + if (!skipWindowResize) { + if (this._listRows.length === 0) { + this._listRows.push(new ListRow({ + kind: "empty", + ref: { activeSearch: SearchHandler.searchValue.length > 0 }, + })); + } + } // Push per-row heights to the virtualized table's _customRowHeightMap this._table.updateCustomRowHeights( @@ -1436,6 +1444,15 @@ class ListLayout extends Layout { divider.className = "divider"; div.appendChild(divider); } + else if (row.kind === "empty") { + let message = doc.createElement("div"); + message.className = "empty-message"; + let suffix = row.ref.activeSearch ? "-searching" : ""; + message.textContent = Zotero.getString( + `integration-citationDialog-list-message-${DIALOG_STATE.type}${suffix}` + ); + div.appendChild(message); + } else { div.setAttribute("data-l10n-id", "integration-citationDialog-aria-item-list"); let node = this.createItemNode(row.ref); diff --git a/chrome/locale/en-US/zotero/integration.ftl b/chrome/locale/en-US/zotero/integration.ftl index 8481e97f2d..6034484b4e 100644 --- a/chrome/locale/en-US/zotero/integration.ftl +++ b/chrome/locale/en-US/zotero/integration.ftl @@ -49,6 +49,10 @@ integration-citationDialog-lib-message-annotations = { $search -> [true] No items with annotations match the current search *[other] No selected or open items with annotations } +integration-citationDialog-list-message-citation = No selected, open, or cited items +integration-citationDialog-list-message-citation-searching = No items match the current search +integration-citationDialog-list-message-add-note = No selected or open notes +integration-citationDialog-list-message-add-note-searching = No notes match the current search integration-citationDialog-settings-keepSorted = Keep sources sorted integration-citationDialog-btn-settings = .title = { general-open-settings } diff --git a/scss/components/_citationDialog.scss b/scss/components/_citationDialog.scss index e28a726e89..16b2f939a7 100644 --- a/scss/components/_citationDialog.scss +++ b/scss/components/_citationDialog.scss @@ -431,6 +431,19 @@ border-bottom: 1px solid var(--fill-quinary); } + // Empty-state message -- emitted as a single row when no search + // results are available. + .row > .empty-message { + display: flex; + align-items: center; + justify-content: center; + height: 100%; + padding: 0 16px; + text-align: center; + font-size: 1rem; + color: var(--fill-secondary); + } + // Section header -- emitted as its own row at the start of every section. .row > .header { font-weight: 700; @@ -538,11 +551,6 @@ } } } - &.empty { - #list-layout-wrapper .virtualized-table-body { - padding: 0; - } - } } #bottom-area-wrapper {