2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-16 06:24:28 -06:00

IE11 compat. Fix status bar.

This commit is contained in:
Jeroen van Oorschot 2019-07-15 15:11:07 +02:00
parent d317873fb0
commit bbf3340581
2 changed files with 18 additions and 3 deletions

View File

@ -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).
<!--## [Unreleased]-->
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

View File

@ -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);