0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/client/routes/editor/new.js
Felix Rieseberg ce9d590f34 Ensure Post Image Uploader Reset
Closes #4431

- The PSM does not reset on a transition from editor (existing post) to
editor (new post). If the existing post had a cover image, the image
uploader would not be reset during the transition and appear slightly
broken in the editor for the new post.
- In this PR: A reference to the uploader is saved, allowing the route
for editor/new to instruct the PSM controller to have the uploader
reset.
2014-11-24 09:43:17 -08:00

28 lines
854 B
JavaScript

import AuthenticatedRoute from 'ghost/routes/authenticated';
import base from 'ghost/mixins/editor-base-route';
var EditorNewRoute = AuthenticatedRoute.extend(base, {
model: function () {
var self = this;
return this.get('session.user').then(function (user) {
return self.store.createRecord('post', {
author: user
});
});
},
setupController: function (controller, model) {
var psm = this.controllerFor('post-settings-menu');
// make sure there are no titleObserver functions hanging around
// from previous posts
psm.removeObserver('titleScratch', psm, 'titleObserver');
// Ensure that the PSM Image Uploader resets
psm.send('resetUploader');
this._super(controller, model);
}
});
export default EditorNewRoute;