这是我面临的问题
- 我有一个包含tinymce 实例的div。
- 此 tinymce 实例位于同一 div 内的无序列表中
- 当我尝试通过单击按钮删除主 div 时,我收到“未捕获的 ReferenceError:t 未定义”错误。
- 但是当我双击按钮时,div 被删除。但我希望在第一次点击时删除 div。
- 我试过 tinymce.execCommand('mceRemoveControl', false, tinymceId); (tinymceID 是 tinymce textarea 的 id)要删除 tinymce 的实例但无济于事
下面是我用来删除 div 的代码
$('div.form').on('click','a.cancel-btn',function(e){
var kk = $(this);
e.preventDefault();
$('.dialog').html('Are you sure you wish to delete this asset ? Selecting \'Yes\' will delete this asset.');
$('.dialog').dialog({
buttons:{
"Yes": function() {
tinymceId = kk.closest('div.box2').find('textarea').attr('id');
if (typeof(tinymceId) == 'string') {
if (tinyMCE.getInstanceById(tinymceId) != null)
{
tinymce.triggerSave();
tinymce.execCommand('mceFocus', false, tinymceId);
tinymce.execCommand('mceRemoveControl', false, tinymceId);
//tinyMCE.execCommand('mceFocus', false, tinymceId);
kk.closest('div.box2').find('textarea.tinymce_new').tinymce().remove();
}
kk.closest('div.box2').find('textarea').remove();
kk.closest('div.box2').find('textarea').remove();
}
//tinyMCE.myClass.remove();
kk.closest('div.box2').remove();
$(this).dialog("close");
kk.click();
},
"Close": function() { $(this).dialog("close"); }
}
});
});