与blockui一起使用tinymce [英] using tinymce with blockui
问题描述
我想做的是使用blockUI将我的网页背景设为灰色,然后在顶部打开一个tinymce.我可以使它开始工作,但是我打开另一个tinymce对话框,例如插入链接或编辑html源,对话框打开但被阻止.我想知道是否有一种方法可以在blockUI中解除阻止.我已经尝试了几件事,但是没有成功. 这是我当前的代码:
What I want to do is grey out the my webpage background with blockUI, then open an tinymce on top. I can get this to work initially, but I open another tinymce dialog like to insert a link or edit the html source, the dialog opens but it's blocked. I'm wondering if there is a way to unblock this in blockUI. I've tried a few things but haven't been successful. Here is my current code:
var editDiv="<div id='tMce'><p>";
editDiv+="<textarea style='width:90%;height:400px;' id='ed_"+theID+"'>"+theHTML+"</textarea><p>";
editDiv+="<button onclick='closeCMS();'>close</button> ";
editDiv+="<button onclick='saveEdit("+dq+theID+dq+","+dq+theID+dq+")'>save</button> ";
editDiv+="</div>";
$.blockUI({ message: editDiv });
tinymce.init({
selector: "textarea",
theme: "modern",
plugins: [
"advlist autolink lists link charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste"
]
});
$('textarea').each(function(){
$(this).unblock();
});
$('input').each(function(){
$(this).unblock();
});
推荐答案
一种可行的解决方案是在.blockUI调用中将bindEvents: false
作为选项(以及message
等)传递.请参阅 http://fiddle.tinymce.com/bzeaab/17 ,了解失败的小提琴的方法(在修改了 http://fiddle.tinymce.com/bzeaab/16 )以允许插入工作.
One solution that seems to work is to pass bindEvents: false
in the .blockUI call as an option (along with message
, etc.). See http://fiddle.tinymce.com/bzeaab/17 for how the failing fiddle (at http://fiddle.tinymce.com/bzeaab/16) was amended to allow the plug in to work.
在您的情况下,$.blockUI({ message: editDiv });
变为
$.blockUI({ message: editDiv, bindEvents: false });
此问题的一个潜在弊端是,这种方法会解除blockUI覆盖中的所有内容的绑定,而不仅仅是tinymce插件,因此可能无法满足您的需求.
One potential downside to this issue is that this approach unbinds everything in the blockUI overlay, not just tinymce plugins, so could be too overreaching for your needs.
这篇关于与blockui一起使用tinymce的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!