diff --git a/src/js/easymde.js b/src/js/easymde.js index bf59082..7fdaeed 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -170,6 +170,30 @@ function createTooltip(title, action, shortcuts) { return tooltip; } +/** + * Create the input element (ie. ) used to open the + * browse-file window in order to allow the user to select an image to be + * imported to the server. Used among with the 'import-image' icon. + * @param editor {Object} the EasyMDE object + * @returns Node The created input DOM element. + */ +function createImageInput(editor) { + var imageInput = document.createElement('input'); + imageInput.className = 'imageInput'; + imageInput.type = 'file'; + imageInput.multiple = true; + imageInput.name = 'image'; + imageInput.accept = editor.options.imageAccept; + imageInput.style.display = 'none'; + imageInput.style.opacity = 0; + imageInput.addEventListener('change', function(event) { + for(var i=0; i