0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fix duplicate URL input field in image uploader

closes #6224
- Add .js-button-accept to removeExtras call
- Check for .js-url container existence before prepending it
- Remove redundant .init() call
This commit is contained in:
Kevin P. Kucharczyk 2015-12-16 21:36:49 +01:00
parent b006eda9f0
commit 89b872ab1a

View file

@ -133,7 +133,7 @@ let UploadUi = function ($dropzone, settings) {
},
removeExtras() {
$dropzone.find('span.media, div.js-upload-progress, a.image-url, a.image-upload, a.image-webcam, div.js-fail, button.js-fail, a.js-cancel').remove();
$dropzone.find('span.media, div.js-upload-progress, a.image-url, a.image-upload, a.image-webcam, div.js-fail, button.js-fail, a.js-cancel, button.js-button-accept').remove();
},
initWithDropzone() {
@ -164,7 +164,9 @@ let UploadUi = function ($dropzone, settings) {
this.initWithDropzone();
});
if (!$dropzone.find('.js-url')[0]) {
$dropzone.find('div.description').before($url);
}
if (settings.editor) {
$dropzone.find('div.js-url').append('<button class="btn btn-blue js-button-accept gh-input">Save</button>');
@ -208,9 +210,6 @@ let UploadUi = function ($dropzone, settings) {
$dropzone.find('img.js-upload-target').attr({src: ''});
$dropzone.find('div.description').show();
$dropzone.trigger('imagecleared');
$dropzone.delay(250).animate({opacity: 100}, 1000, () => {
this.init();
});
$dropzone.trigger('uploadsuccess', 'http://');
this.initWithDropzone();