Toni Michel Caubet
Toni Michel Caubet

Reputation: 20163

tinyMce bind focusin/focusout events?

i am trying like this:

setup : function(ed, evt) {
            ed.onInit.add(function(ed, evt) {
                tinymce.dom.Event.add(ed.getDoc(), 'focus', function(e) {
                    // Do something when the editor window is blured.
                    alert('focus!!!');
                });
            });
            ed.onInit.add(function(ed, evt) {
                tinymce.dom.Event.add(ed.getDoc(), 'blur', function(e) {
                    // Do something when the editor window is blured.
                    alert('blur!!!');
                });
            });
        }

but when i focus the textarea i get many alerts saing focus, next blur, next focus, ... in a loop

what's the right way to do it?

Upvotes: 2

Views: 3078

Answers (1)

Andreas Louv
Andreas Louv

Reputation: 47099

Thats the right appearance . When you get your alert("focus!!!")

you blur the textarea to close the alert. Then you'll get the alert("blur!!!").

After closing this you will get your focus back to the textarea. And the loop continue.

The right way would be not to use alerts for telling your focus and blur.

Upvotes: 2

Related Questions