X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/1411ee86b3f70013b3fd7735e3a504ebe15a154e..refs/pull/632/head:/resources/assets/js/libs/drawio.js diff --git a/resources/assets/js/libs/drawio.js b/resources/assets/js/libs/drawio.js index a44c12c44..beb6f0d59 100644 --- a/resources/assets/js/libs/drawio.js +++ b/resources/assets/js/libs/drawio.js @@ -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