Fix checkmark in libraries-to-sync window on Windows

And switch to Unicode green checkmark and red prohibited characters on
all platforms, which fixes #1675.

The treecol checkmark stopped working on Windows in Fx60.
This commit is contained in:
Dan Stillman 2019-12-03 15:33:31 -07:00
parent 75076cf875
commit 6af5732fca
2 changed files with 14 additions and 4 deletions

View file

@ -52,7 +52,7 @@
onclick="Zotero_Preferences.Sync.clickLibraryToSync(event)" onclick="Zotero_Preferences.Sync.clickLibraryToSync(event)"
onkeyup="if (event.keyCode == event.DOM_VK_SPACE) { Zotero_Preferences.Sync.toggleLibraryToSync(this.currentIndex); }"> onkeyup="if (event.keyCode == event.DOM_VK_SPACE) { Zotero_Preferences.Sync.toggleLibraryToSync(this.currentIndex); }">
<treecols> <treecols>
<treecol editable="true" type="checkbox" id="libraries-to-sync-checked" label="&zotero.preferences.sync.librariesToSync.sync;"/> <treecol editable="false" id="libraries-to-sync-checked" label="&zotero.preferences.sync.librariesToSync.sync;"/>
<treecol editable="false" id="libraries-to-sync-name" flex="1" label="&zotero.preferences.sync.librariesToSync.library;"/> <treecol editable="false" id="libraries-to-sync-name" flex="1" label="&zotero.preferences.sync.librariesToSync.library;"/>
</treecols> </treecols>
<treechildren id="libraries-to-sync-rows"/> <treechildren id="libraries-to-sync-rows"/>

View file

@ -29,6 +29,9 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
Components.utils.import("resource://zotero/config.js"); Components.utils.import("resource://zotero/config.js");
Zotero_Preferences.Sync = { Zotero_Preferences.Sync = {
checkmarkChar: '\u2705',
noChar: '\uD83D\uDEAB',
init: Zotero.Promise.coroutine(function* () { init: Zotero.Promise.coroutine(function* () {
this.updateStorageSettingsUI(); this.updateStorageSettingsUI();
this.updateStorageSettingsGroupsUI(); this.updateStorageSettingsGroupsUI();
@ -273,6 +276,8 @@ Zotero_Preferences.Sync = {
Zotero.Prefs.set('sync.librariesToSkip', JSON.stringify(librariesToSkip)); Zotero.Prefs.set('sync.librariesToSkip', JSON.stringify(librariesToSkip));
var cell = row.firstChild.firstChild; var cell = row.firstChild.firstChild;
var spacing = Zotero.isMac ? ' ' : ' ';
cell.setAttribute('label', spacing + (indexOfId != -1 ? this.checkmarkChar : this.noChar));
cell.setAttribute('value', indexOfId != -1); cell.setAttribute('value', indexOfId != -1);
}, },
@ -284,7 +289,7 @@ Zotero_Preferences.Sync = {
treechildren.removeChild(treechildren.firstChild); treechildren.removeChild(treechildren.firstChild);
} }
function addRow(libraryName, id, checked=false, editable=true) { var addRow = function (libraryName, id, checked=false, editable=true) {
var treeitem = document.createElement('treeitem'); var treeitem = document.createElement('treeitem');
var treerow = document.createElement('treerow'); var treerow = document.createElement('treerow');
var checkboxCell = document.createElement('treecell'); var checkboxCell = document.createElement('treecell');
@ -293,14 +298,19 @@ Zotero_Preferences.Sync = {
nameCell.setAttribute('label', libraryName); nameCell.setAttribute('label', libraryName);
nameCell.setAttribute('value', id); nameCell.setAttribute('value', id);
nameCell.setAttribute('editable', false); nameCell.setAttribute('editable', false);
var spacing = Zotero.isMac ? ' ' : ' ';
checkboxCell.setAttribute(
'label',
id == 'loading' ? '' : (spacing + (checked ? this.checkmarkChar : this.noChar))
);
checkboxCell.setAttribute('value', checked); checkboxCell.setAttribute('value', checked);
checkboxCell.setAttribute('editable', editable); checkboxCell.setAttribute('editable', false);
treerow.appendChild(checkboxCell); treerow.appendChild(checkboxCell);
treerow.appendChild(nameCell); treerow.appendChild(nameCell);
treeitem.appendChild(treerow); treeitem.appendChild(treerow);
treechildren.appendChild(treeitem); treechildren.appendChild(treeitem);
} }.bind(this);
// Add loading row while we're loading a group list // Add loading row while we're loading a group list
var loadingLabel = Zotero.getString("zotero.preferences.sync.librariesToSync.loadingLibraries"); var loadingLabel = Zotero.getString("zotero.preferences.sync.librariesToSync.loadingLibraries");