-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Preview segment #19203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preview segment #19203
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR allows users to preview segmented documents by enabling a segment variant to be passed into the preview window and introducing an additional filter option alongside the existing culture filter. Key changes include:
- Updating the document workspace context to use a variant identifier (including culture and segment) when constructing the preview URL.
- Enhancing the preview context to correctly handle URL parameters for culture and segment, and preserving these values during iframe updates.
- Adding a new preview segment element and registering a corresponding preview segment app in the manifests.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts | Adjusts preview URL building to use the new variant ID for culture and segment handling. |
src/Umbraco.Web.UI.Client/src/apps/preview/preview.context.ts | Updates URL construction and iframe update logic to merge segment parameters properly. |
src/Umbraco.Web.UI.Client/src/apps/preview/apps/preview-segment.element.ts | Introduces a new UI element for segment switching in preview mode. |
src/Umbraco.Web.UI.Client/src/apps/preview/apps/manifests.ts | Registers the new preview segment app with an appropriate weight. |
This PR enables passing a segment variant to the preview window, allowing users to preview the segmented document. Additionally, it introduces an extra filter option alongside the culture filter, which enables users to change the segment during a preview session.
Notice: I have also updated the "open preview" window code to always open on the current host instead of redirecting to the server (https://github.com/umbraco/Umbraco-CMS/pull/19203/files#diff-a540acd68a5b18b1b2735a282949529301fd96161c150ace9592f73c0de572acR386). This allows us to use the preview feature in an SPA (ex: running with vite during development) and utilizes the SPA routing instead of relying on a preview route on the server.
Screen.Recording.2025-05-01.at.09.54.59.mov