I have also just noticed, if i add the above code to each reply box, pressing “add to post” inside of the media popup will insert the html into the main post box and not the reply box.
i have also been looking at the quickpress widget on the dash board and how that does it. the only difference is that the quickpress widget uses the following code and calls media_buttons directly.
<?php if ( current_user_can( 'upload_files' ) ) : ?>
<div id="media-buttons" class="hide-if-no-js">
<?php do_action( 'media_buttons' ); ?>
</div>
<?php endif; ?>
is there a way to make the above code insert the html into my textarea of choice?