Skip to content

Commit

Permalink
Merge pull request #157 from SamLau95/patch-1
Browse files Browse the repository at this point in the history
Stop leading space after entering Markdown
  • Loading branch information
sofish committed Aug 3, 2015
2 parents 049e842 + 03336c2 commit 81a0505
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@
var code = e.keyCode || e.which;

// when `space` is pressed
if(code === 32) {
var cmd = this.stack.join('');
this.stack.length = 0;
return this.valid(cmd);
if (code === 32) {
var markdownSyntax = this.stack.join('');
// reset stack
this.stack = [];

var cmd = this.valid(markdownSyntax);
if (cmd) {
// prevents leading space after executing command
e.preventDefault();
return cmd;
}
}

// make cmd
Expand Down

0 comments on commit 81a0505

Please sign in to comment.