* @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;
iFrame.setAttribute('src', drawIoUrl);
iFrame.setAttribute('class', 'fullscreen');
iFrame.style.backgroundColor = '#FFFFFF';
+ document.body.appendChild(iFrame);
}
-export function close() {
+function close() {
drawEventClose();
}
function drawEventInit() {
if (!onInit) return;
onInit().then(xml => {
- drawPostMessage({action: 'load', autosave: 1, xml: ''});
+ drawPostMessage({action: 'load', autosave: 1, xml: xml});
});
}
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