Skip to content

Commit

Permalink
Add QuickPress support for new media workflow.
Browse files Browse the repository at this point in the history
* Adds the code required to include the new media scripts, styles, and settings to `media_button()`.
* Improves script dependencies, namely making `media-upload` require `media-views`.
* Some CSS tweaks for the making the new button work well with QuickPress.

see #21390, fixes #22021.


git-svn-id: http://core.svn.wordpress.org/trunk@22072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
koop committed Sep 27, 2012
1 parent 8c36f67 commit 0c42e61
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion wp-admin/css/wp-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -6216,7 +6216,7 @@ h3:hover .edit-box {
}

#dashboard_quick_press .wp-media-buttons {
margin: 0 0 .2em 8px;
margin: 0 0 .2em 1px;
padding: 0;
}

Expand Down
6 changes: 2 additions & 4 deletions wp-admin/edit-form-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
add_thickbox();
wp_enqueue_script('media-upload');
wp_enqueue_script( 'media-views' );

wp_enqueue_script( 'media-upload' );
wp_enqueue_style( 'media-views' );
wp_plupload_default_settings();
add_action( 'admin_footer', 'wp_print_media_templates' );

wp_enqueue_script( 'mce-view' );
}

/**
Expand Down
5 changes: 5 additions & 0 deletions wp-admin/includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@ function wp_iframe($content_func /* ... */) {
* @param string $editor_id
*/
function media_buttons($editor_id = 'content') {
wp_enqueue_script( 'media-upload' );
wp_enqueue_style( 'media-views' );
wp_plupload_default_settings();
add_action( 'admin_footer', 'wp_print_media_templates' );

$context = apply_filters('media_buttons_context', __('Upload/Insert %s'));

$img = '<img src="' . esc_url( admin_url( 'images/media-button.png?ver=20111005' ) ) . '" width="16" height="16" />';
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/js/media-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ var tb_position;
}
};

$( wp.mce.media.init )
$( wp.mce.media.init );
}(jQuery));
2 changes: 1 addition & 1 deletion wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function wp_default_scripts( &$scripts ) {
'type' => 'characters' == _x( 'words', 'word count: words or characters?' ) ? 'c' : 'w',
) );

$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'mce-view' ), false, 1 );
$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'mce-view', 'media-views' ), false, 1 );

$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), 'r6', 1 );

Expand Down

0 comments on commit 0c42e61

Please sign in to comment.