How to access the JSON data passed to the node
nebc-jasonfung opened this issue · comments
Jason Fung commented
I am using editor.addNode
function and passing in a JSON object via the data
attribute. How do I get this data when that node is clicked?
Jason Fung commented
Looks like this can be solved by doing the following:
editor.on('nodeSelected', (id) => {
console.log(editor.getNodeFromId(id).data.name);
});
editor.addNode('foo', 1, 1, 100, 100, 'foo', {name: 'test'}, "<p>Test</p>");