fix paste

This commit is contained in:
zhandouxiaojiji committed 2023-11-25 15:51:17 +08:00
1 parent ab2c265f03
commit 4297fb63bb
1 file changed
+2 -2
+2 -2
View File
@@ -428,19 +428,19 @@ export default class Editor extends React.Component<EditorProps, EditorState> {
if (!str || str == "") { if (!str || str == "") {
return; return;
} }
this.pushUndoStack();
const data = Utils.createTreeData(JSON.parse(str), this.settings); const data = Utils.createTreeData(JSON.parse(str), this.settings);
this.autoId = Utils.refreshNodeId(data, this.autoId); this.autoId = Utils.refreshNodeId(data, this.autoId);
this.onSelectNode(null); this.onSelectNode(null);
if (!curNodeData.children) { if (!curNodeData.children) {
curNodeData.children = []; curNodeData.children = [];
} }
this.pushUndoStack();
curNodeData.children.push(data); curNodeData.children.push(data);
// this.autoId = Utils.refreshNodeId(this.graph.findDataById("1") as GraphNodeModel); // this.autoId = Utils.refreshNodeId(this.graph.findDataById("1") as GraphNodeModel);
this.changeWithoutAnim(); this.changeWithoutAnim();
} catch (error) { } catch (error) {
// message.error("粘贴数据有误"); // message.error("粘贴数据有误");
console.log("paste error"); console.log(error);
} }
} }