Sort batch-edit value suggestions by frequency descending

And remove counts, which are confusing
This commit is contained in:
Dan Stillman 2026-06-09 14:50:18 -04:00
parent 3aba0ed231
commit 7751801c87

View file

@ -2041,8 +2041,10 @@
}
}
let options = Object.keys(optionCounts);
options.sort((a, b) => a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true }));
let optionLabels = options.map(o => `[${optionCounts[o]}] ${o}`);
// Sort by frequency (most common first), then alphanumerically
options.sort((a, b) =>
optionCounts[b] - optionCounts[a]
|| a.localeCompare(b, undefined, { sensitivity: 'base', numeric: true }));
valueElement.multipleValues = true;
valueElement.value = '';
valueElement.placeholder = Zotero.getString('item-pane-batch-editing-multiple-values-placeholder');
@ -2056,8 +2058,7 @@
search: 'zotero-options',
searchParam: JSON.stringify({
search: 'zotero-options',
options: optionLabels,
optionValues: options,
options: options,
includeNoValue: true
}),
popup: 'PopupAutoComplete',