dont recompile on component selection

pull/2196/head
Richard Harris 7 years ago
parent 0bf61761d9
commit 87b6e17947

@ -39,7 +39,9 @@
} }
code = new_code; code = new_code;
updating_externally = true;
if (editor) editor.setValue(code); if (editor) editor.setValue(code);
updating_externally = false;
} }
export function update(new_code) { export function update(new_code) {
@ -73,7 +75,7 @@
const refs = {}; const refs = {};
let editor; let editor;
let updating = false; let updating_externally = false;
let marker; let marker;
let error_line; let error_line;
let destroyed = false; let destroyed = false;
@ -131,10 +133,6 @@
} }
}); });
beforeUpdate(() => {
updating = false;
});
function createEditor(mode) { function createEditor(mode) {
if (destroyed || !CodeMirror) return; if (destroyed || !CodeMirror) return;
@ -163,8 +161,8 @@
editor = CodeMirror.fromTextArea(refs.editor, opts); editor = CodeMirror.fromTextArea(refs.editor, opts);
editor.on('change', instance => { editor.on('change', instance => {
if (!updating) { if (!updating_externally) {
updating = true; updating_externally = true;
// code = instance.getValue(); // code = instance.getValue();
dispatch('change', { value: instance.getValue() }); dispatch('change', { value: instance.getValue() });
} }

Loading…
Cancel
Save