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
02714271
Commit
02714271
authored
Jul 19, 2021
by
davidzagi93@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed resizing of the terminal
parent
2bd05d70
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
34 deletions
+115
-34
app.js
apps/remix-ide/src/app.js
+2
-1
main-panel.js
apps/remix-ide/src/app/components/main-panel.js
+1
-1
terminal.js
apps/remix-ide/src/app/panels/terminal.js
+4
-1
remix-ui-static-analyser.tsx
...x-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
+1
-1
remix-ui-terminal.css
libs/remix-ui/terminal/src/lib/remix-ui-terminal.css
+15
-3
remix-ui-terminal.tsx
libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
+92
-27
No files found.
apps/remix-ide/src/app.js
View file @
02714271
...
@@ -299,7 +299,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -299,7 +299,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
newpos
=
(
newpos
<
height
-
limitDown
)
?
newpos
:
height
-
limitDown
newpos
=
(
newpos
<
height
-
limitDown
)
?
newpos
:
height
-
limitDown
return
height
-
newpos
return
height
-
newpos
}
}
}
},
{
config
:
registry
.
get
(
'config'
).
api
}
)
)
makeUdapp
(
blockchain
,
compilersArtefacts
,
(
domEl
)
=>
terminal
.
logHtml
(
domEl
))
makeUdapp
(
blockchain
,
compilersArtefacts
,
(
domEl
)
=>
terminal
.
logHtml
(
domEl
))
...
...
apps/remix-ide/src/app/components/main-panel.js
View file @
02714271
...
@@ -31,7 +31,7 @@ export class MainPanel extends AbstractPanel {
...
@@ -31,7 +31,7 @@ export class MainPanel extends AbstractPanel {
render
()
{
render
()
{
return
yo
`
return
yo
`
<div class=
${
css
.
pluginsContainer
}
data-id="mainPanelPluginsContainer">
<div class=
${
css
.
pluginsContainer
}
data-id="mainPanelPluginsContainer"
id='mainPanelPluginsContainer-id'
>
${
this
.
view
}
${
this
.
view
}
</div>`
</div>`
}
}
...
...
apps/remix-ide/src/app/panels/terminal.js
View file @
02714271
...
@@ -31,7 +31,7 @@ const profile = {
...
@@ -31,7 +31,7 @@ const profile = {
}
}
class
Terminal
extends
Plugin
{
class
Terminal
extends
Plugin
{
constructor
(
opts
,
api
)
{
constructor
(
opts
,
api
,
config
)
{
super
(
profile
)
super
(
profile
)
this
.
element
=
document
.
createElement
(
'div'
)
this
.
element
=
document
.
createElement
(
'div'
)
this
.
element
.
setAttribute
(
'class'
,
'panel_2A0YE0'
)
this
.
element
.
setAttribute
(
'class'
,
'panel_2A0YE0'
)
...
@@ -40,6 +40,7 @@ class Terminal extends Plugin {
...
@@ -40,6 +40,7 @@ class Terminal extends Plugin {
this
.
blockchain
=
opts
.
blockchain
this
.
blockchain
=
opts
.
blockchain
this
.
_api
=
api
this
.
_api
=
api
this
.
_opts
=
opts
this
.
_opts
=
opts
this
.
config
=
config
this
.
version
=
packageJson
.
version
this
.
version
=
packageJson
.
version
this
.
data
=
{
this
.
data
=
{
lineLength
:
opts
.
lineLength
||
80
,
// ????
lineLength
:
opts
.
lineLength
||
80
,
// ????
...
@@ -113,6 +114,7 @@ class Terminal extends Plugin {
...
@@ -113,6 +114,7 @@ class Terminal extends Plugin {
}
}
renderComponent
()
{
renderComponent
()
{
ReactDOM
.
render
(
ReactDOM
.
render
(
<
RemixUiTerminal
<
RemixUiTerminal
event
=
{
this
.
event
}
event
=
{
this
.
event
}
...
@@ -126,6 +128,7 @@ class Terminal extends Plugin {
...
@@ -126,6 +128,7 @@ class Terminal extends Plugin {
registerCommand
=
{
this
.
registerCommand
}
registerCommand
=
{
this
.
registerCommand
}
command
=
{
this
.
commands
}
command
=
{
this
.
commands
}
version
=
{
this
.
version
}
version
=
{
this
.
version
}
config
=
{
this
.
config
}
/>
,
/>
,
this
.
element
this
.
element
)
)
...
...
libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx
View file @
02714271
...
@@ -186,7 +186,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
...
@@ -186,7 +186,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
row
=
location
.
start
.
line
row
=
location
.
start
.
line
column
=
location
.
start
.
column
column
=
location
.
start
.
column
locationString
=
row
+
1
+
':'
+
column
+
':'
locationString
=
row
+
1
+
':'
+
column
+
':'
fileName
=
Object
.
keys
(
lastCompilationResult
.
source
s
)[
file
]
fileName
=
Object
.
keys
(
lastCompilationResult
.
contract
s
)[
file
]
}
}
warningCount
++
warningCount
++
const
msg
=
message
(
item
.
name
,
item
.
warning
,
item
.
more
,
fileName
,
locationString
)
const
msg
=
message
(
item
.
name
,
item
.
warning
,
item
.
more
,
fileName
,
locationString
)
...
...
libs/remix-ui/terminal/src/lib/remix-ui-terminal.css
View file @
02714271
...
@@ -120,7 +120,7 @@ element.style {
...
@@ -120,7 +120,7 @@ element.style {
height
:
0.5em
;
height
:
0.5em
;
right
:
0
;
right
:
0
;
left
:
0
;
left
:
0
;
cursor
:
ns
-resize
;
cursor
:
row
-resize
;
z-index
:
999
;
z-index
:
999
;
}
}
.listenOnNetwork
{
.listenOnNetwork
{
...
@@ -134,4 +134,16 @@ element.style {
...
@@ -134,4 +134,16 @@ element.style {
z-index
:
9999
;
z-index
:
9999
;
left
:
0
;
left
:
0
;
right
:
0
;
right
:
0
;
}
}
\ No newline at end of file
.divider-hitbox
{
color
:
white
;
cursor
:
row-resize
;
align-self
:
stretch
;
display
:
flex
;
align-items
:
center
;
padding
:
0
1rem
;
}
.ul
{
margin-left
:
0
;
padding-left
:
20px
;}
\ No newline at end of file
libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx
View file @
02714271
import
React
,
{
useState
,
useEffect
,
useRef
,
SyntheticEvent
}
from
'react'
// eslint-disable-line
import
React
,
{
useState
,
useEffect
,
useRef
,
SyntheticEvent
,
MouseEvent
}
from
'react'
// eslint-disable-line
import
{
useKeyPress
}
from
'./custom-hooks/useKeyPress'
import
{
useKeyPress
}
from
'./custom-hooks/useKeyPress'
// eslint-disable-line
import
{
useWindowResize
}
from
'beautiful-react-hooks'
import
{
useWindowResize
}
from
'beautiful-react-hooks'
import
'./remix-ui-terminal.css'
import
'./remix-ui-terminal.css'
...
@@ -18,6 +18,7 @@ export interface RemixUiTerminalProps {
...
@@ -18,6 +18,7 @@ export interface RemixUiTerminalProps {
registerCommand
:
any
registerCommand
:
any
command
:
any
command
:
any
version
:
any
version
:
any
config
:
any
// blockRenderHtml: any
// blockRenderHtml: any
// blockRenderLog: any
// blockRenderLog: any
...
@@ -38,6 +39,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -38,6 +39,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
const
[
_cmdTemp
,
setCmdTemp
]
=
useState
(
''
)
const
[
_cmdTemp
,
setCmdTemp
]
=
useState
(
''
)
const
[
_cmdHistory
,
setCmdHistory
]
=
useState
([])
const
[
_cmdHistory
,
setCmdHistory
]
=
useState
([])
const
[
windowHeight
,
setWindowHeight
]
=
useState
(
window
.
innerHeight
)
const
[
windowHeight
,
setWindowHeight
]
=
useState
(
window
.
innerHeight
)
// dragable state
const
[
leftHeight
,
setLeftHeight
]
=
useState
<
undefined
|
number
>
(
undefined
)
const
[
separatorYPosition
,
setSeparatorYPosition
]
=
useState
<
undefined
|
number
>
(
undefined
)
const
[
dragging
,
setDragging
]
=
useState
(
false
)
const
[
state
,
setState
]
=
useState
({
const
[
state
,
setState
]
=
useState
({
journalBlocks
:
{
journalBlocks
:
{
...
@@ -93,7 +98,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -93,7 +98,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
setWindowHeight
(
window
.
innerHeight
)
setWindowHeight
(
window
.
innerHeight
)
})
})
// terminal inputRef
// terminal inputRef
const
inputEl
=
useRef
(
null
)
const
inputEl
=
useRef
(
null
)
// events
// events
...
@@ -147,11 +151,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -147,11 +151,10 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
setToggleDownUp
(
'fa-angle-double-up'
)
setToggleDownUp
(
'fa-angle-double-up'
)
props
.
event
.
trigger
(
'resize'
,
[])
props
.
event
.
trigger
(
'resize'
,
[])
}
else
{
}
else
{
cons
ole
.
log
(
'clikced up
'
)
cons
t
terminalTopOffset
=
props
.
config
.
config
.
get
(
'terminal-top-offset
'
)
props
.
event
.
trigger
(
'resize'
,
[
118
])
props
.
event
.
trigger
(
'resize'
,
[
terminalTopOffset
])
setToggleDownUp
(
'fa-angle-double-down'
)
setToggleDownUp
(
'fa-angle-double-down'
)
}
}
console
.
log
(
props
.
event
,
'event.trigger'
)
}
}
// const reattached = (event) => {
// const reattached = (event) => {
...
@@ -277,6 +280,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -277,6 +280,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
}
}
if
(
event
.
which
===
13
)
{
if
(
event
.
which
===
13
)
{
if
(
event
.
ctrlKey
)
{
// <ctrl+enter>
if
(
event
.
ctrlKey
)
{
// <ctrl+enter>
console
.
log
(
event
.
which
===
32
,
' enter key'
)
// on enter, append the value in the cli input to the journal
// on enter, append the value in the cli input to the journal
// setState(prevState => ({...prevState.journalBlocks, prevState: inputEl})
// setState(prevState => ({...prevState.journalBlocks, prevState: inputEl})
inputEl
.
current
.
innerText
+=
'
\
n'
inputEl
.
current
.
innerText
+=
'
\
n'
...
@@ -284,17 +288,17 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -284,17 +288,17 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
// putCursor2End(inputEl.current)
// putCursor2End(inputEl.current)
// scroll2botton () function not implemented
// scroll2botton () function not implemented
props
.
autoCompletePopup
.
removeAutoComplete
()
props
.
autoCompletePopup
.
removeAutoComplete
()
}
else
{
}
else
{
// <enter>
setCmdIndex
(
-
1
)
setCmdIndex
(
-
1
)
setCmdTemp
(
''
)
setCmdTemp
(
''
)
const
script
=
inputEl
.
current
.
innerText
.
trim
()
const
script
=
inputEl
.
current
.
innerText
.
trim
()
console
.
log
({
script
})
console
.
log
({
script
}
,
' script '
)
inputEl
.
current
.
innerText
+=
'
\
n'
//
inputEl.current.innerText += '\n'
if
(
script
.
length
)
{
//
if (script.length) {
// self._cmdHistory.unshift(script)
//
// self._cmdHistory.unshift(script)
props
.
command
.
script
(
wrapScript
(
script
))
//
props.command.script(wrapScript(script))
}
//
}
props
.
autoCompletePopup
.
removeAutoComplete
()
//
props.autoCompletePopup.removeAutoComplete()
}
}
}
else
if
(
event
.
which
===
38
)
{
// <arrowUp>
}
else
if
(
event
.
which
===
38
)
{
// <arrowUp>
const
len
=
_cmdHistory
.
length
const
len
=
_cmdHistory
.
length
...
@@ -332,31 +336,93 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -332,31 +336,93 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
console
.
log
(
'remove event'
)
console
.
log
(
'remove event'
)
setToggleDownUp
(
'fa-angle-double-down'
)
setToggleDownUp
(
'fa-angle-double-down'
)
}
}
props
.
event
.
trigger
(
'resize'
,
[
props
.
api
.
getPostion
(
event
)])
const
value
=
props
.
event
.
get
(
'resize'
)
console
.
log
({
value
})
props
.
event
.
trigger
(
'resize'
,
[
value
])
}
}
const
mousedown
=
(
event
)
=>
{
/* start of mouse events */
console
.
log
({
windowHeight
})
console
.
log
(
event
.
which
===
1
,
'event.which === 1'
)
const
mousedown
=
(
event
:
MouseEvent
)
=>
{
event
.
preventDefault
()
setSeparatorYPosition
(
event
.
clientY
)
moveGhostbar
(
event
)
setDragging
(
true
)
if
(
event
.
which
===
1
)
{
// console.log({ windowHeight })
console
.
log
(
'event .which code 1'
)
// console.log(event.which === 1, 'event.which === 1')
moveGhostbar
(
event
)
// event.preventDefault()
// moveGhostbar(event)
// if (event.which === 1) {
// console.log('event .which code 1')
// moveGhostbar(event)
// }
}
const
onMouseMove
:
any
=
(
e
:
MouseEvent
)
=>
{
e
.
preventDefault
()
if
(
dragging
&&
leftHeight
&&
separatorYPosition
)
{
const
newEditorHeight
=
leftHeight
-
e
.
clientY
+
separatorYPosition
const
newLeftHeight
=
leftHeight
+
separatorYPosition
-
e
.
clientY
setSeparatorYPosition
(
e
.
clientY
)
// if (newLeftHeight < MIN_HEIGHT) {
// setLeftHeight(MIN_HEIGHT)
// return
// }
// if (splitPaneRef.current) {
// const splitPaneHeight = splitPaneRef.current.clientHeight
// if (newLeftHeight > splitPaneHeight - MIN_HEIGHT) {
// setLeftHeight(splitPaneHeight - MIN_HEIGHT)
// return
// }
// }
setLeftHeight
(
newLeftHeight
)
props
.
event
.
trigger
(
'resize'
,
[
newLeftHeight
+
32
])
console
.
log
({
newLeftHeight
})
}
}
}
}
const
onMouseUp
=
()
=>
{
setDragging
(
false
)
}
/* end of mouse event */
const
cancelGhostbar
=
(
event
)
=>
{
const
cancelGhostbar
=
(
event
)
=>
{
if
(
event
.
keyCode
===
27
)
{
if
(
event
.
keyCode
===
27
)
{
console
.
log
(
'event .key code 27'
)
console
.
log
(
'event .key code 27'
)
}
}
}
}
useEffect
(()
=>
{
document
.
addEventListener
(
'mousemove'
,
onMouseMove
)
document
.
addEventListener
(
'mouseup'
,
onMouseUp
)
return
()
=>
{
document
.
removeEventListener
(
'mousemove'
,
onMouseMove
)
document
.
removeEventListener
(
'mouseup'
,
onMouseUp
)
}
})
React
.
useEffect
(()
=>
{
const
leftRef
=
document
.
getElementById
(
'terminal-view'
)
const
editorRef
=
document
.
getElementById
(
'mainPanelPluginsContainer-id'
)
if
(
leftRef
)
{
if
(
!
leftHeight
)
{
setLeftHeight
(
leftRef
.
offsetHeight
)
return
}
leftRef
.
style
.
height
=
`
${
leftHeight
}
px`
}
},
[
leftHeight
,
setLeftHeight
])
return
(
return
(
<
div
style=
{
{
height
:
'323px'
}
}
className=
'panel_2A0YE0'
>
<
div
style=
{
{
height
:
'323px'
}
}
className=
'panel_2A0YE0'
>
{
console
.
log
({
props
})
}
<
div
className=
"bar_2A0YE0"
>
<
div
className=
"bar_2A0YE0"
>
{
/* ${self._view.dragbar} */
}
{
/* ${self._view.dragbar} */
}
<
div
className=
"dragbarHorizontal
_2A0YE0
"
onMouseDown=
{
mousedown
}
></
div
>
<
div
className=
"dragbarHorizontal"
onMouseDown=
{
mousedown
}
></
div
>
<
div
className=
"menu_2A0YE0 border-top border-dark bg-light"
data
-
id=
"terminalToggleMenu"
>
<
div
className=
"menu_2A0YE0 border-top border-dark bg-light"
data
-
id=
"terminalToggleMenu"
>
{
/* ${self._view.icon} */
}
{
/* ${self._view.icon} */
}
<
i
className=
{
`mx-2 toggleTerminal_2A0YE0 fas ${toggleDownUp}`
}
data
-
id=
"terminalToggleIcon"
onClick=
{
handleMinimizeTerminal
}
></
i
>
<
i
className=
{
`mx-2 toggleTerminal_2A0YE0 fas ${toggleDownUp}`
}
data
-
id=
"terminalToggleIcon"
onClick=
{
handleMinimizeTerminal
}
></
i
>
...
@@ -400,7 +466,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -400,7 +466,6 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
<
div
tabIndex=
{
-
1
}
className=
"terminal_container_2A0YE0"
data
-
id=
"terminalContainer"
>
<
div
tabIndex=
{
-
1
}
className=
"terminal_container_2A0YE0"
data
-
id=
"terminalContainer"
>
{
/* onScroll=${throttle(reattach, 10)} onkeydown=${focusinput} */
}
{
/* onScroll=${throttle(reattach, 10)} onkeydown=${focusinput} */
}
{
/* {props.autoCompletePopup.render()} */
}
{
/* {props.autoCompletePopup.render()} */
}
{
console
.
log
({
props
})
}
<
div
data
-
id=
"terminalContainerDisplay"
style
=
{{
<
div
data
-
id=
"terminalContainerDisplay"
style
=
{{
position
:
'
absolute
',
position
:
'
absolute
',
height
:
'100',
height
:
'100',
...
@@ -425,8 +490,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
...
@@ -425,8 +490,8 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => {
</
div
>
</
div
>
</
div
>
</
div
>
<
div
id=
"terminalCli"
data
-
id=
"terminalCli"
className=
"cli_2A0YE0"
onClick=
{
focusinput
}
>
<
div
id=
"terminalCli"
data
-
id=
"terminalCli"
className=
"cli_2A0YE0"
onClick=
{
focusinput
}
>
<
span
className=
"prompt"
>
{
'>'
}
</
span
>
<
span
className=
"prompt
_2A0YE0
"
>
{
'>'
}
</
span
>
<
span
className=
"input"
ref=
{
inputEl
}
spellCheck=
"false"
contentEditable=
"true"
id=
"terminalCliInput"
data
-
id=
"terminalCliInput"
onPaste=
{
handlePaste
}
onKeyDown=
{
handleKeyDown
}
></
span
>
<
span
className=
"input
_2A0YE0
"
ref=
{
inputEl
}
spellCheck=
"false"
contentEditable=
"true"
id=
"terminalCliInput"
data
-
id=
"terminalCliInput"
onPaste=
{
handlePaste
}
onKeyDown=
{
handleKeyDown
}
></
span
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
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