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
a7d01060
Commit
a7d01060
authored
Jan 23, 2017
by
chriseth
Committed by
GitHub
Jan 23, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #403 from ethereum/editor-events
Introduce editor events
parents
8b4cd6b4
cbdec82e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
app.js
src/app.js
+5
-1
debugger.js
src/app/debugger.js
+2
-3
editor.js
src/app/editor.js
+10
-8
No files found.
src/app.js
View file @
a7d01060
...
@@ -277,6 +277,8 @@ var run = function () {
...
@@ -277,6 +277,8 @@ var run = function () {
return
false
return
false
})
})
editor
.
event
.
register
(
'sessionSwitched'
,
updateFiles
)
function
switchToFile
(
file
)
{
function
switchToFile
(
file
)
{
editor
.
setCacheFile
(
file
)
editor
.
setCacheFile
(
file
)
updateFiles
()
updateFiles
()
...
@@ -573,7 +575,9 @@ var run = function () {
...
@@ -573,7 +575,9 @@ var run = function () {
compileTimeout
=
window
.
setTimeout
(
runCompiler
,
300
)
compileTimeout
=
window
.
setTimeout
(
runCompiler
,
300
)
}
}
editor
.
onChangeSetup
(
editorOnChange
)
editor
.
event
.
register
(
'contentChanged'
,
editorOnChange
)
// in order to save the file when switching
editor
.
event
.
register
(
'sessionSwitched'
,
editorOnChange
)
$
(
'#compile'
).
click
(
function
()
{
$
(
'#compile'
).
click
(
function
()
{
runCompiler
()
runCompiler
()
...
...
src/app/debugger.js
View file @
a7d01060
...
@@ -26,10 +26,9 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
...
@@ -26,10 +26,9 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
self
.
removeCurrentMarker
()
self
.
removeCurrentMarker
()
})
})
this
.
editor
.
onChangeSetup
(
function
()
{
// unload if a file has changed (but not if tabs were switched)
if
(
arguments
.
length
>
0
)
{
// if arguments.length === 0 this is a session change, we don't want to stop debugging in that case
editor
.
event
.
register
(
'contentChanged'
,
function
()
{
self
.
debugger
.
unLoad
()
self
.
debugger
.
unLoad
()
}
})
})
// register selected code item, highlight the corresponding source location
// register selected code item, highlight the corresponding source location
...
...
src/app/editor.js
View file @
a7d01060
/* global FileReader */
/* global FileReader */
'use strict'
'use strict'
var
EventManager
=
require
(
'../lib/eventManager'
)
var
examples
=
require
(
'./example-contracts'
)
var
examples
=
require
(
'./example-contracts'
)
var
ace
=
require
(
'brace'
)
var
ace
=
require
(
'brace'
)
...
@@ -11,6 +12,8 @@ function Editor (doNotLoadStorage, storage) {
...
@@ -11,6 +12,8 @@ function Editor (doNotLoadStorage, storage) {
var
editor
=
ace
.
edit
(
'input'
)
var
editor
=
ace
.
edit
(
'input'
)
document
.
getElementById
(
'input'
).
editor
=
editor
// required to access the editor during tests
document
.
getElementById
(
'input'
).
editor
=
editor
// required to access the editor during tests
var
event
=
new
EventManager
()
this
.
event
=
event
var
sessions
=
{}
var
sessions
=
{}
var
sourceAnnotations
=
[]
var
sourceAnnotations
=
[]
...
@@ -146,14 +149,6 @@ function Editor (doNotLoadStorage, storage) {
...
@@ -146,14 +149,6 @@ function Editor (doNotLoadStorage, storage) {
editor
.
getSession
().
setAnnotations
(
sourceAnnotations
)
editor
.
getSession
().
setAnnotations
(
sourceAnnotations
)
}
}
this
.
onChangeSetup
=
function
(
onChange
)
{
editor
.
getSession
().
on
(
'change'
,
onChange
)
editor
.
on
(
'changeSession'
,
function
()
{
editor
.
getSession
().
on
(
'change'
,
onChange
)
onChange
()
})
}
this
.
handleErrorClick
=
function
(
errLine
,
errCol
)
{
this
.
handleErrorClick
=
function
(
errLine
,
errCol
)
{
editor
.
focus
()
editor
.
focus
()
editor
.
gotoLine
(
errLine
+
1
,
errCol
-
1
,
true
)
editor
.
gotoLine
(
errLine
+
1
,
errCol
-
1
,
true
)
...
@@ -169,6 +164,13 @@ function Editor (doNotLoadStorage, storage) {
...
@@ -169,6 +164,13 @@ function Editor (doNotLoadStorage, storage) {
}
}
// Do setup on initialisation here
// Do setup on initialisation here
editor
.
on
(
'changeSession'
,
function
()
{
event
.
trigger
(
'sessionSwitched'
,
[])
editor
.
getSession
().
on
(
'change'
,
function
()
{
event
.
trigger
(
'contentChanged'
,
[])
})
})
// Unmap ctrl-t & ctrl-f
// Unmap ctrl-t & ctrl-f
editor
.
commands
.
bindKeys
({
'ctrl-t'
:
null
})
editor
.
commands
.
bindKeys
({
'ctrl-t'
:
null
})
...
...
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