Merge pull request #1283 from shakti97/sidebar-shortcut

Feature sidebar toggle shortcut
This commit is contained in:
Cassie Tarakajian 2020-04-09 16:39:15 -04:00 committed by GitHub
commit 4eda1654c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -74,6 +74,12 @@ function KeyboardShortcutModal() {
</span> </span>
<span>Turn off Accessible Output</span> <span>Turn off Accessible Output</span>
</li> </li>
<li className="keyboard-shortcut-item">
<span className="keyboard-shortcut__command">
{metaKeyName} + B
</span>
<span>Toggle Sidebar</span>
</li>
</ul> </ul>
); );
} }

View file

@ -156,6 +156,13 @@ class IDEView extends React.Component {
} else if (e.keyCode === 49 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac)) && e.shiftKey) { } else if (e.keyCode === 49 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac)) && e.shiftKey) {
e.preventDefault(); e.preventDefault();
this.props.setAllAccessibleOutput(true); this.props.setAllAccessibleOutput(true);
} else if (e.keyCode === 66 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) {
e.preventDefault();
if (!this.props.ide.sidebarIsExpanded) {
this.props.expandSidebar();
} else {
this.props.collapseSidebar();
}
} }
} }