umbraco-preview-app-provider by umbraco/umbraco-cms-backoffice-skills
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-preview-app-provider预览应用提供程序用于向 Umbraco 的预览窗口菜单中添加自定义项。当内容编辑者预览其内容时,这些应用会出现在预览菜单中,从而提供额外的功能,例如设备模拟、无障碍访问检查、SEO 分析或其他与预览相关的工具。
在实施前请务必获取最新文档:
Umbraco 元素 : 用于创建 UI 组件的基类
umbraco-umbraco-element上下文 API : 用于访问预览状态时
umbraco-context-api广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import type { ManifestPreviewAppProvider } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<ManifestPreviewAppProvider> = [
{
type: 'previewApp',
alias: 'My.PreviewApp',
name: 'My Preview App',
element: () => import('./my-preview-app.element.js'),
},
];
import { html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@customElement('my-preview-app')
export class MyPreviewAppElement extends UmbLitElement {
@state()
private _isActive = false;
override render() {
return html`
<uui-box headline="My Preview Tool">
<p>Custom preview functionality</p>
<uui-button
look=${this._isActive ? 'primary' : 'default'}
@click=${this.#toggle}
>
${this._isActive ? 'Disable' : 'Enable'}
</uui-button>
</uui-box>
`;
}
#toggle() {
this._isActive = !this._isActive;
// Apply your preview functionality
this.#applyPreviewMode(this._isActive);
}
#applyPreviewMode(active: boolean) {
// Access the preview iframe or apply styles
const previewFrame = document.querySelector('iframe.preview-frame');
if (previewFrame && active) {
// Apply custom preview mode
}
}
}
export default MyPreviewAppElement;
import { html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@customElement('device-preview-app')
export class DevicePreviewAppElement extends UmbLitElement {
@state()
private _selectedDevice = 'desktop';
private _devices = [
{ name: 'desktop', width: '100%', label: 'Desktop' },
{ name: 'tablet', width: '768px', label: 'Tablet' },
{ name: 'mobile', width: '375px', label: 'Mobile' },
];
override render() {
return html`
<uui-box headline="Device Preview">
${this._devices.map(
(device) => html`
<uui-button
look=${this._selectedDevice === device.name ? 'primary' : 'default'}
@click=${() => this.#selectDevice(device)}
>
${device.label}
</uui-button>
`
)}
</uui-box>
`;
}
#selectDevice(device: { name: string; width: string }) {
this._selectedDevice = device.name;
// Dispatch event to resize preview
this.dispatchEvent(
new CustomEvent('preview-resize', {
detail: { width: device.width },
bubbles: true,
composed: true,
})
);
}
}
export default DevicePreviewAppElement;
interface ManifestPreviewAppProvider extends ManifestElement {
type: 'previewApp';
}
就是这样!请务必获取最新文档,保持示例简洁,生成完整可用的代码。
每周安装数
75
代码仓库
GitHub 星标数
17
首次出现
2026年2月4日
安全审计
安装于
github-copilot55
cursor25
opencode23
codex23
gemini-cli21
amp21
Preview App Providers add custom items to the preview window menu in Umbraco. When content editors preview their content, these apps appear in the preview menu allowing additional functionality like device simulation, accessibility checks, SEO analysis, or other preview-related tools.
Always fetch the latest docs before implementing:
Umbraco Element : Base class for creating UI components
umbraco-umbraco-elementContext API : When accessing preview state
umbraco-context-apiimport type { ManifestPreviewAppProvider } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<ManifestPreviewAppProvider> = [
{
type: 'previewApp',
alias: 'My.PreviewApp',
name: 'My Preview App',
element: () => import('./my-preview-app.element.js'),
},
];
import { html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@customElement('my-preview-app')
export class MyPreviewAppElement extends UmbLitElement {
@state()
private _isActive = false;
override render() {
return html`
<uui-box headline="My Preview Tool">
<p>Custom preview functionality</p>
<uui-button
look=${this._isActive ? 'primary' : 'default'}
@click=${this.#toggle}
>
${this._isActive ? 'Disable' : 'Enable'}
</uui-button>
</uui-box>
`;
}
#toggle() {
this._isActive = !this._isActive;
// Apply your preview functionality
this.#applyPreviewMode(this._isActive);
}
#applyPreviewMode(active: boolean) {
// Access the preview iframe or apply styles
const previewFrame = document.querySelector('iframe.preview-frame');
if (previewFrame && active) {
// Apply custom preview mode
}
}
}
export default MyPreviewAppElement;
import { html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@customElement('device-preview-app')
export class DevicePreviewAppElement extends UmbLitElement {
@state()
private _selectedDevice = 'desktop';
private _devices = [
{ name: 'desktop', width: '100%', label: 'Desktop' },
{ name: 'tablet', width: '768px', label: 'Tablet' },
{ name: 'mobile', width: '375px', label: 'Mobile' },
];
override render() {
return html`
<uui-box headline="Device Preview">
${this._devices.map(
(device) => html`
<uui-button
look=${this._selectedDevice === device.name ? 'primary' : 'default'}
@click=${() => this.#selectDevice(device)}
>
${device.label}
</uui-button>
`
)}
</uui-box>
`;
}
#selectDevice(device: { name: string; width: string }) {
this._selectedDevice = device.name;
// Dispatch event to resize preview
this.dispatchEvent(
new CustomEvent('preview-resize', {
detail: { width: device.width },
bubbles: true,
composed: true,
})
);
}
}
export default DevicePreviewAppElement;
interface ManifestPreviewAppProvider extends ManifestElement {
type: 'previewApp';
}
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Weekly Installs
75
Repository
GitHub Stars
17
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
github-copilot55
cursor25
opencode23
codex23
gemini-cli21
amp21
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
TDD 迁移工具:自动化代码移植与重构,基于代理的并行测试驱动开发
238 周安装
参考SDK检查工具 - 快速查看Vercel AI、Anthropic、Zod等SDK实现代码
239 周安装
soul-self-evolution:AI 文档受控更新与回滚工具,自动化管理 SOUL.md 文件
235 周安装
飞书Claude机器人技能 - 集成Claude AI到飞书,提升团队协作效率
233 周安装
MiniMax图像理解与分析工具:使用MCP服务器实现AI图像识别与描述
240 周安装
规范驱动开发 (Spec-Driven Development) 完整指南:三阶段工作流、EARS格式与AI集成
236 周安装