Skip to content

Commit

Permalink
feat:文档更新后再触发
Browse files Browse the repository at this point in the history
  • Loading branch information
songxingguo committed May 25, 2024
1 parent cd96e3a commit 330613d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/.vuepress/components/HtmlEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ const initEditor = (data) => {
javascript(), // 在extensions中配置语言
oneDark,
EditorView.updateListener.of((v) => {
const data = v.state.doc;
handleCodeChanged(data);
// 文档更新后再触发
if(v.docChanged) {
const data = v.state.doc;
handleCodeChanged(data);
}
}),
],
});
Expand Down

0 comments on commit 330613d

Please sign in to comment.