mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 05:46:10 +01:00
Merge branch 'master' into next61
# Conflicts: # src/becca/entities/bnote.js # src/public/app/components/note_context.js # src/public/app/layouts/desktop_layout.js # src/public/app/services/note_content_renderer.js # src/public/app/services/utils.js # src/public/app/widgets/ribbon_widgets/file_properties.js # src/public/app/widgets/ribbon_widgets/note_info_widget.js # src/services/notes.js
This commit is contained in:
@@ -38,6 +38,10 @@ const TPL = `<div class="toc-widget">
|
||||
|
||||
.toc li {
|
||||
cursor: pointer;
|
||||
text-align: justify;
|
||||
text-justify: distribute;
|
||||
word-wrap: break-word;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
.toc li:hover {
|
||||
@@ -80,6 +84,16 @@ 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,
|
||||
* 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);
|
||||
}
|
||||
|
||||
const tocLabel = note.getLabel('toc');
|
||||
|
||||
if (tocLabel?.value === 'hide') {
|
||||
@@ -96,10 +110,13 @@ export default class TocWidget extends RightPanelWidget {
|
||||
}
|
||||
|
||||
this.$toc.html($toc);
|
||||
this.toggleInt(
|
||||
["", "show"].includes(tocLabel?.value)
|
||||
|| headingCount >= options.getInt('minTocHeadings')
|
||||
);
|
||||
if (["", "show"].includes(tocLabel?.value) || headingCount >= options.getInt('minTocHeadings')){
|
||||
this.toggleInt(true);
|
||||
this.noteContext.viewScope.tocPreviousVisible=true;
|
||||
}else{
|
||||
this.toggleInt(false);
|
||||
this.noteContext.viewScope.tocPreviousVisible=false;
|
||||
}
|
||||
|
||||
this.triggerCommand("reEvaluateRightPaneVisibility");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user