Skip to content

Commit

Permalink
Merge pull request #27 from obgnail/dev
Browse files Browse the repository at this point in the history
提高性能
  • Loading branch information
obgnail authored Jul 25, 2023
2 parents d9fea75 + 580934d commit abae087
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions plugin/md_padding/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
const write = (filepath, content) => Package.Fs.writeFileSync(filepath, content);
const save = () => File.saveUseNode();
const reload = content => {
const scrollTop = document.querySelector("content").scrollTop;
File.reloadContent(content, {"fromDiskChange": true, "onInit": true})
document.querySelector("content").scrollTop = scrollTop;
// const scrollTop = document.querySelector("content").scrollTop;
File.reloadContent(content, {"fromDiskChange": false})
// document.querySelector("content").scrollTop = scrollTop;
};

const getFormatter = () => {
Expand Down
13 changes: 6 additions & 7 deletions plugin/multi_highlighter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,11 @@
ele => ele && ele.parentElement && ele.parentElement.removeChild(ele));
}

const reload = () => {
const scrollTop = document.querySelector("content").scrollTop;
const content = File.editor.getMarkdown();
File.reloadContent(content);
document.querySelector("content").scrollTop = scrollTop;
};
const refreshFences = () => {
for (let id in File.editor.fences.queue) {
File.editor.fences.queue[id].refresh();
}
}

const Call = () => {
modal.modal.style.display = "block";
Expand Down Expand Up @@ -326,7 +325,7 @@
document.querySelector("content").addEventListener("mousedown", ev => {
if (searcherList.length !== 0 && !ev.target.closest("#plugin-multi-highlighter")) {
clearHighlight();
reload();
refreshFences();
}
}, true)
}
Expand Down

0 comments on commit abae087

Please sign in to comment.