Splitter

Splits blocks at caret positions.

Access:

app.getService('splitter')

App code:

const splitter = app.getService('splitter');

Plugin:

const splitter = this.app.getService('splitter');

split#

Splits an element at the caret by extracting trailing content into a cloned sibling element, optionally mounting it as a block and removing the source when empty.

Parameters:

  • el (HTMLElement | string) — element to split (defaults to the current caret block)
  • options (object) — object with the keys below
    • append (boolean) — insert the new sibling element into the DOM right after el (default true)
    • mount (boolean) — also register the new element as a mounted block instance

Returns: HTMLElement|null

splitter.split(null, { append: true, mount: true });