Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建节点后,产生了多余的操作记录 #572

Open
zcc0329 opened this issue Mar 19, 2024 · 1 comment
Open

创建节点后,产生了多余的操作记录 #572

zcc0329 opened this issue Mar 19, 2024 · 1 comment

Comments

@zcc0329
Copy link

zcc0329 commented Mar 19, 2024

从根节点创建节点后,发现操作记录(mindMap.command.history)数组中个数为3,对比第二条和第三条记录,第三条记录中新增了 resetRichText: false。猜测可能因此导致对比数据状态时不一致,然后添加了新的操作记录。我从您的在线演示网站上也发现了此问题

@zcc0329 zcc0329 changed the title 创建节点后,产生了多余的历史记录 创建节点后,产生了多余的操作记录 Mar 19, 2024
@zcc0329
Copy link
Author

zcc0329 commented Mar 19, 2024

function repairStore(node) {
// 仓库源码bug
if (node.isRoot) return; // 根节点
const nodeTree = mindMap.getData();
console.log("nodeTree", nodeTree, node.nodeData);
// 如果是第二层节点,添加resetRichText:false
// 如果是第三层节点,删除resetRichText属性

const isTwoLevelNode = nodeTree.children.some(
(curNode) => curNode.data.uid === node.nodeData.data.uid
);
if (isTwoLevelNode) {
node.nodeData.data.resetRichText = false;
} else {
delete node.nodeData.data.resetRichText;
}
}
暂时通过在node_active事件中,延时执行,去除影响操作记录的属性,就可以不用点击两次回退了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant