question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

angular-editor-toolbar component crashes after successful file upload

See original GitHub issue

Hi,

I get following error when I succesfully upload an image:

ERROR TypeError: Cannot read property 'nativeElement' of undefined at AngularEditorToolbarComponent.fileReset (angular-editor-toolbar.component.ts:339)

The problem is that myInputFile is always (ViewChild: fileInput) undefined.

So here:

onFileChanged(event) { /** @type {?} */ const file = event.target.files[0]; if (file.type.includes('image/')) { if (this.uploadUrl) { this.editorService.uploadImage(file).subscribe((/** * @param {?} e * @return {?} */ e => { if (e instanceof _angular_common_http__WEBPACK_IMPORTED_MODULE_1__["HttpResponse"]) { **this.editorService.insertImage(e.body.imageUrl); this.fileReset();** } })); } else { /** @type {?} */ const reader = new FileReader(); reader.onload = (/** * @param {?} e * @return {?} */ (e) => { /** @type {?} */ const fr = (/** @type {?} */ (e.currentTarget)); this.editorService.insertImage(fr.result.toString()); }); reader.readAsDataURL(file); } } }

when calling:

fileReset() { this.myInputFile.nativeElement.value = ''; }

myInputFile does not exist.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
asifisthiaq24commented, Jun 28, 2020

Until new release to fix this issue: goto node_modules/@kolkov/angular-editor/ivy_ngcc/fesm2015/kolkov-angular-editor.js and do the followings:

if (e instanceof HttpResponse) { this.editorService.insertImage(e.body.imageUrl); // this.fileReset(); //comment out his line event.srcElement.value = null; // add this line } //comment this section of the code // /** // * Reset Input // * @return {?} // */ // fileReset() { // this.myInputFile.nativeElement.value = ‘’; // }

1reaction
kolkovcommented, Dec 10, 2019

Hi! Thanks for reporting this issue. I will try to reproduce this situation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AngularEditor: ViewChild removed after successful file upload?
It is a library bug. Should be fixed soon: https://github.com/kolkov/angular-editor/issues/178.
Read more >
Grid in inline-edit mode crashes when another component is ...
Once upload is finished (I can see the file on the server) and "onUploadSuccess" runs, the grid exits editing mode and crashes.
Read more >
Playza Editor Alpha v0.7.0.1 Release Notes [Part4] - Mirror.xyz
[Playza Editor-Template Editor] Fixed the bug that when dragging and dropping the UI with script into template, the exported template (.zip file) ...
Read more >
Unity 2022.2.0b5
Editor : Fixed crash when OnDemand scheduler tries to upload previews ... Added ContentLoadInterface for loading unity serialized files.
Read more >
Scripting API: CrashReport - Unity - Manual
Upon the next application start, if the data gathering was successful, all crash ... in Unity, open it and edit trampoline file: Classes/CrashReporter.h....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found