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
5a404f06
Commit
5a404f06
authored
Nov 27, 2017
by
ninabreznik
Committed by
yann300
Dec 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add next/previous in editor IDE
parent
02311a07
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
18 deletions
+35
-18
app.js
src/app.js
+2
-1
contextView.js
src/app/editor/contextView.js
+32
-6
editor.js
src/app/editor/editor.js
+1
-11
No files found.
src/app.js
View file @
5a404f06
...
@@ -349,6 +349,7 @@ function run () {
...
@@ -349,6 +349,7 @@ function run () {
// ---------------- ContextView -----------------------
// ---------------- ContextView -----------------------
this
.
_components
.
contextView
=
new
ContextView
({
this
.
_components
.
contextView
=
new
ContextView
({
contextualListener
:
this
.
_components
.
contextualListener
,
contextualListener
:
this
.
_components
.
contextualListener
,
editor
:
editor
,
jumpTo
:
(
position
)
=>
{
jumpTo
:
(
position
)
=>
{
if
(
compiler
.
lastCompilationResult
&&
compiler
.
lastCompilationResult
.
data
)
{
if
(
compiler
.
lastCompilationResult
&&
compiler
.
lastCompilationResult
.
data
)
{
var
lineColumn
=
offsetToLineColumnConverter
.
offsetToLineColumn
(
position
,
position
.
file
,
compiler
.
lastCompilationResult
)
var
lineColumn
=
offsetToLineColumnConverter
.
offsetToLineColumn
(
position
,
position
.
file
,
compiler
.
lastCompilationResult
)
...
@@ -357,7 +358,7 @@ function run () {
...
@@ -357,7 +358,7 @@ function run () {
fileManager
.
switchFile
(
filename
)
fileManager
.
switchFile
(
filename
)
}
}
if
(
lineColumn
.
start
&&
lineColumn
.
start
.
line
&&
lineColumn
.
start
.
column
)
{
if
(
lineColumn
.
start
&&
lineColumn
.
start
.
line
&&
lineColumn
.
start
.
column
)
{
editor
.
gotoLine
(
lineColumn
.
start
.
line
,
lineColumn
.
start
.
column
+
1
)
editor
.
gotoLine
(
lineColumn
.
start
.
line
,
lineColumn
.
end
.
column
+
1
)
}
}
}
}
}
}
...
...
src/app/editor/contextView.js
View file @
5a404f06
...
@@ -30,13 +30,14 @@ var css = csjs`
...
@@ -30,13 +30,14 @@ var css = csjs`
.name {
.name {
font-weight : bold;
font-weight : bold;
margin-right : 15px;
margin-right : 15px;
cursor : pointer;
}
}
.jump
to
{
.jump
{
cursor : pointer;
cursor : pointer;
margin
-right :
5px;
margin
: 0
5px;
color :
${
styles
.
editor
.
icon_Color_Editor
}
;
color :
${
styles
.
editor
.
icon_Color_Editor
}
;
}
}
jumpto:hover
{
.jump:hover
{
color :
${
styles
.
editor
.
icon_HoverColor_Editor
}
;
color :
${
styles
.
editor
.
icon_HoverColor_Editor
}
;
}
}
.referencesnb {
.referencesnb {
...
@@ -129,11 +130,36 @@ class ContextView {
...
@@ -129,11 +130,36 @@ class ContextView {
}
}
}
}
function
next
()
{
var
currentName
=
node
.
attributes
.
name
if
(
currentName
===
this
.
refName
)
{
this
.
ref
=
this
.
ref
===
undefined
?
0
:
this
.
ref
}
else
{
this
.
ref
=
0
}
var
nodes
=
self
.
_api
.
contextualListener
.
_activeHighlights
self
.
_api
.
jumpTo
(
nodes
[
this
.
ref
].
position
)
this
.
ref
=
(
this
.
ref
+
1
)
%
nodes
.
length
this
.
refName
=
currentName
}
function
previous
()
{
var
currentName
=
node
.
attributes
.
name
if
(
currentName
===
this
.
refName
)
{
this
.
ref
=
this
.
ref
===
undefined
?
0
:
this
.
ref
}
else
{
this
.
ref
=
0
}
// should be this.ref = ref of the selected node (loop through all nodes to find this one)
var
nodes
=
self
.
_api
.
contextualListener
.
_activeHighlights
this
.
ref
=
this
.
ref
===
undefined
?
0
:
this
.
ref
self
.
_api
.
jumpTo
(
nodes
[
nodes
.
length
-
1
-
this
.
ref
].
position
)
this
.
ref
=
(
this
.
ref
+
1
)
%
nodes
.
length
this
.
refName
=
currentName
}
return
yo
`<div class=
${
css
.
line
}
>
return
yo
`<div class=
${
css
.
line
}
>
<
div title=
${
type
}
class=
${
css
.
type
}
>
${
type
}
</div
>
<
i class="fa fa-share
${
css
.
jump
}
" aria-hidden="true" onclick=
${
jumpTo
}
></i
>
<div title=
${
node
.
attributes
.
name
}
class=
${
css
.
name
}
>
${
node
.
attributes
.
nam
e
}
</div>
<div title=
${
type
}
class=
${
css
.
type
}
>
${
typ
e
}
</div>
<
i title='Go to Definition' class="fa fa-share
${
css
.
jumpto
}
" aria-hidden="true" onclick=
${
jumpTo
}
></i
>
<
div title=
${
node
.
attributes
.
name
}
class=
${
css
.
name
}
>
${
node
.
attributes
.
name
}
</div
>
<span class=
${
css
.
referencesnb
}
>
${
references
}
</span>
<span class=
${
css
.
referencesnb
}
>
${
references
}
</span>
<i class="fa fa-chevron-up
${
css
.
jump
}
" aria-hidden="true" onclick=
${
previous
}
></i>
<i class="fa fa-chevron-down
${
css
.
jump
}
" aria-hidden="true" onclick=
${
next
}
></i>
</div>`
</div>`
}
}
}
}
...
...
src/app/editor/editor.js
View file @
5a404f06
...
@@ -226,9 +226,7 @@ function Editor (opts = {}) {
...
@@ -226,9 +226,7 @@ function Editor (opts = {}) {
editor
.
gotoLine
(
line
+
1
,
col
-
1
,
true
)
editor
.
gotoLine
(
line
+
1
,
col
-
1
,
true
)
}
}
this
.
find
=
function
(
string
)
{
this
.
find
=
(
string
)
=>
editor
.
find
(
string
)
editor
.
find
(
string
)
}
// Do setup on initialisation here
// Do setup on initialisation here
editor
.
on
(
'changeSession'
,
function
()
{
editor
.
on
(
'changeSession'
,
function
()
{
...
@@ -242,14 +240,6 @@ function Editor (opts = {}) {
...
@@ -242,14 +240,6 @@ function Editor (opts = {}) {
// Unmap ctrl-t & ctrl-f
// Unmap ctrl-t & ctrl-f
editor
.
commands
.
bindKeys
({
'ctrl-t'
:
null
})
editor
.
commands
.
bindKeys
({
'ctrl-t'
:
null
})
editor
.
commands
.
addCommand
({
name
:
"myCommand"
,
bindKey
:
{
win
:
"Ctrl-L"
,
mac
:
"Command-L"
},
exec
:
function
()
{
editor
.
insert
(
"Key binded!"
);
}
});
editor
.
resize
(
true
)
editor
.
resize
(
true
)
}
}
...
...
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