I created my own hookImageDialog to upload files directly in the editor.
$('div#insertImageDialog input[type=file]').ajaxfileupload({
action: $file.attr('data-action'),
onStart: function() {
$loader.show();
},
onComplete: function(response) {
$loader.hide();
if (response.success) {
callback(response.imagePath);
dialogClose();
} else {
alert(response.message);
$file.val('');
}
}
});
This works great the first time you insert an image.
Each time after that, it fails with the following exception:
Uncaught TypeError: Unable to call the 'removeChild' method from null Markdown.Editor.js: 1683 commandProto.doLinkOrImage.linkEnteredCallback Markdown.Editor.js: 1683 self.initMarkdownEditor.editor.hooks.set. $. ajaxfileupload.onComplete
The download is doing fine outside of the editor, so I can only think that this is some kind of callback problem.
They pulled my hair for most of the day.
source
share