0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-18 06:11:03 +00:00

Updated drawing upload error to shown/handle server limit errors

Closes 
This commit is contained in:
Dan Brown 2021-05-26 18:23:27 +01:00
parent 1a2d374f24
commit 9cbea1eb08
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
4 changed files with 26 additions and 8 deletions
resources/js/components

View file

@ -14,6 +14,7 @@ class MarkdownEditor {
this.pageId = this.$opts.pageId;
this.textDirection = this.$opts.textDirection;
this.imageUploadErrorText = this.$opts.imageUploadErrorText;
this.serverUploadLimitText = this.$opts.serverUploadLimitText;
this.markdown = new MarkdownIt({html: true});
this.markdown.use(mdTasksLists, {label: true});
@ -446,8 +447,7 @@ class MarkdownEditor {
this.insertDrawing(resp.data, cursorPos);
DrawIO.close();
}).catch(err => {
window.$events.emit('error', trans('errors.image_upload_error'));
console.log(err);
this.handleDrawingUploadError(err);
});
});
}
@ -491,12 +491,20 @@ class MarkdownEditor {
this.cm.focus();
DrawIO.close();
}).catch(err => {
window.$events.emit('error', this.imageUploadErrorText);
console.log(err);
this.handleDrawingUploadError(err);
});
});
}
handleDrawingUploadError(error) {
if (error.status === 413) {
window.$events.emit('error', this.serverUploadLimitText);
} else {
window.$events.emit('error', this.imageUploadErrorText);
}
console.log(error);
}
// Make the editor full screen
actionFullScreen() {
const alreadyFullscreen = this.elem.classList.contains('fullscreen');