Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quill-image-uploader

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quill-image-uploader

A module for Quill rich text editor to allow images to be uploaded to a server instead of being base64 encoded

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-33.04%
Maintainers
1
Weekly downloads
 
Created
Source

Quill ImageHandler Module

A module for Quill rich text editor to allow images to be uploaded to a server instead of being base64 encoded License: MIT

Demo

Image Uploading Demo GIF

Install

Install with npm:

npm install quill-image-uploader --save

Usage

Include the CSS for the loading effect or create your own.

const quill = new Quill(editor, {
  // ...
  modules: {
    // ...
    imageUploader: {
      upload: file => {
        // return a Promise that resolves in a link to the uploaded image
        return new Promise((resolve, reject) => {
          const fd = new FormData();
          fd.append("upload_file", file);

          const xhr = new XMLHttpRequest();
          xhr.open("POST", `${window.location.pathname}/api/files/add`, true);
          xhr.onload = () => {
            if (xhr.status === 200) {
              const response = JSON.parse(xhr.responseText);
              resolve(response.file_path); // Must resolve as a link to the image
            }
          };
          xhr.send(fd);
        });
      }
    }
  }
});

Keywords

FAQs

Package last updated on 28 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc