Skip to content

Commit feea304

Browse files
committed
remove cytoscape-svg causing licensing conflicts
1 parent fb4646b commit feea304

7 files changed

Lines changed: 2 additions & 66 deletions

File tree

package-lock.json

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"cytoscape-edgehandles": "^3.6.0",
1818
"cytoscape-grid-guide": "^2.3.2",
1919
"cytoscape-node-editing": "^4.0.0",
20-
"cytoscape-svg": "^0.4.0",
2120
"file-saver": "^2.0.5",
2221
"hotkeys-js": "^3.8.7",
2322
"jquery": "^3.0.0",

src/component/File-drag-drop.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const app = ({ superState, dispatcher }) => {
4141
fileRef.current.value = null;
4242
const droppedFile = e.dataTransfer.files[0];
4343
const ext = droppedFile && droppedFile.name.split('.').slice(-1)[0]?.toLowerCase();
44-
const allowed = ['graphml', 'json', 'png', 'svg', 'jpg', 'jpeg'];
44+
const allowed = ['graphml', 'json', 'png', 'jpg', 'jpeg'];
4545
if (e.dataTransfer.files.length === 1 && allowed.includes(ext)) {
4646
readFile(superStateRef.current, dispatcherRef.current, droppedFile);
4747
}
@@ -71,7 +71,7 @@ const app = ({ superState, dispatcher }) => {
7171
ref={fileRef}
7272
onClick={(e) => { e.target.value = null; }}
7373
style={{ display: 'none' }}
74-
accept=".graphml,.json,.png,.svg,.jpg,.jpeg"
74+
accept=".graphml,.json,.png,.jpg,.jpeg"
7575
onChange={(e) => readFile(superState, dispatcher, e.target.files[0])}
7676
/>
7777
<span className="arrow">&#10230;</span>

src/graph-builder/graph-core/1-core.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import cytoscape from 'cytoscape';
22
import edgehandles from 'cytoscape-edgehandles';
33
import gridGuide from 'cytoscape-grid-guide';
4-
import svg from 'cytoscape-svg';
54
import Konva from 'konva';
65
import nodeEditing from 'cytoscape-node-editing';
76
import $ from 'jquery';
@@ -45,9 +44,6 @@ class CoreGraph {
4544
if (typeof cytoscape('core', 'gridGuide') !== 'function') {
4645
gridGuide(cytoscape);
4746
}
48-
if (typeof cytoscape('core', 'svg') !== 'function') {
49-
cytoscape.use(svg);
50-
}
5147
// if (cy) this.cy = cy;
5248
this.cy = cytoscape({ ...cyOptions(darkMode), container: element });
5349
this.cy.on('position', 'node', () => {

src/graph-builder/graph-core/5-load-save.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,6 @@ class GraphLoadSave extends GraphUndoRedo {
5252
saveAs(blob, `${this.getName()}.graphml.png`);
5353
return;
5454
}
55-
if (format === 'SVG') {
56-
const blob = new Blob([this.cy.svg({ full: true })], { type: 'image/svg+xml;charset=utf-8' });
57-
saveAs(blob, `${this.getName()}-DHGWorkflow.svg`);
58-
return;
59-
}
60-
if (format === 'SVG-EMBEDDED') {
61-
const svgStr = this.cy.svg({ full: true });
62-
const parser = new DOMParser();
63-
const doc = parser.parseFromString(svgStr, 'image/svg+xml');
64-
const metadata = doc.createElementNS('http://www.w3.org/2000/svg', 'metadata');
65-
metadata.setAttribute('data-graphml', this.getGraphML());
66-
doc.documentElement.insertBefore(metadata, doc.documentElement.firstChild);
67-
const newSvg = new XMLSerializer().serializeToString(doc);
68-
const blob = new Blob([newSvg], { type: 'image/svg+xml;charset=utf-8' });
69-
saveAs(blob, `${this.getName()}.graphml.svg`);
70-
return;
71-
}
7255
if (format === 'JPG-EMBEDDED') {
7356
const b64Uri = this.cy.jpg({ full: true });
7457
const b64Data = b64Uri.split(',')[1];

src/toolbarActions/toolbarFunctions.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -218,36 +218,6 @@ const readFile = async (state, setState, file, fileHandle) => {
218218
};
219219
if (fileHandle) fr.readAsArrayBuffer(await fileHandle.getFile());
220220
else fr.readAsArrayBuffer(file);
221-
} else if (ext === 'svg') {
222-
fr.onload = (x) => {
223-
try {
224-
const parserDOM = new DOMParser();
225-
const svgDoc = parserDOM.parseFromString(x.target.result, 'image/svg+xml');
226-
const metadata = svgDoc.getElementsByTagName('metadata')[0];
227-
const graphML = metadata ? metadata.getAttribute('data-graphml') : null;
228-
if (graphML) {
229-
parser(graphML).then(({ authorName }) => {
230-
setState({
231-
type: T.ADD_GRAPH,
232-
payload: {
233-
projectName,
234-
graphML,
235-
fileHandle: null,
236-
fileName: file.name,
237-
authorName,
238-
},
239-
});
240-
toast.success('Imported embedded GraphML from SVG!');
241-
}).catch(() => toast.error('Embedded GraphML inside SVG is invalid.'));
242-
} else {
243-
toast.error('This SVG does not contain an embedded GraphML Workflow.');
244-
}
245-
} catch (err) {
246-
toast.error('Could not parse the SVG file.');
247-
}
248-
};
249-
if (fileHandle) fr.readAsText(await fileHandle.getFile());
250-
else fr.readAsText(file);
251221
} else if (ext === 'jpg' || ext === 'jpeg') {
252222
fr.onload = (x) => {
253223
try {

src/toolbarActions/toolbarList.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,6 @@ const toolbarList = (state, dispatcher) => [
306306
{ fn: () => downloadImg(s, d, 'JPG-EMBEDDED'), name: 'JPG (with GraphML)' },
307307
{ fn: () => downloadImg(s, d, 'PNG'), name: 'PNG' },
308308
{ fn: () => downloadImg(s, d, 'PNG-EMBEDDED'), name: 'PNG (with GraphML)' },
309-
{ fn: () => downloadImg(s, d, 'SVG'), name: 'SVG' },
310-
{ fn: () => downloadImg(s, d, 'SVG-EMBEDDED'), name: 'SVG (with GraphML)' },
311309
{ fn: () => saveAsJson(s, d), name: 'JSON' },
312310
],
313311
visibility: true,

0 commit comments

Comments
 (0)