Insert HTML
canvas-insert_htmlInsert content from HTML — one undoable action. Accepts three kinds of markup: (1) canvas layers, the data-ac-* format canvas-read action=html returns: every layer element carries data-ac-type (frame | group | rect | ellipse | line | polygon | star | vector | text | image | component | instance | section) and its data-ac-model JSON; data-ac-id is optional (ids are minted; the ones you send come back in idMap). Give every layer you want back an id of its own, across copies too (title-1, title-2, …): a repeated id is mapped for its first layer only. Several top-level layers land together, relative positions kept. To copy layers that already exist, use canvas-duplicate_nodes instead. Markup with data-ac-type, data-ac-model or data-ac-id attributes that holds no layer is refused with the reason, never inserted as a page. (2) raw (becomes native vector/shape layers), (3) any other web HTML incl. full pages. Generic HTML at page level (no parentId) on a live canvas — the default in the Anima Canvas app — becomes a live page: one artboard that keeps the HTML exactly as written and runs it, scripts included, like an HTML file dropped into the canvas. Send a complete document (…) with inline / or absolute URLs; relative files do not resolve. Its layers are a snapshot of the running page, so change it with canvas-replace_html on its artboard (canvas-read action=html returns its HTML). Otherwise (into a parentId, or on a canvas without live pages) generic HTML is rendered off-screen without scripts and converted to native layers. Position: x/y = top-left in world coords, or parent-local when parentId is given; omitted = viewport center. A top-level frame inserted at page level becomes a new artboard. Returns rootIds, idMap (layer markup), bounds (x/y parent-local, w/h after layout — hug and auto-layout sizes included, no canvas-read action=outline needed) and warnings; unmeasured lists any the canvas did not lay out (on another page, or far outside the view): those keep the model's sizes, which a hugging text or auto-layout frame there may not match until it is shown. You cannot measure text: to center or align it, put it in an auto-layout frame (data-ac-layout justify/align) and let it hug (data-ac-text autoResize "auto-wh", or "auto-h" for a fixed width) rather than guessing a width.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>",
"html": "<html>"
},
"name": "canvas-insert_html"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Top-left x (world, or parent-local with parentId) | |
| y | No | Top-left y | |
| html | Yes | The markup to insert | |
| name | No | Name for the created root (one root; a live page defaults to its <title>) | |
| parentId | No | Frame/group/section to insert into (default: page level) | |
| sessionId | Yes | The artifact's id (its sessionId), from canvas-get_open or workspace-list_artifacts. |