Merge pull request #11756 from rusikv/bug/html-error-entity-error

Disabled "Named entity expected" for html editor
This commit is contained in:
Igor Kulikov 2024-11-01 18:42:36 +02:00 committed by GitHub
commit 529109a71f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -126,7 +126,17 @@ export class HtmlComponent implements OnInit, OnDestroy, ControlValueAccessor, V
}); });
// @ts-ignore // @ts-ignore
this.htmlEditor.session.on('changeAnnotation', () => { this.htmlEditor.session.on('changeAnnotation', () => {
const annotations = this.htmlEditor.session.getAnnotations(); const annotations = this.htmlEditor.session.getAnnotations() || [];
const length = annotations.length;
let i = length;
while (i--) {
if(annotations[i].text.includes('Named entity expected')) {
annotations.splice(i, 1);
}
}
if (length > annotations.length) {
this.htmlEditor.session.setAnnotations(annotations);
}
const hasErrors = annotations.filter(annotation => annotation.type === 'error').length > 0; const hasErrors = annotations.filter(annotation => annotation.type === 'error').length > 0;
if (this.hasErrors !== hasErrors) { if (this.hasErrors !== hasErrors) {
this.hasErrors = hasErrors; this.hasErrors = hasErrors;