← @mortar-kit/admin

createEditorStorefunction

import { createEditorStore } from '@mortar-kit/admin'

function createEditorStore(bricks: () => readonly AnyBrick[], collection: () => AnyCollection, doc: () => Doc): EditorStore

Creates the editor store. It is seeded from doc() (normalized, so every form input has a value to bind; the source is never modified) and re-seeded if bricks(), collection() or doc() change, e.g. when a different document is loaded. Edits live in the store until then. The first entry is selected, or the fields when there is no body.

Parameters

bricks: () => readonly AnyBrick[]
collection: () => AnyCollection
doc: () => Doc

Returns

EditorStore