From 0fbe42d593147ba3f6470fd1357c2cb50fd98eca Mon Sep 17 00:00:00 2001 From: Renyu Liu Date: Wed, 9 Apr 2014 01:41:21 +0800 Subject: [PATCH] OSX shortcut fix. closes #2573 - separate different shortcuts by OS detection in markdownEditor.js --- .../assets/lib/editor/markdownEditor.js | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/core/client/assets/lib/editor/markdownEditor.js b/core/client/assets/lib/editor/markdownEditor.js index 65a864e948..050a69de29 100644 --- a/core/client/assets/lib/editor/markdownEditor.js +++ b/core/client/assets/lib/editor/markdownEditor.js @@ -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'}, @@ -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', @@ -92,4 +97,4 @@ Ghost.Editor = Ghost.Editor || {}; Ghost.Editor.MarkdownEditor = MarkdownEditor; -} ()); \ No newline at end of file +} ());