diff --git a/ghost/admin/controllers/modals/copy-html.js b/ghost/admin/controllers/modals/copy-html.js
new file mode 100644
index 0000000000..9d5fcabe58
--- /dev/null
+++ b/ghost/admin/controllers/modals/copy-html.js
@@ -0,0 +1,7 @@
+var CopyHTMLController = Ember.Controller.extend({
+
+ generatedHTML: Ember.computed.alias('model.generatedHTML')
+
+});
+
+export default CopyHTMLController;
diff --git a/ghost/admin/templates/editor/edit.hbs b/ghost/admin/templates/editor/edit.hbs
index 51928ddb58..4b00e46290 100644
--- a/ghost/admin/templates/editor/edit.hbs
+++ b/ghost/admin/templates/editor/edit.hbs
@@ -16,7 +16,7 @@
What is Markdown?
- {{gh-codemirror value=scratch scrollInfo=view.markdownScrollInfo setCodeMirror="setCodeMirror"}}
+ {{gh-codemirror value=scratch scrollInfo=view.markdownScrollInfo setCodeMirror="setCodeMirror" openModal="openModal"}}
@@ -26,10 +26,10 @@
{{gh-markdown markdown=scratch scrollPosition=view.scrollPosition
- uploadStarted="disableCodeMirror" uploadFinished="enableCodeMirror" uploadSuccess="handleImgUpload"}}
+ uploadStarted="disableCodeMirror" uploadFinished="enableCodeMirror" uploadSuccess="handleImgUpload"}}
{{partial "publish-bar"}}
-
+
\ No newline at end of file
diff --git a/ghost/admin/templates/modals/copy-html.hbs b/ghost/admin/templates/modals/copy-html.hbs
new file mode 100644
index 0000000000..caf5f0d49e
--- /dev/null
+++ b/ghost/admin/templates/modals/copy-html.hbs
@@ -0,0 +1,6 @@
+{{#gh-modal-dialog action="closeModal" showClose=true type="action" animation="fade"
+ title="Generated HTML" confirm=confirm class="copy-html"}}
+
+ {{textarea value=generatedHTML rows="6"}}
+
+{{/gh-modal-dialog}}
diff --git a/ghost/admin/utils/codemirror-shortcuts.js b/ghost/admin/utils/codemirror-shortcuts.js
index b8efa44dd7..bb3ee63644 100644
--- a/ghost/admin/utils/codemirror-shortcuts.js
+++ b/ghost/admin/utils/codemirror-shortcuts.js
@@ -1,4 +1,4 @@
-/* global CodeMirror, moment */
+/* global CodeMirror, moment, Showdown */
/** Set up a shortcut function to be called via router actions.
* See editor-route-base
*/
@@ -23,7 +23,9 @@ function init() {
line = this.getLine(cursor.line),
fromLineStart = {line: cursor.line, ch: 0},
toLineEnd = {line: cursor.line, ch: line.length},
- md, letterCount, textIndex, position;
+ md, letterCount, textIndex, position, converter,
+ generatedHTML;
+
switch (type) {
case 'h1':
line = line.replace(/^#* /, '');
@@ -98,18 +100,19 @@ function init() {
case 'titlecase':
md = titleize(text);
break;
- /** @TODO
case 'copyHTML':
converter = new Showdown.converter();
+
if (text) {
- md = converter.makeHtml(text);
+ generatedHTML = converter.makeHtml(text);
} else {
- md = converter.makeHtml(this.getValue());
+ generatedHTML = converter.makeHtml(this.getValue());
}
- $(".modal-copyToHTML-content").text(md).selectText();
+ // Talk to Ember
+ this.component.sendAction('openModal', 'copy-html', { generatedHTML: generatedHTML });
+
break;
- */
default:
if (this.simpleShortcutSyntax[type]) {
md = this.simpleShortcutSyntax[type].replace('$1', text);
diff --git a/ghost/admin/utils/editor-shortcuts.js b/ghost/admin/utils/editor-shortcuts.js
index e8edd92d0f..7d7b3d1986 100644
--- a/ghost/admin/utils/editor-shortcuts.js
+++ b/ghost/admin/utils/editor-shortcuts.js
@@ -20,6 +20,7 @@ shortcuts[ctrlOrCmd + '+i'] = {action: 'codeMirrorShortcut', options: {type: 'it
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'}};
@@ -39,10 +40,4 @@ shortcuts[ctrlOrCmd + '+k'] = {action: 'codeMirrorShortcut', options: {type: 'li
shortcuts[ctrlOrCmd + '+shift+i'] = {action: 'codeMirrorShortcut', options: {type: 'image'}};
shortcuts[ctrlOrCmd + '+shift+k'] = {action: 'codeMirrorShortcut', options: {type: 'code'}};
-//Currently broken CodeMirror Markdown shortcuts.
-// Some may be broken due to a conflict with CodeMirror commands.
-// (see http://codemirror.net/doc/manual.html#commands)
-//
-//shortcuts[ctrlOrCmd + '+c'] = {action: 'codeMirrorShortcut', options: {type: 'copyHTML'}};
-
export default shortcuts;