]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/plugin-drawio.js
Updated draw.io code to support SVGs as primary data type
[bookstack] / resources / js / wysiwyg / plugin-drawio.js
index 6b0167a7045e56fc124a54f450b47a7c68d120ee..c270c5d20f9e889875472c8a9ec6f323bfea4b92 100644 (file)
@@ -34,7 +34,7 @@ function showDrawingEditor(mceEditor, selectedNode = null) {
     DrawIO.show(options.drawioUrl, drawingInit, updateContent);
 }
 
-async function updateContent(pngData) {
+async function updateContent(drawingData) {
     const id = "image-" + Math.random().toString(16).slice(2);
     const loadingImage = window.baseUrl('/loading.gif');
 
@@ -52,7 +52,7 @@ async function updateContent(pngData) {
         DrawIO.close();
         let imgElem = currentNode.querySelector('img');
         try {
-            const img = await DrawIO.upload(pngData, options.pageId);
+            const img = await DrawIO.upload(drawingData, options.pageId);
             pageEditor.dom.setAttrib(imgElem, 'src', img.url);
             pageEditor.dom.setAttrib(currentNode, 'drawio-diagram', img.id);
         } catch (err) {
@@ -65,7 +65,7 @@ async function updateContent(pngData) {
         pageEditor.insertContent(`<div drawio-diagram contenteditable="false"><img src="${loadingImage}" id="${id}"></div>`);
         DrawIO.close();
         try {
-            const img = await DrawIO.upload(pngData, options.pageId);
+            const img = await DrawIO.upload(drawingData, options.pageId);
             pageEditor.dom.setAttrib(id, 'src', img.url);
             pageEditor.dom.get(id).parentNode.setAttribute('drawio-diagram', img.id);
         } catch (err) {