Im have a title input field and an tinymce4 textarea.
In the tinymce init i defined blur and focus event listeners (coffescript).
tinymce.init(
$.extend {}, tinyMceDefaultConfig,
editor_selector:"tinymce-question"
setup: (editor) ->
editor
.on 'init', (e).....
.on 'focus', ->
console.log('focus')
.on 'blur', ->
console.log('blur')
When i go into the tinymce textarea field, it fire only focus event. Works fine.
But when i go from the title input field to the tinymce (with mouse event), it fire focus and blur events.
Why? Or how do I avoid this?
UPDATE:
Here an example. Is it a bug?
When I click into the textarea only the focus fired. When I am in the input field and then click into the textarea, focus and blur fires.
<html>
<head><!-- CDN hosted by Cachefly -->
<script src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script>
<script>
tinymce.init({
selector:"textarea",
setup: function(editor) {
editor.on('focus', function() {
console.log('focus');
});
editor.on('blur', function(){
console.log('blur');
})
}
});
</script>
</head>
<body>
<input type="text" name="fname">
<textarea>Your content here.</textarea>
</body>
</html>
JSFIDDLE
UPDATE:
Updated JSFIDDLE
The focus fired now one time, but the blur do not fire anymore.
UPDATE2:
I see, this problem is only in Chrome. In Firefox and Safari it works fine.
UPDATE3:
It is fixed with the actual Nightly build. I dunno in which version it will be merged.