mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: handle enter key with a better way on site setting string inputs
This commit is contained in:
parent
f2dd35ab08
commit
823061a2cf
1 changed files with 12 additions and 11 deletions
|
@ -24,19 +24,20 @@ Discourse.SiteSettingView = Discourse.View.extend(Discourse.ScrollTop, {
|
|||
|
||||
}.property('content.type'),
|
||||
|
||||
didInsertElement: function() {
|
||||
_watchEnterKey: function() {
|
||||
var self = this;
|
||||
this._super();
|
||||
Em.run.schedule('afterRender', function() {
|
||||
self.$('.input-setting-string').keydown(function(e) {
|
||||
if (e.keyCode === 13) { // enter key
|
||||
var setting = self.get('content');
|
||||
if (setting.get('dirty')) {
|
||||
setting.save();
|
||||
}
|
||||
this.$().on("keydown.site-setting-enter", ".input-setting-string", function (e) {
|
||||
if (e.keyCode === 13) { // enter key
|
||||
var setting = self.get('content');
|
||||
if (setting.get('dirty')) {
|
||||
setting.save();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}.on('didInsertElement'),
|
||||
|
||||
_removeBindings: function() {
|
||||
this.$().off("keydown.site-setting-enter");
|
||||
}.on("willDestroyElement")
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue