MooContentAssist is a javascript library that add a content assist feature to textareas in your webpage.
MooContentAssist is based on MooTools 1.3.1 and works with FireFox, Chrome, Safari, IE7/8.
1-You need a textarea with the html id, example:
<textarea id="myeditor">
Lorem Ipsum
</textarea>
2-Then include the MooContentAssist.js and CSS (and MooTools if you already haven't)
<link type="text/css" rel="stylesheet" href="MooContentAssist.css" /> <script src="js/lib/mootools-core-1.3.1-full-nocompat.js"></script> <script src="js/lib/mootools-more-1.3.1.1.js"></script> <script src="Source/MooContentAssist.js"></script>
3-Istantiate a new MooContentAssist
<script type="text/javascript>
window.addEvent("domready",function(){
var editorAssisted = new MooContentAssist( {
"source": document.id("myeditor"),
"vocabulary" : {
"key0": null,
"key1": ["subkey1","subkey2","subkey3"],
"key2": {
"subsubkey1": null,
"subsubkey2": ["a","b","c"],
"subsubkey3": {
"a": null,
"b": ["1","2","3"]
}
}
}
});
});
</script>
Eeverything works if you give the right json words object.
Use this as root:
vocabulary: {
"key1":
"key2":
"key3":
}
If the key doesn't have sub-keys you must use an array with strings:
"key_without_subkeys": ["word1","word2","word3"]
If the key has sub-keys you must use objects:
"key_with_subkeys": {
"subkey1": ["word","word","word"],
"subkey2": ["word","word","word"],
"subkey3": ["word","word","word"]
}
Obviously you could have infinite sub-levels :)
Please see index.html in the git repo if you need a working example. :)
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus