HistoryBank
which enables an undo and redo via engine.getHistoryBank().goForward();
. Is this available in react-diagrams as well? And how do I access the HistoryBank?
canLinkToPort
to my component containing the CanvasWidget
?
Hi @ygrossm, cool idea! Not sure I will be able to assist very well as Im new to TS.
Anyways, I did implement a similar dynamic port thing, where ports are created from an array. Maybe you can find some inspiration there (even though its not perfect)
Also shouldn't you be using your own models? In the factory and a few other places you refer to the default models?
Good luck :)
Huh, just discovered that PostgreSQL pgAdmin4 project uses react-diagrams hehe
Hi all! Quick (fairly common I bet) question...
Thanks in advance!
Let's say i have a two nodes Node1 and Node2, and both the node are connected with default link (link1). Now i also have another node named as Node3, which is not connected to any link.
When dragging Node3 and drop on link1, Node3 should placed between Node1 and Node2 and connected to link1.
How to achieve this. Please help me.
Im migrating my react-diagram app to TS but have issues when inheriting from react-diagrams classes. Here is my PortModel.js:
import { DefaultPortModel } from '@projectstorm/react-diagrams';
export default class PortModel extends DefaultPortModel {
constructor(options) {
super({
...options,
// Make id easier on humans
id: `Port_${options.name}_on_${options.parent.options.id}}`
});
}
}
After renaming it to PortModel.ts I get this message
Class constructor DefaultPortModel cannot be invoked without 'new'
It seems I have some transpilation/versioning issue. Though I have lots of TS other files migrated already and it works fine...
Configs:
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"lib": [
"es2019",
"dom"
],
}
}
.babelrc
{
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties"
]
}
Any remedy for my situation?
Hello! I picked up the lib today and doing quite well. I'm trying to see if it is possible to only export nodes + their links to .json. Using serialization makes a massive file and i'm having a hard time reading through if theres anything like I want in it.
If anyone knows or could point me in the direction to export only nodes and their links to .json, it would be a great help.
Cheers.
ps: using custom nodes if that makes a difference