Spellchecker is not working in tinymce 4.0 (Non JSON response)

不问归期 提交于 2019-12-24 01:48:32

问题


I'm trying to use Spellchecker in TinyMCE 4.0, but it returns the error:

Non JSON response:<br />
<b>Warning</b>:  call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'PSpellShell::spellcheck' was given in <b>/home/www/misitio.com/doc/plugins/tinymce/plugins/spellchecker/rpc.php</b> on line <b>98</b><br />
{"id":null,"result":null,"error":null}

The code I use is:

//Javascript:
tinymce.init({
        selector: "textarea",
        theme: "modern",
        language : 'es',
        menubar : false,
        height: 400,
        autoresize_min_height: 400,
        plugins: [
            "advlist autolink lists link image charmap hr",
            "searchreplace wordcount visualchars fullscreen",
            "insertdatetime table contextmenu directionality",
            "template textcolor autoresize spellchecker"
        ],
        toolbar: "undo redo | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | forecolor backcolor | subscript superscript | removeformat blockquote | charmap inserttime | link image | table hr | searchreplace | fullscreen spellchecker",
        image_advtab: true,
        spellchecker_languages : "+English=en",
        spellchecker_rpc_url: 'plugins/tinymce/plugins/spellchecker/rpc.php'
    });

with plugin PHP Spellchecker 2.0.6.1 (http://www.tinymce.com/develop/changelog/?type=phpspell)

I think that you can fix connection problems with Google trying to https://github.com/tinymce/tinymce_spellchecker_php just do not see how to integrate it, Has anyone been able to use the Spellchecker in TinyMCE 4.0? or do they know of any tutorial to integrate Spellchecker to TinyMCE 4.0?

Well, thank you! : D


回答1:


Try passing the first argument for of call_user_func_array like this:

call_user_func_array(array("PSpellShell","spellcheck"), $arguments);



回答2:


As far as I know, Google closed down this service. You shouldn't use it any more.




回答3:


This issue can be resolved by updating few lines in php spell checker plugin.

1) Rename "&checkWords" method to "&spellcheck" of EnchantSpell, GoogleSpell, PSpell, PSpellShell and Sp ellChecker classes

2) update spellcheck method to return the data in following format

array(
    'incorrect word 1'=>array('suggestion 1','suggestion 2', etc...),
    'incorrect word 2'=>array('suggestion 1','suggestion 2', etc...),
)

For example lets update spellcheck method of EnchantSpell.php file

... ...

if(!$correct) {
    //$returnData[] = trim($value);
    $returnData[trim($value)] = $this->getSuggestions($lang, trim($value));
}

... ...



来源:https://stackoverflow.com/questions/17241992/spellchecker-is-not-working-in-tinymce-4-0-non-json-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!