Hey,
hope it is ok to ask this many questions, but you are such a big help and it seems i cant manage alone.
I try to load a library i created in the scratchpad of
www.draw.io and exported it as xml in a plugin to my embedded
draw.io.
I saw the example in plugins/p1.js and try to write something similar. But there are only images imported.
I saw in google+ community that it is possible to load an xml library in two ways. I tried both but i m not able to get it to work:
1)sidebar.createVertexTemplateFromCells([cell], cell.geometry.width,
cell.geometry.height, 'Title')
For the first solution i tried it like this:
var myCell = new mxCell('
http://192.168...../url/to/my/file.xml', new mxGeometry(0, 0, 120, 60), 'shape=component;align=left');
myCell.vertex = true;
ui.sidebar.addPalette('name', 'name',true,function(content){
content.appendChild(ui.sidebar.createVertexTemplateFromCell([myCell],100,100);
});
But it doesn't load, so i think i created the myCell in the wrong way. I also tried to create the cell like this:
var doc = mxUtils.createXmlDocument();
var myCell = doc.createElement('xml')
myCell.setAttribute('xml', 'http://192.168...../url/to/my/file.xml');
ui.sidebar.addPalette('name', 'name',true,function(content){
content.appendChild(ui.sidebar.createVertexTemplateFromCell([myCell.getAttribute('xml')],100,100);
});
2) ui.sidebar.addPalette('name', 'name',true,function(content){
mxUtils.get(
'http://192.168...../url/to/my/file.xml',function(req)
{
ui.sidebar.loadLibrary(new LocalLibrary(this, req.getText(), file.xml));
});
});
But this one also doesn't work out this way. I tried also:
ui.sidebar.addStencilPalette('name', 'NAME','
http://192.168...../url/to/my/file.xml');
But none of the solutions worked for me. Is one of them implemented in the right way and there is a mistake in my file.xml or do i have to do it in an other way?
I also tried to use the URL parameter clib=Uhttps%3A%2F%2F192.168....%2Furl%2Fto%2Fmy%2Ffile%2Ffile.xml but this didn't work either, and it is also not my preferred way to do it.
Thanks again for your amazing support. It really helps me a lot.
Best Thiya