mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-12 17:46:26 +02:00
fix showError code for monaco
This commit is contained in:
@ -159,6 +159,19 @@ export default class CodeEditor extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showErrors(errors) {
|
||||||
|
if (this.props.type === 'codemirror') {
|
||||||
|
errors.forEach(function(error) {
|
||||||
|
this.instance.operation(function() {
|
||||||
|
var n = document.createElement('div');
|
||||||
|
n.setAttribute('data-title', error.message);
|
||||||
|
n.classList.add('gutter-error-marker');
|
||||||
|
editor.setGutterMarker(error.lineNumber, 'error-gutter', n);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.instance.refresh ? this.instance.refresh() : this.instance.layout();
|
this.instance.refresh ? this.instance.refresh() : this.instance.layout();
|
||||||
}
|
}
|
||||||
|
@ -173,15 +173,7 @@ export default class ContentWrap extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showErrors(lang, errors) {
|
showErrors(lang, errors) {
|
||||||
var editor = this.cm[lang];
|
this.cm[lang].showErrors(errors);
|
||||||
errors.forEach(function(e) {
|
|
||||||
editor.operation(function() {
|
|
||||||
var n = document.createElement('div');
|
|
||||||
n.setAttribute('data-title', e.message);
|
|
||||||
n.classList.add('gutter-error-marker');
|
|
||||||
editor.setGutterMarker(e.lineNumber, 'error-gutter', n);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,16 +263,8 @@ export default class ContentWrapFiles extends Component {
|
|||||||
this.editor.clearGutter('error-gutter');
|
this.editor.clearGutter('error-gutter');
|
||||||
}
|
}
|
||||||
|
|
||||||
showErrors(lang, errors) {
|
showErrors(errors) {
|
||||||
var editor = this.cm;
|
this.editor.showErrors(errors);
|
||||||
errors.forEach(function(e) {
|
|
||||||
editor.operation(function() {
|
|
||||||
var n = document.createElement('div');
|
|
||||||
n.setAttribute('data-title', e.message);
|
|
||||||
n.classList.add('gutter-error-marker');
|
|
||||||
editor.setGutterMarker(e.lineNumber, 'error-gutter', n);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user