Skip to content

Add revision history to the editor - #377

Draft
priethor wants to merge 18 commits into
mainfrom
priethor/add/visual-revision-history
Draft

Add revision history to the editor#377
priethor wants to merge 18 commits into
mainfrom
priethor/add/visual-revision-history

Conversation

@priethor

Copy link
Copy Markdown
Collaborator

What

Closes #137.

Cortext now has a History panel in the editor. You can open it from the document toolbar or the sidebar row menu, preview an older version without editing it by accident, see what changed in the content and properties, and restore that version. When you restore, the version you were on is kept in history too.

How

  • Uses WordPress 7.0 revision support for document fields and layout data.
  • Saves the current document before applying an older revision.
  • Disables restore while the document has unsaved changes, is saving, or is still in Trash.

Testing Instructions

  1. Create or open a Cortext document.
  2. Save one version, then change the title, body, or properties and save again.
  3. Open History from the top bar.
  4. Select an older revision and confirm the editor switches to read-only preview mode.
  5. Turn on Show changes and check the content/property diff.
  6. Close the History panel and confirm you're back in the normal editor.
  7. Restore an older revision and confirm the previous current version is still listed in history.

@priethor
priethor force-pushed the priethor/add/visual-revision-history branch 2 times, most recently from 59f0233 to 2ba2d5f Compare June 26, 2026 15:39
@priethor
priethor force-pushed the priethor/add/visual-revision-history branch from 2ba2d5f to 19a814d Compare June 26, 2026 15:58
@priethor
priethor force-pushed the priethor/add/visual-revision-history branch from 19a814d to dcf9184 Compare June 26, 2026 16:07
priethor added 16 commits June 26, 2026 19:02
The Revision tab swapped the whole inspector frame for the properties diff,
which renders nothing when a document has no property fields, so pages and
collections opened an empty panel. The revision-aware icon and cover lookups
never ran either, since those controls only mount in the other branch.
Revisions stored before these metadata keys were revisioned carry no copy of
the icon, cover, collection schema or field values. Reading that silence as
"empty" cleared them on the live document. Revisions now carry a format
marker, and restoring an unmarked one applies the content and leaves every
metadata value alone.

Formulas are materialised output rather than authored input, so they are
skipped and recomputed from the values that land, the same way
apply_meta_updates does it. And wp_update_post no longer leaves its own
revision behind, which used to record restored content against pre-restore
metadata whenever the pre-restore snapshot found nothing to save.
Rows and backlinks are deliberately outside core-data, so receiving the
restored record never reached them and mounted views kept stale field
values, relations and link counts.

Also trims the revision cache invalidation to the one query anything
actually resolves, tells the user when a restore could only apply content,
and stops a failed restore from raising an unhandled rejection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add page revision history in the shell

1 participant