mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Electron: Fix checkbox issue in config screen
This commit is contained in:
parent
c011b53d1f
commit
fd29f20b2e
@ -89,8 +89,11 @@ class ConfigScreenComponent extends React.Component {
|
|||||||
updateSettingValue(key, !value)
|
updateSettingValue(key, !value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hack: The {key+value.toString()} is needed as otherwise the checkbox doesn't update when the state changes.
|
||||||
|
// There's probably a better way to do this but can't figure it out.
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={key} style={rowStyle}>
|
<div key={key+value.toString()} style={rowStyle}>
|
||||||
<div style={controlStyle}>
|
<div style={controlStyle}>
|
||||||
<input id={'setting_checkbox_' + key} type="checkbox" checked={!!value} onChange={(event) => { onCheckboxClick(event) }}/><label onClick={(event) => { onCheckboxClick(event) }} style={labelStyle} htmlFor={'setting_checkbox_' + key}>{md.label()}</label>
|
<input id={'setting_checkbox_' + key} type="checkbox" checked={!!value} onChange={(event) => { onCheckboxClick(event) }}/><label onClick={(event) => { onCheckboxClick(event) }} style={labelStyle} htmlFor={'setting_checkbox_' + key}>{md.label()}</label>
|
||||||
</div>
|
</div>
|
||||||
@ -98,9 +101,7 @@ class ConfigScreenComponent extends React.Component {
|
|||||||
);
|
);
|
||||||
} else if (md.type === Setting.TYPE_STRING) {
|
} else if (md.type === Setting.TYPE_STRING) {
|
||||||
const onTextChange = (event) => {
|
const onTextChange = (event) => {
|
||||||
const settings = Object.assign({}, this.state.settings);
|
updateSettingValue(key, event.target.value);
|
||||||
settings[key] = event.target.value;
|
|
||||||
this.setState({ settings: settings });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -111,9 +112,7 @@ class ConfigScreenComponent extends React.Component {
|
|||||||
);
|
);
|
||||||
} else if (md.type === Setting.TYPE_INT) {
|
} else if (md.type === Setting.TYPE_INT) {
|
||||||
const onNumChange = (event) => {
|
const onNumChange = (event) => {
|
||||||
const settings = Object.assign({}, this.state.settings);
|
updateSettingValue(key, event.target.value);
|
||||||
settings[key] = event.target.value;
|
|
||||||
this.setState({ settings: settings});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -63,6 +63,8 @@ class Setting extends BaseModel {
|
|||||||
'encryption.enabled': { value: false, type: Setting.TYPE_BOOL, public: false },
|
'encryption.enabled': { value: false, type: Setting.TYPE_BOOL, public: false },
|
||||||
'encryption.activeMasterKeyId': { value: '', type: Setting.TYPE_STRING, public: false },
|
'encryption.activeMasterKeyId': { value: '', type: Setting.TYPE_STRING, public: false },
|
||||||
'encryption.passwordCache': { value: {}, type: Setting.TYPE_OBJECT, public: false },
|
'encryption.passwordCache': { value: {}, type: Setting.TYPE_OBJECT, public: false },
|
||||||
|
'style.zoom': {value: "100", type: Setting.TYPE_INT, public: true, appTypes: ['desktop'], label: () => _('Set application zoom percentage'), minimum: "50", maximum: "500", step: "10"},
|
||||||
|
'autoUpdateEnabled': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Automatically update the application') },
|
||||||
'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation interval'), options: () => {
|
'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation interval'), options: () => {
|
||||||
return {
|
return {
|
||||||
0: _('Disabled'),
|
0: _('Disabled'),
|
||||||
@ -74,9 +76,7 @@ class Setting extends BaseModel {
|
|||||||
86400: _('%d hours', 24),
|
86400: _('%d hours', 24),
|
||||||
};
|
};
|
||||||
}},
|
}},
|
||||||
'style.zoom': {value: "100", type: Setting.TYPE_INT, public: true, appTypes: ['desktop'], label: () => _('Set application zoom percentage'), minimum: "50", maximum: "500", step: "10"},
|
|
||||||
'noteVisiblePanes': { value: ['editor', 'viewer'], type: Setting.TYPE_ARRAY, public: false, appTypes: ['desktop'] },
|
'noteVisiblePanes': { value: ['editor', 'viewer'], type: Setting.TYPE_ARRAY, public: false, appTypes: ['desktop'] },
|
||||||
'autoUpdateEnabled': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Automatically update the application') },
|
|
||||||
'showAdvancedOptions': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['mobile' ], label: () => _('Show advanced options') },
|
'showAdvancedOptions': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['mobile' ], label: () => _('Show advanced options') },
|
||||||
'sync.target': { value: SyncTargetRegistry.nameToId('onedrive'), type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation target'), description: () => _('The target to synchonise to. If synchronising with the file system, set `sync.2.path` to specify the target directory.'), options: () => {
|
'sync.target': { value: SyncTargetRegistry.nameToId('onedrive'), type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation target'), description: () => _('The target to synchonise to. If synchronising with the file system, set `sync.2.path` to specify the target directory.'), options: () => {
|
||||||
return SyncTargetRegistry.idAndLabelPlainObject();
|
return SyncTargetRegistry.idAndLabelPlainObject();
|
||||||
|
Loading…
Reference in New Issue
Block a user