FIX: handle enter key with a better way on site setting string inputs
This commit is contained in:
parent
f2dd35ab08
commit
823061a2cf
|
@ -24,19 +24,20 @@ Discourse.SiteSettingView = Discourse.View.extend(Discourse.ScrollTop, {
|
||||||
|
|
||||||
}.property('content.type'),
|
}.property('content.type'),
|
||||||
|
|
||||||
didInsertElement: function() {
|
_watchEnterKey: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._super();
|
this.$().on("keydown.site-setting-enter", ".input-setting-string", function (e) {
|
||||||
Em.run.schedule('afterRender', function() {
|
if (e.keyCode === 13) { // enter key
|
||||||
self.$('.input-setting-string').keydown(function(e) {
|
var setting = self.get('content');
|
||||||
if (e.keyCode === 13) { // enter key
|
if (setting.get('dirty')) {
|
||||||
var setting = self.get('content');
|
setting.save();
|
||||||
if (setting.get('dirty')) {
|
|
||||||
setting.save();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}.on('didInsertElement'),
|
||||||
|
|
||||||
|
_removeBindings: function() {
|
||||||
|
this.$().off("keydown.site-setting-enter");
|
||||||
|
}.on("willDestroyElement")
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue