mirror of https://github.com/laurent22/joplin.git
Desktop: Added keyboard shortcut and menu item for toggleEditorPlugin command
parent
69fb1ab104
commit
7e8dee4906
|
@ -789,6 +789,7 @@ function useMenu(props: Props) {
|
|||
shim.isMac() ? noItem : menuItemDic.toggleMenuBar,
|
||||
menuItemDic.toggleNoteList,
|
||||
menuItemDic.toggleVisiblePanes,
|
||||
menuItemDic.toggleEditorPlugin,
|
||||
{
|
||||
label: _('Layout button sequence'),
|
||||
submenu: layoutButtonSequenceMenuItems,
|
||||
|
|
|
@ -43,6 +43,7 @@ export default function() {
|
|||
'togglePerFolderSortOrder',
|
||||
'toggleSideBar',
|
||||
'toggleVisiblePanes',
|
||||
'toggleEditorPlugin',
|
||||
'toggleTabMovesFocus',
|
||||
'editor.deleteLine',
|
||||
'editor.duplicateLine',
|
||||
|
|
|
@ -45,5 +45,7 @@ export const runtime = (): CommandRuntime => {
|
|||
});
|
||||
}
|
||||
},
|
||||
|
||||
enabledCondition: 'hasActivePluginEditor',
|
||||
};
|
||||
};
|
||||
|
|
|
@ -42,6 +42,7 @@ const defaultKeymapItems = {
|
|||
{ accelerator: 'Option+Cmd+S', command: 'toggleSideBar' },
|
||||
{ accelerator: 'Option+Cmd+L', command: 'toggleNoteList' },
|
||||
{ accelerator: 'Cmd+L', command: 'toggleVisiblePanes' },
|
||||
{ accelerator: 'Option+Cmd+V', command: 'toggleEditorPlugin' },
|
||||
{ accelerator: 'Cmd+0', command: 'zoomActualSize' },
|
||||
{ accelerator: 'Cmd+E', command: 'toggleExternalEditing' },
|
||||
{ accelerator: 'Option+Cmd+T', command: 'setTags' },
|
||||
|
@ -93,6 +94,7 @@ const defaultKeymapItems = {
|
|||
{ accelerator: 'Ctrl+Shift+M', command: 'toggleMenuBar' },
|
||||
{ accelerator: 'F11', command: 'toggleNoteList' },
|
||||
{ accelerator: 'Ctrl+L', command: 'toggleVisiblePanes' },
|
||||
{ accelerator: 'Alt+Ctrl+V', command: 'toggleEditorPlugin' },
|
||||
{ accelerator: 'Ctrl+0', command: 'zoomActualSize' },
|
||||
{ accelerator: 'Ctrl+E', command: 'toggleExternalEditing' },
|
||||
{ accelerator: 'Ctrl+Alt+T', command: 'setTags' },
|
||||
|
|
|
@ -7,6 +7,7 @@ import { FolderEntity, NoteEntity } from '../database/types';
|
|||
import { itemIsReadOnlySync, ItemSlice } from '../../models/utils/readOnly';
|
||||
import ItemChange from '../../models/ItemChange';
|
||||
import { getTrashFolderId } from '../trash';
|
||||
import getActivePluginEditorView from '../plugins/utils/getActivePluginEditorView';
|
||||
|
||||
export interface WhenClauseContextOptions {
|
||||
commandFolderId?: string;
|
||||
|
@ -43,6 +44,7 @@ export interface WhenClauseContext {
|
|||
oneNoteSelected: boolean;
|
||||
someNotesSelected: boolean;
|
||||
syncStarted: boolean;
|
||||
hasActivePluginEditor: boolean;
|
||||
}
|
||||
|
||||
export default function stateToWhenClauseContext(state: State, options: WhenClauseContextOptions = null): WhenClauseContext {
|
||||
|
@ -61,6 +63,8 @@ export default function stateToWhenClauseContext(state: State, options: WhenClau
|
|||
const commandFolderId = options.commandFolderId || windowState.selectedFolderId;
|
||||
const commandFolder: FolderEntity = commandFolderId ? BaseModel.byId(state.folders, commandFolderId) : null;
|
||||
|
||||
const { editorPlugin } = state.pluginService ? getActivePluginEditorView(state.pluginService.plugins) : { editorPlugin: null };
|
||||
|
||||
const settings = state.settings || {};
|
||||
|
||||
return {
|
||||
|
@ -108,5 +112,7 @@ export default function stateToWhenClauseContext(state: State, options: WhenClau
|
|||
joplinServerConnected: [9, 10].includes(settings['sync.target']),
|
||||
joplinCloudAccountType: settings['sync.target'] === 10 ? settings['sync.10.accountType'] : 0,
|
||||
hasMultiProfiles: state.profileConfig && state.profileConfig.profiles.length > 1,
|
||||
|
||||
hasActivePluginEditor: !!editorPlugin,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue