1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Electron: Improve speed of loading notes that include many resources, and prevent UI from freezing

This commit is contained in:
Laurent Cozic 2018-06-29 18:51:50 +00:00
parent 70adf10f2e
commit d27cbaa663

View File

@ -711,8 +711,16 @@ class NoteTextComponent extends React.Component {
updateHtml(body = null) { updateHtml(body = null) {
const mdOptions = { const mdOptions = {
onResourceLoaded: () => { onResourceLoaded: () => {
this.updateHtml(); if (this.resourceLoadedTimeoutId_) {
this.forceUpdate(); clearTimeout(this.resourceLoadedTimeoutId_);
this.resourceLoadedTimeoutId_ = null;
}
this.resourceLoadedTimeoutId_ = setTimeout(() => {
this.resourceLoadedTimeoutId_ = null;
this.updateHtml();
this.forceUpdate();
}, 1000);
}, },
postMessageSyntax: 'ipcRenderer.sendToHost', postMessageSyntax: 'ipcRenderer.sendToHost',
}; };