unravel-me
v0.2.2
Published
A real time text expander for form fields and text areas.
Downloads
7
Maintainers
Readme
Unravel-Me
Unravel-Me is a simple text unwrapper, expander or if you prefer--snippets, that expand in real time.
Installation and Usage.
To install simply do
npm install --save unravel-me
To initialize your snippets you must pass a JSON object to it. The key is the desired shortcut and the value is the expanded form.
// This is snippets.json.
{
.
.
.
"jcd": "Jacaranda",
"abf": "A quick brown fox jumps over the lazy dog.",
"ss": "strawberry shortcake",
"th": "the",
.
.
.
}
import { Unravel } from 'Unravel-Me';
.
.
,
import abbreviation_list from './path/to/your/list/of/abbreviations/snippets.json';
// ***********
// You must initialize the abbreviation map.
// Place in your code where ever you see fit.
// ***********
Unravel.create_abbreviation_map(abbreviation_list);
// ***********
// If you want to pass the event and have unravel take care of the rest then simply
// pass the event function to it.
function your_function_that_handles_the_event(event) {
Unravel.expand_abbreviation(event);
}