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

git-svn-id: https://develop.svn.wordpress.org/trunk@6834 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-02-14 00:51:28 +00:00
parent 0f79cd3d6e
commit 3b76fae7e4
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 );