diff --git a/packages/designer/src/designer/designer.ts b/packages/designer/src/designer/designer.ts index 7bee2289b..066e2a481 100644 --- a/packages/designer/src/designer/designer.ts +++ b/packages/designer/src/designer/designer.ts @@ -99,7 +99,7 @@ export class Designer { const { dragObject, copy } = e; const loc = this._dropLocation; if (loc) { - if (isLocationChildrenDetail(loc.detail)) { + if (isLocationChildrenDetail(loc.detail) && loc.detail.valid !== false) { let nodes: Node[] | undefined; if (isDragNodeObject(dragObject)) { nodes = insertChildren(loc.target, dragObject.nodes, loc.detail.index, copy); diff --git a/packages/designer/src/document/document-model.ts b/packages/designer/src/document/document-model.ts index e4442734f..fe7908500 100644 --- a/packages/designer/src/document/document-model.ts +++ b/packages/designer/src/document/document-model.ts @@ -41,7 +41,6 @@ export class DocumentModel { private seqId = 0; private _simulator?: ISimulatorHost; - /** * 模拟器 */ @@ -119,7 +118,6 @@ export class DocumentModel { // return this.addonsData[name]; // } - /** * 生成唯一id */ @@ -240,12 +238,12 @@ export class DocumentModel { node.remove(); } getAddonData(name: string) { - const addon = this.getNode(name) + const addon = this.getNode(name); if (addon) { // 无法确定是否有这个api // return addon.exportData(); } - return addon + return addon; } @obx.ref private _dropLocation: DropLocation | null = null; @@ -485,7 +483,8 @@ export class DocumentModel { // add toData toData() { - return { componentsTree: [this.project?.currentDocument?.export(TransformStage.Save)] }; + const node = this.project?.currentDocument?.export(TransformStage.Serilize); + return { componentsTree: [node] }; } getHistory(): History { diff --git a/packages/editor-skeleton/src/components/mixed-setter/index.tsx b/packages/editor-skeleton/src/components/mixed-setter/index.tsx index 1fa351670..6f5ddeeeb 100644 --- a/packages/editor-skeleton/src/components/mixed-setter/index.tsx +++ b/packages/editor-skeleton/src/components/mixed-setter/index.tsx @@ -142,19 +142,8 @@ export default class MixedSetter extends Component<{ // dirty fix vision variable setter logic private hasVariableSetter = this.setters.some((item) => item.name === 'VariableSetter'); - private getDefaultValueWhenUseSetter(oldUsed?: string): any { - if (this.used === 'I18nSetter') { - return { - type: 'i18n', - zh_CN: '', - en_US: '', - } - } - } - private useSetter = (name: string) => { const { field, onChange } = this.props; - const oldUsed = this.used; if (name === 'VariableSetter') { const setterComponent = getSetter('VariableSetter')?.component as any; if (setterComponent && setterComponent.isPopup) { @@ -167,10 +156,7 @@ export default class MixedSetter extends Component<{ } const setter = this.setters.find((item) => item.name === name); this.used = name; - const newValue = this.getDefaultValueWhenUseSetter(oldUsed); - if (newValue !== undefined) { - onChange && onChange(newValue); - } else if (setter) { + if (setter) { this.handleInitial(setter); } }; diff --git a/packages/vision-preset/src/bundle/upgrade-metadata.ts b/packages/vision-preset/src/bundle/upgrade-metadata.ts index af3646d1f..c734ff68d 100644 --- a/packages/vision-preset/src/bundle/upgrade-metadata.ts +++ b/packages/vision-preset/src/bundle/upgrade-metadata.ts @@ -370,14 +370,7 @@ export function upgradePropConfig(config: OldPropConfig, addInitial: AddIntial) }, ]; if (allowTextInput !== false) { - setters.unshift({ - componentName: 'I18nSetter', - title: { - 'type': 'i18n', - 'zh-CN': '国际化输入', - 'en-US': 'Internationalized Input' - }, - }); + setters.unshift('I18nSetter'); } if (supportVariable) { setters.push('VariableSetter');