fix(amis-editor): 修复选择弹窗类型错误,弹窗path不正确导致页面初始化失败的问题 (#8746)

This commit is contained in:
ascend13 2023-11-15 16:03:11 +08:00 committed by GitHub
parent 5fd41298db
commit c71e19b53c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -227,8 +227,6 @@ export function makeWrapper(
return Wrapper as any; return Wrapper as any;
} }
// 将之前选择的弹窗和本次现有弹窗schema替换为$ref引用
/** /**
* schema替换为$ref引用 * schema替换为$ref引用
* @param schema * @param schema
@ -240,7 +238,7 @@ function replaceDialogtoRef(
dialogId: string, dialogId: string,
dialogRefsName: string dialogRefsName: string
) { ) {
let replacedSchema = null; let replacedSchema = schema;
const dialog = JSONGetById(schema, dialogId); const dialog = JSONGetById(schema, dialogId);
if (dialog) { if (dialog) {
replacedSchema = JSONUpdate(schema, dialogId, {$ref: dialogRefsName}, true); replacedSchema = JSONUpdate(schema, dialogId, {$ref: dialogRefsName}, true);
@ -512,7 +510,7 @@ function SchemaFrom({
// 添加弹窗事件后自动选中弹窗 // 添加弹窗事件后自动选中弹窗
if (store.activeDialogPath) { if (store.activeDialogPath) {
let activeId = store.getSchemaByPath( let activeId = store.getSchemaByPath(
store.activeDialogPath.split('/') store.activeDialogPath.split('/').filter(item => item !== '')
)?.$$id; )?.$$id;
activeId && store.setPreviewDialogId(activeId); activeId && store.setPreviewDialogId(activeId);
store.setActiveDialogPath(''); store.setActiveDialogPath('');

View File

@ -3300,7 +3300,7 @@ export const getEventControlConfig = (
// 选择现有弹窗后为了使之前的弹窗和现有弹窗$$id唯一这里重新生成一下 // 选择现有弹窗后为了使之前的弹窗和现有弹窗$$id唯一这里重新生成一下
let newDialogId = guid(); let newDialogId = guid();
action.actionType = dialogType; action.actionType = dialogType;
action.dialog = { action[dialogType] = {
$$id: newDialogId, $$id: newDialogId,
type: dialogType type: dialogType
}; };