mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Fixes #9: handle errors correctly, fix scss file name
This commit is contained in:
parent
62030f63a6
commit
4e34ca8bdf
2 changed files with 10 additions and 1 deletions
|
|
@ -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,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue