Skip to content

Commit

Permalink
added keyboard shortcut for toggling the right pane, closes #4552
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Jan 28, 2024
1 parent c6df25e commit 6b58e59
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/public/app/widgets/containers/right_pane_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -44,4 +47,10 @@ export default class RightPaneContainer extends FlexContainer {
splitService.setupRightPaneResizer();
}
}

toggleRightPaneEvent() {
this.rightPaneHidden = !this.rightPaneHidden;

this.reEvaluateRightPaneVisibilityCommand();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions src/services/keyboard_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
{
Expand Down

0 comments on commit 6b58e59

Please sign in to comment.