Add uiDensity pref and menu controls

This commit is contained in:
Abe Jellinek 2023-09-29 11:31:05 -04:00 committed by Dan Stillman
parent be4ecb31bc
commit d6e5da403c
5 changed files with 42 additions and 1 deletions

View file

@ -438,6 +438,11 @@ const ZoteroStandalone = new function() {
this.updateMenuItemCheckmark('view-menuitem-standard', mode != 'stacked');
this.updateMenuItemCheckmark('view-menuitem-stacked', mode == 'stacked');
// Density
let density = Zotero.Prefs.get('uiDensity');
this.updateMenuItemCheckmark('view-menuitem-ui-density-compact', density == 'compact');
this.updateMenuItemCheckmark('view-menuitem-ui-density-comfortable', density == 'comfortable');
// Panes
this.updateMenuItemCheckmark(
'view-menuitem-collections-pane',
@ -498,6 +503,14 @@ const ZoteroStandalone = new function() {
Zotero.Prefs.set('layout', 'stacked');
break;
case 'ui-density-comfortable':
Zotero.Prefs.set('uiDensity', 'comfortable');
break;
case 'ui-density-compact':
Zotero.Prefs.set('uiDensity', 'compact');
break;
case 'collections-pane':
var collectionsPane = document.getElementById('zotero-collections-pane');
// Show

View file

@ -44,7 +44,7 @@ Zotero.Prefs = new function() {
// Process pref version updates
var fromVersion = this.get('prefVersion');
var toVersion = 9;
var toVersion = 10;
if (!fromVersion) {
this.set('prefVersion', toVersion);
}
@ -130,6 +130,11 @@ Zotero.Prefs = new function() {
this.clear('attachmentRenameFormatString');
}
break;
// Set UI density to Compact for existing users
case 10:
this.set('uiDensity', 'compact');
break;
}
}
this.set('prefVersion', toVersion);

View file

@ -461,6 +461,20 @@
/>
</menupopup>
</menu>
<menu id="density-menu" data-l10n-id="menu-ui-density">
<menupopup oncommand="ZoteroStandalone.onViewMenuItemClick(event)">
<menuitem
id="view-menuitem-ui-density-compact"
data-l10n-id="menu-ui-density-compact"
type="checkbox"
/>
<menuitem
id="view-menuitem-ui-density-comfortable"
data-l10n-id="menu-ui-density-comfortable"
type="checkbox"
/>
</menupopup>
</menu>
<menu id="font-size-menu"
label="&fontSize.label;">
<menupopup oncommand="ZoteroStandalone.onViewMenuItemClick(event)">

View file

@ -192,3 +192,10 @@ restart-in-troubleshooting-mode-menuitem =
.accesskey = T
restart-in-troubleshooting-mode-dialog-title = Restart in Troubleshooting Mode
restart-in-troubleshooting-mode-dialog-description = { -app-name } will restart with all plugins disabled. Some features may not function correctly while Troubleshooting Mode is enabled.
menu-ui-density =
.label = Density
menu-ui-density-comfortable =
.label = Comfortable
menu-ui-density-compact =
.label = Compact

View file

@ -72,6 +72,8 @@ pref("extensions.zotero.lastLongTagDelimiter", ";");
pref("extensions.zotero.fallbackSort", "firstCreator,date,title,dateAdded");
pref("extensions.zotero.sortCreatorAsString", false);
pref("extensions.zotero.uiDensity", "comfortable");
//Tag Selector
pref("extensions.zotero.tagSelector.showAutomatic", true);