1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

Improved Draw.io integration pending changes detection

This commit is contained in:
McMatts 2018-08-23 12:29:55 +01:00
parent 8a30f3681c
commit b1a35b7f75
5 changed files with 693 additions and 680 deletions

View file

@ -110,7 +110,15 @@ export default Component.extend({
},
invokeExport() {
// Cannot export if nothing has been changed
// so we skip straight to the save process.
if (is.empty(this.get('diagramXML'))) {
this.set('readyToSave', true);
return;
}
let editorFrame = document.getElementById(this.get('editorId'));
editorFrame.contentWindow.postMessage(
JSON.stringify(
{
@ -126,7 +134,12 @@ export default Component.extend({
if (this.get('readyToSave')) {
let page = this.get('page');
let meta = this.get('meta');
meta.set('rawBody', this.get('diagram'));
// handle case where no diagram changes were made
let dg = this.get('diagram');
if (is.empty(dg)) dg = this.get('meta.rawBody');
meta.set('rawBody', dg);
page.set('title', this.get('title'));
this.set('waiting', false);