Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
cytoscape-node-html-label
Advanced tools
This extension provides ability to add labels for Cytoscape nodes. Simple example:
cyInstance.nodeHtmlLabel( [{ tpl: d => '<div>' + d + '</div>' }] );
Demo: https://kaluginserg.github.io/cytoscape-node-html-label/
Download the library:
npm install cytoscape-node-html-label
,bower install cytoscape-node-html-label
, or<script src="http://cytoscape.github.io/cytoscape.js/api/cytoscape.js-latest/cytoscape.min.js"></script>
<script src="cytoscape-node-html-label.js"></script>
require()
the library as appropriate for your project:
CommonJS:
var cytoscape = require('cytoscape');
var nodeHtmlLabel = require('cytoscape-node-html-label');
nodeHtmlLabel( cytoscape ); // register extension
AMD:
require(['cytoscape', 'cytoscape-node-html-label'], function( cytoscape, nodeHtmlLabel ){
nodeHtmlLabel( cytoscape ); // register extension
});
nodeHtmlLabel
parameter is an array of options:
cyInstance.nodeHtmlLabel([
{
query: 'node', // cytoscape query selector
halign: 'center', // title vertical position. Can be 'left',''center, 'right'
valign: 'center', // title vertical position. Can be 'top',''center, 'bottom'
halignBox: 'center', // title vertical position. Can be 'left',''center, 'right'
valignBox: 'center', // title relative box vertical position. Can be 'top',''center, 'bottom'
cssClass: '', // any classes will be as attribute of <div> container for every title
tpl(data) {
return '<span>' + data + '</span>'; // your html template here
}
}
]);
To make links clickable inside your labels, you need to pass enablePointerEvents: true
as the 3rd argument to nodeHtmlLabel
:
cyInstance.nodeHtmlLabel([
{
...
}
], {
enablePointerEvents: true
});
Code example:
// create Cy instance
var cyInstance = cytoscape({
container: document.getElementById('cy'),
layout: {
name: 'random'
},
elements: [ // your cy elements
{ group: "nodes", data: { id: 'a1', name: 'a10' }, classes: 'l1' },
{ group: "nodes", data: { id: 'a1', name: 'a10' }, classes: 'l1' },
{ group: "nodes", data: { id: 'a1', name: 'a10' }, classes: 'l1' },
{ group: "nodes", data: { id: 'a5', name: 'a5' }, classes: 'l2' }
]
});
// set nodeHtmlLabel for your Cy instance
cyInstance.nodeHtmlLabel([{
query: '.l1',
valign: "top",
halign: "left",
valignBox: "top",
halignBox: "left",
tpl: function(data) {
return '<p class="cy-title__p1">' + data.id + '</p>' + '<p class="cy-title__p2">' + data.name + '</p>';
}
},
{
query: '.l2',
tpl: function(data) {
return '<p class="cy-title__p1">' + data.id + '</p>' + '<p class="cy-title__p2">' + data.name + '</p>';
}
}
]);
Demo here: https://kaluginserg.github.io/cytoscape-node-html-label/
npm start
npm run test
npm run build
git commit
Then, for version update and publish:
gulp patch
, gulp feature
or gulp release
npm publish
FAQs
labels for cytoscape nodes
The npm package cytoscape-node-html-label receives a total of 6,213 weekly downloads. As such, cytoscape-node-html-label popularity was classified as popular.
We found that cytoscape-node-html-label demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.