getting response from scriptRunnser

pull/5370/head
davidzagi93@gmail.com 3 years ago
parent 0c73b10b83
commit aa5fe61758
  1. 24
      apps/remix-ide/src/app/panels/terminal.js
  2. 24
      libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx

@ -92,18 +92,18 @@ class Terminal extends Plugin {
} }
onActivation () { onActivation () {
this.on('scriptRunner', 'log', (msg) => { // this.on('scriptRunner', 'log', (msg) => {
this.commands.log.apply(this.commands, msg.data) // this.commands.log.apply(this.commands, msg.data)
}) // })
this.on('scriptRunner', 'info', (msg) => { // this.on('scriptRunner', 'info', (msg) => {
this.commands.info.apply(this.commands, msg.data) // this.commands.info.apply(this.commands, msg.data)
}) // })
this.on('scriptRunner', 'warn', (msg) => { // this.on('scriptRunner', 'warn', (msg) => {
this.commands.warn.apply(this.commands, msg.data) // this.commands.warn.apply(this.commands, msg.data)
}) // })
this.on('scriptRunner', 'error', (msg) => { // this.on('scriptRunner', 'error', (msg) => {
this.commands.error.apply(this.commands, msg.data) // this.commands.error.apply(this.commands, msg.data)
}) // })
this.renderComponent() this.renderComponent()
} }

@ -217,6 +217,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
// events // events
useEffect(() => { useEffect(() => {
registerLogScriptRunnerAction(props.thisState, 'log', newstate.commands, scriptRunnerDispatch)
registerInfoScriptRunnerAction(props.thisState, 'info', newstate.commands, scriptRunnerDispatch)
registerWarnScriptRunnerAction(props.thisState, 'warn', 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)
@ -234,6 +238,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
filterFnAction('warn', basicFilter, filterDispatch) filterFnAction('warn', basicFilter, filterDispatch)
filterFnAction('error', basicFilter, filterDispatch) filterFnAction('error', basicFilter, filterDispatch)
filterFnAction('script', basicFilter, filterDispatch) filterFnAction('script', basicFilter, filterDispatch)
registerLogScriptRunnerAction(props.thisState, 'log', newstate.commands, scriptRunnerDispatch)
registerInfoScriptRunnerAction(props.thisState, 'info', newstate.commands, scriptRunnerDispatch)
registerWarnScriptRunnerAction(props.thisState, 'warn', newstate.commands, scriptRunnerDispatch)
registerErrorScriptRunnerAction(props.thisState, 'error', newstate.commands, scriptRunnerDispatch)
// console.log({ htmlresullt }, { logresult }) // console.log({ htmlresullt }, { logresult })
// dispatch({ type: 'html', payload: { commands: htmlresullt.commands } }) // dispatch({ type: 'html', payload: { commands: htmlresullt.commands } })
// dispatch({ type: 'log', payload: { _commands: logresult._commands } }) // dispatch({ type: 'log', payload: { _commands: logresult._commands } })
@ -398,10 +406,26 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
/* end of mouse event */ /* end of mouse event */
useEffect(() => { useEffect(() => {
// document.addEventListener('mousemove', changeBg)
// function changeBg () {
// document.getElementById('dragId').style.backgroundColor = 'skyblue'
// }
// document.addEventListener('mouseup', changeBg2)
// function changeBg2 () {
// document.getElementById('dragId').style.backgroundColor = ''
// }
document.addEventListener('mousemove', onMouseMove) document.addEventListener('mousemove', onMouseMove)
document.addEventListener('mouseup', onMouseUp) document.addEventListener('mouseup', onMouseUp)
return () => { return () => {
// document.addEventListener('mousemove', changeBg)
// function changeBg () {
// document.getElementById('dragId').style.backgroundColor = 'skyblue'
// }
// document.addEventListener('mouseup', changeBg2)
// function changeBg2 () {
// document.getElementById('dragId').style.backgroundColor = ''
// }
document.removeEventListener('mousemove', onMouseMove) document.removeEventListener('mousemove', onMouseMove)
document.removeEventListener('mouseup', onMouseUp) document.removeEventListener('mouseup', onMouseUp)
} }

Loading…
Cancel
Save