@@ -85,22 +84,21 @@ module.exports = class Filepanel extends ViewPlugin {
self.event = event
var element = template()
fileExplorer.ensureRoot()
- self._deps.fileProviders['localhost'].event.register('connecting', (event) => {
+ self._deps.fileProviders.localhost.event.register('connecting', (event) => {
})
- self._deps.fileProviders['localhost'].event.register('connected', (event) => {
+ self._deps.fileProviders.localhost.event.register('connected', (event) => {
fileSystemExplorer.show()
})
- self._deps.fileProviders['localhost'].event.register('errored', (event) => {
+ self._deps.fileProviders.localhost.event.register('errored', (event) => {
fileSystemExplorer.hide()
})
- self._deps.fileProviders['localhost'].event.register('closed', (event) => {
+ self._deps.fileProviders.localhost.event.register('closed', (event) => {
fileSystemExplorer.hide()
})
self.render = function render () { return element }
}
}
-
diff --git a/apps/remix-ide/src/app/panels/main-view.js b/apps/remix-ide/src/app/panels/main-view.js
index ef52644d19..2d812e0fff 100644
--- a/apps/remix-ide/src/app/panels/main-view.js
+++ b/apps/remix-ide/src/app/panels/main-view.js
@@ -33,6 +33,7 @@ export class MainView {
this.appManager = appManager
this.init()
}
+
showApp (name) {
this.fileManager.unselectCurrentFile()
this.mainPanel.showContent(name)
@@ -40,9 +41,11 @@ export class MainView {
this._components.contextView.hide()
this._view.mainPanel.style.display = 'block'
}
+
getAppPanel () {
return this.mainPanel
}
+
init () {
var self = this
self._deps = {
@@ -86,7 +89,7 @@ export class MainView {
}
}
- const contextView = new ContextView({contextualListener: self._components.contextualListener, editor: self.editor})
+ const contextView = new ContextView({ contextualListener: self._components.contextualListener, editor: self.editor })
self._components.contextView = contextView
@@ -97,9 +100,11 @@ export class MainView {
})
}
}
+
_terminalTopOffset () {
return this._deps.config.get('terminal-top-offset') || 150
}
+
_adjustLayout (direction, delta) {
var limitUp = 0
var limitDown = 32
@@ -129,36 +134,45 @@ export class MainView {
self._components.terminal.scroll2bottom()
}
}
+
minimizeTerminal () {
this._adjustLayout('top')
}
+
showTerminal (offset) {
this._adjustLayout('top', offset || this._terminalTopOffset())
}
+
getTerminal () {
return this._components.terminal
}
+
getEditor () {
var self = this
return self.editor
}
+
refresh () {
var self = this
self._view.tabs.onmouseenter()
}
+
log (data = {}) {
var self = this
var command = self._components.terminal.commands[data.type]
if (typeof command === 'function') command(data.value)
}
+
logMessage (msg) {
var self = this
- self.log({type: 'log', value: msg})
+ self.log({ type: 'log', value: msg })
}
+
logHtmlMessage (msg) {
var self = this
- self.log({type: 'html', value: msg})
+ self.log({ type: 'html', value: msg })
}
+
render () {
var self = this
if (self._view.mainview) return self._view.mainview
@@ -184,12 +198,13 @@ export class MainView {
return self._view.mainview
}
+
registerCommand (name, command, opts) {
var self = this
return self._components.terminal.registerCommand(name, command, opts)
}
+
updateTerminalFilter (filter) {
this._components.terminal.updateJournal(filter)
}
}
-
diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js
index 3f1fe66bd4..055be15fc3 100644
--- a/apps/remix-ide/src/app/panels/tab-proxy.js
+++ b/apps/remix-ide/src/app/panels/tab-proxy.js
@@ -93,10 +93,11 @@ export class TabProxy {
}
})
}
+
updateImgStyles () {
const images = this._view.filetabs.getElementsByClassName('image')
if (images.length !== 0) {
- for (let element of images) {
+ for (const element of images) {
globalRegistry.get('themeModule').api.fixInvert(element)
};
}
@@ -147,8 +148,8 @@ export class TabProxy {
const tabPath = slash.reverse()
const tempTitle = []
- if(!title) {
- for(let i = 0; i < tabPath.length; i++) {
+ if (!title) {
+ for (let i = 0; i < tabPath.length; i++) {
tempTitle.push(tabPath[i])
const formatPath = [...tempTitle].reverse()
const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/'))
@@ -179,7 +180,7 @@ export class TabProxy {
tooltip: duplicateTabName
})
}
- break;
+ break
}
}
} else {
diff --git a/apps/remix-ide/src/app/panels/terminal.js b/apps/remix-ide/src/app/panels/terminal.js
index 93e905fe37..632e45c3e2 100644
--- a/apps/remix-ide/src/app/panels/terminal.js
+++ b/apps/remix-ide/src/app/panels/terminal.js
@@ -51,7 +51,7 @@ class Terminal extends Plugin {
self._components.cmdInterpreter = new CommandInterpreterAPI(this, null, self.blockchain)
self._components.autoCompletePopup = new AutoCompletePopup(self._opts)
self._components.autoCompletePopup.event.register('handleSelect', function (input) {
- let textList = self._view.input.innerText.split(' ')
+ const textList = self._view.input.innerText.split(' ')
textList.pop()
textList.push(input)
self._view.input.innerText = textList
@@ -90,33 +90,38 @@ class Terminal extends Plugin {
if (opts.shell) self._shell = opts.shell // ???
register(self)
}
+
onActivation () {
this.on('scriptRunner', 'log', (msg) => {
- this.commands['log'].apply(this.commands, msg.data)
+ this.commands.log.apply(this.commands, msg.data)
})
this.on('scriptRunner', 'info', (msg) => {
- this.commands['info'].apply(this.commands, msg.data)
+ this.commands.info.apply(this.commands, msg.data)
})
this.on('scriptRunner', 'warn', (msg) => {
- this.commands['warn'].apply(this.commands, msg.data)
+ this.commands.warn.apply(this.commands, msg.data)
})
this.on('scriptRunner', 'error', (msg) => {
- this.commands['error'].apply(this.commands, msg.data)
+ this.commands.error.apply(this.commands, msg.data)
})
}
+
onDeactivation () {
this.off('scriptRunner', 'log')
this.off('scriptRunner', 'info')
this.off('scriptRunner', 'warn')
this.off('scriptRunner', 'error')
}
+
logHtml (html) {
- var command = this.commands['html']
+ var command = this.commands.html
if (typeof command === 'function') command(html)
}
+
focus () {
if (this._view.input) this._view.input.focus()
}
+
render () {
var self = this
if (self._view.el) return self._view.el
@@ -311,7 +316,7 @@ class Terminal extends Plugin {
event.key === 'ArrowRight' ||
event.key === 'Esc' ||
event.key === 'Escape'
- ) return
+ ) return
refocus()
}
@@ -538,6 +543,7 @@ class Terminal extends Plugin {
}
}
}
+
putCursor2End (editable) {
var range = document.createRange()
range.selectNode(editable)
@@ -565,6 +571,7 @@ class Terminal extends Plugin {
editable.focus()
}
+
updateJournal (filterEvent) {
var self = this
var commands = self.data.activeFilters.commands
@@ -605,6 +612,7 @@ class Terminal extends Plugin {
self._view.journal.appendChild(df)
})
}
+
_appendItem (item) {
var self = this
var { el, gidx } = item
@@ -618,12 +626,14 @@ class Terminal extends Plugin {
}
if (self.data.activeFilters.commands[item.cmd]) self._jobs.push(el)
}
+
scroll2bottom () {
var self = this
setTimeout(function () {
self._view.term.scrollTop = self._view.term.scrollHeight
}, 0)
}
+
_blocksRenderer (mode) {
if (mode === 'html') {
return function logger (args, scopedCommands, append) {
@@ -634,7 +644,8 @@ class Terminal extends Plugin {
log: 'text-info',
info: 'text-info',
warn: 'text-warning',
- error: 'text-danger' }[mode] // defaults
+ error: 'text-danger'
+ }[mode] // defaults
if (mode) {
const filterUndefined = (el) => el !== undefined && el !== null
@@ -653,6 +664,7 @@ class Terminal extends Plugin {
throw new Error('mode is not supported')
}
}
+
_scopeCommands (append) {
var self = this
var scopedCommands = {}
@@ -665,9 +677,11 @@ class Terminal extends Plugin {
})
return scopedCommands
}
+
registerFilter (commandName, filterFn) {
this.data.filterFns[commandName] = filterFn
}
+
registerCommand (name, command, opts) {
var self = this
name = String(name)
@@ -713,6 +727,7 @@ class Terminal extends Plugin {
}
return self.commands[name]
}
+
async _shell (script, scopedCommands, done) { // default shell
if (script.indexOf('remix:') === 0) {
return done(null, 'This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.')
diff --git a/apps/remix-ide/src/app/tabs/analysis-tab.js b/apps/remix-ide/src/app/tabs/analysis-tab.js
index 3ff067f96a..987c098921 100644
--- a/apps/remix-ide/src/app/tabs/analysis-tab.js
+++ b/apps/remix-ide/src/app/tabs/analysis-tab.js
@@ -1,11 +1,11 @@
-var yo = require('yo-yo')
-var StaticAnalysis = require('./staticanalysis/staticAnalysisView')
-var EventManager = require('../../lib/events')
-
import { ViewPlugin } from '@remixproject/engine'
import { EventEmitter } from 'events'
import * as packageJson from '../../../../../package.json'
+var yo = require('yo-yo')
+var StaticAnalysis = require('./staticanalysis/staticAnalysisView')
+var EventManager = require('../../lib/events')
+
const profile = {
name: 'solidityStaticAnalysis',
displayName: 'Solidity static analysis',
@@ -20,7 +20,6 @@ const profile = {
}
class AnalysisTab extends ViewPlugin {
-
constructor (registry) {
super(profile)
this.event = new EventManager()
@@ -32,19 +31,18 @@ class AnalysisTab extends ViewPlugin {
if (!this.staticanalysis) this.staticanalysis = new StaticAnalysis(this.registry, this)
this.staticanalysis.event.register('staticAnaysisWarning', (count) => {
if (count > 0) {
- this.emit('statusChanged', {key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning'})
+ this.emit('statusChanged', { key: count, title: `${count} warning${count === 1 ? '' : 's'}`, type: 'warning' })
} else if (count === 0) {
- this.emit('statusChanged', {key: 'succeed', title: 'no warning', type: 'success'})
+ this.emit('statusChanged', { key: 'succeed', title: 'no warning', type: 'success' })
} else {
// count ==-1 no compilation result
- this.emit('statusChanged', {key: 'none'})
+ this.emit('statusChanged', { key: 'none' })
}
})
- this.registry.put({api: this.staticanalysis, name: 'staticanalysis'})
+ this.registry.put({ api: this.staticanalysis, name: 'staticanalysis' })
return yo`
${this.staticanalysis.render()}
`
}
-
}
module.exports = AnalysisTab
diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js
index 05bdb94087..2d4a04b862 100644
--- a/apps/remix-ide/src/app/tabs/compile-tab.js
+++ b/apps/remix-ide/src/app/tabs/compile-tab.js
@@ -1,4 +1,9 @@
/* global */
+import { ViewPlugin } from '@remixproject/engine'
+import * as packageJson from '../../../../../package.json'
+import publishToStorage from '../../publishToStorage'
+import { compile } from '../compiler/compiler-helpers'
+
const EventEmitter = require('events')
const $ = require('jquery')
const yo = require('yo-yo')
@@ -17,11 +22,6 @@ var css = require('./styles/compile-tab-styles')
const CompileTabLogic = require('./compileTab/compileTab.js')
const CompilerContainer = require('./compileTab/compilerContainer.js')
-import { ViewPlugin } from '@remixproject/engine'
-import * as packageJson from '../../../../../package.json'
-import publishToStorage from '../../publishToStorage'
-import { compile } from '../compiler/compiler-helpers'
-
const profile = {
name: 'solidity',
displayName: 'Solidity compiler',
@@ -41,7 +41,6 @@ const profile = {
// - methods: ['getCompilationResult']
class CompileTab extends ViewPlugin {
-
constructor (editor, config, renderer, fileProvider, fileManager) {
super(profile)
this.events = new EventEmitter()
@@ -85,19 +84,19 @@ class CompileTab extends ViewPlugin {
listenToEvents () {
this.data.eventHandlers.onContentChanged = () => {
- this.emit('statusChanged', {key: 'edited', title: 'the content has changed, needs recompilation', type: 'info'})
+ this.emit('statusChanged', { key: 'edited', title: 'the content has changed, needs recompilation', type: 'info' })
}
this.editor.event.register('contentChanged', this.data.eventHandlers.onContentChanged)
this.data.eventHandlers.onLoadingCompiler = () => {
this.data.loading = true
- this.emit('statusChanged', {key: 'loading', title: 'loading compiler...', type: 'info'})
+ this.emit('statusChanged', { key: 'loading', title: 'loading compiler...', type: 'info' })
}
this.compiler.event.register('loadingCompiler', this.data.eventHandlers.onLoadingCompiler)
this.data.eventHandlers.onCompilerLoaded = () => {
this.data.loading = false
- this.emit('statusChanged', {key: 'none'})
+ this.emit('statusChanged', { key: 'none' })
}
this.compiler.event.register('compilerLoaded', this.data.eventHandlers.onCompilerLoaded)
@@ -105,7 +104,7 @@ class CompileTab extends ViewPlugin {
if (this._view.errorContainer) {
this._view.errorContainer.innerHTML = ''
}
- this.emit('statusChanged', {key: 'loading', title: 'compiling...', type: 'info'})
+ this.emit('statusChanged', { key: 'loading', title: 'compiling...', type: 'info' })
}
this.compileTabLogic.event.on('startingCompilation', this.data.eventHandlers.onStartingCompilation)
@@ -130,7 +129,7 @@ class CompileTab extends ViewPlugin {
title: `compilation finished successful with warning${data.errors.length > 1 ? 's' : ''}`,
type: 'warning'
})
- } else this.emit('statusChanged', {key: 'succeed', title: 'compilation successful', type: 'success'})
+ } else this.emit('statusChanged', { key: 'succeed', title: 'compilation successful', type: 'success' })
// Store the contracts
this.data.contractsDetails = {}
this.compiler.visitContracts((contract) => {
@@ -142,24 +141,24 @@ class CompileTab extends ViewPlugin {
})
} else {
const count = (data.errors ? data.errors.filter(error => error.severity === 'error').length : 0 + data.error ? 1 : 0)
- this.emit('statusChanged', {key: count, title: `compilation failed with ${count} error${count.length > 1 ? 's' : ''}`, type: 'error'})
+ this.emit('statusChanged', { key: count, title: `compilation failed with ${count} error${count.length > 1 ? 's' : ''}`, type: 'error' })
}
// Update contract Selection
- let contractMap = {}
+ const contractMap = {}
if (success) this.compiler.visitContracts((contract) => { contractMap[contract.name] = contract })
- let contractSelection = this.contractSelection(contractMap)
+ const contractSelection = this.contractSelection(contractMap)
yo.update(this._view.contractSelection, contractSelection)
- if (data['error']) {
+ if (data.error) {
this.renderer.error(
- data['error'].formattedMessage || data['error'],
+ data.error.formattedMessage || data.error,
this._view.errorContainer,
- {type: data['error'].severity || 'error'}
+ { type: data.error.severity || 'error' }
)
- if (data['error'].mode === 'panic') {
+ if (data.error.mode === 'panic') {
return modalDialogCustom.alert(yo`
- The compiler returned with the following internal error:
${data['error'].formattedMessage}.
+ The compiler returned with the following internal error:
${data.error.formattedMessage}.
The compiler might be in a non-sane state, please be careful and do not use further compilation data to deploy to mainnet.
It is heavily recommended to use another browser not affected by this issue (Firefox is known to not be affected).
Please join remix gitter channel for more information.`)
@@ -169,10 +168,10 @@ class CompileTab extends ViewPlugin {
data.errors.forEach((err) => {
if (this.config.get('hideWarnings')) {
if (err.severity !== 'warning') {
- this.renderer.error(err.formattedMessage, this._view.errorContainer, {type: err.severity})
+ this.renderer.error(err.formattedMessage, this._view.errorContainer, { type: err.severity })
}
} else {
- this.renderer.error(err.formattedMessage, this._view.errorContainer, {type: err.severity})
+ this.renderer.error(err.formattedMessage, this._view.errorContainer, { type: err.severity })
}
})
}
@@ -280,18 +279,18 @@ class CompileTab extends ViewPlugin {
name: key,
file: getFileName(contractMap[key].file)
})) : []
- let selectEl = yo`
+ const selectEl = yo`
`
// define swarm logo
- let result = contractList.length
- ? yo`
+ const result = contractList.length
+ ? yo`
@@ -326,7 +325,7 @@ class CompileTab extends ViewPlugin {
`
- : yo`