mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-08 07:10:01 +02:00
🐛 Fix
- Zen Mods: Default value not being loaded on theme install due to zen mods not being always triggered and default values not being in place when reading them (fixes #3887) - Zen Mods: Fixed string preferences not changing completely by changing the event listener and replacing the throttle with a debounce, so we only listen to the last keydown (fixes #3558)
This commit is contained in:
parent
5e77f44e05
commit
2b1224b3df
2 changed files with 47 additions and 35 deletions
|
@ -292,7 +292,7 @@ var gZenMarketplaceManager = {
|
|||
preferencesWrapper.setAttribute('flex', '1');
|
||||
|
||||
for (const entry of preferences) {
|
||||
const { property, label, type, placeholder } = entry;
|
||||
const { property, label, type, placeholder, defaultValue } = entry;
|
||||
|
||||
switch (type) {
|
||||
case 'dropdown': {
|
||||
|
@ -309,7 +309,7 @@ var gZenMarketplaceManager = {
|
|||
menulist.setAttribute('sizetopopup', 'none');
|
||||
menulist.setAttribute('id', property + '-popup-menulist');
|
||||
|
||||
const savedValue = Services.prefs.getStringPref(property, 'none');
|
||||
const savedValue = Services.prefs.getStringPref(property, defaultValue ?? 'none');
|
||||
|
||||
menulist.setAttribute('value', savedValue);
|
||||
menulist.setAttribute('tooltiptext', property);
|
||||
|
@ -395,7 +395,7 @@ var gZenMarketplaceManager = {
|
|||
checkboxElement.setAttribute('zen-pref', property);
|
||||
|
||||
// Checkbox only works with "true" and "false" values, it's not like HTML checkboxes.
|
||||
if (Services.prefs.getBoolPref(property, false)) {
|
||||
if (Services.prefs.getBoolPref(property, defaultValue ?? false)) {
|
||||
checkboxElement.setAttribute('checked', 'true');
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ var gZenMarketplaceManager = {
|
|||
container.setAttribute('align', 'center');
|
||||
container.setAttribute('role', 'group');
|
||||
|
||||
const savedValue = Services.prefs.getStringPref(property, '');
|
||||
const savedValue = Services.prefs.getStringPref(property, defaultValue ?? '');
|
||||
const sanitizedProperty = property?.replaceAll(/\./g, '-');
|
||||
|
||||
const input = document.createElement('input');
|
||||
|
@ -439,8 +439,8 @@ var gZenMarketplaceManager = {
|
|||
}
|
||||
|
||||
input.addEventListener(
|
||||
'change',
|
||||
ZenThemesCommon.throttle((event) => {
|
||||
'keydown',
|
||||
ZenThemesCommon.debounce((event) => {
|
||||
const value = event.target.value;
|
||||
|
||||
Services.prefs.setStringPref(property, value);
|
||||
|
@ -1083,38 +1083,38 @@ Preferences.addAll([
|
|||
default: false,
|
||||
},
|
||||
{
|
||||
id: "zen.glance.activation-method",
|
||||
type: "string",
|
||||
default: "ctrl",
|
||||
id: 'zen.glance.activation-method',
|
||||
type: 'string',
|
||||
default: 'ctrl',
|
||||
},
|
||||
{
|
||||
id: "zen.glance.enabled",
|
||||
type: "bool",
|
||||
id: 'zen.glance.enabled',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "zen.theme.color-prefs.use-workspace-colors",
|
||||
type: "bool",
|
||||
id: 'zen.theme.color-prefs.use-workspace-colors',
|
||||
type: 'bool',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "zen.view.compact.color-toolbar",
|
||||
type: "bool",
|
||||
id: 'zen.view.compact.color-toolbar',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "zen.urlbar.behavior",
|
||||
type: "string",
|
||||
default: "float",
|
||||
id: 'zen.urlbar.behavior',
|
||||
type: 'string',
|
||||
default: 'float',
|
||||
},
|
||||
{
|
||||
id: "zen.view.compact.color-sidebar",
|
||||
type: "bool",
|
||||
id: 'zen.view.compact.color-sidebar',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "zen.essentials.enabled",
|
||||
type: "bool",
|
||||
id: 'zen.essentials.enabled',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
|
@ -1123,18 +1123,18 @@ Preferences.addAll([
|
|||
default: false,
|
||||
},
|
||||
{
|
||||
id: "zen.tabs.show-newtab-vertical",
|
||||
type: "bool",
|
||||
id: 'zen.tabs.show-newtab-vertical',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "zen.view.show-newtab-button-border-top",
|
||||
type: "bool",
|
||||
id: 'zen.view.show-newtab-button-border-top',
|
||||
type: 'bool',
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "zen.view.show-newtab-button-top",
|
||||
type: "bool",
|
||||
id: 'zen.view.show-newtab-button-top',
|
||||
type: 'bool',
|
||||
default: true,
|
||||
},
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue