Hiding "Disable smooth scroll" option in web (#2638)

* Hiding "smooth-scroll" setting when not electron

- This feature requires the restart of electron and
doesn't work in web builds.

* Removing this comment

- A safeguard was added
- This function won't be called unless IS_ELECTRON is true
This commit is contained in:
Emma 2022-09-29 08:24:10 -04:00 committed by GitHub
parent fbc0bff055
commit f0deb78e6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -109,6 +109,9 @@ export default Vue.extend({
const colorName = colorVal.replace(/([A-Z])/g, ' $1').trim() const colorName = colorVal.replace(/([A-Z])/g, ' $1').trim()
return this.$t(`Settings.Theme Settings.Main Color Theme.${colorName}`) return this.$t(`Settings.Theme Settings.Main Color Theme.${colorName}`)
}) })
},
usingElectron: function () {
return process.env.IS_ELECTRON
} }
}, },
mounted: function () { mounted: function () {
@ -139,9 +142,7 @@ export default Vue.extend({
this.updateDisableSmoothScrolling( this.updateDisableSmoothScrolling(
this.disableSmoothScrollingToggleValue this.disableSmoothScrollingToggleValue
).then(() => { ).then(() => {
// FIXME: No electron safeguard
const { ipcRenderer } = require('electron') const { ipcRenderer } = require('electron')
ipcRenderer.send('relaunchRequest') ipcRenderer.send('relaunchRequest')
}) })
}, },

View File

@ -14,6 +14,7 @@
@change="handleExpandSideBar" @change="handleExpandSideBar"
/> />
<ft-toggle-switch <ft-toggle-switch
v-if="usingElectron"
:label="$t('Settings.Theme Settings.Disable Smooth Scrolling')" :label="$t('Settings.Theme Settings.Disable Smooth Scrolling')"
:default-value="disableSmoothScrollingToggleValue" :default-value="disableSmoothScrollingToggleValue"
@change="handleRestartPrompt" @change="handleRestartPrompt"