简体   繁体   English

如何检测tinyMCE textarea模糊/焦点事件?

[英]How to detect tinyMCE textarea blur/focusout event?

I am working on existing project. 我正在研究现有项目。 When I click some editable text on webpage, it becomes textarea and tinyMCE tool bar appears. 当我点击网页上的某些可编辑文本时,它会变成textarea并出现tinyMCE工具栏。 When I click outside that textarea then toolbar disappears. 当我在textarea外面点击时,工具栏就会消失。 I want to get that event when textarea lost focus and want to submit the form automatically. 当textarea失去焦点并希望自动提交表单时,我想获得该事件。

I am unable to capture that focusout event. 我无法捕捉到focusout事件。 Only mouseout event is working but it is not good because as we move outside textarea, form is submitted and page is refreshed each time. 只有mouseout事件正在运行,但它并不好,因为当我们移动到textarea之外时,表单被提交并且页面每次刷新。

$('.module-container form').live("mouseout", function() { // blur/focusout not working here. even ".module-container form textarea" selector not working
    alert('outside');
});

So how to capture tinyMCE textarea focusout event. 那么如何捕获tinyMCE textarea focusout事件。 Any Idea ? 任何想法 ?

Thanks 谢谢

Try: 尝试:

tinyMCE.dom.Event.add(tinyMCE.getInstanceById("editor-id").getWin(), "blur", function(){
    // Blur operations
});

An easy approach is 一个简单的方法是

$(ed.getDoc()).bind("blur", function(e){
    // do whatever you like here
}, true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM