fix: fieldId 重置需要限定在同一个 doc, 解决多 doc 时 fieldId 重复导致重置的问题

This commit is contained in:
力皓 2021-05-25 16:21:37 +08:00
parent 2acc70a422
commit 7d2bb4fa79
3 changed files with 4 additions and 4 deletions

View File

@ -233,7 +233,7 @@ export class Designer {
private _dropLocation?: DropLocation;
dropLocation() {
get dropLocation() {
return this._dropLocation;
}

View File

@ -14,10 +14,10 @@ export function initNodeReducer(props, node) {
...props,
};
if (newProps.fieldId) {
const fieldIds = getCurrentFieldIds();
const { doc, fieldIds } = getCurrentFieldIds();
// 全局的关闭 uniqueIdChecker 信号,在 ve-utils 中实现
if (fieldIds.indexOf(props.fieldId) >= 0 && !(window as any).__disable_unique_id_checker__) {
if (doc === node.document && fieldIds.indexOf(props.fieldId) >= 0 && !(window as any).__disable_unique_id_checker__) {
newProps.fieldId = undefined;
}
}

View File

@ -10,7 +10,7 @@ export function getCurrentFieldIds() {
fieldIds.push(fieldId);
}
});
return fieldIds;
return { doc: designer?.currentDocument, fieldIds };
}
export function invariant(check: any, message: string, thing?: any) {