mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-03 08:25:06 +03:00
f1c8680f53
closes TryGhost/Ghost#8443 - Fixes a bug where the keyboard shortcut `cmd+s` would cause a `Maximum call stack size` error and not save. - Wherever there is a `save` button, the keyboard shortcut to save works now.
37 lines
817 B
JavaScript
37 lines
817 B
JavaScript
import Controller from 'ember-controller';
|
|
import injectService from 'ember-service/inject';
|
|
import {task} from 'ember-concurrency';
|
|
import {alias} from 'ember-computed';
|
|
|
|
export default Controller.extend({
|
|
notifications: injectService(),
|
|
settings: injectService(),
|
|
|
|
model: alias('settings.amp'),
|
|
|
|
save: task(function* () {
|
|
let amp = this.get('model');
|
|
let settings = this.get('settings');
|
|
|
|
settings.set('amp', amp);
|
|
|
|
try {
|
|
return yield settings.save();
|
|
|
|
} catch (error) {
|
|
this.get('notifications').showAPIError(error);
|
|
throw error;
|
|
}
|
|
}).drop(),
|
|
|
|
actions: {
|
|
update(value) {
|
|
this.set('model', value);
|
|
},
|
|
|
|
save() {
|
|
this.get('save').perform();
|
|
}
|
|
}
|
|
});
|