Skip to content
solomotion
BuildPlugins

Add your own panel

A plugin is a folder with a manifest and an HTML page. It opens as a panel in the studio, runs in a sandboxed iframe, and reaches the document only through window.solomotion.

Install the SDK

Install
npm install --save-dev @solomotion/plugin-sdk@next

The SDK holds the types and the manifest validator. The studio validates every plugin with the same package, so what type-checks here is what the host accepts.

Write the manifest

solomotion.plugin.json, beside the entry page:

solomotion.plugin.json
{
  "manifestVersion": 1,
  "id": "com.acme.confetti",
  "name": "Confetti",
  "version": "1.0.0",
  "author": { "name": "Acme" },
  "api": 1,
  "main": "ui.html",
  "capabilities": ["document:write", "ui:notify"],
  "window": { "width": 360, "height": 560 }
}

The id is reverse-DNS and unique. version is semver, which is how the studio tells an update from a new install. Check a manifest before you ship it with parseManifest(json).

Call the studio

ui.ts
import type { PluginApi } from "@solomotion/plugin-sdk";

const app = (window as unknown as { solomotion: PluginApi }).solomotion;

document.querySelector("#title")!.addEventListener("click", async () => {
  const doc = await app.document.getInfo();
  await app.document.insertText({ text: doc.name, fontSize: 120 });
  await app.ui.notify("Added a title", "success");
});

app.on("selectionchange", (sel) => console.log(sel.clipIds));

Ask only for what you need

The host rejects any call outside the capabilities you declare.

CapabilityGrants
document:readRead frames, layers and properties.
document:writeCreate, edit and remove layers.
selection:readSee and react to the current selection.
ui:notifyShow messages in the editor.

Methods and capabilities are only ever added, so a plugin built for api: 1 keeps working.

Load it

Open Plugins in the left rail to add and manage plugins. A link on any layer can open one with the address /plugin/<id>.