Skip to content

Commit c3a703f

Browse files
committed
app: Drop doc toggle shortkey.
This was an undocumented feature that gets in the way of other shortcuts, and doesn't extend well to the sideview being used for other things in future commits.
1 parent 2884825 commit c3a703f

2 files changed

Lines changed: 1 addition & 32 deletions

File tree

src/app/App.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import SponsorDialog from '../sponsor/SponsorDialog';
1616
import StatusBar from '../status-bar/StatusBar';
1717
import Toolbar from '../toolbar/Toolbar';
1818
import Tour from '../tour/Tour';
19-
import { isMacOS } from '../utils/os';
2019
import { docsDefaultPage } from './constants';
2120
import { useI18n } from './i18n';
2221

@@ -47,8 +46,6 @@ const Terminal = React.lazy(async () => {
4746
});
4847

4948
const Docs: React.FunctionComponent = () => {
50-
const { setIsSettingShowDocsEnabled } = useSettingIsShowDocsEnabled();
51-
5249
return (
5350
<iframe
5451
onLoad={(e) => {
@@ -59,23 +56,6 @@ const Docs: React.FunctionComponent = () => {
5956
return;
6057
}
6158

62-
// Override browser default key bindings in iframe.
63-
contentWindow.document.addEventListener('keydown', (e) => {
64-
// use Ctrl-D/Cmd-D to toggle docs
65-
if (
66-
(isMacOS()
67-
? e.metaKey && !e.ctrlKey
68-
: e.ctrlKey && !e.metaKey) &&
69-
!e.altKey &&
70-
e.key === 'd'
71-
) {
72-
e.preventDefault();
73-
// since the iframe is only visible when docs are shown
74-
// the only action is to hide the docs
75-
setIsSettingShowDocsEnabled(false);
76-
}
77-
});
78-
7959
if (document.body.classList.contains(Classes.DARK)) {
8060
contentWindow.document.documentElement.classList.add(Classes.DARK);
8161
}

src/editor/Editor.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: MIT
2-
// Copyright (c) 2020-2023 The Pybricks Authors
2+
// Copyright (c) 2020-2026 The Pybricks Authors
33

44
import './editor.scss';
55
import {
@@ -409,17 +409,6 @@ const Editor: React.FunctionComponent = () => {
409409
[i18n],
410410
);
411411

412-
useEditorAction(
413-
editor,
414-
() => ({
415-
id: 'pybricks.action.toggleDocs',
416-
label: i18n.translate('toggleDocs'),
417-
run: () => toggleIsSettingShowDocsEnabled(),
418-
keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyD],
419-
}),
420-
[i18n, toggleIsSettingShowDocsEnabled],
421-
);
422-
423412
useEditorAction(
424413
editor,
425414
() => ({

0 commit comments

Comments
 (0)