为什么TinyMCE获取焦点和模糊事件,当用户从其他输入字段跳转? [英] Why TinyMCE get focus and blur event, when user jump from other input field?

查看:3820
本文介绍了为什么TinyMCE获取焦点和模糊事件,当用户从其他输入字段跳转?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标题输入字段和一个tinymce4 textarea。



在tinymce init中定义模糊焦点事件侦听器(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')

当我进入tinymce textarea字段时,只会触发焦点事件。



当我从标题输入字段转到tinymce(使用鼠标事件)时,它会触发焦点模糊事件。



为什么?或者如何避免这种情况?



UPDATE





当我点击textarea只有焦点被触发,当我在输入字段,然后点击进入textarea,焦点和迷离火。

 < html> 
< head><! - 由Cachefly托管的CDN - >
< 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 =textname =fname>
< textarea>您的内容在这里。< / textarea>
< / body>
< / html>

JSFIDDLE



UPDATE:



更新了JSFIDDLE



焦点现在发射一次,但模糊



我看到,这个问题是仅在Chrome中。在Firefox和Safari中,它工作正常。



UPDATE3:



与实际的每夜构建。

解决方案

它与实际的Nightly构建固定。我dunno在哪个版本它将被合并。


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.

解决方案

It is fixed with the actual Nightly build. I dunno in which version it will be merged.

这篇关于为什么TinyMCE获取焦点和模糊事件,当用户从其他输入字段跳转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆