Save tags lingering in quick add box upon save. Props fitzrev. fixes #5849

git-svn-id: http://svn.automattic.com/wordpress/trunk@6834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-14 00:51:28 +00:00
parent 968682dea6
commit 3453246f35
2 changed files with 10 additions and 1 deletions

View File

@ -146,7 +146,7 @@ if ( 'future' == $post->post_status ) {
</div> </div>
<p class="submit"> <p class="submit">
<input type="submit" name="save" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" /> <input type="submit" name="save" id="save-post" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
<?php <?php
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) { if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
?> ?>

View File

@ -45,6 +45,11 @@ function tag_flush_to_text() {
return false; return false;
} }
function tag_save_on_publish() {
if ( jQuery('#newtag').val() != postL10n.addTag )
tag_flush_to_text();
}
function tag_press_key( e ) { function tag_press_key( e ) {
if ( 13 == e.keyCode ) { if ( 13 == e.keyCode ) {
tag_flush_to_text(); tag_flush_to_text();
@ -78,6 +83,10 @@ addLoadEvent( function() {
jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
}); });
// auto-save tags on post save/publish
jQuery('#publish').click( tag_save_on_publish );
jQuery('#save-post').click( tag_save_on_publish );
// auto-suggest stuff // auto-suggest stuff
jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } ); jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } );
jQuery('#newtag').keypress( tag_press_key ); jQuery('#newtag').keypress( tag_press_key );