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

[Feature]: Custom image upload function #103

Closed VladimirHumeniuk closed 3 years ago

VladimirHumeniuk commented 6 years ago

I'm submitting a

Description

It would be amazing if we could use custom functions to load pictures, and not just send POST requests to the address specified in the configuration. For example, I use Firebase in my application, and just a post request to save a picture to the FIrestore is not enough.

Also, huge thanks for you work. Editor is pretty nice.

Version Information

ngx-editor: 3.3.0
angular: 5.2.9
sibiraj-s commented 6 years ago

@VladimirHumeniuk . Glad to hear that.

I use Firebase in my application, and just a post request to save a picture to the FIrestore is not enough.

What would it be. More information will be easier to get going. Like an example.

VladimirHumeniuk commented 6 years ago

@Sibiraj-S To solve the problem of downloading files to Firebase, I had to add an additional button next to the editor. The function of uploading a file to the Firebase Storage is as follows: image

Its return downloadURL, which I copy and paste into the editor.

sibiraj-s commented 6 years ago

I can't have multiple methods, but what possible is

  1. A custom toolbar as previously said
  2. An api can be exposed that inserts image to the editor.

What do you think?

VladimirHumeniuk commented 6 years ago

@Sibiraj-S i want both variants, that would be really useful 😊

sibiraj-s commented 6 years ago

Will try to solve these issues ASAP, but I was little tied up to other tasks here. so may take a little time than expected.

🍻

VladimirHumeniuk commented 6 years ago

@Sibiraj-S cool, thanks.

cerealexx commented 5 years ago

@Sibiraj-S Is there a way to get a file path from the uploader instead of a buffer? That way it'd be quite easy to build an endpoint with Firebase Functions.

khernik93 commented 5 years ago

I've added a PR with the upload event implementation - feel free to approve it, or discard if it doesn't really suits your architecture ;-)

sibiraj-s commented 3 years ago

With v5. you can write your own custom menu items, so it is possible to write custom image component/upload function to upload images and insert the images back. See the ImageCommand implementation for how to insert images.

Also. Sorry for the delay. I have been not using angular anymore and I maintain this during my spare time. If you are still using the package and need help feel free to post the issues if you face any. I will help.

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.