Skip to content

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

Merged
merged 12 commits into from
May 1, 2025
Merged

Preview segment #19203

merged 12 commits into from
May 1, 2025

Conversation

madsrasmussen
Copy link
Contributor

@madsrasmussen madsrasmussen commented Apr 30, 2025

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

@madsrasmussen madsrasmussen marked this pull request as ready for review May 1, 2025 08:13
@Copilot Copilot AI review requested due to automatic review settings May 1, 2025 08:13
Copy link
Contributor

@Copilot Copilot AI left a 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.

@madsrasmussen madsrasmussen requested a review from nielslyngsoe May 1, 2025 08:21
@nielslyngsoe nielslyngsoe merged commit a201bbd into release/16.0 May 1, 2025
22 of 23 checks passed
@nielslyngsoe nielslyngsoe deleted the v16/feature/preview-segment branch May 1, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants