删除CKEdit实例 [英] Remove CKEdit Instance

查看:107
本文介绍了删除CKEdit实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



请考虑以下事项:

 < input name =txt1type =textid =txt1/>< br /> 
< a href =javascript:void(0); onclick =create()>创建< / a>< br />
< a href =javascript:void(0); onclick =destroy()>销毁< / a>
< script type =text / javascript>
<! -
function create(){
var hEd = CKEDITOR.instances ['txt1'];
if(hEd){
CKEDITOR.remove(hEd);
}
hEd = CKEDITOR.replace('txt1');
}
function destroy(){
var hEd = CKEDITOR.instances ['txt1'];
if(hEd){
CKEDITOR.remove(hEd);
}
}
- >
< / script>

当destroy()运行时,CKEDITOR.remove(hEd);正在被调用。多次点击create()在屏幕上产生CKEditor的多个实例,但它们的实例不再出现在CKEDITOR.instances中。



我缺少一些东西?

解决方案

您必须使用hEd.destroy( editor.destroy())。



CKEDITOR.remove()用于API中所述的内部使用。


I can't seem to destroy instances of CKEdit per the documentation.

Consider the following:

<input name="txt1" type="text" id="txt1" /><br />
<a href="javascript:void(0);" onclick="create()">Create</a><br />
<a href="javascript:void(0);" onclick="destroy()">Destroy</a>
<script type= "text/javascript" >
<!--
function create() {
    var hEd = CKEDITOR.instances['txt1'];
    if (hEd) {
        CKEDITOR.remove(hEd);
    }
    hEd = CKEDITOR.replace('txt1');
}
function destroy(){
    var hEd = CKEDITOR.instances['txt1'];
    if (hEd) {
        CKEDITOR.remove(hEd);
    }
}
-->
</script>

When destroy() runs, CKEDITOR.remove(hEd); is being called. Multiple clicks to create() produce multiple instances of CKEditor on screen, but their instances no longer appear in CKEDITOR.instances.

Am I missing something?

解决方案

You must use hEd.destroy (editor.destroy()).

CKEDITOR.remove() is for internal use as stated in the API.

这篇关于删除CKEdit实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆