[6.x] Add preview target links to the Inertia editor - #19404
Closed
brianjhanson wants to merge 1 commit into
Closed
Conversation
📚 Storybook previews@craftcms/ui — open Storybook No changed components detected in this Storybook. resources/js — |
brianjhanson
force-pushed
the
feature/inertia-edit-preview
branch
2 times, most recently
from
August 12, 2026 14:53
a525a27 to
6c644c8
Compare
brianjhanson
force-pushed
the
feature/inertia-edit-preview
branch
from
August 12, 2026 16:14
6c644c8 to
ce546d2
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 withgetParam(), 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) thatRouteTokenrejects outright.Live Preview itself is not included.
Craft.Previewis built around aCraft.ElementEditorinstance — 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.