初始化时返回tinyMCE的实例

时间:2012-07-06 13:59:41

标签: javascript tinymce

是否可以通过oninit回调使此函数返回textEditor?我试图将textEditor作为参数传递给initialised(),但只是未定义。

function magic() {

    var returnMe;

    function initialised() {
        console.log('initialised');
        //tried to set returnMe here, textEditor undefined! what!
    }



    var textEditor = new tinymce.Editor(element, {

        ...

        oninit : initialised(),

        ...

        }
    });

}

1 个答案:

答案 0 :(得分:1)

解决方案很简单:

function initialised() {
    console.log('initialised');
}

function magic() {

    var returnMe;

    var textEditor = new tinymce.Editor(element, {

        ...

        oninit : initialised(),

        ...

        }
    });

}