删除所有 CK Editor 实例
Deleting all CK Editor instances
在线解决方案无效。
我正在开发一个动态生成 HTML 的应用程序,我需要对它们启动 CK 编辑器,但是当长度超过 1
时,我收到 'this editor has already been attached' 的错误
这似乎是我想要的,但我尝试通过此解决方案在线完成此操作,但没有成功
for(name in CKEDITOR.instances)
{
CKEDITOR.instances[name].destroy(true);
}
我该如何完成?
您应该首先检查该元素的实例是否存在,然后执行操作:
if (CKEDITOR.instances['textarea_name']) {
CKEDITOR.instances['textarea_name'].destroy();
}
CKEDITOR.replace('textarea_name');
穿过 CKEDITOR.instances
并摧毁它们。
CKEDITOR.instances.forEach(key) {
if (CKEDITOR.instances.hasOwnProperty(key) {
CKEDITOR.instances[key].destroy();
})
}
在线解决方案无效。
我正在开发一个动态生成 HTML 的应用程序,我需要对它们启动 CK 编辑器,但是当长度超过 1
时,我收到 'this editor has already been attached' 的错误这似乎是我想要的,但我尝试通过此解决方案在线完成此操作,但没有成功
for(name in CKEDITOR.instances)
{
CKEDITOR.instances[name].destroy(true);
}
我该如何完成?
您应该首先检查该元素的实例是否存在,然后执行操作:
if (CKEDITOR.instances['textarea_name']) {
CKEDITOR.instances['textarea_name'].destroy();
}
CKEDITOR.replace('textarea_name');
穿过 CKEDITOR.instances
并摧毁它们。
CKEDITOR.instances.forEach(key) {
if (CKEDITOR.instances.hasOwnProperty(key) {
CKEDITOR.instances[key].destroy();
})
}