sibiraj-s / ngx-editor

🖋️ Rich Text Editor for angular using ProseMirror
https://sibiraj-s.github.io/ngx-editor/
MIT License
424 stars 183 forks source link

Unable to upload image in the editor #156

Closed dsjambekar closed 5 years ago

dsjambekar commented 5 years ago

I'm submitting a

Description

I am trying to load an image in the editor. It allows me to select image. And then it shows 100% uploaded but it doesn't really upload the image. image

I get this following error in the console- image

Maybe it is not about your editor. I have to do something on my side but I don't know exactly what to do. What should I do with the json response? Can you please explain?

Version Information

ngx-bootstrap": "^3.0.1", ngx-editor": "^3.3.0", ngx-quill": "^3.6.0"

sibiraj-s commented 5 years ago

I guess, the problem is with the endpoint. Have you added the endpoint as mentioned here? Upload Images

dsjambekar commented 5 years ago

I have added it like this - <app-ngx-editor id="question" imageEndPoint="/assets" [placeholder]="'Enter text here...'" [spellcheck]="true" height="200px" >

And in the console, it is able to find the right path.

sibiraj-s commented 5 years ago

Okay. Are you trying to upload the image to a local directory?

dsjambekar commented 5 years ago

yes, when running in local, it will upload on local. But I have hosted this app on the firebase, so later I want it to be inside a folder with the same name, on the firebase.

sibiraj-s commented 5 years ago

Sorry, It doesn't work that way. The editor expects an actual api to post the data and expects a response from that. Its just a plain api call. You can see that here https://github.com/sibiraj-s/ngx-editor/blob/cfb89028b9bec7eb2118bc1edac77d655c10c63c/src/app/ngx-editor/common/services/command-executor.service.ts#L129

dsjambekar commented 5 years ago

Ok, so the api will receive the image as input and then the api has to save the image to whatever folder I want to save. The api will have to return the image url. Am I right?

sibiraj-s commented 5 years ago

Yes, totally correct.

I should have been more clear in the docs regarding this. as this is the third issue related to the same question. Will update the docs.

dsjambekar commented 5 years ago

ok, thanks for the explanation.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.