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
9a524ccd
Commit
9a524ccd
authored
Jan 30, 2019
by
Grandschtroumpf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change var to const
parent
4ad08f8b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
editor.js
src/app/editor/editor.js
+26
-26
No files found.
src/app/editor/editor.js
View file @
9a524ccd
'use strict'
'use strict'
var
EventManager
=
require
(
'../../lib/events'
)
const
EventManager
=
require
(
'../../lib/events'
)
var
yo
=
require
(
'yo-yo'
)
const
yo
=
require
(
'yo-yo'
)
var
csjs
=
require
(
'csjs-inject'
)
const
csjs
=
require
(
'csjs-inject'
)
var
ace
=
require
(
'brace'
)
const
ace
=
require
(
'brace'
)
require
(
'brace/theme/tomorrow_night_blue'
)
require
(
'brace/theme/tomorrow_night_blue'
)
var
globalRegistry
=
require
(
'../../global/registry'
)
const
globalRegistry
=
require
(
'../../global/registry'
)
const
SourceHighlighters
=
require
(
'./SourceHighlighters'
)
const
SourceHighlighters
=
require
(
'./SourceHighlighters'
)
var
Range
=
ace
.
acequire
(
'ace/range'
).
Range
const
Range
=
ace
.
acequire
(
'ace/range'
).
Range
require
(
'brace/ext/language_tools'
)
require
(
'brace/ext/language_tools'
)
require
(
'brace/ext/searchbox'
)
require
(
'brace/ext/searchbox'
)
var
langTools
=
ace
.
acequire
(
'ace/ext/language_tools'
)
const
langTools
=
ace
.
acequire
(
'ace/ext/language_tools'
)
require
(
'ace-mode-solidity/build/remix-ide/mode-solidity'
)
require
(
'ace-mode-solidity/build/remix-ide/mode-solidity'
)
require
(
'brace/mode/javascript'
)
require
(
'brace/mode/javascript'
)
require
(
'brace/mode/python'
)
require
(
'brace/mode/python'
)
require
(
'brace/mode/json'
)
require
(
'brace/mode/json'
)
var
styleGuide
=
require
(
'../ui/styles-guide/theme-chooser'
)
const
styleGuide
=
require
(
'../ui/styles-guide/theme-chooser'
)
var
styles
=
styleGuide
.
chooser
()
const
styles
=
styleGuide
.
chooser
()
function
setTheme
(
cb
)
{
function
setTheme
(
cb
)
{
if
(
styles
.
appProperties
.
aceTheme
)
{
if
(
styles
.
appProperties
.
aceTheme
)
{
...
@@ -30,7 +30,7 @@ setTheme((path, theme) => {
...
@@ -30,7 +30,7 @@ setTheme((path, theme) => {
require
(
'brace/theme/tomorrow_night_blue'
)
require
(
'brace/theme/tomorrow_night_blue'
)
})
})
var
css
=
csjs
`
const
css
=
csjs
`
.ace-editor {
.ace-editor {
background-color :
${
styles
.
editor
.
backgroundColor_Editor
}
;
background-color :
${
styles
.
editor
.
backgroundColor_Editor
}
;
width : 100%;
width : 100%;
...
@@ -76,11 +76,11 @@ document.head.appendChild(yo`
...
@@ -76,11 +76,11 @@ document.head.appendChild(yo`
class
Editor
{
class
Editor
{
/*
/*
// Private
// Private
attributs
_components
_components
_deps
_deps
// Public
// Public
attributs
editor
editor
event
event
sessions
sessions
...
@@ -140,13 +140,13 @@ class Editor {
...
@@ -140,13 +140,13 @@ class Editor {
/** Listen on Gutter Mouse Down */
/** Listen on Gutter Mouse Down */
this
.
editor
.
on
(
'guttermousedown'
,
e
=>
{
this
.
editor
.
on
(
'guttermousedown'
,
e
=>
{
var
target
=
e
.
domEvent
.
target
const
target
=
e
.
domEvent
.
target
if
(
target
.
className
.
indexOf
(
'ace_gutter-cell'
)
===
-
1
)
{
if
(
target
.
className
.
indexOf
(
'ace_gutter-cell'
)
===
-
1
)
{
return
return
}
}
var
row
=
e
.
getDocumentPosition
().
row
const
row
=
e
.
getDocumentPosition
().
row
var
breakpoints
=
e
.
editor
.
session
.
getBreakpoints
()
const
breakpoints
=
e
.
editor
.
session
.
getBreakpoints
()
for
(
var
k
in
breakpoints
)
{
for
(
const
k
in
breakpoints
)
{
if
(
k
===
row
.
toString
())
{
if
(
k
===
row
.
toString
())
{
this
.
event
.
trigger
(
'breakpointCleared'
,
[
this
.
currentSession
,
row
])
this
.
event
.
trigger
(
'breakpointCleared'
,
[
this
.
currentSession
,
row
])
e
.
editor
.
session
.
clearBreakpoint
(
row
)
e
.
editor
.
session
.
clearBreakpoint
(
row
)
...
@@ -181,11 +181,11 @@ class Editor {
...
@@ -181,11 +181,11 @@ class Editor {
}
}
_onChange
()
{
_onChange
()
{
var
currentFile
=
this
.
_deps
.
config
.
get
(
'currentFile'
)
const
currentFile
=
this
.
_deps
.
config
.
get
(
'currentFile'
)
if
(
!
currentFile
)
{
if
(
!
currentFile
)
{
return
return
}
}
var
input
=
this
.
get
(
currentFile
)
const
input
=
this
.
get
(
currentFile
)
if
(
!
input
)
{
if
(
!
input
)
{
return
return
}
}
...
@@ -213,13 +213,13 @@ class Editor {
...
@@ -213,13 +213,13 @@ class Editor {
}
}
_getMode
(
path
)
{
_getMode
(
path
)
{
var
ext
=
path
.
indexOf
(
'.'
)
!==
-
1
?
/
[^
.
]
+$/
.
exec
(
path
)
:
null
let
ext
=
path
.
indexOf
(
'.'
)
!==
-
1
?
/
[^
.
]
+$/
.
exec
(
path
)
:
null
if
(
ext
)
ext
=
ext
[
0
]
if
(
ext
)
ext
=
ext
[
0
]
return
ext
&&
this
.
modes
[
ext
]
?
this
.
modes
[
ext
]
:
this
.
modes
[
'txt'
]
return
ext
&&
this
.
modes
[
ext
]
?
this
.
modes
[
ext
]
:
this
.
modes
[
'txt'
]
}
}
_createSession
(
content
,
mode
)
{
_createSession
(
content
,
mode
)
{
var
s
=
new
ace
.
EditSession
(
content
)
const
s
=
new
ace
.
EditSession
(
content
)
s
.
setMode
(
mode
||
'ace/mode/text'
)
s
.
setMode
(
mode
||
'ace/mode/text'
)
s
.
setUndoManager
(
new
ace
.
UndoManager
())
s
.
setUndoManager
(
new
ace
.
UndoManager
())
s
.
setTabSize
(
4
)
s
.
setTabSize
(
4
)
...
@@ -253,7 +253,7 @@ class Editor {
...
@@ -253,7 +253,7 @@ class Editor {
open
(
path
,
content
)
{
open
(
path
,
content
)
{
if
(
!
this
.
sessions
[
path
])
{
if
(
!
this
.
sessions
[
path
])
{
var
session
=
this
.
_createSession
(
content
,
this
.
_getMode
(
path
))
const
session
=
this
.
_createSession
(
content
,
this
.
_getMode
(
path
))
this
.
sessions
[
path
]
=
session
this
.
sessions
[
path
]
=
session
this
.
readOnlySessions
[
path
]
=
false
this
.
readOnlySessions
[
path
]
=
false
}
else
if
(
this
.
sessions
[
path
].
getValue
()
!==
content
)
{
}
else
if
(
this
.
sessions
[
path
].
getValue
()
!==
content
)
{
...
@@ -264,7 +264,7 @@ class Editor {
...
@@ -264,7 +264,7 @@ class Editor {
openReadOnly
(
path
,
content
)
{
openReadOnly
(
path
,
content
)
{
if
(
!
this
.
sessions
[
path
])
{
if
(
!
this
.
sessions
[
path
])
{
var
session
=
this
.
_createSession
(
content
,
this
.
_getMode
(
path
))
const
session
=
this
.
_createSession
(
content
,
this
.
_getMode
(
path
))
this
.
sessions
[
path
]
=
session
this
.
sessions
[
path
]
=
session
this
.
readOnlySessions
[
path
]
=
true
this
.
readOnlySessions
[
path
]
=
true
}
}
...
@@ -328,11 +328,11 @@ class Editor {
...
@@ -328,11 +328,11 @@ class Editor {
resize
(
useWrapMode
)
{
resize
(
useWrapMode
)
{
this
.
editor
.
resize
()
this
.
editor
.
resize
()
var
session
=
this
.
editor
.
getSession
()
const
session
=
this
.
editor
.
getSession
()
session
.
setUseWrapMode
(
useWrapMode
)
session
.
setUseWrapMode
(
useWrapMode
)
if
(
session
.
getUseWrapMode
())
{
if
(
session
.
getUseWrapMode
())
{
var
characterWidth
=
this
.
editor
.
renderer
.
characterWidth
const
characterWidth
=
this
.
editor
.
renderer
.
characterWidth
var
contentWidth
=
this
.
editor
.
container
.
ownerDocument
.
getElementsByClassName
(
const
contentWidth
=
this
.
editor
.
container
.
ownerDocument
.
getElementsByClassName
(
'ace_scroller'
'ace_scroller'
)[
0
].
clientWidth
)[
0
].
clientWidth
...
@@ -343,7 +343,7 @@ class Editor {
...
@@ -343,7 +343,7 @@ class Editor {
}
}
addMarker
(
lineColumnPos
,
source
,
cssClass
)
{
addMarker
(
lineColumnPos
,
source
,
cssClass
)
{
var
currentRange
=
new
Range
(
const
currentRange
=
new
Range
(
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
end
.
line
,
lineColumnPos
.
end
.
line
,
...
...
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