Skip to content

Commit

Permalink
Merge pull request TryGhost#2574 from LazyChild/issue-2573
Browse files Browse the repository at this point in the history
OSX shortcut fix.
  • Loading branch information
ErisDS committed Apr 9, 2014
2 parents f47af46 + 0fbe42d commit 37d13d3
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions core/client/assets/lib/editor/markdownEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
MarkdownEditor;

MarkdownShortcuts = [
{'key': 'Ctrl+B', 'style': 'bold'},
{'key': 'Meta+B', 'style': 'bold'},
{'key': 'Ctrl+I', 'style': 'italic'},
{'key': 'Meta+I', 'style': 'italic'},
{'key': 'Ctrl+Alt+U', 'style': 'strike'},
{'key': 'Ctrl+Shift+K', 'style': 'code'},
{'key': 'Meta+K', 'style': 'code'},
Expand All @@ -31,13 +27,22 @@
{'key': 'Ctrl+Shift+U', 'style': 'lowercase'},
{'key': 'Ctrl+Alt+Shift+U', 'style': 'titlecase'},
{'key': 'Ctrl+Alt+W', 'style': 'selectword'},
{'key': 'Ctrl+L', 'style': 'list'},
{'key': 'Ctrl+Alt+C', 'style': 'copyHTML'},
{'key': 'Meta+Alt+C', 'style': 'copyHTML'},
{'key': 'Meta+Enter', 'style': 'newLine'},
{'key': 'Ctrl+Enter', 'style': 'newLine'}
{'key': 'Ctrl+L', 'style': 'list'}
];

if (navigator.userAgent.indexOf('Mac') !== -1) {
MarkdownShortcuts.push({'key': 'Meta+B', 'style': 'bold'});
MarkdownShortcuts.push({'key': 'Meta+I', 'style': 'italic'});
MarkdownShortcuts.push({'key': 'Meta+Alt+C', 'style': 'copyHTML'});
MarkdownShortcuts.push({'key': 'Meta+Enter', 'style': 'newLine'});
} else {
MarkdownShortcuts.push({'key': 'Ctrl+B', 'style': 'bold'});
MarkdownShortcuts.push({'key': 'Ctrl+I', 'style': 'italic'});
MarkdownShortcuts.push({'key': 'Ctrl+Alt+C', 'style': 'copyHTML'});
MarkdownShortcuts.push({'key': 'Ctrl+Enter', 'style': 'newLine'});

}

MarkdownEditor = function () {
var codemirror = CodeMirror.fromTextArea(document.getElementById('entry-markdown'), {
mode: 'gfm',
Expand Down Expand Up @@ -92,4 +97,4 @@

Ghost.Editor = Ghost.Editor || {};
Ghost.Editor.MarkdownEditor = MarkdownEditor;
} ());
} ());

0 comments on commit 37d13d3

Please sign in to comment.