editor.canvases.add
Adds a canvas to the open project, empty or as a copy of another refitted to its size, and shows it.
JSON-RPC 2.0project.write
A copy without size is a duplicate at its own size, named "*Name* copy". Without copy_of, size is needed.
Parameters
- size[number, number] | string[width, height], or
landscape,vertical,square,portrait. - namestringIts name.
- copy_ofstringA canvas to copy, refitted to fill the new size.
Result
- idstringThe new canvas's id.
Errors
Invalid params (-32602) without size or copy_of. Not found (-32004) for an unknown canvas. A state error (-32005) when no Editor project is open, or the open one is read-only because a newer Lightair made it.
Events
Subscribers to events get editor.changed.
From an AI agent
The MCP server's editor_canvases (action: add) reaches this method.
Example
{ "jsonrpc": "2.0", "id": 1, "method": "editor.canvases.add", "params": { "copy_of": "Landscape", "size": "vertical" }}lightair call editor.canvases.add '{"copy_of":"Landscape","size":"vertical"}'const result = lightair.call("editor.canvases.add", {"copy_of":"Landscape","size":"vertical"});Result
{ "id": "019ad3f0-0a1b-7c2d-8e3f-4a5b6c7d8e9f" }