Merged
Conversation
Contributor
There was a problem hiding this comment.
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. |
nielslyngsoe
approved these changes
May 1, 2025
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.
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