Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
2.2k views
in Plugins by

Is anyone else having problems using the Markdown plugin with the image upload by Onurb?

Seems to work fine but, when I go to edit a post the preview does not work and the markdown toolbar disappears.

I get this error in the console;
Uncaught ReferenceError: Markdown is not defined

Also, could you tell me if this works when you have images to disk?

Thanks

Q2A version: 1.6.2

2 Answers

+2 votes
by

i had similar situation.

In file qa-markdown-editor.php

i did commenting this strings:

 

//$js = file_get_contents($this->pluginurl.'pagedown/markdown.min.js');
//if (qa_opt('md_enable_image_upload')) {
// $js = str_replace("<!--REPLACEMENT_UPLOAD!>", '<div><form enctype="multipart/form-data" id="qa_imageupload_form"  name="qa_imageupload_form" action="upload.php" method="POST"><input type="file" name="qa_imageupload_file" id="qa_imageupload_file"><input type="button" value="Upload" onclick="javascript:qa_imageupload();" name="qa_imageupload_submitbutton" id="qa_imageupload_submitbutton"></form><div id="progress"></div></div>', $js);
 
//}
//$html .= '<script type="text/javascript">'.$js.'</script>' . "\n";
//$html .= '<script src="'.$js.'"></script>' . "\n";
 
and then added this string:
 
$html .= '<script src="'.$this->pluginurl.'pagedown/markdown.min.js"></script>' . "\n";
 
and also in file markdown.min.js
 

this :

<!--REPLACEMENT_UPLOAD!>

replace on this:

<div><form enctype="multipart/form-data" id="qa_imageupload_form"  name="qa_imageupload_form" action="upload.php" method="POST"><input type="file" name="qa_imageupload_file" id="qa_imageupload_file"><input type="button" value="Upload" onclick="javascript:qa_imageupload();" name="qa_imageupload_submitbutton" id="qa_imageupload_submitbutton"></form><div id="progress"></div></div>

and this proplem was resolve

good luck

 

by
Thanks Vadim, I'm having some problems understanding your edits. Any chance you could upload your plugin somewhere for me to download? thanks in advance.
by
I managed to get the buttons showing but, when I click Upload nothing happens.
0 votes
by
Thanks Vadim but, when I click the Upload button nothing happens and I get the following in the error console

<script>(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {javascript:qa_imageupload();

Uncaught ReferenceError: qa_imageupload is not defined (repeated 7 times)

};}}}})</script>
by
edited by
awesome thanks, however just tried it and got the following error, think it's because I have images to disk enabled not blobs

<br /><b>Warning</b>:  fileperms() [<a href='function.fileperms'>function.fileperms</a>]: stat failed for media in <b>/home/dirdave/public_html/qa-include/qa-app-blobs.php</b> on line <b>96</b><br /><br /><b>Warning</b>:  mkdir() [<a href='function.mkdir'>function.mkdir</a>]: No such file or directory in <b>/home/dirdave/public_html/qa-include/qa-app-blobs.php</b> on line <b>96</b><br />http://www.dirdave.co.uk/?qa=blob&qa_blobid=10697528941655244274
by
strange as it seems to be working on localhost however, the image doesn't upload. I get the correct link /?qa=blob&qa_blobid=10299225248821961908 but, a broken image.
...