ngx-quill-upload icon indicating copy to clipboard operation
ngx-quill-upload copied to clipboard

Cannot read properties of null (reading 'removeAttribute') at ImageHandler.loadFile

Open ghost opened this issue 2 years ago • 2 comments

When I try and upload an image, I am getting this error:

Cannot read properties of null (reading 'removeAttribute') at ImageHandler.loadFile.

I've had a look into the source code and set breakpoints. The problem seems to be this line:

this.loading.removeAttribute('class');.

I can see that loadingHTML() is called on instantiation when debugging.

The div with the id of __ID_SPLIT__.QUILL-LOADING is present in the DOM at the point of attempting to upload an image.

I can't figure out why the reference to loading is being set to null.

I have a component that allows users to create and edit documents. This issue only happens when I edit a document that already exists. There's no difference, as far as I know, other than the editor is programatically filled in when a user goes to edit a document. This is obviously causing an issue, but I can not for the life of me figure out why.

Screenshot 2022-11-25 at 12 52 57 Screenshot 2022-11-25 at 12 53 22 Screenshot 2022-11-25 at 12 53 51

ghost avatar Nov 25 '22 13:11 ghost

@tomdeakin-tootoot Did you figure out why this error is coming, I'm also having same issue.

umar0645 avatar Mar 09 '23 16:03 umar0645

For me, it seems like registering a module and getting a reference to the loading node happens before most of the structure directives like *ngIf. For instance, you have your entity to be retrieved from the server, and before you get it, you already registered ImageHandler, therefore you called his constructor which receives a reference to the loading node. It happens only once

ihor-pidhornyi avatar Apr 29 '24 15:04 ihor-pidhornyi