Commit 7f74f954 authored by Alex Beregszaszi's avatar Alex Beregszaszi

Remove the extra init function from editor

parent d74cb8e5
......@@ -14,8 +14,6 @@ function Editor (doNotLoadStorage, storage) {
var sessions = {}
var sourceAnnotations = []
setupStuff()
this.addMarker = function (range, cssClass) {
return editor.session.addMarker(range, cssClass)
}
......@@ -170,31 +168,31 @@ function Editor (doNotLoadStorage, storage) {
return s
}
function setupStuff () {
// Unmap ctrl-t & ctrl-f
editor.commands.bindKeys({ 'ctrl-t': null })
editor.commands.bindKeys({ 'ctrl-f': null })
// Do setup on initialisation here
if (doNotLoadStorage) {
return
}
// Unmap ctrl-t & ctrl-f
editor.commands.bindKeys({ 'ctrl-t': null })
editor.commands.bindKeys({ 'ctrl-f': null })
var files = getFiles()
if (doNotLoadStorage) {
return
}
if (files.length === 0) {
files.push(examples.ballot.name)
storage.set(examples.ballot.name, examples.ballot.content)
}
var files = getFiles()
this.setCacheFile(files[0])
if (files.length === 0) {
files.push(examples.ballot.name)
storage.set(examples.ballot.name, examples.ballot.content)
}
for (var x in files) {
sessions[files[x]] = newEditorSession(files[x])
}
this.setCacheFile(files[0])
editor.setSession(sessions[this.getCacheFile()])
editor.resize(true)
for (var x in files) {
sessions[files[x]] = newEditorSession(files[x])
}
editor.setSession(sessions[this.getCacheFile()])
editor.resize(true)
}
module.exports = Editor
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment