Drawflow
Drawflow copied to clipboard
list of modules & removeModule not work after import.
Hello, I have some questions to share with you:
- I see that in the API it is possible to add / remove modules. However, I can't find anything to have the list of these modules.
Does this function exist or do you want me to code it and make a MR?
- I have loaded your example data which has the module "Home" and "Other" however when I execute directly after the call removeModule("Home") it is not removed. I have the impression that I have to wait for the editor to be fully loaded before I can perform the removeModule.
editor.start();
editor.import(dataToImport);
editor.removeModule("Home");
Thanks :)
Hello! @quentingosset
You can get the list of modules like this:
const listModules = Object.keys(editor.drawflow.drawflow);
console.log(listModules);
The "Home" module is a default module, I recommend not to delete it. But it can be deleted, with the example case:
editor.start();
editor.import(dataToImport);
editor.changeModule('Other')
editor.removeModule("Home");
console.log(editor.export());
Since if you try to delete the same module, it returns to home. https://github.com/jerosoler/Drawflow/blob/300c9efda3bf8820131b3e93ea50cd9b76c892d3/src/drawflow.js#L1864
If you don't want to use the "home", I recommend creating a new one and leaving it blank.