inacho / bootstrap-markdown-editor

Markdown editor for Bootstrap with preview, image upload support, shortcuts and other features.
MIT License
294 stars 76 forks source link

Image upload feature is not working in IE 11 #4

Closed webfriend13 closed 8 years ago

webfriend13 commented 8 years ago

I am using image upload feature of the editor. I have enabled the feature by setting imageUpload: true. While the feature works just fine in chrome it does not work in IE 11. In IE 11 I do not see the file upload window. There is no error on the console.

Upon further investigation I found, a button tag is generated around file upload control. If we remove the button tag and convert it into a div tag, everything is working fine.

webfriend13 commented 8 years ago

Two possible solutions.

Convert

 <button title="Uplaod image" 
     class="btn btn-sm btn-default md-btn-file" 
     style="border: 1px solid red; border-image: none;" 
     type="button" data-mdtooltip="tooltip">

  <span class="glyphicon glyphicon-upload"></span>
<input class="md-input-upload" type="file" accept=".jpg,.jpeg,.png,.gif" multiple="">

INTO

   <div title="Uplaod image" 
         class="btn btn-sm btn-default md-btn-file" 
         style="border: 1px solid red; border-image: none;" 
         data-mdtooltip="tooltip">

      <span class="glyphicon glyphicon-upload"></span>
    <input class="md-input-upload" type="file" accept=".jpg,.jpeg,.png,.gif" multiple="">
 </div>

OR - Add click event on top of file upload control using jquery:

document.querySelector(".md-btn-file").addEventListener("click", function() { var clickEvent = document.createEvent('MouseEvents'); document.querySelector(".md-input-upload").click(clickEvent); });

You also might want to consider the way controls are currently placed: It is forbidden, by the HTML specification, to place an inside a

inacho commented 8 years ago

Thank you for the solution! :+1: