small refactorings and fixes

This commit is contained in:
zadam
2023-06-29 23:32:19 +02:00
parent 48029cea7c
commit eb34f9c64f
45 changed files with 78 additions and 188 deletions

View File

@@ -84,15 +84,11 @@ export default class TocWidget extends RightPanelWidget {
}
async refreshWithNote(note) {
/*The reason for adding tocPreviousVisible is to record whether the previous state of the toc is hidden or displayed,
* and then let it be displayed/hidden at the initial time. If there is no such value,
* when the right panel needs to display highlighttext but not toc, every time the note content is changed,
/*The reason for adding tocPreviousVisible is to record whether the previous state of the toc is hidden or displayed,
* and then let it be displayed/hidden at the initial time. If there is no such value,
* when the right panel needs to display highlighttext but not toc, every time the note content is changed,
* toc will appear and then close immediately, because getToc(html) function will consume time*/
if (this.noteContext.viewScope.tocPreviousVisible ==true){
this.toggleInt(true);
}else{
this.toggleInt(false);
}
this.toggleInt(!!this.noteContext.viewScope.tocPreviousVisible);
const tocLabel = note.getLabel('toc');
@@ -112,10 +108,10 @@ export default class TocWidget extends RightPanelWidget {
this.$toc.html($toc);
if (["", "show"].includes(tocLabel?.value) || headingCount >= options.getInt('minTocHeadings')){
this.toggleInt(true);
this.noteContext.viewScope.tocPreviousVisible=true;
this.noteContext.viewScope.tocPreviousVisible=true;
}else{
this.toggleInt(false);
this.noteContext.viewScope.tocPreviousVisible=false;
this.noteContext.viewScope.tocPreviousVisible=false;
}
this.triggerCommand("reEvaluateRightPaneVisibility");