fix: fieldId 重置bug

This commit is contained in:
mario.gk 2020-08-23 13:14:01 +08:00
parent 488a5d8283
commit 31215da05b

View File

@ -26,8 +26,9 @@ export const designer = new Designer({ editor: editor });
editor.set(Designer, designer); editor.set(Designer, designer);
editor.set('designer', designer); editor.set('designer', designer);
const nodeCache: any = {}; let nodeCache: any = {};
designer.project.onCurrentDocumentChange((doc) => { designer.project.onCurrentDocumentChange((doc) => {
nodeCache = {};
doc.nodesMap.forEach((node) => { doc.nodesMap.forEach((node) => {
nodeCache[node.id] = node; nodeCache[node.id] = node;
}); });
@ -97,6 +98,9 @@ designer.addPropsReducer((props, node) => {
if (newProps.fieldId) { if (newProps.fieldId) {
const fieldIds: any = []; const fieldIds: any = [];
Object.keys(nodeCache).forEach(nodeId => { Object.keys(nodeCache).forEach(nodeId => {
if (nodeId === node.id) {
return;
}
const fieldId = nodeCache[nodeId].getPropValue('fieldId'); const fieldId = nodeCache[nodeId].getPropValue('fieldId');
if (fieldId) { if (fieldId) {
fieldIds.push(fieldId); fieldIds.push(fieldId);