quill-mention
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"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 @@ |
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
64
11472
6
0
2