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
31361b4d
Commit
31361b4d
authored
Sep 28, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add contextview to editorpanel
parent
b000cab7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
12 deletions
+51
-12
contextView.js
src/app/editor/contextView.js
+39
-11
editor-panel.js
src/app/panels/editor-panel.js
+12
-1
No files found.
src/app/editor/contextView.js
View file @
31361b4d
...
@@ -7,9 +7,13 @@ var csjs = require('csjs-inject')
...
@@ -7,9 +7,13 @@ var csjs = require('csjs-inject')
var
css
=
csjs
`
var
css
=
csjs
`
.contextview {
.contextview {
position : absolute;
background-color :
${
styles
.
colors
.
backgroundBlue
}
;
background-color :
${
styles
.
colors
.
backgroundBlue
}
;
opacity : 0.8;
opacity : 0.8;
width : 20em;
height : 5em;
border-color : transparent;
border-radius : 3px;
border : .3px solid hsla(0, 0%, 40%, .2);
}
}
`
`
...
@@ -26,6 +30,7 @@ class ContextView {
...
@@ -26,6 +30,7 @@ class ContextView {
this
.
_event
=
event
this
.
_event
=
event
this
.
_view
this
.
_view
this
.
_nodes
this
.
_nodes
this
.
_current
event
.
contextualListener
.
register
(
'contextChanged'
,
nodes
=>
{
event
.
contextualListener
.
register
(
'contextChanged'
,
nodes
=>
{
this
.
_nodes
=
nodes
this
.
_nodes
=
nodes
this
.
update
()
this
.
update
()
...
@@ -35,36 +40,59 @@ class ContextView {
...
@@ -35,36 +40,59 @@ class ContextView {
render
()
{
render
()
{
var
view
=
yo
`<div class=
${
css
.
contextview
}
>
var
view
=
yo
`<div class=
${
css
.
contextview
}
>
<div>
<div>
<span>
${
this
.
_render
Items
()}
</span>
<span>
${
this
.
_render
Target
()}
</span>
</div>
</div>
</div>`
</div>`
if
(
!
this
.
_view
)
{
if
(
!
this
.
_view
)
{
this
.
_view
=
view
this
.
_view
=
view
this
.
hide
()
}
}
return
view
return
view
}
}
hide
()
{
if
(
this
.
_view
)
{
this
.
_view
.
style
.
display
=
'none'
}
}
show
()
{
if
(
this
.
_view
)
{
this
.
_view
.
style
.
display
=
'block'
}
}
update
()
{
update
()
{
if
(
this
.
_view
)
{
if
(
this
.
_view
)
{
yo
.
update
(
this
.
_view
,
this
.
render
())
yo
.
update
(
this
.
_view
,
this
.
render
())
this
.
_view
.
style
.
display
=
this
.
_current
?
'block'
:
'none'
}
}
}
}
_renderItems
()
{
_renderTarget
()
{
this
.
_current
=
null
if
(
this
.
_nodes
&&
this
.
_nodes
.
length
)
{
if
(
this
.
_nodes
&&
this
.
_nodes
.
length
)
{
var
last
=
this
.
_nodes
[
this
.
_nodes
.
length
-
1
]
var
last
=
this
.
_nodes
[
this
.
_nodes
.
length
-
1
]
if
(
this
.
_api
.
contextualListener
.
declarationOf
(
last
))
{
if
(
last
.
name
===
'ContractDefinition'
||
last
.
name
===
'FunctionDefinition'
||
last
.
name
===
'ModifierDefinition'
||
last
.
name
===
'VariableDeclaration'
)
{
return
renderReference
(
last
)
this
.
_current
=
last
}
else
{
var
target
=
this
.
_api
.
contextualListener
.
declarationOf
(
last
)
if
(
target
)
{
this
.
_current
=
target
}
}
}
}
}
return
yo
``
return
this
.
_renderDeclarations
(
this
.
_current
)
}
}
}
_renderDeclarations
(
node
)
{
function
renderReference
(
node
)
{
if
(
!
node
)
return
yo
`<div></div>`
yo
`<div><span>
${
node
.
name
}
</span></div>`
var
references
=
this
.
_api
.
contextualListener
.
referencesOf
(
node
)
references
=
yo
`<div>
${
references
?
references
.
length
:
'0'
}
references</div>`
return
yo
`<div><div>
${
node
.
attributes
.
type
}
${
node
.
attributes
.
name
}
(
${
node
.
name
}
)</div>
<div>
${
references
}
</div>
</div>`
}
}
}
module
.
exports
=
ContextView
module
.
exports
=
ContextView
src/app/panels/editor-panel.js
View file @
31361b4d
...
@@ -123,9 +123,17 @@ var css = csjs`
...
@@ -123,9 +123,17 @@ var css = csjs`
width : 100%;
width : 100%;
}
}
.banner {
.banner
{
width : 25em;
width : 25em;
}
}
.contextviewcontainer{
position : absolute;
z-index : 100;
right : 20px;
top : 20px;
width : 20em;
}
`
`
class
EditorPanel
{
class
EditorPanel
{
...
@@ -221,6 +229,9 @@ class EditorPanel {
...
@@ -221,6 +229,9 @@ class EditorPanel {
self
.
_view
.
terminal
=
self
.
_components
.
terminal
.
render
()
self
.
_view
.
terminal
=
self
.
_components
.
terminal
.
render
()
self
.
_view
.
content
=
yo
`
self
.
_view
.
content
=
yo
`
<div class=
${
css
.
content
}
>
<div class=
${
css
.
content
}
>
<div class=
${
css
.
contextviewcontainer
}
>
${
self
.
_api
.
contextview
.
render
()}
</div>
${
self
.
_view
.
editor
}
${
self
.
_view
.
editor
}
${
self
.
_view
.
terminal
}
${
self
.
_view
.
terminal
}
</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