Fix invalid fallback accelerator warning (#2892)

This commit is contained in:
Felix Häusler 2022-01-16 16:06:03 +01:00 committed by GitHub
parent 3f15e048f5
commit 75591f0958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 9 deletions

View File

@ -135,7 +135,8 @@ jobs:
key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
- name: Install dependencies
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
# Windows worker fail sometimes because a module cannot be found.
# if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: yarn install --check-files --frozen-lockfile
- name: Lint

View File

@ -36,7 +36,7 @@ class Keybindings {
getAccelerator (id) {
const name = this.keys.get(id)
if (!name) {
return ''
return null
}
return name
}
@ -146,7 +146,6 @@ class Keybindings {
_loadLocalKeybindings () {
if (global.MARKTEXT_SAFE_MODE || !isFile2(this.configPath)) {
console.log('Ignoring key bindings because safe mode is enabled.')
return
}

View File

@ -85,13 +85,12 @@ class SettingWindow extends BaseWindow {
win.loadURL(this._buildUrlString(this.id, env, preferences))
win.setSheetOffset(TITLE_BAR_HEIGHT)
electronLocalshortcut.register(
win,
keybindings.getAccelerator('view.toggle-dev-tools'),
() => {
const devToolsAccelerator = keybindings.getAccelerator('view.toggle-dev-tools')
if (env.debug && devToolsAccelerator) {
electronLocalshortcut.register(win, devToolsAccelerator, () => {
win.webContents.toggleDevTools()
}
)
})
}
return win
}
}