Skip to content

[6.x] Add preview target links to the Inertia editor - #19404

Closed
brianjhanson wants to merge 1 commit into
feature/inertia-edit-action-menufrom
feature/inertia-edit-preview
Closed

[6.x] Add preview target links to the Inertia editor#19404
brianjhanson wants to merge 1 commit into
feature/inertia-edit-action-menufrom
feature/inertia-edit-preview

Conversation

@brianjhanson

@brianjhanson brianjhanson commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the View control to the Inertia editor, linking each of the element's preview targets at the front end.

The legacy editor mints preview tokens from JavaScript, juggling a token queue and rewriting hrefs once a token is live. Every input to that is known server-side, so the links arrive ready to follow instead: a live element points at its own URL, and anything not publicly visible — a draft, a disabled entry, a future post date — points at preview/create-token, which mints the token and redirects to the tokenized URL. The controller grants the matching session authorization, as the legacy screen did.

PreviewController::createToken() read its params from the request body only. Craft 5 read them with getParam(), i.e. query or body, which is what the View links depend on — they're plain GET hrefs. It now reads either, taking only the token's own keys, since a control panel URL carries others (site) that RouteToken rejects outright.

Live Preview itself is not included. Craft.Preview is built around a Craft.ElementEditor instance — it reads its settings, serializes its form, and asks it for tokenized URLs — and none of that exists on this screen. Wiring it up means writing an adapter that impersonates the legacy editor, which is worth doing deliberately rather than as a side effect of this change.

@brianjhanson brianjhanson changed the title Add preview target links to the Inertia editor [6.x] Add preview target links to the Inertia editor Aug 11, 2026
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/uiopen Storybook

No changed components detected in this Storybook.

resources/js⚠️ deploy failure, no preview available

@brianjhanson
brianjhanson force-pushed the feature/inertia-edit-preview branch 2 times, most recently from a525a27 to 6c644c8 Compare August 12, 2026 14:53
@brianjhanson

Copy link
Copy Markdown
Contributor Author

Superseded by #19425, which flattens this stack into a single PR against 6.x — this PR is one of its commits, description and all.

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.

1 participant