0
votes

When i init nicEdit with this script :

script 1

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

My textarea still default , and then i add this script:

script 2

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

It's work but what the function of the first script ? bcause while i just used the second script its work

this is my problem :D After i'm success init nicEdit , i create new textarea again in new div (i write again script 1 and 2) and then firebug speak " A.removeInstance is not a function "

help me Master

I'm just newbie

2

2 Answers

3
votes

In niceEdit.js replace the checkReplace function with the following:

    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;
}
2
votes

Try the newer version from https://github.com/danishkhan/NicEdit/downloads - it's from September 2010. The version from his website is created on April.

On his github-website you can see a comment on the top: "fixed removeInstance bug: r is an instance of nicEditorInstance( or nicE"

Maybe this will help you - I lost the whole morning by fixing an already fixed bug, because I didn't know this =)