(no title)
spellcard199 | 4 years ago
Since it may be of interest I'll add some notes.
You can get a console also in the desktop app if you launch it from a terminal adding --remote-debugging-port=..., then opening http://127.0.0.1:<port> from a chromium-based web browser.
A couple of useful functions that allow to listen to events are graph.model.addListener and graph.selectionModel.addListener. They are documented in the mxGraph api page.
You can make your functions persistent between sessions by putting your code in a javascript file, clicking from the desktop app on Extras > Plugins > Add > Select File... Then restart the app. In the web app "Select File..." is replaced by "Custom..." and the file should be some reacheable url. The javascript file can contain arbitrary javascript code, doesn't need to have a specific format.
Finally, to customize the ui actions, keybindings and menus without touching the various event listeners, this answer on stackexchange [1] from user holroy is what initially guided me in the right direction.
No comments yet.