added keyboard shortcut for toggling the right pane, closes #4552

This commit is contained in:
zadam 2024-01-28 08:58:40 +01:00
parent c6df25ece8
commit 6b58e59819
4 changed files with 20 additions and 0 deletions

View File

@ -8,10 +8,13 @@ export default class RightPaneContainer extends FlexContainer {
this.id('right-pane'); this.id('right-pane');
this.css('height', '100%'); this.css('height', '100%');
this.collapsible(); this.collapsible();
this.rightPaneHidden = false;
} }
isEnabled() { isEnabled() {
return super.isEnabled() return super.isEnabled()
&& !this.rightPaneHidden
&& this.children.length > 0 && this.children.length > 0
&& !!this.children.find(ch => ch.isEnabled() && ch.canBeShown()); && !!this.children.find(ch => ch.isEnabled() && ch.canBeShown());
} }
@ -44,4 +47,10 @@ export default class RightPaneContainer extends FlexContainer {
splitService.setupRightPaneResizer(); splitService.setupRightPaneResizer();
} }
} }
toggleRightPaneEvent() {
this.rightPaneHidden = !this.rightPaneHidden;
this.reEvaluateRightPaneVisibilityCommand();
}
} }

View File

@ -18,6 +18,8 @@ const TPL = `
<h5>Highlights List visibility</h5> <h5>Highlights List visibility</h5>
<p>You can hide the highlights widget per-note by adding a <code>#hideHighlightWidget</code> label.</p> <p>You can hide the highlights widget per-note by adding a <code>#hideHighlightWidget</code> label.</p>
<p>You can configure a keyboard shortcut for quickly toggling the right pane (including Highlights) in the Options -> Shortcuts (name "toggleRightPane").</p>
</div>`; </div>`;
export default class HighlightsListOptions extends OptionsWidget { export default class HighlightsListOptions extends OptionsWidget {

View File

@ -11,6 +11,8 @@ const TPL = `
</div> </div>
<p>You can also use this option to effectively disable TOC by setting a very high number.</p> <p>You can also use this option to effectively disable TOC by setting a very high number.</p>
<p>You can configure a keyboard shortcut for quickly toggling the right pane (including TOC) in the Options -> Shortcuts (name "toggleRightPane").</p>
</div>`; </div>`;
export default class TableOfContentsOptions extends OptionsWidget { export default class TableOfContentsOptions extends OptionsWidget {

View File

@ -494,9 +494,16 @@ const DEFAULT_KEYBOARD_ACTIONS = [
separator: "Other" separator: "Other"
}, },
{
actionName: "toggleRightPane",
defaultShortcuts: [],
description: "Toggle the display of the right pane, which includes Table of Contents and Highlights",
scope: "window"
},
{ {
actionName: "printActiveNote", actionName: "printActiveNote",
defaultShortcuts: [], defaultShortcuts: [],
description: "Print active note",
scope: "window" scope: "window"
}, },
{ {