Add Clear command to terminal context menu

Fixes pybricks/support#103
This commit is contained in:
David Lechner
2020-07-17 20:40:00 -05:00
committed by David Lechner
parent 5c3727b3ce
commit 68021545c5
3 changed files with 10 additions and 2 deletions
+7 -1
View File
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 The Pybricks Authors
import { Menu, MenuItem, ResizeSensor } from '@blueprintjs/core';
import { Menu, MenuDivider, MenuItem, ResizeSensor } from '@blueprintjs/core';
// importing this way due to https://github.com/palantir/blueprint/issues/3891
import { ContextMenuTarget } from '@blueprintjs/core/lib/esnext/components/context-menu/contextMenuTarget';
import { WithI18nProps, withI18n } from '@shopify/react-i18n';
@@ -127,6 +127,12 @@ class Terminal extends React.Component<TerminalProps> {
icon="clipboard"
label={/mac/i.test(navigator.platform) ? 'Cmd-V' : 'Ctrl-Shift-V'}
/>
<MenuDivider />
<MenuItem
onClick={(): void => this.xterm.clear()}
text={i18n.translate(TerminalStringId.Clear)}
icon="trash"
/>
</Menu>
);
}
+2 -1
View File
@@ -1,6 +1,7 @@
{
"terminal": {
"copy": "Copy",
"paste": "Paste"
"paste": "Paste",
"clear": "Clear"
}
}
+1
View File
@@ -6,4 +6,5 @@
export enum TerminalStringId {
Copy = 'terminal.copy',
Paste = 'terminal.paste',
Clear = 'terminal.clear',
}