Skip to content

RuledPlugin

A plugin: a plain object a host passes in plugins. It needs nothing from @ruled/sheet at run time, only its types.

Property Type Description
apiVersion 1 The contract this plugin was written for. The editor refuses a version it doesn’t know, saying so.
id string Unique, reverse-DNS style: “page.ruled.onedrive”. Commands, messages and storage are kept under it.
translations? Readonly<Record<string, Readonly<Record<string, string>>>> Messages by language, keyed as the plugin uses them; the editor shows them as plugin.<id>.<key>.
setup(ctx): void | (() => void) | Promise<void | (() => void)>;

Called once, as soon as the editor is made and the code that runs plugins has loaded. Return a function to clean up, or nothing; or a promise of either, which the handle’s ready waits for. A cleanup it resolves to after the plugin was stopped runs at once.

Parameter Type
ctx PluginContext

void | (() => void) | Promise<void | (() => void)>