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

quill-mention

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quill-mention

@mentions for the Quill rich text editor

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20K
decreased by-78.49%
Maintainers
1
Weekly downloads
 
Created
Source

Quill Mention

Quill Mention

npm version License: MIT

Quill Mention is a module to provide @mentions functionality for the Quill rich text editor.

Demo

https://afconsult.github.io/projects/quill-mention/

Mention Demo GIF

Getting Started

Install

Install with npm:

npm install quill-mention --save

Install with Yarn:

yarn add quill-mention

Example

const values = [
  { id: 1, value: 'Fredrik Sundqvist' },
  { id: 2, value: 'Patrik Sjölin' }
];
const quill = new Quill(editor, {
  modules: {
    mention: {
      allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
      source: function (searchTerm) {
        if (searchTerm.length === 0) {
          this.renderList(values, searchTerm);
        } else {
          const matches = [];
          for (i = 0; i < values.length; i++)
            if (~values[i].value.toLowerCase().indexOf(searchTerm)) matches.push(values[i]);
          this.renderList(matches, searchTerm);
        }
      },
    },
  }
});

Settings

PropertyDefaultDescription
source(searchTerm, renderList, mentionChar)nullRequired callback function to handle the search term and connect it to a data source for matches. The data source can be a local source or an AJAX request. The callback should call this.renderList(matches, searchTerm); with matches of JSON Objects in an array to show the result for the user. The JSON Objects should have id and value but can also have other values to be used in renderItem for custom display.
renderItem(item)functionA function that gives you control over how matches from source are displayed.
allowedChars[a-zA-Z0-9_]Allowed characters in search term triggering a search request using regular expressions
minChars0Minimum number of characters after the @ symbol triggering a search request
maxChars31Maximum number of characters after the @ symbol triggering a search request
offsetTop2Additional top offset of the mention container position
offsetLeft0Additional left offset of the mention container position
mentionDenotationChars["@"]Specifies which characters will cause the mention autocomplete to open

Authors

Fredrik Sundqvist (MadSpindel)

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Keywords

FAQs

Package last updated on 23 May 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