cytoscape-node-html-label icon indicating copy to clipboard operation
cytoscape-node-html-label copied to clipboard

Callback/event when a label is updated

Open josejulio opened this issue 5 years ago • 3 comments

Would it be possible to have a callback/event when a label is updated? Ideally I would like a ref to the htmlElement and the cytoscapeElement

Would it be accepted if I work on a PR?

josejulio avatar Aug 14 '19 14:08 josejulio

Related to #12

josejulio avatar Aug 19 '19 15:08 josejulio

@josejulio anything on this?

I think this makes a lot of sense, and would enable additional functionality such as manipulation of the HTML element and syncronization between the html and the cytoscape element (like #12).

Personally I need to add transitions to the html element by adding a class after the HTML initialization.

jeppebm avatar Dec 07 '20 15:12 jeppebm

I did this on my fork. I think is something that would be ported here, but currently working on other project and have little time to update this. A PR porting/improving that would be accepted here.

You can test it out in this npm package: https://www.npmjs.com/package/cy-node-html-label

// Listening for changes
cyInstance.on('nodehtml-create-or-update nodehtml-delete', function(event, data) {
   // When created/updated data has the label, and you can get the html node with element.getNode()
   // It also has isNew to know if it was created or updated.
   // Target event is the cytoscape node associated to the label.
});

josejulio avatar Dec 09 '20 18:12 josejulio