Skip to content

Commit 4d64c8f

Browse files
authored
fix: 修复子编辑器修改丢失问题 (#11867)
1 parent b1bcbda commit 4d64c8f

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

Diff for: packages/amis-editor-core/src/store/editor.ts

+22-21
Original file line numberDiff line numberDiff line change
@@ -929,27 +929,7 @@ export const MainStore = types
929929

930930
get subEditorValue() {
931931
if (self.subEditorContext) {
932-
let subSchema = self.subEditorContext.slot
933-
? {
934-
...mapObject(self.subEditorContext.slot, function (value: any) {
935-
if (value === '$$') {
936-
return self.subEditorContext!.value;
937-
}
938-
939-
return value;
940-
}),
941-
isSlot: true
942-
}
943-
: self.subEditorContext.value;
944-
945-
if (!subSchema.definitions) {
946-
subSchema = {
947-
...subSchema,
948-
definitions: modalsToDefinitions(this.modals)
949-
};
950-
}
951-
952-
return subSchema;
932+
return self.subEditorContext.value;
953933
}
954934

955935
return undefined;
@@ -2029,8 +2009,29 @@ export const MainStore = types
20292009
return;
20302010
}
20312011

2012+
let subSchema = context.slot
2013+
? {
2014+
...mapObject(context.slot, function (value: any) {
2015+
if (value === '$$') {
2016+
return context.value;
2017+
}
2018+
2019+
return value;
2020+
}),
2021+
isSlot: true
2022+
}
2023+
: context.value;
2024+
2025+
if (!subSchema.definitions) {
2026+
subSchema = {
2027+
...subSchema,
2028+
definitions: modalsToDefinitions(self.modals)
2029+
};
2030+
}
2031+
20322032
self.subEditorContext = {
20332033
...context,
2034+
value: subSchema,
20342035
hostNode: self.getNodeById(activeId),
20352036
data: createObject(
20362037
self.ctx,

0 commit comments

Comments
 (0)