AlxixDocs

DocumentationDevelopers

Visual editor plugins

Extend the visual editor with your own tools, like plugins in a design app.

A plugin is a small JavaScript program that runs inside the visual editor: it reads the selected layers and the page, and — with permission — changes properties and styles, adds, renames or removes layers. People run approved plugins from the editor’s app menu → Plugins. Every change goes through the editor, so it is validated and can be undone.

How a plugin runs

  • In a sandboxed frame: no access to the editor page, the account, cookies, storage or the internet. It can only talk to the editor through the alxix API.
  • Its window shows whatever HTML it draws into its own document (forms, buttons, results).
  • Only reviewed and approved plugins appear in the editor.

The files

manifest.json
{
  "id": "my-plugin",
  "name": "My plugin",
  "description": "One sentence on what it does.",
  "author": "Your name or company",
  "version": "1.0.0",
  "permissions": ["read", "write"]
}
plugin.js
(async () => {
  document.body.innerHTML = '<button id="go">Uppercase titles</button>';
  document.getElementById('go').onclick = async () => {
    for (const node of await alxix.selection())
      if (node.type === 'Heading')
        await alxix.setProps(node.id, { text: String(node.props.text).toLocaleUpperCase('tr-TR') });
    await alxix.notify('Done');
    alxix.close();
  };
})();

The alxix API

alxix.selection()
The selected layers: id, type, name, props, styles, children ids.
alxix.page()
The open page: id, name, route and its root layer.
alxix.getNode(id)
One layer of the open page.
alxix.setProps(id, props)
Changes properties, e.g. { text: "…" }. Needs write.
alxix.setStyles(id, styles)
Changes styles at the active breakpoint, e.g. { color: "#111" }. Needs write.
alxix.add({ type, parentId, index, props, styles })
Adds a component (Heading, Text, Button, Image, Container…). Needs write.
alxix.rename(id, name) · alxix.remove(id)
Renames or removes a layer. Needs write.
alxix.select(ids)
Changes the selection.
alxix.notify(text) · alxix.close()
Shows a short message; closes the plugin.

Every call returns a promise. Calls with bad input reject with a readable error. A run can make at most 2000 calls.

Publishing a plugin

  1. 1Zip manifest.json, plugin.js and a short README (what it does, how to use it, a screenshot).
  2. 2Email it to [email protected].
  3. 3We review the code: it must only use the alxix API, make no network calls, collect no data and do what it says.
  4. 4Approved plugins are published and appear in every editor’s Plugins menu. Updates go through the same review.