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
c9863057
Unverified
Commit
c9863057
authored
Sep 07, 2018
by
yann300
Committed by
GitHub
Sep 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1492 from ethereum/addAPIs2
Fix Editor API
parents
00eba199
acb75262
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
5 deletions
+41
-5
fileManager.js
src/app/files/fileManager.js
+5
-0
pluginAPI.js
src/app/plugin/pluginAPI.js
+11
-4
index.html
test-browser/plugin/index.html
+5
-1
plugin.js
test-browser/plugin/plugin.js
+20
-0
No files found.
src/app/files/fileManager.js
View file @
c9863057
...
@@ -79,6 +79,11 @@ class FileManager {
...
@@ -79,6 +79,11 @@ class FileManager {
return
null
return
null
}
}
currentFile
()
{
var
self
=
this
return
self
.
_deps
.
config
.
get
(
'currentFile'
)
}
currentPath
()
{
currentPath
()
{
var
self
=
this
var
self
=
this
var
currentFile
=
self
.
_deps
.
config
.
get
(
'currentFile'
)
var
currentFile
=
self
.
_deps
.
config
.
get
(
'currentFile'
)
...
...
src/app/plugin/pluginAPI.js
View file @
c9863057
...
@@ -67,7 +67,7 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
...
@@ -67,7 +67,7 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
},
},
editor
:
{
editor
:
{
getCurrentFile
:
(
mod
,
cb
)
=>
{
getCurrentFile
:
(
mod
,
cb
)
=>
{
var
path
=
fileManager
.
current
Path
()
var
path
=
fileManager
.
current
File
()
if
(
!
path
)
{
if
(
!
path
)
{
cb
(
'no file selected'
)
cb
(
'no file selected'
)
}
else
{
}
else
{
...
@@ -78,7 +78,7 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
...
@@ -78,7 +78,7 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
var
provider
=
fileManager
.
fileProviderOf
(
path
)
var
provider
=
fileManager
.
fileProviderOf
(
path
)
if
(
provider
)
{
if
(
provider
)
{
// TODO add approval to user for external plugin to get the content of the given `path`
// TODO add approval to user for external plugin to get the content of the given `path`
provider
.
get
(
mod
+
'/'
+
path
,
(
error
,
content
)
=>
{
provider
.
get
(
path
,
(
error
,
content
)
=>
{
cb
(
error
,
content
)
cb
(
error
,
content
)
})
})
}
else
{
}
else
{
...
@@ -89,7 +89,7 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
...
@@ -89,7 +89,7 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
var
provider
=
fileManager
.
fileProviderOf
(
path
)
var
provider
=
fileManager
.
fileProviderOf
(
path
)
if
(
provider
)
{
if
(
provider
)
{
// TODO add approval to user for external plugin to set the content of the given `path`
// TODO add approval to user for external plugin to set the content of the given `path`
provider
.
set
(
mod
+
'/'
+
path
,
content
,
(
error
)
=>
{
provider
.
set
(
path
,
content
,
(
error
)
=>
{
cb
(
error
)
cb
(
error
)
})
})
}
else
{
}
else
{
...
@@ -97,8 +97,15 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
...
@@ -97,8 +97,15 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
}
}
},
},
highlight
:
(
mod
,
lineColumnPos
,
filePath
,
hexColor
,
cb
)
=>
{
highlight
:
(
mod
,
lineColumnPos
,
filePath
,
hexColor
,
cb
)
=>
{
var
position
try
{
position
=
JSON
.
parse
(
lineColumnPos
)
}
catch
(
e
)
{
return
cb
(
e
.
message
)
}
highlighter
.
currentSourceLocation
(
null
)
highlighter
.
currentSourceLocation
(
null
)
highlighter
.
currentSourceLocation
(
lineColumnPos
,
filePath
,
hexColor
)
highlighter
.
currentSourceLocationFromfileName
(
position
,
filePath
,
hexColor
)
cb
()
}
}
}
}
}
}
...
...
test-browser/plugin/index.html
View file @
c9863057
...
@@ -37,13 +37,17 @@
...
@@ -37,13 +37,17 @@
<body>
<body>
<div>
PLUGIN
</div>
<div>
PLUGIN
</div>
<input
type=
"text"
id=
"filename"
></input>
<input
type=
"text"
id=
"filename"
></input>
<input
type=
"text"
id=
"valuetosend"
></input>
<br>
<input
type=
"text"
id=
"valuetosend"
></input>
<
input
type=
"text"
id=
"valuetosend2"
></input>
<
br>
<input
type=
"button"
id=
"testmessageadd"
>
add config
</input>
<br>
<input
type=
"button"
id=
"testmessageadd"
>
add config
</input>
<br>
<input
type=
"button"
id=
"testmessageremove"
>
remove config
</input>
<br>
<input
type=
"button"
id=
"testmessageremove"
>
remove config
</input>
<br>
<input
type=
"button"
id=
"testmessagerget"
>
get config
</input>
<br>
<input
type=
"button"
id=
"testmessagerget"
>
get config
</input>
<br>
<input
type=
"button"
id=
"testcontractcreation"
>
oraclize contract creation
</input>
<br>
<input
type=
"button"
id=
"testcontractcreation"
>
oraclize contract creation
</input>
<br>
<input
type=
"button"
id=
"testaccountcreation"
>
account creation
</input>
<br>
<input
type=
"button"
id=
"testaccountcreation"
>
account creation
</input>
<br>
<input
type=
"button"
id=
"testchangetitle"
>
change title
</input>
<br>
<input
type=
"button"
id=
"testchangetitle"
>
change title
</input>
<br>
<input
type=
"button"
id=
"setcontentof"
>
setcontentof
</input>
<br>
<input
type=
"button"
id=
"getcontentof"
>
getcontentof
</input>
<br>
<input
type=
"button"
id=
"getcurrent"
>
getcurrent
</input>
<br>
<input
type=
"button"
id=
"sethighlight"
>
sethighlight
</input>
<br>
<br>
<br>
<div
id=
'compilationdata'
></div>
<div
id=
'compilationdata'
></div>
</body>
</body>
...
...
test-browser/plugin/plugin.js
View file @
c9863057
...
@@ -53,4 +53,24 @@ window.onload = function () {
...
@@ -53,4 +53,24 @@ window.onload = function () {
extension
.
call
(
'app'
,
'updateTitle'
,
[
'changed title '
+
k
++
],
extension
.
call
(
'app'
,
'updateTitle'
,
[
'changed title '
+
k
++
],
function
(
error
,
result
)
{
console
.
log
(
error
,
result
)
})
function
(
error
,
result
)
{
console
.
log
(
error
,
result
)
})
})
})
document
.
querySelector
(
'input#setcontentof'
).
addEventListener
(
'click'
,
function
()
{
extension
.
call
(
'editor'
,
'setFile'
,
[
document
.
getElementById
(
'filename'
).
value
,
document
.
getElementById
(
'valuetosend'
).
value
],
function
(
error
,
result
)
{
console
.
log
(
error
,
result
)
})
})
document
.
querySelector
(
'input#getcontentof'
).
addEventListener
(
'click'
,
function
()
{
extension
.
call
(
'editor'
,
'getFile'
,
[
document
.
getElementById
(
'filename'
).
value
],
function
(
error
,
result
)
{
console
.
log
(
error
,
result
)
})
})
document
.
querySelector
(
'input#getcurrent'
).
addEventListener
(
'click'
,
function
()
{
extension
.
call
(
'editor'
,
'getCurrentFile'
,
[],
function
(
error
,
result
)
{
console
.
log
(
error
,
result
)
})
})
document
.
querySelector
(
'input#sethighlight'
).
addEventListener
(
'click'
,
function
()
{
extension
.
call
(
'editor'
,
'highlight'
,
[
document
.
getElementById
(
'filename'
).
value
,
document
.
getElementById
(
'valuetosend'
).
value
,
document
.
getElementById
(
'valuetosend2'
).
value
],
function
(
error
,
result
)
{
console
.
log
(
error
,
result
)
})
})
}
}
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