feat: 实现可扩展的字段编辑器系统与专业资产选择器 (#227)

This commit is contained in:
YHH
2025-11-19 14:54:03 +08:00
committed by GitHub
parent caed5428d5
commit ecfef727c8
18 changed files with 1330 additions and 11 deletions

View File

@@ -0,0 +1,29 @@
import React from 'react';
import { IFieldEditor, FieldEditorProps } from '@esengine/editor-core';
import { AssetField } from '../../components/inspectors/fields/AssetField';
export class AssetFieldEditor implements IFieldEditor<string | null> {
readonly type = 'asset';
readonly name = 'Asset Field Editor';
readonly priority = 100;
canHandle(fieldType: string): boolean {
return fieldType === 'asset' || fieldType === 'assetReference' || fieldType === 'resourcePath';
}
render({ label, value, onChange, context }: FieldEditorProps<string | null>): React.ReactElement {
const fileExtension = context.metadata?.fileExtension || '';
const placeholder = context.metadata?.placeholder || '拖拽或选择资源文件';
return (
<AssetField
label={label}
value={value}
onChange={onChange}
fileExtension={fileExtension}
placeholder={placeholder}
readonly={context.readonly}
/>
);
}
}