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

View file

@ -18,6 +18,8 @@ const TPL = `
<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 configure a keyboard shortcut for quickly toggling the right pane (including Highlights) in the Options -> Shortcuts (name "toggleRightPane").</p>
</div>`;
export default class HighlightsListOptions extends OptionsWidget {

View file

@ -11,6 +11,8 @@ const TPL = `
</div>
<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>`;
export default class TableOfContentsOptions extends OptionsWidget {

View file

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