From d8e21274c5d56dda87a8805832008254c64c4d73 Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Sat, 28 Oct 2023 08:56:51 +0200 Subject: [PATCH] clear button --- .../lib/components/remix-ui-xterminals.tsx | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx index cf43cdc51b..c14203b4f1 100644 --- a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx +++ b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx @@ -3,8 +3,9 @@ import { ElectronPlugin } from '@remixproject/engine-electron' import RemixUiXterm from './remix-ui-xterm' import '../css/index.css' import { Button, ButtonGroup, Dropdown, Tab, Tabs } from 'react-bootstrap' -import { CustomIconsToggle } from '@remix-ui/helper' +import { CustomTooltip } from '@remix-ui/helper' import { RemixUiTerminal } from '@remix-ui/terminal' +import { FormattedMessage } from 'react-intl' export interface RemixUiXterminalsProps { plugin: ElectronPlugin onReady: (api: any) => void @@ -64,7 +65,7 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => { }] }) }) - + plugin.on('fs', 'workingDirChanged', (path: string) => { setWorkingDir(path) @@ -174,6 +175,11 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => { if (terminals.length === 0) createTerminal() } + const clearTerminal = () => { + const terminal = terminals.find(xtermState => xtermState.hidden === false) + if (terminal && terminal.ref && terminal.ref.terminal) + terminal.ref.terminal.clear() + } return (<> @@ -186,7 +192,16 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
- + + @@ -197,7 +212,11 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => { })} - +