Socket
Socket
Sign inDemoInstall

quill-mention

Package Overview
Dependencies
30
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

9

package.json
{
"name": "quill-mention",
"version": "0.2.1",
"version": "0.2.2",
"description": "@mentions for the Quill rich text editor",
"main": "dist/main.js",
"main": "dist/quill.mention.min.js",
"repository": "https://github.com/afconsult/quill-mention.git",
"author": "Fredrik Sundqvist <fsundqvist@gmail.com>",
"license": "MIT",
"files": [
"dist",
"LICENSE",
"README.md"
],
"devDependencies": {

@@ -10,0 +15,0 @@ "css-loader": "^0.28.8",

@@ -23,21 +23,21 @@ # Quill Mention

const values = [
{ id: 1, value: 'Fredrik Sundqvist' },
{ id: 2, value: 'Patrik Sjölin' }
{ 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);
}
},
},
}
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);
}
},
},
}
});

@@ -50,6 +50,8 @@ ```

| `source(searchTerm)` | `null` | Required 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)` | `function` | A function that gives you control over how matches from source are displayed. |
| `renderItem(item)` | `function` | A 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 |
| `minChars` | `0` | Minimum number of characters after the @ symbol triggering a search request |
| `maxChars` | `31` | Maximum number of characters after the @ symbol triggering a search request |
| `offsetTop` | `2` | Additional top offset of the mention container position |
| `offsetLeft` | `0` | Additional left offset of the mention container position |

@@ -56,0 +58,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc