Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/craigmccauley/craigs-spell-check-dialog
jQuery/bootstrap plugin to provide a spellcheck dialog.
https://github.com/craigmccauley/craigs-spell-check-dialog
Last synced: 19 days ago
JSON representation
jQuery/bootstrap plugin to provide a spellcheck dialog.
- Host: GitHub
- URL: https://github.com/craigmccauley/craigs-spell-check-dialog
- Owner: craigmccauley
- License: mit
- Created: 2015-07-07T21:49:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-10T17:55:13.000Z (about 8 years ago)
- Last Synced: 2024-11-11T17:02:42.671Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Craig's Spell Check Dialog
jQuery plugin to provide a spell check dialog##Usage
Some conteent
Check for errors
$(function(){
var spellchecker = $(document).cscd({
//either specify your server URL
spellcheckURL : "http://localhost/SpellCheck/api/CheckWords",
//or you can use client side spellchecking with Typo.js
//CSCD will automatically look for .aff and .dic files in specified directory
//ex. en_CA.aff/en_CA.dic
//make sure you can serve .aff and .dic files as text/plain from your web server
dictionaryPath : "./Dictionary/",
//sample alert (not required, will use js alert by default)
alertFunction : function(header, body, callback){
$('#spellCheckModal #confirmModalTitle').text(header);
$('#spellCheckModal #confirmModalMsg').text(body);
$('#spellCheckModal').modal('show');
$('#spellCheckOkButton').unbind('click').on('click', function () {
if (callback) {
callback();
}
}).focus();
}
});
$('#spellcheckbutton').click(function(){
spellchecker.cscd(
//execute spellcheck function
'SpellCheck',
//html content to check
$('#mycontent').html(),
//callback function
function(data){
$('#mycontent').html(data);
}
);
});
});
##On the Server Side - if needed
You will need a function that accepts an array of strings and returns a Dictionary<string, string[]>.
The array of strings passed in is a unique list of words.
In the dictionay passed back the key string is the misspelled word, value array of strings are the suggestions.
In .Net it would look like this.public Dictionary Post([FromBody]string[] words)
If you are not using .Net the request body will look similar to this=wordtocheck1&=wordtocheck2&=wordtocheck3&=wordtocheck4
and your response body should look similar to this
{"typo1":["sug1", "sug2"],"typo2":["sug1","sug2"]}