Fix colorpicker styling on Windows (#4326)

This commit is contained in:
windingwind 2024-07-03 15:26:20 +08:00 committed by GitHub
parent 694ccecf4a
commit 54721652b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 10 deletions

View file

@ -26,10 +26,6 @@
"use strict";
{
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("chrome://zotero/content/elements/base.js", this);
class ColorPicker extends XULElementBase {
content = MozXULElement.parseXULToFragment(`
<vbox>
@ -57,9 +53,15 @@
}
else {
return [
'#FF6666', '#FF8C19', '#999999',
'#5FB236', '#009980', '#2EA8E5',
'#576DD9', '#A28AE5', '#A6507B'
'#FF6666',
'#FF8C19',
'#999999',
'#5FB236',
'#009980',
'#2EA8E5',
'#576DD9',
'#A28AE5',
'#A6507B'
];
}
}
@ -89,9 +91,15 @@
Zotero.debug('WARNING: <color-picker> CE: Set color-labels when setting colors');
}
return [
'general.red', 'general.orange', 'general.gray',
'general.green', 'general.teal', 'general.blue',
'general.purple', 'general.violet', 'general.maroon'
'general.red',
'general.orange',
'general.gray',
'general.green',
'general.teal',
'general.blue',
'general.purple',
'general.violet',
'general.maroon'
].map(label => Zotero.getString(label));
}
}
@ -177,6 +185,8 @@
let tile = document.createElement('button');
tile.setAttribute('aria-label', colorLabels[i]);
tile.classList.add('grid-tile');
// Disable our custom button styling on Windows
tile.classList.add('btn');
tile.style.background = color;
tile.addEventListener('click', () => {

View file

@ -50,6 +50,7 @@
Services.scriptloader.loadSubScript("chrome://zotero/content/tagColorChooser.js", this);
// Custom elements
Services.scriptloader.loadSubScript("chrome://zotero/content/customElements.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/elements/colorPicker.js", this);
</script>