]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/libs/drawio.js
Finished migrated from icon-font to SVG
[bookstack] / resources / assets / js / libs / drawio.js
index a44c12c4459d36ebaf41e2fcad4efada7b43aa55..beb6f0d59709af43d64a20e03fa470630edeef75 100644 (file)
@@ -9,7 +9,7 @@ let onInit, onSave;
  * @param onInitCallback - Must return a promise with the xml to load for the editor.
  * @param onSaveCallback - Is called with the drawing data on save.
  */
-export function show(onInitCallback, onSaveCallback) {
+function show(onInitCallback, onSaveCallback) {
     onInit = onInitCallback;
     onSave = onSaveCallback;
 
@@ -19,9 +19,10 @@ export function show(onInitCallback, onSaveCallback) {
     iFrame.setAttribute('src', drawIoUrl);
     iFrame.setAttribute('class', 'fullscreen');
     iFrame.style.backgroundColor = '#FFFFFF';
+    document.body.appendChild(iFrame);
 }
 
-export function close() {
+function close() {
     drawEventClose();
 }
 
@@ -52,7 +53,7 @@ function drawEventSave(message) {
 function drawEventInit() {
     if (!onInit) return;
     onInit().then(xml => {
-        drawPostMessage({action: 'load', autosave: 1, xml: ''});
+        drawPostMessage({action: 'load', autosave: 1, xml: xml});
     });
 }
 
@@ -63,4 +64,6 @@ function drawEventClose() {
 
 function drawPostMessage(data) {
     iFrame.contentWindow.postMessage(JSON.stringify(data), '*');
-}
\ No newline at end of file
+}
+
+module.exports = {show, close};
\ No newline at end of file