Ticket #14311: insert_media_in_correct_editor.patch
File insert_media_in_correct_editor.patch, 3.2 KB (added by , 14 years ago) |
---|
-
wp-includes/general-template.php
1817 1817 1818 1818 if ( $media_buttons ) { ?> 1819 1819 <div id="media-buttons" class="hide-if-no-js"> 1820 <?php do_action( 'media_buttons' ); ?>1820 <?php do_action( 'media_buttons', $id ); ?> 1821 1821 </div> 1822 1822 <?php 1823 1823 } ?> -
wp-admin/includes/media.php
356 356 * 357 357 * @since 2.5.0 358 358 */ 359 function media_buttons( ) {359 function media_buttons($editor_id='content') { 360 360 $do_image = $do_audio = $do_video = true; 361 361 if ( is_multisite() ) { 362 362 $media_buttons = get_site_option( 'mu_media_buttons' ); … … 370 370 $out = ''; 371 371 372 372 if ( $do_image ) 373 $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image' );373 $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image', $editor_id); 374 374 if ( $do_video ) 375 $out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video' );375 $out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video', $editor_id); 376 376 if ( $do_audio ) 377 $out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio' );377 $out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio', $editor_id); 378 378 379 $out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media' );379 $out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media', $editor_id); 380 380 381 381 $context = apply_filters('media_buttons_context', __('Upload/Insert %s')); 382 382 … … 384 384 } 385 385 add_action( 'media_buttons', 'media_buttons' ); 386 386 387 function _media_button($title, $icon, $type ) {388 return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='add_$type' class='thickbox' title='$title' ><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>";387 function _media_button($title, $icon, $type, $editor_id='content') { 388 return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='add_$type' class='thickbox' title='$title' rel='$editor_id'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>"; 389 389 } 390 390 391 391 function get_upload_iframe_src($type) { -
wp-admin/js/media-upload.dev.js
60 60 })(jQuery); 61 61 62 62 jQuery(document).ready(function($){ 63 $('a.thickbox').click(function(){ 63 $('a.thickbox').click(function(ev){ 64 var editor_id = ev.currentTarget.rel ? ev.currentTarget.rel : 'content'; 64 65 if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) { 65 tinyMCE.get( 'content').focus();66 tinyMCE.get(editor_id).focus(); 66 67 tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple'); 67 68 } 68 69 });