javascript - Hijack a CKeditor input field -
i want able grab onfocus event url text input field when pulls image dialog box in ckeditor.
i tried adding event handler element (id #cke_75_textinput) it's in dom after image button has been clicked.
having looked through ckeditor 3 javascript api documentation , here, struggling , couldn't find needed.
is can done through api?
there's no need magic focus delegation (which mess since focus not bubble). use ckeditor api:
ckeditor.on( 'dialogdefinition', function( evt ) { if ( evt.data.name == 'image' ) { var def = evt.data.definition; var onshow = def.onshow; def.onshow = function() { onshow && onshow.apply( this, arguments ); var input = this.getcontentelement( 'info', 'txturl' ); console.log( input.getvalue() ); input.on( 'focus', function() { console.log( 'focused' ); } ); }; } } ); ps. cke4's docs more handful old cke3's - http://docs.ckeditor.com/#!/api/ckeditor.dialog
Comments
Post a Comment