Working example

Save and restore

A JSON + CSS snapshot in this browser, with separate actions.

Local setup

Script integration is available through the browser archive. For ESM, use npm install @vitext-ru/editor@beta. The live example above runs in an isolated browser document; no document data is sent to a server.

Workflow

Click Save snapshot to explicitly store current applied JSON and CSS in this browser. Change the text, then click Restore snapshot to return to that saved version. The two actions are separate so the difference is visible. A reload keeps the snapshot; another browser/device does not have it. Delete snapshot clears the stored copy. This is a localStorage example, not server persistence. In source mode, return to visual editing before saving or restoring.

localStorage.setItem('vitext-example-snapshot', JSON.stringify({
  version: 1, json: editor.getJSON(), css: editor.getCSS(), savedAt: Date.now()
}));
const saved = JSON.parse(localStorage.getItem('vitext-example-snapshot')!);
await editor.setContent(saved.json, { css: saved.css });

Integration and cleanup

Destroy the instance before unmounting, and await asynchronous imports/styles. Your application owns storage, authentication and uploads. Integration guide. Open separately. The browser archive includes a standalone script example.

← All examples

Search documentation

No results. Try different words.

All documentation