Sets metadata for the diagram currently loaded in the editor.
.setDiagramMetadata(/* String */ name, /* Object */ value)
The name of a diagram metadata object that is to be set for the current diagram.
The following string names have meaning internal to the editor and should therefore not be used.
The value to be set for the metadata item. This can be any type of javascript object.
If you wish to remove a metadata item call set using the name you wish to remove with a
value of undefined
or null
. See the example below.
This method can only be used after the startup method has been called.
Note that this method sets the metadata for the current diagram only. If you load a different diagram into the editor, you will also have to set the metadata for it.
editor = new window.__editor(undefined, document.getElementById('editor-node')); editor.startup(...); // Using a string as the value editor.setDiagramMetadata("item1", "item1Val"); // Using an array as the value editor.setDiagramMetadata("item2", ["one", "two", "three"]); // Remove "item1" from the metadata editor.setDiagramMetadata("item1", undefined);