npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@roel.id/quill-image-browser

v0.1.1

Published

A Quill rich text editor Module which adds an image browser

Readme

quill-image-browser

npm (scoped) NPM npm

quill-image-browser is image browser module for Quill text editor. By default, Quill embed image into post as base64 string, which make the post unnecessarily large. There is quill-image-uploader module that overcome this problem. And better, this module can intercept dragged or pasted image, and upload to server. But how if one wants to pick previously uploaded image? Then quill-image-browser come to rescue.

Usage

<script src="/js/quill/quill.min.js"></script>
<script src="/js/media-browser.min.js"></script>
<script>
  let quill = new Quill('#editor', {
    theme: 'snow',
    modules: {
      toolbar: {
        container: [['bold', 'italic'], ['image']],
        handlers: {
          image: () => {
            new MediaBrowser({
              parent: '.ql-container',
              upload: file => {// upload file to server, return url,
                return new Promise(resolve => {
                  // const formData = new FormData();
                  // formData.append("file", file);
                  // axios.post('/upload', formData, { headers: { 'Content-Type': 'multipart/form-data'} })
                  //   .then(resp => resolve(resp.data) )
                  resolve({ url: 'https://picsum.photos/id/23/300/200.webp', name: 'Forks' });
                })
              },
              list: keyword => { // list of image [{url, title}], filtered by keyword
                return new Promise(resolve => {
                  // axios.post('/get-images', { keyword }, ).then(resp => resolve(resp.data));
                  let images = [
                    { url: 'https://picsum.photos/id/20/300/200.webp', name: 'Mac & iPhone' },
                    { url: 'https://picsum.photos/id/21/300/200.webp', name: 'High heel' },
                    { url: 'https://picsum.photos/id/22/300/200.webp', name: 'Walking' },
                  ];
                  resolve(keyword ? images.filter(e => e.name.match(new RegExp(keyword, 'i'))) : images);
                })
              },
              callback: url => {
                let range = quill.getSelection(true);
                quill.insertEmbed(range.index, "image", `${url}`);
              },
            }).open();
          }
        }
      }
    }
  })
</script>

Image Browser

Using together with quill-image-uploader

We can use quill-image-browser along side with quill-image-uploader by creating a new class that extends ImageUploader.

class ImageBrowser extends ImageUploader {
  constructor(quill, options) {
    super(quill, options);
    this.range = null;
    const toolbar = quill.getModule("toolbar");
    toolbar.addHandler("image", this.browseLocalImage.bind(this));
    this.mediaBrowser = new MediaBrowser({
      parent: '.ql-container',
      upload: options.upload,
      list: options.list,
      callback: this.callback.bind(this),
    });
  }

  browseLocalImage() {
    this.range = this.quill.getSelection();
    this.mediaBrowser.open();
  }

  callback(images) {
    this.quill.insertEmbed(this.range.index, "image", `${images[0]}`, "user");
  }
}

In this class, we replace the image handler, and let parent class catch image drop or paste event as usual.