From 9579750dc16c5da46f0a0e89458cdb4ae643dced Mon Sep 17 00:00:00 2001 From: Liberty Date: Wed, 20 Sep 2023 14:58:51 +0800 Subject: [PATCH] perf: optimize drop logic and add id to inline child elements 1.Remove delete field operation as invalid 2.Add id to inline child element --- .../components/Layout/ControlInsertionPlugin.js | 10 +++++----- packages/formEditor/components/Layout/DragGable.jsx | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/formEditor/components/Layout/ControlInsertionPlugin.js b/packages/formEditor/components/Layout/ControlInsertionPlugin.js index 27536bc..4f694cf 100644 --- a/packages/formEditor/components/Layout/ControlInsertionPlugin.js +++ b/packages/formEditor/components/Layout/ControlInsertionPlugin.js @@ -328,11 +328,11 @@ function ControlInsertionPlugin (ER) { if (!isBlock) { if (oldEl.context) { oldEl.context.delete() - utils.deepTraversal(oldEl, (node) => { - if (utils.checkIsField(node)) { - ER.delField(node) - } - }) + // utils.deepTraversal(oldEl, (node) => { + // if (utils.checkIsField(node) && node.type !== 'subform') { + // ER.delField(node) + // } + // }) } } if (inserRowIndex !== '') { diff --git a/packages/formEditor/components/Layout/DragGable.jsx b/packages/formEditor/components/Layout/DragGable.jsx index 09c820d..cfdb9d3 100644 --- a/packages/formEditor/components/Layout/DragGable.jsx +++ b/packages/formEditor/components/Layout/DragGable.jsx @@ -156,7 +156,8 @@ export default defineComponent({ TypeComponent = load.findComponent('FormTypes', element.type) const params = { data: element, - parent: props.data + parent: props.data, + key: element.id } if (process.env.NODE_ENV === 'test') { params['data-field-id'] = `${element.id}`