|
|
@ -44,7 +44,8 @@ export interface RemixUiTerminalProps { |
|
|
|
registry: any, |
|
|
|
registry: any, |
|
|
|
commands: any, |
|
|
|
commands: any, |
|
|
|
txListener: any, |
|
|
|
txListener: any, |
|
|
|
eventsDecoder: any |
|
|
|
eventsDecoder: any, |
|
|
|
|
|
|
|
logHtml: any |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export interface ClipboardEvent<T = Element> extends SyntheticEvent<T, any> { |
|
|
|
export interface ClipboardEvent<T = Element> extends SyntheticEvent<T, any> { |
|
|
@ -102,6 +103,11 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
messagesEndRef.current.scrollIntoView({ behavior: 'smooth' }) |
|
|
|
messagesEndRef.current.scrollIntoView({ behavior: 'smooth' }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
scriptRunnerDispatch({ type: 'html', payload: { message: props.logHtml } }) |
|
|
|
|
|
|
|
}, [props.logHtml]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log({ logHtml: props.logHtml }) |
|
|
|
// events
|
|
|
|
// events
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
initListeningOnNetwork(props, scriptRunnerDispatch) |
|
|
|
initListeningOnNetwork(props, scriptRunnerDispatch) |
|
|
@ -109,7 +115,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
registerInfoScriptRunnerAction(props.thisState, 'info', newstate.commands, scriptRunnerDispatch) |
|
|
|
registerInfoScriptRunnerAction(props.thisState, 'info', newstate.commands, scriptRunnerDispatch) |
|
|
|
registerWarnScriptRunnerAction(props.thisState, 'warn', newstate.commands, scriptRunnerDispatch) |
|
|
|
registerWarnScriptRunnerAction(props.thisState, 'warn', newstate.commands, scriptRunnerDispatch) |
|
|
|
registerErrorScriptRunnerAction(props.thisState, 'error', newstate.commands, scriptRunnerDispatch) |
|
|
|
registerErrorScriptRunnerAction(props.thisState, 'error', newstate.commands, scriptRunnerDispatch) |
|
|
|
|
|
|
|
|
|
|
|
registerCommandAction('html', _blocksRenderer('html'), { activate: true }, dispatch) |
|
|
|
registerCommandAction('html', _blocksRenderer('html'), { activate: true }, dispatch) |
|
|
|
registerCommandAction('log', _blocksRenderer('log'), { activate: true }, dispatch) |
|
|
|
registerCommandAction('log', _blocksRenderer('log'), { activate: true }, dispatch) |
|
|
|
registerCommandAction('info', _blocksRenderer('info'), { activate: true }, dispatch) |
|
|
|
registerCommandAction('info', _blocksRenderer('info'), { activate: true }, dispatch) |
|
|
@ -118,12 +123,13 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
|
|
|
|
|
|
|
|
registerCommandAction('script', function execute (args, scopedCommands, append) { |
|
|
|
registerCommandAction('script', function execute (args, scopedCommands, append) { |
|
|
|
var script = String(args[0]) |
|
|
|
var script = String(args[0]) |
|
|
|
|
|
|
|
console.log({ script }, 'script') |
|
|
|
_shell(script, scopedCommands, function (error, output) { |
|
|
|
_shell(script, scopedCommands, function (error, output) { |
|
|
|
if (error) scriptRunnerDispatch({ type: 'error', payload: { message: error } }) |
|
|
|
if (error) scriptRunnerDispatch({ type: 'error', payload: { message: error } }) |
|
|
|
if (output) scriptRunnerDispatch({ type: 'script', payload: { message: '5' } }) |
|
|
|
if (output) scriptRunnerDispatch({ type: 'script', payload: { message: '5' } }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, { activate: true }, dispatch) |
|
|
|
}, { activate: true }, dispatch) |
|
|
|
}, [props.thisState.autoCompletePopup, autoCompletState.text]) |
|
|
|
}, [props.thisState.autoCompletePopup, autoCompletState.text, props.logHtml]) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
scrollToBottom() |
|
|
|
scrollToBottom() |
|
|
@ -870,15 +876,15 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { |
|
|
|
{ |
|
|
|
{ |
|
|
|
handleAutoComplete() |
|
|
|
handleAutoComplete() |
|
|
|
} |
|
|
|
} |
|
|
|
<div data-id="terminalContainerDisplay" style = {{ |
|
|
|
<div data-id='terminalContainerDisplay' style = {{ |
|
|
|
position: 'absolute', |
|
|
|
position: 'absolute', |
|
|
|
height: '100', |
|
|
|
height: '100%', |
|
|
|
width: '100', |
|
|
|
width: '100%', |
|
|
|
opacity: '0.1', |
|
|
|
opacity: '0.1', |
|
|
|
zIndex: -1 |
|
|
|
zIndex: -1 |
|
|
|
}}></div> |
|
|
|
}}></div> |
|
|
|
<div className="terminal"> |
|
|
|
<div className="terminal"> |
|
|
|
<div id="journal" className="journal" data-id="terminalJournal"> |
|
|
|
<div id='journal' className='journal' data-id='terminalJournal'> |
|
|
|
{!clearConsole && <TerminalWelcomeMessage packageJson={props.version}/>} |
|
|
|
{!clearConsole && <TerminalWelcomeMessage packageJson={props.version}/>} |
|
|
|
{newstate.journalBlocks && newstate.journalBlocks.map((x, index) => { |
|
|
|
{newstate.journalBlocks && newstate.journalBlocks.map((x, index) => { |
|
|
|
if (x.name === 'emptyBlock') { |
|
|
|
if (x.name === 'emptyBlock') { |
|
|
|