mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
6710a1da89
closes #3481 - Pressing Ctrl/CMD+Shift+C in the editor will open up a modal that contains the generated HTML for either the selected text or the whole post
44 lines
2.0 KiB
JavaScript
44 lines
2.0 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'}};
|
|
|
|
//Headings
|
|
shortcuts['ctrl+alt+1'] = {action: 'codeMirrorShortcut', options: {type: 'h1'}};
|
|
shortcuts['ctrl+alt+2'] = {action: 'codeMirrorShortcut', options: {type: 'h2'}};
|
|
shortcuts['ctrl+alt+3'] = {action: 'codeMirrorShortcut', options: {type: 'h3'}};
|
|
shortcuts['ctrl+alt+4'] = {action: 'codeMirrorShortcut', options: {type: 'h4'}};
|
|
shortcuts['ctrl+alt+5'] = {action: 'codeMirrorShortcut', options: {type: 'h5'}};
|
|
shortcuts['ctrl+alt+6'] = {action: 'codeMirrorShortcut', options: {type: 'h6'}};
|
|
|
|
//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;
|