diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ed5ad..72ff45f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,11 @@ All notable changes to easymde will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -Merge 2.7.0 with https://github.com/Ionaru/easy-markdown-editor/pull/71 @jeroenvo +## [Unreleased/Forked] +- Merge 2.7.0 with https://github.com/Ionaru/easy-markdown-editor/pull/71 @jeroenvo +- replace MouseEvent(click) with .click() for IE compat +- Fix status bar update when dragging but not dropping +- ## [2.7.0] - 2019-07-13 ### Added diff --git a/src/js/easymde.js b/src/js/easymde.js index 45dbdf8..ea32e5b 100644 --- a/src/js/easymde.js +++ b/src/js/easymde.js @@ -727,6 +727,7 @@ function afterImageUploaded(editor, url) { var options = editor.options; var imageName = url.substr(url.lastIndexOf('/') + 1); _replaceSelection(cm, stat.image, options.insertTexts.uploadedImage, url); + // show uploaded image filename for 1000ms editor.updateStatusBar('upload-image', editor.options.imageTexts.sbOnUploaded.replace('#image_name#', imageName)); setTimeout(function() { editor.updateStatusBar('upload-image', editor.options.imageTexts.sbInit); @@ -1619,8 +1620,19 @@ function EasyMDE(options) { event.stopPropagation(); event.preventDefault(); }); + this.codemirror.on('dragend', function(cm, event) { + self.updateStatusBar('upload-image', self.options.imageTexts.sbInit); + event.stopPropagation(); + event.preventDefault(); + }); + this.codemirror.on('dragleave', function(cm, event) { + self.updateStatusBar('upload-image', self.options.imageTexts.sbInit); + event.stopPropagation(); + event.preventDefault(); + }); this.codemirror.on('dragover', function(cm, event) { + self.updateStatusBar('upload-image', self.options.imageTexts.sbOnDragEnter); event.stopPropagation(); event.preventDefault(); }); @@ -1944,7 +1956,7 @@ EasyMDE.prototype.clearAutosavedValue = function () { EasyMDE.prototype.openBrowseFileWindow = function(onSuccess, onError) { var self = this; var imageInput = this.gui.toolbar.getElementsByClassName('imageInput')[0]; - imageInput.dispatchEvent(new MouseEvent('click')); + imageInput.click() //dispatchEvent(new MouseEvent('click')); // replaced with click() for IE11 compatibility. function onChange(event) { self.uploadImages(event.target.files, onSuccess, onError); imageInput.removeEventListener('change', onChange);