fix(amis-saas-9257): 修复快速构建修改配置未更新问题

Change-Id: I919169c2e90f71e459dbd41c55ad6615f33a5663
This commit is contained in:
wibetter 2023-01-10 18:25:07 +08:00
parent d90c41cd19
commit 4cb6cbf236
2 changed files with 17 additions and 7 deletions

View File

@ -1539,7 +1539,7 @@ export class EditorManager {
this.dnd.startDrag(id, e.nativeEvent);
}
async scaffold(form: ScaffoldForm, value: any): Promise<SchemaObject> {
async scaffold(form: any, value: any): Promise<SchemaObject> {
return new Promise(resolve => {
this.store.openScaffoldForm({
...form,
@ -1554,6 +1554,14 @@ export class EditorManager {
this.replaceChild(id, replaceWith);
}
async reScaffoldV2(id: string) {
const commonContext = this.buildEventContext(id);
const scaffoldForm = commonContext.info?.scaffoldForm;
const curSchema = commonContext.schema;
const replaceWith = await this.scaffold(scaffoldForm, curSchema);
this.replaceChild(id, replaceWith);
}
// 用来纠正一些错误的配置。
lazyPatchSchema = debounce(this.patchSchema.bind(this), 250, {
leading: false,

View File

@ -1176,12 +1176,14 @@ export abstract class BasePlugin implements PluginInterface {
iconSvg: 'harmmer',
tooltip: `快速构建「${info.plugin.name}`,
placement: 'bottom',
onClick: () =>
this.manager.reScaffold(
id,
info.scaffoldForm || plugin.scaffoldForm!,
schema
)
onClick: () => this.manager.reScaffoldV2(id)
/*
this.manager.reScaffold(
id,
info.scaffoldForm || plugin.scaffoldForm!,
schema
)
*/
});
}
}