I am trying to get the selection from a default instance of the new media uploader...
I am happy with the way it displays by default so I am NOT using:-
file_frame = wp.media.frames.file_frame = wp.media(
{
title: 'Select File',
button: {
text: jQuery( this ).data( 'uploader_button_text' )
},
multiple: false
});
Just
wp.media.editor.open();
so this doesn't work obviously
attachment = file_frame.state().get('selection').first().toJSON();
but neither does this
wp.media.editor.state().get('selection').first().toJSON();
or this
wp.media.state().get('selection').first().toJSON();
so what is the code I should use?