| 1. | Emmanuel | my website | 07/16/2010 02:32:54 |
Thank you this will surely be very handy for my Ruby projects :)
def spellcheck
spell = Aspell.new
spell.set_option("mode", "html")
words = spell.list_misspelled([params[:text]])
checked = { :check => :spelling,
:data => words.map { |word|
{
:word => word,
:suggestions => spell.suggest(word)
}
}
}
render :json => checked.to_json
end
this._conn = YAHOO.util.Connect.asyncRequest('POST', '/editor/spellcheck', {
success: this._checkSpelling,
failure: function() {},
scope: this
}, 'text=' + escape(this.getEditorHTML()));
html = html.replace(new RegExp('\\b' + data.data[i].word + '(?![^<]*>)\\b', 'g'), '<span class="yui-spellcheck">' + data.data[i].word + '</span>');editor.initSpellChecker();
{ type: 'push', label: 'Check Spelling', value: 'spellcheck' } extracss: '.yui-spellcheck { background-color: yellow; }'
| 1. | Emmanuel | my website | 07/16/2010 02:32:54 |
Thank you this will surely be very handy for my Ruby projects :)
Post a Comment