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