Plugins in embedded mode

276 views
Skip to first unread message

Thiya

unread,
Mar 8, 2017, 4:42:48 AM3/8/17
to draw.io
sorry for this bunch of questions.

Is there a possibility to enable loading plugins in embedded mode?
it tried it as explained here: https://support.draw.io/pages/viewpage.action?pageId=12878136
with adding &p=p1 (also with plugins=1&p=p1) but it didn't work. I already thought it wouldn't work because this parameters are not listed here: https://desk.draw.io/support/solutions/articles/16000042544-how-does-embed-mode-work-
It would be helpful to work in embedded mode with plugins to be abel to use new versions of draw.io without a lot of changes in the code itself.

My other question is, ist there any documentation for developers where i could find answers to questions like this?
I didn't find anything, besindes the few posts on the blog (and the mxGraph-Doc (https://jgraph.github.io/mxgraph/docs/js-api/files/index-txt.html)) and tried to read a lot directly from the code, but i some cases its really difficult to understand. To embed draw.io is just a small side-Project from a bigger one and i m not really into Web-Development. So a Documentation would be amazing.

Thanks again for this amazing support here.

Gaudenz Alder

unread,
Mar 8, 2017, 6:36:47 AM3/8/17
to dra...@googlegroups.com
Plugins work for me in embed-mode, you'd have to show us what you've tried in order to debug it. Does it work if you use www.draw.io? The documentation is constantly updated.

Thiya

unread,
Mar 8, 2017, 7:42:09 AM3/8/17
to draw.io
Perhaps I did an overall mistake in setting up the embed mode. I did follwing steps:
1) Downloading the complete draw.io Project with all folders
2) loading it on a Server
3) setting up an url to the index.html in the war-file.
I did not build up anything or...? Is that right?

What i tried for testing a plugIn is this:
The file p1.js is placed in war/plugins (as it is in the github Project). The url i called from my application ist following one: 'http://192.168.(rest of my Ip-Adress)/drawio/index.html?https=0&proto=json&embed=1&splash=0&spin=1&local=1&plugins=1&p=p1';

If i call: https://www.draw.io/?proto=json&splash=0&spin=1&local=1&plugins=1&p=p1 (Its same after ?, i just left embed=1 and https=0 away) the plugin is loaded properly.

I observed with the firefox developertool the debugging-Process and follwing parameters have been loaded.



Hope this helps. I got the feeling that i did something wrong in my overall way to set it up. If so, please let me know, than i will try to do it again.

Do you mean this documentation: https://desk.draw.io/support/solutions/16000042316

Thanks

Am Mittwoch, 8. März 2017 12:36:47 UTC+1 schrieb Gaudenz Alder:
Plugins work for me in embed-mode, you'd have to show us what you've tried in order to debug it. Does it work if you www.draw.io? The documentation is constantly updated.
Auto Generated Inline Image 1

Gaudenz Alder

unread,
Mar 8, 2017, 7:55:31 AM3/8/17
to draw.io
With ?dev=1, does it load the script file in App.js on line 368?

Thiya

unread,
Mar 8, 2017, 8:13:01 AM3/8/17
to draw.io
If i call the url like this: /index.html?https=0&proto=json&plugins=1&p=p1&dev=1
or like this: http://192.168.253.33/drawio/index.html?https=0&dev=1
or even like this: http://192.168.253.33/drawio/index.html?https=0&proto=json&embed=1&p=p1&splash=0&spin=1&local=1&plugins=1&dev=1
i get a "Page could not be loaded"
and it does not even go inside of this function (in which i think is the line you meant):

(function()
{
    if (!mxClient.IS_CHROMEAPP)

the Variable field for mxClient of the developer tool says: ReferenceError: mxClient is not defined

Gaudenz Alder

unread,
Mar 8, 2017, 8:15:20 AM3/8/17
to draw.io
In dev mode, you need to check out the mxgraph repo.

Thiya

unread,
Mar 8, 2017, 8:32:24 AM3/8/17
to draw.io
I m sorry. i m completely stumped.

What do you mean?
I tried to delete the folder "mxGraph" from the folder "etc". Also the "mxGraph" from war (what shoudln't make a difference it is just css. and a picture)

In both it is not loading my page at all

David Benson

unread,
Mar 8, 2017, 8:39:29 AM3/8/17
to draw.io

Thiya

unread,
Mar 8, 2017, 9:37:02 AM3/8/17
to draw.io
Now i slowly get it I think.

I downloaded all docs here:
https://github.com/jgraph/mxgraph

I placed them on my Server in a floder called "mxgraph2", which is a sibling folder to the folder drawio (which holds all github-folders of draw.io)

I think i also found the code-line, where it is all about. In line 289 -297 in war/index.html :

if (urlParams['dev'] == '1') { // Used to request grapheditor/mxgraph sources in dev mode var mxDevUrl = document.location.protocol + '//devhost.jgraph.com/mxgraph2';
if (document.location.protocol == 'file:') { mxDevUrl = '../../mxgraph2'; }


But because my embedded draw.io is placed on a server, it wont be like this: document.location.protocol == 'file: this variable is 'http:'

so for me mxDevUrl is http://devhost.jgraph.com/mxgraph2 and not this files in my mxgraph2 folder.

Or did i understand it wrong?

Gaudenz Alder

unread,
Mar 8, 2017, 9:43:23 AM3/8/17
to draw.io
Sounds OK. So does it load the script file for the p1 plugin in App.js on line 368?

Thiya

unread,
Mar 8, 2017, 9:54:17 AM3/8/17
to draw.io
no. Its still not going deeper in the code in app.js than Line 219 (!mxClient.IS_CHROMEAPP)


Am Mittwoch, 8. März 2017 15:43:23 UTC+1 schrieb Gaudenz Alder:

Thiya

unread,
Mar 8, 2017, 9:56:38 AM3/8/17
to draw.io
And i forgot. It is not loading at all. Still:

Page could not be loaded. Please try refreshing.

Gaudenz Alder

unread,
Mar 8, 2017, 10:02:09 AM3/8/17
to draw.io
Is there an error in the console?

Thiya

unread,
Mar 8, 2017, 10:12:12 AM3/8/17
to draw.io
yes. a lot: (Sidebar is not defined is really often in the lines above the picture.)
Auto Generated Inline Image 1

Gaudenz Alder

unread,
Mar 8, 2017, 10:14:07 AM3/8/17
to draw.io
Did you setup the hosts file for devhost.jgraph.com?

Thiya

unread,
Mar 8, 2017, 10:59:06 AM3/8/17
to draw.io
no, i didn't know, that i need to do that.

Sorry for the stupid question, but how to do that.
I googled around, but couldn't figure it out. I just found something about devhost.com cloud management, but i dont have an account for that.

Could you link me a page or explain it to me please?

Gaudenz Alder

unread,
Mar 9, 2017, 7:27:10 AM3/9/17
to draw.io
Might be easier to replace devhost.jgraph.com in index.html with the name of your host if you're unsure how to add an entry to your hosts file.

Thiya

unread,
Mar 9, 2017, 8:08:55 AM3/9/17
to draw.io
just a few minutes ago i solved the first part of the problem.

I got to know how to set the host file. (I was only totally confuesed about what devhost.jgraph.com is, up to the moment i found out it is just a simple name) Changing host didn't work so i decided to change exactly what you sugessted in the moment. Why I needed the whole moring was, because I needed to wait for a college who could give me URL-Access to the folder. But all in all i can access by dev-mode.

It also loads the script file in App.js in line 368.
But plugins still dont load.

The console tells me that it has the wrong url of p1.js. But i m trying to figure it out. I have an idea to what it is connected.

Thanks.
Reply all
Reply to author
Forward
0 new messages