How to open quill image uploader programmatically?

480 Views Asked by At

I have a two toolbar in quill.

  1. Quill toolbar
  2. Custom toolbar

I need to put the image tool in the custom toolbar but the problem is that quill is only allowed the addHandler for its own toolbar so I need to open the quill image uploader programmatically when the user clicks on my image.

Is there any way to do it?

Thanks

1

There are 1 best solutions below

0
On

You can access the Quill toolbar with quill.getModule('toolbar') which will expose the format handlers. This will also work with custom handlers that you've added to the Quill toolbar.

// ... set up quill stuff

// get the quill toolbar
let toolbar = quill.getModule('toolbar')

// call the image handler
toolbar.handlers.image()