Para começar, as funções básicas e substituições, tanto quanto eu sei atualmente. Pode haver soluções melhores, mas eu só tinha dois dias com 3.5 ainda:
// open modal - bind this to your button
if ( typeof wp !== 'undefined' && wp.media && wp.media.editor )
wp.media.editor.open( ##unique_id_here## );
// backup of original send function
original_send = wp.media.editor.send.attachment;
// new send function
wp.media.editor.send.attachment = function( a, b) {
console.log(b); // b has all informations about the attachment
// or whatever you want to do with the data at this point
// original function makes an ajax call to retrieve the image html tag and does a little more
};
// wp.media.send.to.editor will automatically trigger window.send_to_editor for backwards compatibility
// backup original window.send_to_editor
window.original_send_to_editor = window.send_to_editor;
// override window.send_to_editor
window.send_to_editor = function(html) {
// html argument might not be useful in this case
// use the data from var b (attachment) here to make your own ajax call or use data from b and send it back to your defined input fields etc.
}
Esta não é uma resposta completa de trabalho. Você tem que definir e manter o controle de seus campos de entrada por si mesmo, etc. Isso só deve começar. Se você tiver perguntas mais concretas, basta perguntar.
E certifique-se de reatribuir as funções originais quando o seu script estiver pronto.
Retirado de comentários:
Como posso ouvir o evento de fechamento da mesa de luz?
// add listener:
wp.media.view.Modal.prototype.on('close', function(){ console.log('triggered close'); }