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')) }} key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
- name: Install dependencies - 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 run: yarn install --check-files --frozen-lockfile
- name: Lint - name: Lint

View File

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

View File

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