Skip to main content

Documentation

No results found.
Features

Draft Recovery

The page editor keeps a working copy of your unsaved edits so that an accidental refresh, a closed tab, or a browser crash doesn't throw away work in progress. When you reopen the same page in the editor, your unsaved changes are waiting wh...

The page editor keeps a working copy of your unsaved edits so that an accidental refresh, a closed tab, or a browser crash doesn't throw away work in progress. When you reopen the same page in the editor, your unsaved changes are waiting where you left them.


What gets recovered

There are two kinds of unsaved edit, and they're preserved by two different mechanisms.

Field edits — content, styling, and section design

Text, headings, link URLs, class strings, toggles, and section-level design (background colour/image/video, texture, colour preset, dividers, animation, sticky header, etc.) are mirrored into the browser's localStorage as you edit, debounced so a burst of typing writes once. A final flush also runs when the tab is closing, so even the last keystrokes before a refresh survive.

On reopening the page, the editor overlays that saved draft back onto the freshly-loaded rows. Text comes back in place; background and texture edits trigger a one-time preview re-bake so the section renders exactly as you left it (they can't be patched in place the way text can, because they drive the section's CSS, not its text). The sidebar's design panel also re-reflects the recovered values.

Because this layer lives in localStorage, it is independent of your login cookie — it survives a session timeout, a logout, or a power loss, and is restored the next time you open that page in the same browser.

Structural edits — adding, removing, and reordering rows

Adding, deleting, duplicating, reordering rows (and edits to the page's underlying PHP) are preserved in your server-side editing session. With the default 24-hour session lifetime, an unsaved structural change is recoverable for up to a day, and across any refresh or tab-close within that window.

When you return to a page that has both a saved version on disk and an unsaved draft — for example because the page was saved from another tab or by another editor in the meantime — the editor shows a Keep / Discard banner so you decide which version wins, rather than silently overwriting either.

What it does not cover

Recovery is a safety net for the "oops" moments, not a substitute for saving or for the Backups/Revisions system. Specifically:

  • It's per-browser, per-device. Drafts live in the browser you were editing in. They do not roam to a different computer, a different browser, or a private/incognito window.
  • Clearing browser data removes field drafts. localStorage is wiped if the user clears site data or edits in a private window that's then closed.
  • Structural changes are tied to the session window. Added/removed/reordered rows are recoverable for the session's lifetime (24 hours by default). If the session has ended when you return — a logout, or a return after that window — those structural changes are gone, even though your field edits (text, backgrounds) still come back. Save before stepping away for an extended period if you've restructured a page.
  • A draft is dropped when the file changed underneath it. If the page was saved (by you in another tab, or by another editor) after your draft was started, the editor discards the now-mismatched draft rather than re-applying edits against rows that may have shifted, been renamed, or been deleted. The structural layer surfaces this as the Keep / Discard banner; the field layer drops silently.

For lasting safety, use Backups & Revisions

Draft recovery protects in-progress, unsaved edits. For recovering saved work — rolling a page back to an earlier published state, or restoring the whole site — use Page Revisions and Sitewide Backups instead. See Backups & Page Revisions. The two systems are complementary: draft recovery is the everyday "don't lose what I'm typing" net; backups and revisions are the durable history of what's been saved.

Where this lives in the code

  • Field drafts — _persistFieldDraft() / _loadFieldDraft() in resources/js/editor/editor-state.js, keyed per file in localStorage (editor_field_draft.{file}). The closing-tab flush is wired in resources/js/manager.js (beforeunload).
  • Structural drafts — persistRowDraft() / loadRowDraft() / clearRowDraft() and the dehydrate() auto-persist hook in ⚡editor.blade.php, stored in the session under editor_row_drafts.{md5(file)} with a captured sourceMtime for conflict detection.