1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Desktop: Remove from keymap editor commands that cannot be associated with a shortcut

This commit is contained in:
Laurent Cozic 2020-10-31 16:29:17 +00:00
parent 154163bd6c
commit 4d20589773
6 changed files with 50 additions and 39 deletions

View File

@ -126,6 +126,7 @@ ElectronClient/gui/MainScreen/commands/toggleSideBar.js
ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js
ElectronClient/gui/MainScreen/MainScreen.js ElectronClient/gui/MainScreen/MainScreen.js
ElectronClient/gui/MenuBar.js ElectronClient/gui/MenuBar.js
ElectronClient/gui/menuCommandNames.js
ElectronClient/gui/MultiNoteActions.js ElectronClient/gui/MultiNoteActions.js
ElectronClient/gui/NoteContentPropertiesDialog.js ElectronClient/gui/NoteContentPropertiesDialog.js
ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js

1
.gitignore vendored
View File

@ -120,6 +120,7 @@ ElectronClient/gui/MainScreen/commands/toggleSideBar.js
ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js
ElectronClient/gui/MainScreen/MainScreen.js ElectronClient/gui/MainScreen/MainScreen.js
ElectronClient/gui/MenuBar.js ElectronClient/gui/MenuBar.js
ElectronClient/gui/menuCommandNames.js
ElectronClient/gui/MultiNoteActions.js ElectronClient/gui/MultiNoteActions.js
ElectronClient/gui/NoteContentPropertiesDialog.js ElectronClient/gui/NoteContentPropertiesDialog.js
ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js

View File

@ -69,6 +69,7 @@ ElectronClient/gui/MainScreen/commands/toggleSideBar.js
ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js
ElectronClient/gui/MainScreen/MainScreen.js ElectronClient/gui/MainScreen/MainScreen.js
ElectronClient/gui/MenuBar.js ElectronClient/gui/MenuBar.js
ElectronClient/gui/menuCommandNames.js
ElectronClient/gui/MultiNoteActions.js ElectronClient/gui/MultiNoteActions.js
ElectronClient/gui/NoteContentPropertiesDialog.js ElectronClient/gui/NoteContentPropertiesDialog.js
ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js

View File

@ -14,6 +14,7 @@ import Setting from 'lib/models/Setting';
import actionApi from 'lib/services/rest/actionApi.desktop'; import actionApi from 'lib/services/rest/actionApi.desktop';
import BaseApplication from 'lib/BaseApplication'; import BaseApplication from 'lib/BaseApplication';
import { _, setLocale } from 'lib/locale'; import { _, setLocale } from 'lib/locale';
import menuCommandNames from './gui/menuCommandNames';
require('app-module-path').addPath(__dirname); require('app-module-path').addPath(__dirname);
@ -526,7 +527,9 @@ class Application extends BaseApplication {
} }
const keymapService = KeymapService.instance(); const keymapService = KeymapService.instance();
keymapService.initialize(CommandService.instance().commandNames(true)); // We only add the commands that appear in the menu because only
// those can have a shortcut associated with them.
keymapService.initialize(menuCommandNames());
try { try {
await keymapService.loadCustomKeymap(`${dir}/keymap-desktop.json`); await keymapService.loadCustomKeymap(`${dir}/keymap-desktop.json`);
@ -534,9 +537,10 @@ class Application extends BaseApplication {
reg.logger().error(error); reg.logger().error(error);
} }
// Since the settings need to be loaded before the store is created, it will never // Since the settings need to be loaded before the store is
// receive the SETTING_UPDATE_ALL even, which mean state.settings will not be // created, it will never receive the SETTING_UPDATE_ALL even,
// initialised. So we manually call dispatchUpdateAll() to force an update. // which mean state.settings will not be initialised. So we
// manually call dispatchUpdateAll() to force an update.
Setting.dispatchUpdateAll(); Setting.dispatchUpdateAll();
await FoldersScreenUtils.refreshFolders(); await FoldersScreenUtils.refreshFolders();

View File

@ -14,6 +14,7 @@ import InteropServiceHelper from '../InteropServiceHelper';
import { _ } from 'lib/locale'; import { _ } from 'lib/locale';
import { MenuItem, MenuItemLocation } from 'lib/services/plugins/api/types'; import { MenuItem, MenuItemLocation } from 'lib/services/plugins/api/types';
import stateToWhenClauseContext from 'lib/services/commands/stateToWhenClauseContext'; import stateToWhenClauseContext from 'lib/services/commands/stateToWhenClauseContext';
import menuCommandNames from './menuCommandNames';
const { connect } = require('react-redux'); const { connect } = require('react-redux');
const { reg } = require('lib/registry.js'); const { reg } = require('lib/registry.js');
@ -86,41 +87,7 @@ interface Props {
pluginMenus: any[], pluginMenus: any[],
} }
const commandNames:string[] = [ const commandNames:string[] = menuCommandNames();
'focusElementSideBar',
'focusElementNoteList',
'focusElementNoteTitle',
'focusElementNoteBody',
'exportPdf',
'newNote',
'newTodo',
'newFolder',
'newSubFolder',
'print',
'synchronize',
'textCopy',
'textCut',
'textPaste',
'textSelectAll',
'textBold',
'textItalic',
'textLink',
'textCode',
'insertDateTime',
'attachFile',
'focusSearch',
'showLocalSearch',
'toggleSideBar',
'toggleNoteList',
'toggleVisiblePanes',
'toggleExternalEditing',
'setTags',
'showNoteContentProperties',
'copyDevCommand',
'openProfileDirectory',
'historyBackward',
'historyForward',
];
function menuItemSetChecked(id:string, checked:boolean) { function menuItemSetChecked(id:string, checked:boolean) {
const menu = Menu.getApplicationMenu(); const menu = Menu.getApplicationMenu();

View File

@ -0,0 +1,37 @@
export default function() {
return [
'attachFile',
'copyDevCommand',
'exportPdf',
'focusElementNoteBody',
'focusElementNoteList',
'focusElementNoteTitle',
'focusElementSideBar',
'focusSearch',
'historyBackward',
'historyForward',
'insertDateTime',
'newFolder',
'newNote',
'newSubFolder',
'newTodo',
'openProfileDirectory',
'print',
'setTags',
'showLocalSearch',
'showNoteContentProperties',
'synchronize',
'textBold',
'textCode',
'textCopy',
'textCut',
'textItalic',
'textLink',
'textPaste',
'textSelectAll',
'toggleExternalEditing',
'toggleNoteList',
'toggleSideBar',
'toggleVisiblePanes',
];
}