Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
1a44aa56
Unverified
Commit
1a44aa56
authored
May 21, 2021
by
bunsenstraat
Committed by
GitHub
May 21, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1210 from ethereum/bunsenstraat-patch-1
terminal2
parents
d471d048
93128aa9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
terminal.js
apps/remix-ide/src/app/panels/terminal.js
+33
-2
No files found.
apps/remix-ide/src/app/panels/terminal.js
View file @
1a44aa56
/* global Node, requestAnimationFrame */
/* global Node, requestAnimationFrame */
import
{
Plugin
}
from
'@remixproject/engine'
import
{
Plugin
}
from
'@remixproject/engine'
import
*
as
packageJson
from
'../../../../../package.json'
import
*
as
packageJson
from
'../../../../../package.json'
import
*
as
remixBleach
from
'../../lib/remixBleach'
var
yo
=
require
(
'yo-yo'
)
var
yo
=
require
(
'yo-yo'
)
var
javascriptserialize
=
require
(
'javascript-serialize'
)
var
javascriptserialize
=
require
(
'javascript-serialize'
)
...
@@ -26,7 +27,7 @@ var ghostbar = yo`<div class=${css.ghostbar} bg-secondary></div>`
...
@@ -26,7 +27,7 @@ var ghostbar = yo`<div class=${css.ghostbar} bg-secondary></div>`
const
profile
=
{
const
profile
=
{
displayName
:
'Terminal'
,
displayName
:
'Terminal'
,
name
:
'terminal'
,
name
:
'terminal'
,
methods
:
[],
methods
:
[
'log'
],
events
:
[],
events
:
[],
description
:
' - '
,
description
:
' - '
,
version
:
packageJson
.
version
version
:
packageJson
.
version
...
@@ -113,6 +114,32 @@ class Terminal extends Plugin {
...
@@ -113,6 +114,32 @@ class Terminal extends Plugin {
this
.
off
(
'scriptRunner'
,
'error'
)
this
.
off
(
'scriptRunner'
,
'error'
)
}
}
log
(
message
)
{
var
command
=
this
.
commands
[
message
.
type
]
if
(
typeof
command
===
'function'
)
{
if
(
typeof
message
.
value
===
'string'
&&
message
.
type
===
'html'
)
{
var
el
=
document
.
createElement
(
'div'
)
el
.
innerHTML
=
remixBleach
.
sanitize
(
message
.
value
,
{
list
:
[
'a'
,
'b'
,
'p'
,
'em'
,
'strong'
,
'div'
,
'span'
,
'ul'
,
'li'
,
'ol'
,
'hr'
]
})
message
.
value
=
el
}
command
(
message
.
value
)
};
}
logHtml
(
html
)
{
logHtml
(
html
)
{
var
command
=
this
.
commands
.
html
var
command
=
this
.
commands
.
html
if
(
typeof
command
===
'function'
)
command
(
html
)
if
(
typeof
command
===
'function'
)
command
(
html
)
...
@@ -653,7 +680,11 @@ class Terminal extends Plugin {
...
@@ -653,7 +680,11 @@ class Terminal extends Plugin {
return
function
logger
(
args
,
scopedCommands
,
append
)
{
return
function
logger
(
args
,
scopedCommands
,
append
)
{
var
types
=
args
.
filter
(
filterUndefined
).
map
(
type
)
var
types
=
args
.
filter
(
filterUndefined
).
map
(
type
)
var
values
=
javascriptserialize
.
apply
(
null
,
args
.
filter
(
filterUndefined
)).
map
(
function
(
val
,
idx
)
{
var
values
=
javascriptserialize
.
apply
(
null
,
args
.
filter
(
filterUndefined
)).
map
(
function
(
val
,
idx
)
{
if
(
typeof
args
[
idx
]
===
'string'
)
val
=
args
[
idx
]
if
(
typeof
args
[
idx
]
===
'string'
)
{
const
el
=
document
.
createElement
(
'div'
)
el
.
innerHTML
=
args
[
idx
].
replace
(
/
(\r\n
|
\n
|
\r)
/gm
,
'<br>'
)
val
=
el
.
children
.
length
===
0
?
el
.
firstChild
:
el
}
if
(
types
[
idx
]
===
'element'
)
val
=
jsbeautify
.
html
(
val
)
if
(
types
[
idx
]
===
'element'
)
val
=
jsbeautify
.
html
(
val
)
return
val
return
val
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment