Closed charleshetier closed 7 months ago
Yes, run without vue!
editor.start()
before addNode.
addNode without last parameter.
example with simple html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jerosoler/Drawflow/dist/drawflow.min.css" />
<script src="https://cdn.jsdelivr.net/gh/jerosoler/Drawflow/dist/drawflow.min.js"></script>
<style>
#drawflow {
position: relative;
width: 100%;
height: 800px;
border: 1px solid red;
}
</style>
</head>
<body>
<div>
<div id="drawflow"></div>
</div>
<script>
var id = document.getElementById("drawflow");
const editor = new Drawflow(id);
editor.start();
const html = `<div><input type="text" df-name></div>`;
const data = { name: "" };
editor.addNode("github", 0, 1, 150, 300, "github", data, html);
</script>
</body>
</html>
This is the demo wihtou vue: https://jerosoler.github.io/Drawflow/
Example in repo: https://github.com/jerosoler/Drawflow/blob/master/docs/index.html
It works like a charm, thank you very much ! However, there is just a little issue with the @types, le last parameter is mandatory in type definition
/**
* @param name Name of module
* @param inputs Number of inputs
* @param outputs Number of outputs
* @param posx Position on start node left
* @param posy Position on start node top
* @param className Added classname to de node
* @param data Data passed to node
* @param html HTML drawn on node or name of register node.
* @param typenode Default false, true for Object HTML, vue for vue
*/
addNode(
name: string,
inputs: number,
outputs: number,
posx: number,
posy: number,
className: string,
data: any,
html: string,
typenode: boolean | string,
): number | string;
I guess it should be then:
/**
* @param name Name of module
* @param inputs Number of inputs
* @param outputs Number of outputs
* @param posx Position on start node left
* @param posy Position on start node top
* @param className Added classname to de node
* @param data Data passed to node
* @param html HTML drawn on node or name of register node.
* @param typenode Default false, true for Object HTML, vue for vue
*/
addNode(
name: string,
inputs: number,
outputs: number,
posx: number,
posy: number,
className: string,
data: any,
html: string,
typenode?: boolean | string,
): number | string;
Thank you very much, the lib sounds very nice
Types is an external package to drawflow. Try setting false. In parameter.
It works fine. Again, thank you !
Here is my minimalist try:
as far as I understand the documentation, there might be possible to run drawflow without vue (can I ?...)![image](https://github.com/jerosoler/Drawflow/assets/8912998/ebc09875-ab4e-44cd-adb7-f68b25bfe601)
This example raises the followind error:
Cannot read properties of null (reading 'version')
It's happening here, on![image](https://github.com/jerosoler/Drawflow/assets/8912998/1f2c63e3-4a4e-4bd8-b0d4-816d4a0a1e79)
addNode
function:Am I missing something ?
(I am using typescript and vite)
Thank you !