From 0dd1e72897baa089a3b75678b3d138e2748493ad Mon Sep 17 00:00:00 2001 From: Matthew Harrison-Jones Date: Mon, 16 Sep 2013 15:18:33 +0100 Subject: [PATCH] Improved Image keyboard shortcut Image keyboard shortcut now inserts a new line when on a line with text --- core/client/markdown-actions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/client/markdown-actions.js b/core/client/markdown-actions.js index 070c22b7ca..43d693d62f 100644 --- a/core/client/markdown-actions.js +++ b/core/client/markdown-actions.js @@ -67,7 +67,11 @@ pass = false; break; case "image": + cursor = this.elem.getCursor(); md = this.options.syntax.image.replace('$1', text); + if (this.elem.getLine(cursor.line) !== "") { + md = "\n\n" + md; + } this.elem.replaceSelection(md, "end"); cursor = this.elem.getCursor(); this.elem.setSelection({line: cursor.line, ch: cursor.ch - 8}, {line: cursor.line, ch: cursor.ch - 1});