Skip to content

Instantly share code, notes, and snippets.

@mlewand
Created October 15, 2015 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlewand/0251b6add54b02e20325 to your computer and use it in GitHub Desktop.
Save mlewand/0251b6add54b02e20325 to your computer and use it in GitHub Desktop.
An example how one might add custom file browsing handler for CKEditor.
CKEDITOR.replace( 'editor', {
on: {
// You need to listen to dialogShow event.
dialogShow: function( evt ) {
// Getting browse button object.
var browseButton = evt.data.getContentElement( 'info', 'browse' );
if ( browseButton ) {
browseButton.on( 'click', function( evt ) {
// Do your custom logic here, e.g. display a floating div with UI.
evt.stop(); // Stop the event if you want nothing more to happen.
}, null, null, 9 );
}
}
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment