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
1119c5bb
Commit
1119c5bb
authored
Aug 29, 2019
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge editor plugin
parent
c64a11ca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
16 deletions
+27
-16
app.js
src/app.js
+1
-1
SourceHighlighters.js
src/app/editor/SourceHighlighters.js
+3
-14
editor.js
src/app/editor/editor.js
+22
-1
test-tab.js
src/app/tabs/test-tab.js
+1
-0
No files found.
src/app.js
View file @
1119c5bb
...
@@ -247,7 +247,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -247,7 +247,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
appManager
.
register
([
appManager
.
register
([
contentImport
,
contentImport
,
themeModule
,
themeModule
,
editor
.
sourceHighlighters
,
editor
,
fileManager
,
fileManager
,
compilerMetadataGenerator
,
compilerMetadataGenerator
,
compilersArtefacts
,
compilersArtefacts
,
...
...
src/app/editor/SourceHighlighters.js
View file @
1119c5bb
...
@@ -4,26 +4,16 @@ const SourceHighlighter = require('./sourceHighlighter')
...
@@ -4,26 +4,16 @@ const SourceHighlighter = require('./sourceHighlighter')
import
{
Plugin
}
from
'@remixproject/engine'
import
{
Plugin
}
from
'@remixproject/engine'
import
*
as
packageJson
from
'../../../package.json'
import
*
as
packageJson
from
'../../../package.json'
const
profile
=
{
displayName
:
'Editor'
,
name
:
'editor'
,
description
:
'service - highlight source code'
,
version
:
packageJson
.
version
,
methods
:
[
'highlight'
,
'discardHighlight'
]
}
// EditorApi:
// EditorApi:
// - methods: ['highlight', 'discardHighlight'],
// - methods: ['highlight', 'discardHighlight'],
class
SourceHighlighters
extends
Plugin
{
class
SourceHighlighters
{
constructor
()
{
constructor
()
{
super
(
profile
)
this
.
highlighters
=
{}
this
.
highlighters
=
{}
}
}
highlight
(
position
,
filePath
,
hexColor
)
{
highlight
(
position
,
filePath
,
hexColor
,
from
)
{
const
{
from
}
=
this
.
currentRequest
try
{
try
{
if
(
!
this
.
highlighters
[
from
])
this
.
highlighters
[
from
]
=
new
SourceHighlighter
()
if
(
!
this
.
highlighters
[
from
])
this
.
highlighters
[
from
]
=
new
SourceHighlighter
()
this
.
highlighters
[
from
].
currentSourceLocation
(
null
)
this
.
highlighters
[
from
].
currentSourceLocation
(
null
)
...
@@ -33,8 +23,7 @@ class SourceHighlighters extends Plugin {
...
@@ -33,8 +23,7 @@ class SourceHighlighters extends Plugin {
}
}
}
}
discardHighlight
()
{
discardHighlight
(
from
)
{
const
{
from
}
=
this
.
currentRequest
if
(
this
.
highlighters
[
from
])
this
.
highlighters
[
from
].
currentSourceLocation
(
null
)
if
(
this
.
highlighters
[
from
])
this
.
highlighters
[
from
].
currentSourceLocation
(
null
)
}
}
}
}
...
...
src/app/editor/editor.js
View file @
1119c5bb
...
@@ -3,6 +3,8 @@ const EventManager = require('../../lib/events')
...
@@ -3,6 +3,8 @@ const EventManager = require('../../lib/events')
const
yo
=
require
(
'yo-yo'
)
const
yo
=
require
(
'yo-yo'
)
const
csjs
=
require
(
'csjs-inject'
)
const
csjs
=
require
(
'csjs-inject'
)
const
ace
=
require
(
'brace'
)
const
ace
=
require
(
'brace'
)
import
{
Plugin
}
from
'@remixproject/engine'
import
*
as
packageJson
from
'../../../package.json'
const
globalRegistry
=
require
(
'../../global/registry'
)
const
globalRegistry
=
require
(
'../../global/registry'
)
const
SourceHighlighters
=
require
(
'./SourceHighlighters'
)
const
SourceHighlighters
=
require
(
'./SourceHighlighters'
)
...
@@ -37,9 +39,18 @@ document.head.appendChild(yo`
...
@@ -37,9 +39,18 @@ document.head.appendChild(yo`
</style>
</style>
`
)
`
)
class
Editor
{
const
profile
=
{
displayName
:
'Editor'
,
name
:
'editor'
,
description
:
'service - editor'
,
version
:
packageJson
.
version
,
methods
:
[
'highlight'
,
'discardHighlight'
,
'clearAnnotations'
,
'addAnnotation'
]
}
class
Editor
extends
Plugin
{
constructor
(
opts
=
{},
themeModule
)
{
constructor
(
opts
=
{},
themeModule
)
{
super
(
profile
)
// Dependancies
// Dependancies
this
.
_components
=
{}
this
.
_components
=
{}
this
.
_components
.
registry
=
globalRegistry
this
.
_components
.
registry
=
globalRegistry
...
@@ -177,6 +188,16 @@ class Editor {
...
@@ -177,6 +188,16 @@ class Editor {
})
})
}
}
highlight
(
position
,
filePath
,
hexColor
)
{
const
{
from
}
=
this
.
currentRequest
this
.
sourceHighlighters
.
highlight
(
position
,
filePath
,
hexColor
,
from
)
}
discardHighlight
()
{
const
{
from
}
=
this
.
currentRequest
this
.
sourceHighlighters
.
discardHighlight
(
from
)
}
setTheme
(
type
)
{
setTheme
(
type
)
{
this
.
editor
.
setTheme
(
'ace/theme/'
+
this
.
_themes
[
type
])
this
.
editor
.
setTheme
(
'ace/theme/'
+
this
.
_themes
[
type
])
}
}
...
...
src/app/tabs/test-tab.js
View file @
1119c5bb
...
@@ -178,6 +178,7 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -178,6 +178,7 @@ module.exports = class TestTab extends ViewPlugin {
}
}
runTests
()
{
runTests
()
{
this
.
call
(
'editor'
,
'clearAnnotations'
)
this
.
testsOutput
.
innerHTML
=
''
this
.
testsOutput
.
innerHTML
=
''
this
.
testsSummary
.
innerHTML
=
''
this
.
testsSummary
.
innerHTML
=
''
var
tests
=
this
.
data
.
selectedTests
var
tests
=
this
.
data
.
selectedTests
...
...
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