0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/client/controllers/editor/new.js

32 lines
861 B
JavaScript
Raw Normal View History

import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
import MarkerManager from 'ghost/mixins/marker-manager';
var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, MarkerManager, {
init: function () {
var self = this;
this._super();
window.onbeforeunload = function () {
return self.get('isDirty') ? self.unloadDirtyMessage() : null;
};
},
actions: {
/**
* Redirect to editor after the first save
*/
save: function () {
var self = this;
this._super().then(function (model) {
if (model.get('id')) {
self.transitionTo('editor.edit', model);
}
return model;
});
}
}
});
export default EditorNewController;