Any details on the canvas API?

Has any details on a canvas API been released?

I know we’ve got the four commands: New file, Export as image, Jump to group and Convert to file…, but I’m more wanting to know if someone knows of other ways to interact with the commands through some internal API stuff?

Like is there any function calls to add new cards, or link notes, or similar to an open canvas? Is this kind of API exposed (and ready for use) by our scripts somehow?

(Part of the reason for asking, is that I’m thinking of using a canvas to do a visual reordering of a task list, and it would be really neat to “toss” every task onto a canvas (as cards), do a visual re-order or grouping, and then have some function to export these cards again as a task list. )

3 Likes

For anyone wondering, you can inspect the Canvas methods by opening a canvas file in Obsidian and typing app.workspace.getLeavesOfType('canvas')[0].view.canvas in the dev console.

2 Likes

@demeneer, thank you for the starting point.
I’ve created a plugin with features like copying styles, merging and splitting cards, custom shapes, and hotkeys.
There are various bugs and glitches, but perhaps someone will find it useful.

ec-features