Create, edit and preview content on the same page.

Same Page Preview upgrades the Preview button so content editors can see what they're editing, and how it will look, without leaving the form.

Wouldn't it be nice to see a preview of what you're editing, while you're editing it? Like this?

Same Page Preview shows an article title and body editor on the left and its themed preview with the same unsaved headline, herb photo and formatted text on the right.

Edit your content and see the result beside the form, before saving. Click the screenshot for the full-size view.
Photo: Keith Jay, Drupal Umami demonstration content, CC BY-SA 4.0.

Version 3.0 is here

Same Page Preview 3.0.0 is the first stable release for Drupal 11. It brings together the work from five release candidates:

  • Preview while you edit. See new nodes and incomplete drafts beside the form. Normal validation still applies when you save.
  • Stays in sync. The selected view mode is kept across refreshes, form rebuilds and new-window previews. The preview refreshes after Paragraphs and drag-and-drop reordering, and shows loading feedback while it updates.
  • Accessible by design. Includes full keyboard access, a skip-to-preview link, named landmarks, current frame titles, focus return, and a spoken "Preview closed" message. It was tested with NVDA on Windows.
  • Site-wide control. Set display defaults, hide the Settings button, and limit which view modes editors can preview. Each content type's preview settings are respected, including core's "Preview before submitting" setting.
  • Works with your stack. Coexists with Domain Source, Responsive Preview and Site Studio. It works in narrow, full-screen and right-to-left layouts, and when browser storage is blocked.

Version 3 requires Drupal 11.2 or newer and PHP 8.3 or newer. Drupal 10 sites should stay on the 2.1.x release line. Install with composer require 'drupal/same_page_preview:^3.0', then run drush updb and drush cr. Custom code that calls the old procedural hooks must move to the object-oriented hooks in src/Hook/SamePagePreviewHooks.php.

2.x end of life

Drupal 10 reaches end of life on December 9, 2026. Same Page Preview 2.x supports only Drupal 10, so support for 2.x ends on the same day. After December 9, 2026, 2.x will receive no further releases, including security fixes. Plan to upgrade to Drupal 11 and Same Page Preview 3.x before then.

Coming in 4.0

Development of 4.0 is underway on the 4.0.x branch:

  • HTMX. Preview requests use Drupal core's HTMX integration instead of the AJAX API, to prepare for HTMX 4 and Drupal 12 (#3619936). 4.0 will require Drupal 11.3 or newer.
  • Live Site Studio Layout Canvas preview. The preview refreshes automatically when a Layout Canvas changes, and unsaved canvases are compiled for the first preview (#3619942).

Other planned work includes a Settings popover (#3619937), preview zoom (#3453208), device-width presets (#3345991), and VoiceOver/Safari testing. An alpha release will be announced here. Until 4.0 is stable, use 3.0.x on production sites.

Backstory

During Florida DrupalCamp 2023, we got together to discuss a "Live Preview" feature. After reviewing what Drupal already offered, we found some low-hanging fruit in the Preview system: display previews on the same page as the edit form.

We released our first alpha of Same Page Preview on March 29, 2023. Version 3.0 is the result of that work.

Way we work

Team members work through issues in the #preview channel on Drupal Slack. We're a group of volunteers who are excited about this idea. We try to meet every other Wednesday at 4:00 PM Coordinated Universal Time (UTC) to report on a sprint's worth of work and plan strategy.

We use this issue queue to report bugs, build features, and record our plans and strategy. Please jump in and help us shape what preview in Drupal should become.

AttachmentSize
same_page_preview.png429.89 KB

Project information

Releases