mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Merge pull request #4502 from felixrieseberg/iss4431
Ensure Post Image Uploader Reset
This commit is contained in:
commit
a1ab6b4a13
@ -237,6 +237,13 @@ UploadUi = function ($dropzone, settings) {
|
||||
} else {
|
||||
this.initWithImage();
|
||||
}
|
||||
},
|
||||
|
||||
reset: function () {
|
||||
$dropzone.find('.js-url').remove();
|
||||
$dropzone.find('.js-fileupload').removeClass('right');
|
||||
this.removeExtras();
|
||||
this.initWithDropzone();
|
||||
}
|
||||
});
|
||||
};
|
||||
@ -253,6 +260,7 @@ upload = function (options) {
|
||||
ui;
|
||||
|
||||
ui = new UploadUi($dropzone, settings);
|
||||
this.uploaderUi = ui;
|
||||
ui.init();
|
||||
});
|
||||
};
|
||||
|
@ -7,10 +7,10 @@ var PostImageUploader = Ember.Component.extend({
|
||||
var $this = this.$(),
|
||||
self = this;
|
||||
|
||||
uploader.call($this, {
|
||||
this.set('uploaderReference', uploader.call($this, {
|
||||
editor: true,
|
||||
fileStorage: this.get('config.fileStorage')
|
||||
});
|
||||
}));
|
||||
|
||||
$this.on('uploadsuccess', function (event, result) {
|
||||
if (result && result !== '' && result !== 'http://') {
|
||||
|
@ -451,6 +451,14 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
||||
|
||||
closeSubview: function () {
|
||||
this.set('isViewingSubview', false);
|
||||
},
|
||||
|
||||
resetUploader: function () {
|
||||
var uploader = this.get('uploaderReference');
|
||||
|
||||
if (uploader && uploader[0]) {
|
||||
uploader[0].uploaderUi.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -18,6 +18,9 @@ var EditorNewRoute = AuthenticatedRoute.extend(base, {
|
||||
// from previous posts
|
||||
psm.removeObserver('titleScratch', psm, 'titleObserver');
|
||||
|
||||
// Ensure that the PSM Image Uploader resets
|
||||
psm.send('resetUploader');
|
||||
|
||||
this._super(controller, model);
|
||||
}
|
||||
});
|
||||
|
@ -7,7 +7,7 @@
|
||||
<button class="close icon-x settings-menu-header-action" {{action "closeSettingsMenu"}}><span class="hidden">Close</span></button>
|
||||
</div>
|
||||
<div class="settings-menu-content">
|
||||
{{gh-uploader uploaded="setCoverImage" canceled="clearCoverImage" image=image tagName="section"}}
|
||||
{{gh-uploader uploaded="setCoverImage" canceled="clearCoverImage" image=image uploaderReference=uploaderReference tagName="section"}}
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="url">Post URL</label>
|
||||
|
Loading…
Reference in New Issue
Block a user