重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
umbraco-property-value-preset by umbraco/umbraco-cms-backoffice-skills
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-property-value-preset属性值预设功能在用户创建新内容时提供默认值。它通过 API 为特定的属性编辑器提供预设值,从而实现使用合理的默认值来简化内容创建流程。多个预设可以通过 weight 属性协同工作,逐步修改值。
在实现之前,请务必获取最新的文档:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import type { ManifestPropertyValuePreset } from '@umbraco-cms/backoffice/extension-registry';
const manifest: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.DefaultText',
name: 'Default Text Preset',
api: () => import('./default-text-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
export const manifests = [manifest];
import type { UmbPropertyValuePresetApi } from '@umbraco-cms/backoffice/property';
export class DefaultTextPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
// 如果值不存在,则返回默认值
return value ? value : 'Default text value';
}
destroy() {
// 如果需要,进行清理
}
}
export default DefaultTextPreset;
import type { UmbPropertyValuePresetApi, UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property';
export class DynamicPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: UmbPropertyEditorConfigCollection): Promise<unknown> {
if (value) return value;
// 使用配置来确定默认值
const defaultFromConfig = config?.getValueByAlias('defaultValue');
return defaultFromConfig || 'Fallback default';
}
destroy() {}
}
export default DynamicPreset;
import type { UmbPropertyValuePresetApi } from '@umbraco-cms/backoffice/property';
export class ApiPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
if (value) return value;
// 从服务器获取默认值
const response = await fetch('/api/defaults/text');
const data = await response.json();
return data.defaultValue;
}
destroy() {}
}
export default ApiPreset;
const manifest: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.JsonDefault',
name: 'JSON Default Preset',
api: () => import('./json-preset.js'),
forPropertyEditorSchemaAlias: 'Umbraco.Plain.Json', // 指定 schema 而不是 UI
};
// 第一个预设(权重较低,首先运行)
const basePreset: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.Base',
name: 'Base Preset',
weight: 100,
api: () => import('./base-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
// 第二个预设(随后运行,可以修改基础值)
const enhancedPreset: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.Enhanced',
name: 'Enhanced Preset',
weight: 200,
api: () => import('./enhanced-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
export class TodayDatePreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
if (value) return value;
return new Date().toISOString().split('T')[0]; // 今天的日期
}
destroy() {}
}
export default TodayDatePreset;
就是这样!请务必获取最新的文档,保持示例简洁,生成完整可用的代码。
每周安装数
71
代码仓库
GitHub 星标数
14
首次出现
2026年2月4日
安全审计
安装于
github-copilot50
cursor24
opencode22
codex22
gemini-cli19
amp19
Property Value Presets provide default values when users create new content. They use an API to supply preset values for specific property editors, enabling streamlined content creation with sensible defaults. Multiple presets can work together using the weight property to progressively modify values.
Always fetch the latest docs before implementing:
import type { ManifestPropertyValuePreset } from '@umbraco-cms/backoffice/extension-registry';
const manifest: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.DefaultText',
name: 'Default Text Preset',
api: () => import('./default-text-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
export const manifests = [manifest];
import type { UmbPropertyValuePresetApi } from '@umbraco-cms/backoffice/property';
export class DefaultTextPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
// Return default if no value exists
return value ? value : 'Default text value';
}
destroy() {
// Cleanup if needed
}
}
export default DefaultTextPreset;
import type { UmbPropertyValuePresetApi, UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property';
export class DynamicPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: UmbPropertyEditorConfigCollection): Promise<unknown> {
if (value) return value;
// Use configuration to determine default
const defaultFromConfig = config?.getValueByAlias('defaultValue');
return defaultFromConfig || 'Fallback default';
}
destroy() {}
}
export default DynamicPreset;
import type { UmbPropertyValuePresetApi } from '@umbraco-cms/backoffice/property';
export class ApiPreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
if (value) return value;
// Fetch default from server
const response = await fetch('/api/defaults/text');
const data = await response.json();
return data.defaultValue;
}
destroy() {}
}
export default ApiPreset;
const manifest: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.JsonDefault',
name: 'JSON Default Preset',
api: () => import('./json-preset.js'),
forPropertyEditorSchemaAlias: 'Umbraco.Plain.Json', // Target schema instead of UI
};
// First preset (runs first due to lower weight)
const basePreset: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.Base',
name: 'Base Preset',
weight: 100,
api: () => import('./base-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
// Second preset (runs after, can modify base value)
const enhancedPreset: ManifestPropertyValuePreset = {
type: 'propertyValuePreset',
alias: 'My.PropertyValuePreset.Enhanced',
name: 'Enhanced Preset',
weight: 200,
api: () => import('./enhanced-preset.js'),
forPropertyEditorUiAlias: 'Umb.PropertyEditorUi.TextBox',
};
export class TodayDatePreset implements UmbPropertyValuePresetApi {
async processValue(value: unknown, config: unknown): Promise<unknown> {
if (value) return value;
return new Date().toISOString().split('T')[0]; // Today's date
}
destroy() {}
}
export default TodayDatePreset;
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Weekly Installs
71
Repository
GitHub Stars
14
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
github-copilot50
cursor24
opencode22
codex22
gemini-cli19
amp19
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
122,000 周安装
Electrobun 最佳实践:TypeScript + Bun 跨平台桌面应用开发指南
112 周安装
Microsoft Teams自动化指南:通过Rube MCP实现频道消息、聊天与会议管理
72 周安装
通过Rube MCP实现Make自动化:集成Composio工具包管理场景与操作
72 周安装
ActiveCampaign自动化集成指南:通过Rube MCP实现CRM与营销自动化
72 周安装
Capacitor推送通知插件教程:iOS/Android集成Firebase与APNs实现推送
84 周安装
Supabase 后端架构优化指南:数据库模式、行级安全与边缘函数实战
73 周安装