Наконец-то нашли решение
Шаблон:
<input type="file" [multiple]="multiple" #fileInput class="browse-btn" (change)="readFile()" accept=".xlsx">
<button type="button" class="btn btn-info btn-lg" (click)="upload()" >Upload</button>
Компонент:
public upload() {
const inputEl: HTMLInputElement = this.inputEl.nativeElement;
const fileCount: number = inputEl.files.length;
const formData = new FormData();
const headers = new Headers();
headers.set('Accept', 'application/json');
headers.delete('Content-Type'); // mandate for accepting binary content
if (fileCount > 0) {
for (let i = 0; i < fileCount; i++) {
formData.append('file', inputEl.files.item(i));
}
try {
this.loaderForFileUpload = true;
this.http
.post('http://urlForFileUpload', formData, { headers: headers })
.subscribe(response => {
if (response.status === 200) {
this._toastr.success('File uploaded successfully', 'Success!');
}
}, error => {
this._toastr.error('File contents mismatch', error.statusText);
});
} catch (e) {
console.log('Error occured while posting uploaded file. See below message for details : \n');
console.log(e);
}
}
}
Первая идея, прибывающая по моему мнению, состоит в том, чтобы размыть () текстовую область или поместить фокус в другом месте. Конечно, я предполагаю, что WYSIWYG-редактор использует простую текстовую область, не более сложный компонент DHTML.