Closed zachBears closed 7 years ago
@svivian Added this change for a project and thought you might want to merge something similar in to add the ability for users to upload images directly through the markdown editor. Let me know if you like the base approach and I'll add in the appropriate admin settings flags.
Sounds great! I've been meaning to do this for a long time. Will take a look and merge when I can.
Great. There are some fixes that I'll make to productize it (adding the admin toggles and making the upload a bit more intuitive) and I'll tag you again when it's ready for a formal review.
@svivian Added an administration panel toggle for image upload. This is ready for review.
@svivian Any estimates on when you'll have time to take a look at this?
Hi, sorry for the delay in getting to this. Checked this out and it looks great! However I'm getting an issue when I upload a large file, nothing is uploaded or inserted into the editor, and there's a JavaScript error in the console:
Uncaught TypeError: Cannot read property 'replace' of undefined
at i (markdown.min.js:149)
at a (markdown.min.js:219)
at Object.success (markdown.min.js:179)
at j (jquery-1.11.3.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.11.3.min.js:2)
at x (jquery-1.11.3.min.js:5)
at XMLHttpRequest.b (jquery-1.11.3.min.js:5)
The image I tried to upload was a 5.9MB PNG. Max upload size is 16MB so I don't think it's that. Any ideas?
Edit: the console error using the non-minified JS is
Uncaught TypeError: Cannot read property 'replace' of undefined
at properlyEncoded (Markdown.Editor.js:1805)
at linkEnteredCallback (Markdown.Editor.js:1904)
at Object.success (Markdown.Editor.js:1123)
at j (jquery-1.11.3.min.js:2)
at Object.fireWith [as resolveWith] (jquery-1.11.3.min.js:2)
at x (jquery-1.11.3.min.js:5)
at XMLHttpRequest.b (jquery-1.11.3.min.js:5)
Also the AJAX response from the qa-markdown-upload
POST request is blank.
Couldn't reproduce that error again so I've gone ahead and merged this. Thanks for the work on this!
Thanks for merging this! I was unable to replicate the error in my testing and hadn't gotten a chance to take a deep dive into what could have been wrong. I will be using this for a large group of people when the new release comes out and will let you know if we have any issues with large file uploads.
Modify the markdown editor to add image upload capabilities. Images are uploaded as q2a blobs. Following this change, users will have the ability to either upload an image or enter an image URL.