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

stencil-quill

v11.0.0

Published

Native web component for quill editor

Downloads

9,923

Readme

stencil-quill Build Status

Native web components for the Quill Rich Text Editor

Built With Stencil

Donate/Support

If you like my work, feel free to support it. Donations to the project are always welcomed :)

PayPal: PayPal.Me/bengtler

Examples

Installation

  • npm install stencil-quill
  • load node_modules/stencil-quill/dist/quill-components.js in your index.html or add it to your build process or project
  • do not forget to install quill v2! and include it + theme css in your buildprocess, module or index.html! (the component is using the global Quill object)

QuillEditor component

HTML-Tag

<quill-editor content="" format="html" theme="snow"></quill-editor>

Config

  • Check the component readme
  • content - the base content of the editor passed as string or JSON string
  • readOnly (true | false) if user can edit content
  • formats - array of allowed formats/groupings
  • format - model format - default: html, values: html | text | json, sets the model value type - html = html string, json = quill operations as json string, text = plain text
  • modules - configure/disable quill modules, passed as JSON-string!, e.g toolbar or add custom toolbar via html element default is
{
  toolbar: [
    ['bold', 'italic', 'underline', 'strike'],        // toggled buttons
    ['blockquote', 'code-block'],

    [{ 'header': 1 }, { 'header': 2 }],               // custom button values
    [{ 'list': 'ordered'}, { 'list': 'bullet' }],
    [{ 'script': 'sub'}, { 'script': 'super' }],      // superscript/subscript
    [{ 'indent': '-1'}, { 'indent': '+1' }],          // outdent/indent
    [{ 'direction': 'rtl' }],                         // text direction

    [{ 'size': ['small', false, 'large', 'huge'] }],  // custom dropdown
    [{ 'header': [1, 2, 3, 4, 5, 6, false] }],

    [{ 'color': [] }, { 'background': [] }],          // dropdown with defaults from theme
    [{ 'font': [] }],
    [{ 'align': [] }],

    ['clean'],                                         // remove formatting button

    ['link', 'image', 'video']                         // link and image, video
  ]
};
  • theme - bubble/snow, default is snow
  • styles - set a styles object, e.g. styles="{height: '250px'}"
  • placeholder - placeholder text, default is Insert text here ...
  • bounds - boundary of the editor, default document.body, pass 'self' to attach the editor element
  • possbility to create a custom toolbar via a custom slot quill-toolbar:
<quill-component content="test">
  <div slot="quill-toolbar">
    <span class="ql-formats">
      <select class="ql-font">
        <option value="aref">Aref Ruqaa</option>
        <option value="mirza">Mirza</option>
        <option selected>Roboto</option>
      </select>
      <select class="ql-align" title="Aligment">
        <option selected></option>
        <option value="center"></option>
        <option value="right"></option>
        <option value="justify"></option>
      </select>
      <select class="ql-align" title="Aligment2">
        <option selected></option>
        <option value="center"></option>
        <option value="right"></option>
        <option value="justify"></option>
      </select>
    </span>
    <span class="ql-formats">
      <div id="counter"></div>
    </span>
  </div>
</quill-component>
  • customToolbarPosition - if you are working with a custom toolbar you can switch the position :). - default: top, possible values top, bottom
  • debug - set log level warn, error, log or false to deactivate logging, default: warn
  • defaultEmptValue - set the default empty value, e.g. empty string, default null

Full Quill Toolbar HTML

Events

  • editorInit - editor instance
editor
  • editorContentChange - text is updated by 'user'
{
  editor: editorInstance,
  html: html,
  text: text,
  content: content,
  delta: delta,
  oldDelta: oldDelta,
  source: source
}
  • editorSelectionChange - selection is updated, also triggered for onBlur and onFocus, because the selection changed
{
  editor: editorInstance,
  range: range,
  oldRange: oldRange,
  source: source
}
  • editorChange - text or selection is updated - independent of the source
{
  editor: editorInstance, // Quill
  event: 'text-change' // event type
  html: html, // html string
  text: text, // plain text string
  content: content, // Content - operatins representation
  delta: delta, // Delta
  oldDelta: oldDelta, // Delta
  source: source // ('user', 'api', 'silent' , undefined)
}

or

{
  editor: editorInstance, // Quill
  event: 'selection-change' // event type
  range: range, // Range
  oldRange: oldRange, // Range
  source: source // ('user', 'api', 'silent' , undefined)
}
  • editorFocus - editor is focused
{
  editor: editorInstance, // Quill
  source: source // ('user', 'api', 'silent' , undefined)
}
  • editorBlur - editor is blured
{
  editor: editorInstance, // Quill
  source: source // ('user', 'api', 'silent' , undefined)
}

QuillView component

It renders a readOnly quilljs editor without a border and toolbar. Does not provide any Events, but has similar properties.

HTML-Tag

<quill-view content="" format="html" theme="snow"></quill-view>

Config

  • Check the component readme
  • content - the base content of the editor passed as string or JSON string
  • formats - array of allowed formats/groupings
  • format - model format - default: html, values: html | text | json, sets the model value type - html = html string, json = quill operations as json string, text = plain text
  • modules - configure/disable quill modules, passed as JSON-string! - keep in mind toolbar will be set to false anyways
  • theme - bubble/snow, default is snow
  • styles - set a styles object, e.g. styles="{height: '250px'}"
  • debug - set log level warn, error, log or false to deactivate logging, default: warn
  • defaultEmptValue - set the default empty value, e.g. empty string, default null

QuillViewHTML component

It renders an quilljs html string as you would expect it without createing a quilljs instance.

HTML-Tag

<quill-view-html content="" theme="snow"></quill-view-html>

Config

  • Check the component readme
  • content - the base content of the editor passed as string or JSON string
  • theme - bubble/snow, default is snow

Using the components

Script tag

  • Publish to NPM
  • Put a script tag similar to this <script src='https://unpkg.com/stencil-quill/dist/quill-components/quill-components.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install stencil-quill --save
  • Put a script tag similar to this <script src='node_modules/stencil-quill/dist/quill-components/quill-components.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

In a stencil-starter app

  • Run npm install stencil-quill --save
  • Add an import to the npm packages import quill-components;
  • Then you can use the element anywhere in your template, JSX, html etc