Skip to content

Conversation

@leekelleher
Copy link
Member

@leekelleher leekelleher commented Oct 6, 2025

Note

This pull request has been developed on top of #20021, with a view to merge this into that, to have a PR contain a single unified feature.

Description

Introduces a previewOption kind for the workspaceActionMenuItem extension-type. This will enable a 3rd-party implementation to define a custom preview option for their own target preview environment, (using a server-side registered IUrlProvider, see #20021 for further details).

The default "Save and preview" action has been refactored to make use of the new extension kind.

How to test?

Initially, test that the built-in "Save and preview" action/button still works as expected.

Next, try adding a custom previewOption extension kind...

{
	type: 'workspaceActionMenuItem',
	kind: 'previewOption',
	alias: 'My.Custom.PreviewOption',
	name: 'My Custom Preview Option',
	forWorkspaceActions: 'Umb.WorkspaceAction.Document.SaveAndPreview',
	weight: 101,
	meta: {
		icon: 'icon-umbraco',
		label: 'Preview.me',
		urlProviderAlias: 'MyUrlProvider',
	},
}

Notice that the custom preview option replaces the core "Save and preview" button (moving it an addition workspace-action-menu-item). This is configurable by the weighing, the core option is weighted at 100.

If the custom URL provider has not been registered on the server, then pressing the action in the result in an error, (the message is provided by the server).

With a custom IUrlProvider registered on the server, the target URL of the preview environment will be returned and a new tab/window will be opened for the user.

from Management API
Fixed TS errors

Added temp stub for `getPreviewUrl`
reworked using the "default" `previewOption` kind.
to a more suitable filename.

Exported element so can be reused in other packages,
e.g. documents, for the new "save and preview" feature.
to work with first action's manifest/API.
Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`.
This is to simplify the extension point and surrounding logic.
to extend `UmbWorkspaceActionElement`.

This did mean exposing certain methods/properties to be overridable.
@leekelleher leekelleher changed the title Preview URLs: Client-side urlProvider extension kind Preview URLs: Client-side previewOption extension kind Oct 7, 2025
@nielslyngsoe

This comment was marked as resolved.

@leekelleher leekelleher marked this pull request as ready for review October 7, 2025 07:30
@leekelleher leekelleher requested a review from iOvergaard October 7, 2025 07:31
@iOvergaard iOvergaard merged commit d00df79 into v17/feature/preview-urls Oct 7, 2025
3 of 4 checks passed
@iOvergaard iOvergaard deleted the v17/feature/preview-urls-client branch October 7, 2025 12:27
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.

4 participants