Skip to content
QuireKit
Core docs
Alpha · evolving API
Core conceptsView Markdown ↗

Persistence

Save JSON, choose storage and understand versioning and restoration.

Core supplies content access; your application chooses storage. Start by saving the current document in the browser, then add restoration and version checks.

Save current content

editor.getJSON() returns nodes, attributes and formatting. Browser storage accepts strings:

Save a local draftts

version identifies your backup format for future migrations. localStorage belongs to this browser, without cross-device synchronization or image bytes.

Validate before restoring

Read and parse the backup, check its version, then validate content with the matching Schema. Create defaults only when no save exists. Preserve damaged or unsupported files for recovery.

These helpers show explicit save and read operations. recipes/save.ts handles storage and basic version checks; recipes/types.ts defines the envelope. Complete products also validate nodes and attributes against Schema; see files.

recipes/save.tsts

Report success after writing

Storage can fail: show an error and retry. Clear unsaved state only after a successful write. During network saves users may continue editing, so an older completion must not clear a newer draft's unsaved state.

Autosave can observe content changes and coalesce requests, while still handling versions, failures and conflicts. Downloading JSON alone does not implement restoration or server synchronization.

QuireKitQuireKit · Core, plugins and Classic docs