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 🙏

© 2024 – Pkg Stats / Ryan Hefner

quill-image-upload-v2

v1.2.7

Published

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

Downloads

6

Readme

from Quill ImageHandler Module

because Quill ImageHandler has some issues, when copied content that contains image both text, it will upload above all with a single image,image and text merge to a single image, no text part; its not too good. then, i add a logic,if it contain image and text. it will stop upload function, we can upload image by upload buttons at the top toolbar。

Quill ImageHandler logic, it will upload above all with a single image,image and text merge to a single image, no text part Image

this is change logic image, it will stop upload function,text is copyied, image need you upload by upload buttons at the top toolbar。 Image

of course,we can also upload image,replace base64 image width uploaded urls before we post form, see html-base64-img-to-upload

npm install quill-image-upload-v2 --save
import Quill from "quill";
import ImageUploadV2 from "quill-image-uploader-v2";

Quill.register("modules/ImageUploadV2", ImageUploadV2);

const quill = new Quill(editor, {
  // ...
  modules: {
    // ...
    ImageUploadV2: {
      upload: (file) => {
        return new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve(
              "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/JavaScript-logo.png/480px-JavaScript-logo.png"
            );
          }, 3500);
        });
      },
    },
  },
});

balabala

see Quill ImageHandler

Quill ImageHandler is below :

A module for Quill rich text editor to allow images to be uploaded to a server instead of being base64 encoded. Adds a button to the toolbar for users to click, also handles drag,dropped and pasted images.

Demo

Image of Yaktocat

Install

Install with npm:

npm install quill-image-uploader --save

Webpack/ES6

import Quill from "quill";
import ImageUpload from "quill.imageUpload.js";

Quill.register("modules/imageUpload", imageUpload);

const quill = new Quill(editor, {
  // ...
  modules: {
    // ...
    imageUpload: {
      upload: (file) => {
        return new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve(
              "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/JavaScript-logo.png/480px-JavaScript-logo.png"
            );
          }, 3500);
        });
      },
    },
  },
});

Quickstart (React with react-quill)

React Example on CodeSandbox

Quickstart (script tag)

Example on CodeSandbox

// A link to quill.js
<script src="/dist/quill.js"></script>
<script src="/dist/quill.imageUpload.min.js"></script>

Quill.register("modules/imageUpload", imageUpload);

var quill = new Quill(editor, {
  // ...
  modules: {
    // ...
    imageUpload: {
      upload: file => {
        return new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve(
              "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/JavaScript-logo.png/480px-JavaScript-logo.png"
            );
          }, 3500);
        });
      }
    }
  }
});