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) { ...@@ -14,8 +14,6 @@ function Editor (doNotLoadStorage, storage) {
var sessions = {} var sessions = {}
var sourceAnnotations = [] var sourceAnnotations = []
setupStuff()
this.addMarker = function (range, cssClass) { this.addMarker = function (range, cssClass) {
return editor.session.addMarker(range, cssClass) return editor.session.addMarker(range, cssClass)
} }
...@@ -170,31 +168,31 @@ function Editor (doNotLoadStorage, storage) { ...@@ -170,31 +168,31 @@ function Editor (doNotLoadStorage, storage) {
return s return s
} }
function setupStuff () { // Do setup on initialisation here
// Unmap ctrl-t & ctrl-f
editor.commands.bindKeys({ 'ctrl-t': null })
editor.commands.bindKeys({ 'ctrl-f': null })
if (doNotLoadStorage) { // Unmap ctrl-t & ctrl-f
return editor.commands.bindKeys({ 'ctrl-t': null })
} editor.commands.bindKeys({ 'ctrl-f': null })
var files = getFiles() if (doNotLoadStorage) {
return
}
if (files.length === 0) { var files = getFiles()
files.push(examples.ballot.name)
storage.set(examples.ballot.name, examples.ballot.content)
}
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) { this.setCacheFile(files[0])
sessions[files[x]] = newEditorSession(files[x])
}
editor.setSession(sessions[this.getCacheFile()]) for (var x in files) {
editor.resize(true) sessions[files[x]] = newEditorSession(files[x])
} }
editor.setSession(sessions[this.getCacheFile()])
editor.resize(true)
} }
module.exports = Editor 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