|
|
@ -299,6 +299,8 @@ var run = function () { |
|
|
|
editor.event.register('sessionSwitched', refreshTabs) |
|
|
|
editor.event.register('sessionSwitched', refreshTabs) |
|
|
|
|
|
|
|
|
|
|
|
function switchToFile (file) { |
|
|
|
function switchToFile (file) { |
|
|
|
|
|
|
|
editorSyncFile() |
|
|
|
|
|
|
|
|
|
|
|
currentFile = file |
|
|
|
currentFile = file |
|
|
|
|
|
|
|
|
|
|
|
if (files.isReadOnly(file)) { |
|
|
|
if (files.isReadOnly(file)) { |
|
|
@ -659,6 +661,11 @@ var run = function () { |
|
|
|
compiler.compile(files, target) |
|
|
|
compiler.compile(files, target) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function editorSyncFile () { |
|
|
|
|
|
|
|
var input = editor.get(currentFile) |
|
|
|
|
|
|
|
files.set(currentFile, input) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var previousInput = '' |
|
|
|
var previousInput = '' |
|
|
|
var compileTimeout = null |
|
|
|
var compileTimeout = null |
|
|
|
var saveTimeout = null |
|
|
|
var saveTimeout = null |
|
|
@ -677,10 +684,7 @@ var run = function () { |
|
|
|
if (saveTimeout) { |
|
|
|
if (saveTimeout) { |
|
|
|
window.clearTimeout(saveTimeout) |
|
|
|
window.clearTimeout(saveTimeout) |
|
|
|
} |
|
|
|
} |
|
|
|
saveTimeout = window.setTimeout(function () { |
|
|
|
saveTimeout = window.setTimeout(editorSyncFile, 5000) |
|
|
|
var input = editor.get(currentFile) |
|
|
|
|
|
|
|
files.set(currentFile, input) |
|
|
|
|
|
|
|
}, 5000) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// special case: there's nothing else to do
|
|
|
|
// special case: there's nothing else to do
|
|
|
|
if (input === '') { |
|
|
|
if (input === '') { |
|
|
|