Skip to content

Commit

Permalink
Merge pull request #95 from GuoXiCheng/dev-c
Browse files Browse the repository at this point in the history
update MarMap
  • Loading branch information
GuoXiCheng authored Jul 12, 2024
2 parents a92c2d6 + 0b5c731 commit 0bf046c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/MarkMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ const createOrUpdateMarkmap = (markmapFormat) => {
}
markmapInstance = Markmap.create('#markmap', undefined, markmapFormat);
// 滚动到当前节点
document.querySelectorAll(".markmap-node").forEach((node) => {
node.addEventListener('click', (event) => {
setTimeout(() => {
const activeNode = document.querySelector('.is-active');
if (activeNode) {
activeNode.scrollIntoView({ behavior: 'auto', block: 'center' });
}
}, 500)
});
});
}
const convertMarkdown = (markdown) => {
Expand Down

0 comments on commit 0bf046c

Please sign in to comment.