Keyboard shortcut for posting/editing a comment

This commit is contained in:
Julien Chaumond 2012-10-08 15:11:35 +02:00
parent 88d26d446b
commit 3126c5b566
4 changed files with 8 additions and 2 deletions

View file

@ -10,7 +10,7 @@
{{/constant}}
<div class="form-actions">
<a class="delete-link" href="/comments/deleted">Delete Comment</a>
<input type="submit" value="Submit" />
<input type="submit" value="Submit" title="(⌘+enter)" />
</div>
</form>
{{/with}}

View file

@ -9,6 +9,9 @@ Template.comment_edit.rendered = function(){
if(comment && Meteor.user() && !this.editor){
this.editor = new EpicEditor(EpicEditorOptions).load();
this.editor.importFile('editor',comment.body);
$(this.editor.editor).bind('keydown', 'meta+return', function(){
$(window.editor).closest('form').find('input[type="submit"]').click();
});
}
}

View file

@ -7,7 +7,7 @@
</div>
{{/constant}}
<div class="comment-submit">
<input type="submit" class="button" value="Add Comment" />
<input type="submit" class="button" value="Add Comment" title="(⌘+enter)" />
</div>
</form>
</div>

View file

@ -1,6 +1,9 @@
Template.comment_form.rendered = function(){
if(Meteor.user() && !this.editor){
this.editor = new EpicEditor(EpicEditorOptions).load();
$(this.editor.editor).bind('keydown', 'meta+return', function(){
$(window.editor).closest('form').find('input[type="submit"]').click();
});
}
}