added same feature to publisher
This commit is contained in:
parent
5f6ce87a23
commit
b0879dd256
3 changed files with 29 additions and 3 deletions
|
|
@ -115,6 +115,7 @@ 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
|
||||||
|
|
||||||
|
|
@ -126,7 +127,8 @@ 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)
|
||||||
* Shift + Enter will submit the comment. [#4096](github.com/diaspora/diaspora/pull/4096)
|
* Add a preview for posts in the stream [#4099](https://github.com/diaspora/diaspora/issues/4099)
|
||||||
|
* Add shortcut key Shift to submit comments and publish posts. [#4096](github.com/diaspora/diaspora/pull/4096)
|
||||||
|
|
||||||
# 0.0.3.4
|
# 0.0.3.4
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
el : "#publisher",
|
el : "#publisher",
|
||||||
|
|
||||||
events : {
|
events : {
|
||||||
|
"keydown #status_message_fake_text" : "keyDown",
|
||||||
"focus textarea" : "open",
|
"focus textarea" : "open",
|
||||||
"click #hide_publisher" : "clear",
|
"click #hide_publisher" : "clear",
|
||||||
"submit form" : "createStatusMessage",
|
"submit form" : "createStatusMessage",
|
||||||
|
|
@ -88,7 +89,7 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
// clear state
|
// clear state
|
||||||
this.clear();
|
this.clear();
|
||||||
},
|
},
|
||||||
|
|
||||||
createPostPreview : function(evt) {
|
createPostPreview : function(evt) {
|
||||||
if(evt){ evt.preventDefault(); }
|
if(evt){ evt.preventDefault(); }
|
||||||
|
|
||||||
|
|
@ -166,6 +167,14 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
keyDown : function(evt) {
|
||||||
|
if( evt.keyCode == 13 && evt.shiftKey ) {
|
||||||
|
this.$("form").submit();
|
||||||
|
this.open();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
clear : function() {
|
clear : function() {
|
||||||
// clear text(s)
|
// clear text(s)
|
||||||
this.el_input.val('');
|
this.el_input.val('');
|
||||||
|
|
@ -205,7 +214,6 @@ app.views.Publisher = Backbone.View.extend(_.extend(
|
||||||
|
|
||||||
// fetch contacts for mentioning
|
// fetch contacts for mentioning
|
||||||
Mentions.fetchContacts();
|
Mentions.fetchContacts();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,22 @@ describe("app.views.Publisher", function() {
|
||||||
expect(this.view.$("input[name='photos[]']").length).toBe(0);
|
expect(this.view.$("input[name='photos[]']").length).toBe(0);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("publishing a post with keyboard", function(){
|
||||||
|
it("should submit the form when shift+enter 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 = true;
|
||||||
|
this.view.keyDown(e);
|
||||||
|
|
||||||
|
expect(submitCallback).toHaveBeenCalled();
|
||||||
|
expect($(this.view.el)).not.toHaveClass("closed");
|
||||||
|
})
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
context("#toggleService", function(){
|
context("#toggleService", function(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue