2015-03-13 12:39:28 +03:00
|
|
|
// # Editor shortcuts
|
2015-12-14 15:52:53 +03:00
|
|
|
// Loaded by gh-editor component
|
2015-03-13 12:39:28 +03:00
|
|
|
// This map is used to ensure the right action is called by each shortcut
|
2016-05-24 15:06:59 +03:00
|
|
|
import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd';
|
2014-11-12 23:35:41 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
let shortcuts = {};
|
2014-07-31 07:18:00 +04:00
|
|
|
|
2015-03-13 12:39:28 +03:00
|
|
|
// Markdown Shortcuts
|
2014-07-31 07:18:00 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
// Text
|
2015-03-13 12:39:28 +03:00
|
|
|
shortcuts['ctrl+alt+u'] = {action: 'editorShortcut', options: {type: 'strike'}};
|
2015-10-28 14:36:45 +03:00
|
|
|
shortcuts[`${ctrlOrCmd}+b`] = {action: 'editorShortcut', options: {type: 'bold'}};
|
|
|
|
shortcuts[`${ctrlOrCmd}+i`] = {action: 'editorShortcut', options: {type: 'italic'}};
|
2014-07-31 07:18:00 +04:00
|
|
|
|
2015-03-13 12:39:28 +03:00
|
|
|
shortcuts['ctrl+u'] = {action: 'editorShortcut', options: {type: 'uppercase'}};
|
|
|
|
shortcuts['ctrl+shift+u'] = {action: 'editorShortcut', options: {type: 'lowercase'}};
|
|
|
|
shortcuts['ctrl+alt+shift+u'] = {action: 'editorShortcut', options: {type: 'titlecase'}};
|
2015-10-28 14:36:45 +03:00
|
|
|
shortcuts[`${ctrlOrCmd}+shift+c`] = {action: 'editorShortcut', options: {type: 'copyHTML'}};
|
|
|
|
shortcuts[`${ctrlOrCmd}+h`] = {action: 'editorShortcut', options: {type: 'cycleHeaderLevel'}};
|
2014-07-31 07:18:00 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
// Formatting
|
2015-03-13 12:39:28 +03:00
|
|
|
shortcuts['ctrl+q'] = {action: 'editorShortcut', options: {type: 'blockquote'}};
|
|
|
|
shortcuts['ctrl+l'] = {action: 'editorShortcut', options: {type: 'list'}};
|
2014-07-31 07:18:00 +04:00
|
|
|
|
2014-10-25 01:09:50 +04:00
|
|
|
// Insert content
|
2015-03-13 12:39:28 +03:00
|
|
|
shortcuts['ctrl+shift+1'] = {action: 'editorShortcut', options: {type: 'currentDate'}};
|
2015-10-28 14:36:45 +03:00
|
|
|
shortcuts[`${ctrlOrCmd}+k`] = {action: 'editorShortcut', options: {type: 'link'}};
|
|
|
|
shortcuts[`${ctrlOrCmd}+shift+i`] = {action: 'editorShortcut', options: {type: 'image'}};
|
|
|
|
shortcuts[`${ctrlOrCmd}+shift+k`] = {action: 'editorShortcut', options: {type: 'code'}};
|
2014-07-31 07:18:00 +04:00
|
|
|
|
|
|
|
export default shortcuts;
|