mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
5b30a51adf
closes #3019 * Remove preexisting `ctrl+h` keymap. * Add logic to cycle the header level. * Loops around after h3. * Sets cursor position to end of heading * Set initial level to h2. * Remove `ctrl+alt+${NUM}` keymaps (as they do not work internationally).
36 lines
1.6 KiB
JavaScript
36 lines
1.6 KiB
JavaScript
var shortcuts = {},
|
|
ctrlOrCmd = navigator.userAgent.indexOf('Mac') !== -1 ? 'command' : 'ctrl';
|
|
//
|
|
//General editor shortcuts
|
|
//
|
|
|
|
shortcuts[ctrlOrCmd + '+s'] = 'save';
|
|
shortcuts[ctrlOrCmd + '+alt+p'] = 'publish';
|
|
shortcuts['alt+shift+z'] = 'toggleZenMode';
|
|
|
|
//
|
|
//CodeMirror Markdown Shortcuts
|
|
//
|
|
|
|
//Text
|
|
shortcuts['ctrl+alt+u'] = {action: 'codeMirrorShortcut', options: {type: 'strike'}};
|
|
shortcuts[ctrlOrCmd + '+b'] = {action: 'codeMirrorShortcut', options: {type: 'bold'}};
|
|
shortcuts[ctrlOrCmd + '+i'] = {action: 'codeMirrorShortcut', options: {type: 'italic'}};
|
|
|
|
shortcuts['ctrl+U'] = {action: 'codeMirrorShortcut', options: {type: 'uppercase'}};
|
|
shortcuts['ctrl+shift+U'] = {action: 'codeMirrorShortcut', options: {type: 'lowercase'}};
|
|
shortcuts['ctrl+alt+shift+U'] = {action: 'codeMirrorShortcut', options: {type: 'titlecase'}};
|
|
shortcuts[ctrlOrCmd + '+shift+c'] = {action: 'codeMirrorShortcut', options: {type: 'copyHTML'}};
|
|
shortcuts[ctrlOrCmd + '+h'] = {action: 'codeMirrorShortcut', options: {type: 'cycleHeaderLevel'}};
|
|
|
|
//Formatting
|
|
shortcuts['ctrl+q'] = {action: 'codeMirrorShortcut', options: {type: 'blockquote'}};
|
|
shortcuts['ctrl+l'] = {action: 'codeMirrorShortcut', options: {type: 'list'}};
|
|
|
|
//Insert content
|
|
shortcuts['ctrl+shift+1'] = {action: 'codeMirrorShortcut', options: {type: 'currentDate'}};
|
|
shortcuts[ctrlOrCmd + '+k'] = {action: 'codeMirrorShortcut', options: {type: 'link'}};
|
|
shortcuts[ctrlOrCmd + '+shift+i'] = {action: 'codeMirrorShortcut', options: {type: 'image'}};
|
|
shortcuts[ctrlOrCmd + '+shift+k'] = {action: 'codeMirrorShortcut', options: {type: 'code'}};
|
|
|
|
export default shortcuts;
|