php - 拼写检查器在 tinymce 4.0 中不起作用(非 JSON 响应)

标签 php javascript tinymce spell-checking

我试图在 TinyMCE 4.0 中使用拼写检查器,但它返回错误:

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}

我使用的代码是:

//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'
    });

使用插件 PHP Spellchecker 2.0.6.1 ( http://www.tinymce.com/develop/changelog/?type=phpspell )

我认为您可以解决 Google 尝试 https://github.com/tinymce/tinymce_spellchecker_php 的连接问题只是不知道如何集成它,有没有人能够在 TinyMCE 4.0 中使用拼写检查器?或者他们知道将拼写检查器集成到 TinyMCE 4.0 的任何教程吗?

好的,谢谢! :D

最佳答案

这个问题可以通过更新 php 拼写检查器插件中的几行来解决。

1) 将 EnchantSpell、GoogleSpell、PSpell、PSpellShell 和 SpellChecker 类的“&checkWords”方法重命名为“&spellcheck”

2) 更新拼写检查方法以按以下格式返回数据

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

例如让我们更新 EnchantSpell.php 文件的拼写检查方法

... ...

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

... ...

关于php - 拼写检查器在 tinymce 4.0 中不起作用(非 JSON 响应),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17241992/

相关文章:

javascript - wp_编辑器 : How to load wp_editor on demand using jQuery?

javascript - 如何在同一个表单中制作提交按钮、删除和更新,php

php - Magento upsell_products 引发错误 "must be an instance of Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection"

Javascript RegExp + 单词边界 + unicode 字符

tinymce - 您如何以编程方式从 TinyMCE 中删除(而不是禁用)按钮?

tinymce - Tumblr 帖子允许使用哪些 HTML 属性? (小小)

php - websocketpp 服务器的主机 URL

php - 如何在没有交互的情况下运行doctrine 2 迁移命令行?

javascript - following a function with (jQuery, window, document) 是什么意思?意思?

javascript - react : How to update state in an array requiring remote calls for each item?