added shift+enter key from new comment box to submit the comment.
This commit is contained in:
parent
06d67bf854
commit
5f6ce87a23
3 changed files with 37 additions and 2 deletions
|
|
@ -115,7 +115,6 @@ by them self.
|
||||||
* Remove unnecessary dotted CSS borders. [#2940](https://github.com/diaspora/diaspora/issues/2940)
|
* Remove unnecessary dotted CSS borders. [#2940](https://github.com/diaspora/diaspora/issues/2940)
|
||||||
* Fix default image url in profiles table. [#3795](https://github.com/diaspora/diaspora/issues/3795)
|
* Fix default image url in profiles table. [#3795](https://github.com/diaspora/diaspora/issues/3795)
|
||||||
* Fix mobile buttons are only clickable when scrolled to the top. [#4102](https://github.com/diaspora/diaspora/issues/4102)
|
* Fix mobile buttons are only clickable when scrolled to the top. [#4102](https://github.com/diaspora/diaspora/issues/4102)
|
||||||
* Fix regression in bookmarklet causing uneditable post contents. [#4057](https://github.com/diaspora/diaspora/issues/4057)
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
@ -127,7 +126,7 @@ by them self.
|
||||||
* Add multiphoto for mobile post. [#4065](https://github.com/diaspora/diaspora/issues/4065)
|
* Add multiphoto for mobile post. [#4065](https://github.com/diaspora/diaspora/issues/4065)
|
||||||
* Add hotkeys to navigate in stream [#4089](https://github.com/diaspora/diaspora/pull/4089)
|
* Add hotkeys to navigate in stream [#4089](https://github.com/diaspora/diaspora/pull/4089)
|
||||||
* Add a brief explanatory text about external services connections to services index page [#3064](https://github.com/diaspora/diaspora/issues/3064)
|
* Add a brief explanatory text about external services connections to services index page [#3064](https://github.com/diaspora/diaspora/issues/3064)
|
||||||
* Add a preview for posts in the stream [#4099](https://github.com/diaspora/diaspora/issues/4099)
|
* Shift + Enter will submit the comment. [#4096](github.com/diaspora/diaspora/pull/4096)
|
||||||
|
|
||||||
# 0.0.3.4
|
# 0.0.3.4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
className : "comment_stream",
|
className : "comment_stream",
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
"keydown .comment_box": "keyDownOnCommentBox",
|
||||||
"submit form": "createComment",
|
"submit form": "createComment",
|
||||||
"focus .comment_box": "commentTextareaFocused",
|
"focus .comment_box": "commentTextareaFocused",
|
||||||
"click .toggle_post_comments": "expandComments"
|
"click .toggle_post_comments": "expandComments"
|
||||||
|
|
@ -51,6 +52,13 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
keyDownOnCommentBox: function(evt) {
|
||||||
|
if(evt.keyCode == 13 && evt.shiftKey) {
|
||||||
|
this.$("form").submit()
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
appendComment: function(comment) {
|
appendComment: function(comment) {
|
||||||
// Set the post as the comment's parent, so we can check
|
// Set the post as the comment's parent, so we can check
|
||||||
// on post ownership in the Comment view.
|
// on post ownership in the Comment view.
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,32 @@ describe("app.views.CommentStream", function(){
|
||||||
expect(this.view.$("textarea").val()).toEqual("great post!");
|
expect(this.view.$("textarea").val()).toEqual("great post!");
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("pressing a key when typing on the new comment box", function(){
|
||||||
|
it("should not submit the form when enter key is pressed", function(){
|
||||||
|
this.view.render();
|
||||||
|
var form = this.view.$("form")
|
||||||
|
var submitCallback = jasmine.createSpy().andReturn(false);form.submit(submitCallback);
|
||||||
|
|
||||||
|
var e = $.Event("keydown", { keyCode: 13 });
|
||||||
|
e.shiftKey = false;
|
||||||
|
this.view.keyDownOnCommentBox(e);
|
||||||
|
|
||||||
|
expect(submitCallback).not.toHaveBeenCalled();
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should submit the form when enter is pressed with shift", function(){
|
||||||
|
this.view.render();
|
||||||
|
var form = this.view.$("form")
|
||||||
|
var submitCallback = jasmine.createSpy().andReturn(false);
|
||||||
|
form.submit(submitCallback);
|
||||||
|
|
||||||
|
var e = $.Event("keydown", { keyCode: 13 });
|
||||||
|
e.shiftKey = true;
|
||||||
|
this.view.keyDownOnCommentBox(e);
|
||||||
|
|
||||||
|
expect(submitCallback).toHaveBeenCalled();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue