質問

I am using TinyMCE and I have rolled my own spellchecker using FFI-Hunspell.

I am just rendering this hardcoded response but when I click the spell check button in the WYSIWYG editor, it says that there aren't any misspelled words.

render :json => {:id => "#{params[:id]}", :result => {"presents" => ["presnts"], "motor" => ["moors"]}}.to_json

So, what is the JSON supposed to look like?

役に立ちましたか?

解決

I am using the tinymce_rails gem. I would have thought it was using the newer version. Anyways, I found this link that describes in detail how the request/response should look: https://github.com/spohlenz/tinymce-rails. Effectively, the response for the older version of tinyMCE is this:

render :json => ({:id => nil, :result => ['badk', 'wirds'], :error => nil}).to_json

Also, it actually uses a second request to get the suggestions. And those should look like:

render :json => ({:id => nil, :result => ['bad', 'bed'], :error => nil}).to_json
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top