feat(editor): 添加插件多语言支持

This commit is contained in:
YHH
2025-10-28 17:19:28 +08:00
parent fb4316aeb9
commit fc042bb7d9
9 changed files with 441 additions and 58 deletions

View File

@@ -179,9 +179,29 @@ export class EditorPluginManager extends PluginManager {
/**
* 获取所有插件元数据
*
* 实时从插件实例获取 displayName 和 description以支持多语言切换
*/
public getAllPluginMetadata(): IEditorPluginMetadata[] {
return Array.from(this.pluginMetadata.values());
const metadataList: IEditorPluginMetadata[] = [];
for (const [name, metadata] of this.pluginMetadata.entries()) {
const plugin = this.editorPlugins.get(name);
// 如果插件实例存在,使用实时的 displayName 和 description
if (plugin) {
metadataList.push({
...metadata,
displayName: plugin.displayName,
description: plugin.description
});
} else {
// 回退到缓存的元数据
metadataList.push(metadata);
}
}
return metadataList;
}
/**

View File

@@ -121,6 +121,16 @@ export interface IEditorPlugin extends IPlugin {
* 文件保存后回调
*/
onAfterSave?(filePath: string): void | Promise<void>;
/**
* 设置插件语言
*/
setLocale?(locale: string): void;
/**
* 获取行为树节点模板
*/
getNodeTemplates?(): any[];
}
/**