Hide post title field in DFW if title is not supported by the current post type or missing, fixes $18568

git-svn-id: http://svn.automattic.com/wordpress/trunk@18828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-09-29 22:59:49 +00:00
parent 32e25b6aec
commit 3be0b41d68
4 changed files with 10 additions and 6 deletions

View File

@ -139,8 +139,8 @@ PubSub.prototype.publish = function( topic, args ) {
// Settings can be added or changed by defining "wp_fullscreen_settings" JS object.
// This can be done by defining it as PHP array and passing it to JS with:
// wp_add_script_data( 'wp-fullscreen', 'wp_fullscreen_settings', $settings_array )
if ( typeof(wp_fullscreen_settings) != 'undefined' )
// add_script_data( 'wp-fullscreen', 'wp_fullscreen_settings', $settings_array )
if ( typeof(wp_fullscreen_settings) == 'object' )
$.extend( s, wp_fullscreen_settings );
s.editor_id = wpActiveEditor || 'content';
@ -148,8 +148,10 @@ PubSub.prototype.publish = function( topic, args ) {
if ( !s.title_id ) {
if ( $('input#title').length && s.editor_id == 'content' )
s.title_id = 'title';
else if ( $('input#' + s.editor_id + '-title').length ) // the title input field should have [editor_id]-title HTML ID to be auto detected
s.title_id = s.editor_id + '-title';
else
$('#wp-fullscreen-title').hide();
$('#wp-fullscreen-title, #wp-fullscreen-title-prompt-text').hide();
}
s.mode = $('#' + s.editor_id).is(':hidden') ? 'tinymce' : 'html';
@ -536,7 +538,7 @@ PubSub.prototype.publish = function( topic, args ) {
if ( !s.has_tinymce )
$('#wp-fullscreen-mode-bar').hide();
if ( wptitlehint )
if ( wptitlehint && $('#wp-fullscreen-title').length )
wptitlehint('wp-fullscreen-title');
$(document).keyup(function(e){

File diff suppressed because one or more lines are too long

View File

@ -677,8 +677,10 @@ class WP_Editor {
</div>
<div id="wp-fullscreen-wrap" style="width:<?php echo $dfw_width; ?>px;">
<?php if ( post_type_supports($post->post_type, 'title') ) { ?>
<label id="wp-fullscreen-title-prompt-text" for="wp-fullscreen-title"><?php echo apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); ?></label>
<input type="text" id="wp-fullscreen-title" value="" autocomplete="off" />
<?php } ?>
<div id="wp-fullscreen-container">
<textarea id="wp_mce_fullscreen"></textarea>

View File

@ -86,7 +86,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110820', 1 );
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110926', 1 );
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110929', 1 );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');