Fixes #9: handle errors correctly, fix scss file name

This commit is contained in:
Alex Dima 2016-06-21 01:08:02 +02:00
parent 62030f63a6
commit 4e34ca8bdf
2 changed files with 10 additions and 1 deletions

View file

@ -66,11 +66,20 @@ function loadSample(mode) {
$('.loading.editor').show(); $('.loading.editor').show();
}, },
error: function () { error: function () {
if (editor) {
if (editor.getModel()) {
editor.getModel().dispose();
}
editor.dispose();
editor = null;
}
$('.loading.editor').fadeOut({ duration: 200 }); $('.loading.editor').fadeOut({ duration: 200 });
$('#editor').append('<p class="alert alert-error">Failed to load ' + mode.name + ' sample</p>'); $('#editor').empty();
$('#editor').append('<p class="alert alert-error">Failed to load ' + mode.modeId + ' sample</p>');
} }
}).done(function (data) { }).done(function (data) {
if (!editor) { if (!editor) {
$('#editor').empty();
editor = monaco.editor.create(document.getElementById('editor'), { editor = monaco.editor.create(document.getElementById('editor'), {
model: null, model: null,
}); });