mirror of
https://github.com/documize/community.git
synced 2025-07-23 15:19:42 +02:00
Finished up Draw.io integration
This commit is contained in:
parent
d746c90624
commit
85b6e40d8c
2 changed files with 16 additions and 5 deletions
|
@ -30,7 +30,7 @@ func (*Provider) Meta() provider.TypeMeta {
|
|||
section := provider.TypeMeta{}
|
||||
|
||||
section.ID = "d46a18f6-49fb-11e8-842f-0ed5f89f718b"
|
||||
section.Title = "Graphical Diagram"
|
||||
section.Title = "Draw.io Diagram"
|
||||
section.Description = "Draw.io powered flowcharts and diagrams"
|
||||
section.ContentType = "flowchart"
|
||||
section.PageType = "tab"
|
||||
|
|
|
@ -67,9 +67,18 @@ export default Component.extend({
|
|||
let self = this;
|
||||
|
||||
let flowCallback = function(evt) {
|
||||
if (self.get('isDestroyed') || self.get('isDestroying')) return;
|
||||
if (evt.origin !== 'https://www.draw.io') return;
|
||||
if (evt.data.length === 0) return;
|
||||
if (self.get('isDestroyed') || self.get('isDestroying')) {
|
||||
console.log('draw.io component destroyed'); // eslint-disable-line no-console
|
||||
return;
|
||||
}
|
||||
// if (evt.origin !== 'https://www.draw.io') {
|
||||
// console.log('draw.io incorrect message source: ' + evt.source); // eslint-disable-line no-console
|
||||
// return;
|
||||
// }
|
||||
if (evt.data.length === 0) {
|
||||
console.log('draw.io no event data'); // eslint-disable-line no-console
|
||||
return;
|
||||
}
|
||||
|
||||
let editorFrame = document.getElementById(self.get('editorId'));
|
||||
var msg = JSON.parse(evt.data);
|
||||
|
@ -127,7 +136,9 @@ export default Component.extend({
|
|||
this.set('title', title);
|
||||
|
||||
let editorFrame = document.getElementById(this.get('editorId'));
|
||||
editorFrame.contentWindow.postMessage(JSON.stringify({action: 'export', format: 'xmlpng', xml: this.get('diagramXML'), spin: 'Updating'}), '*');
|
||||
editorFrame.contentWindow.postMessage(
|
||||
JSON.stringify({action: 'export', format: 'xmlpng',
|
||||
xml: this.get('diagramXML'), spin: 'Updating'}), '*');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue