0

当我用这个脚本初始化 nicEdit 时:

脚本 1

<script type="text/javascript">
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });

我的 textarea 仍然是默认的,然后我添加了这个脚本:

脚本 2

$(document).ready(function() {
    nicEditors.allTextAreas();

这是工作,但第一个脚本的功能是什么?因为当我刚刚使用第二个脚本时它的工作

这是我的问题:D 在我成功初始化 nicEdit 后,我​​在新 div 中再次创建新的 textarea(我再次编写脚本 1 和 2)然后萤火虫说“A.removeInstance 不是函数”

帮帮我师父

我只是新手

4

2 回答 2

3

在 niceEdit.js 中,将 checkReplace 函数替换为以下内容:

    checkReplace : function(e) {
    var r;
    var editors = nicEditors.editors;
    for(var i=0;i<editors.length;i++) {
        if(editors[i].instanceById(e)) {
            r = editors[i]; // r is an instance of nicEditorInstance therefore it does not have removeInstance or removePanel methods
            break;
        }
    }

    if(r) { 
        r.removeInstance(e);
        r.removePanel();    
    }
    return e;
}
于 2012-07-23T20:58:09.787 回答
2

从https://github.com/danishkhan/NicEdit/downloads尝试更新版本- 它是从 2010 年 9 月开始的。他网站上的版本是在 4 月创建的。

在他的 github 网站上,您可以在顶部看到一条评论:“fixed removeInstance bug: r is an instance of nicEditorInstance( or nicE”

也许这会对你有所帮助 - 我通过修复一个已经修复的错误而迷失了整个上午,因为我不知道这个 =)

于 2011-11-15T11:51:26.573 回答