X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/da3ae3ba8b47800058f8613b2608a4084d64eb43..refs/pull/4467/head:/resources/js/wysiwyg/plugin-drawio.js diff --git a/resources/js/wysiwyg/plugin-drawio.js b/resources/js/wysiwyg/plugin-drawio.js index 7b1750786..3b343a958 100644 --- a/resources/js/wysiwyg/plugin-drawio.js +++ b/resources/js/wysiwyg/plugin-drawio.js @@ -1,4 +1,5 @@ import * as DrawIO from '../services/drawio'; +import {wait} from '../services/util'; let pageEditor = null; let currentNode = null; @@ -33,7 +34,6 @@ function showDrawingManager(mceEditor, selectedNode = null) { } async function updateContent(pngData) { - const id = `image-${Math.random().toString(16).slice(2)}`; const loadingImage = window.baseUrl('/loading.gif'); const handleUploadError = error => { @@ -57,24 +57,29 @@ async function updateContent(pngData) { }); } catch (err) { handleUploadError(err); + throw new Error(`Failed to save image with error: ${err}`); } return; } - setTimeout(async () => { - pageEditor.insertContent(`