Fix status bar.

pull/101/head
Jeroen van Oorschot 5 years ago
parent bbf3340581
commit c54168a656

@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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
-
- Fix progressbar
## [2.7.0] - 2019-07-13
### Added

@ -1956,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.click() //dispatchEvent(new MouseEvent('click')); // replaced with click() for IE11 compatibility.
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);
@ -1996,16 +1996,15 @@ EasyMDE.prototype.uploadImage = function(file, onSuccess, onError) {
var formData = new FormData();
formData.append('image', file);
var request = new XMLHttpRequest();
request.open('POST', this.options.imageUploadEndpoint);
request.send(formData);
request.onprogress = function (event) {
// TODO insert csrf token in post ajax request
request.upload.onprogress = function (event) {
if (event.lengthComputable) {
// FIXME: progress doesn't work well
var progress = '' + Math.round((event.loaded * 100) / event.total);
self.updateStatusBar('upload-image', self.options.imageTexts.sbProgress.replace('#file_name#', file.name).replace('#progress#', progress));
}
};
request.open('POST', this.options.imageUploadEndpoint);
request.onload = function () {
try {
@ -2033,6 +2032,9 @@ EasyMDE.prototype.uploadImage = function(file, onSuccess, onError) {
+ event.target.status + ' (' + event.target.statusText + ')');
onError(self.options.errorMessages.importError);
};
request.send(formData);
};
EasyMDE.prototype.createSideBySide = function () {

Loading…
Cancel
Save