equal
deleted
inserted
replaced
509 event.preventDefault(); |
509 event.preventDefault(); |
510 // The return string is needed for browser compat. |
510 // The return string is needed for browser compat. |
511 // See https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event. |
511 // See https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event. |
512 return __( 'The changes you made will be lost if you navigate away from this page.' ); |
512 return __( 'The changes you made will be lost if you navigate away from this page.' ); |
513 } |
513 } |
514 }).on( 'unload.edit-post', function( event ) { |
514 }).on( 'pagehide.edit-post', function( event ) { |
515 if ( ! releaseLock ) { |
515 if ( ! releaseLock ) { |
516 return; |
516 return; |
517 } |
517 } |
518 |
518 |
519 /* |
519 /* |
787 } else { |
787 } else { |
788 $timestampdiv.find('.timestamp-wrap').removeClass('form-invalid'); |
788 $timestampdiv.find('.timestamp-wrap').removeClass('form-invalid'); |
789 } |
789 } |
790 |
790 |
791 // Determine what the publish should be depending on the date and post status. |
791 // Determine what the publish should be depending on the date and post status. |
792 if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) { |
792 if ( attemptedDate > currentDate ) { |
793 publishOn = __( 'Schedule for:' ); |
793 publishOn = __( 'Schedule for:' ); |
794 $('#publish').val( _x( 'Schedule', 'post action/button label' ) ); |
794 $('#publish').val( _x( 'Schedule', 'post action/button label' ) ); |
795 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) { |
795 } else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) { |
796 publishOn = __( 'Publish on:' ); |
796 publishOn = __( 'Publish on:' ); |
797 $('#publish').val( __( 'Publish' ) ); |
797 $('#publish').val( __( 'Publish' ) ); |
887 updateText(); |
887 updateText(); |
888 event.preventDefault(); |
888 event.preventDefault(); |
889 }); |
889 }); |
890 |
890 |
891 // Set the selected visibility as current. |
891 // Set the selected visibility as current. |
892 $postVisibilitySelect.find('.save-post-visibility').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels. |
892 $postVisibilitySelect.find('.save-post-visibility').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels. |
893 var visibilityLabel = '', selectedVisibility = $postVisibilitySelect.find('input:radio:checked').val(); |
893 var visibilityLabel = '', selectedVisibility = $postVisibilitySelect.find('input:radio:checked').val(); |
894 |
894 |
895 $postVisibilitySelect.slideUp('fast'); |
895 $postVisibilitySelect.slideUp('fast'); |
896 $('#visibility .edit-visibility').show().trigger( 'focus' ); |
896 $('#visibility .edit-visibility').show().trigger( 'focus' ); |
897 updateText(); |
897 updateText(); |
943 updateText(); |
943 updateText(); |
944 event.preventDefault(); |
944 event.preventDefault(); |
945 }); |
945 }); |
946 |
946 |
947 // Save the changed timestamp. |
947 // Save the changed timestamp. |
948 $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels. |
948 $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels. |
949 if ( updateText() ) { |
949 if ( updateText() ) { |
950 $timestampdiv.slideUp('fast'); |
950 $timestampdiv.slideUp('fast'); |
951 $timestampdiv.siblings('a.edit-timestamp').show().trigger( 'focus' ); |
951 $timestampdiv.siblings('a.edit-timestamp').show().trigger( 'focus' ); |
952 } |
952 } |
953 event.preventDefault(); |
953 event.preventDefault(); |
1171 |
1171 |
1172 event.preventDefault(); |
1172 event.preventDefault(); |
1173 } |
1173 } |
1174 |
1174 |
1175 /** |
1175 /** |
1176 * When the dragging stopped make sure we return focus and do a sanity check on the height. |
1176 * When the dragging stopped make sure we return focus and do a confidence check on the height. |
1177 */ |
1177 */ |
1178 function endDrag() { |
1178 function endDrag() { |
1179 var height, toolbarHeight; |
1179 var height, toolbarHeight; |
1180 |
1180 |
1181 if ( $postdivrich.hasClass( 'wp-editor-expand' ) ) { |
1181 if ( $postdivrich.hasClass( 'wp-editor-expand' ) ) { |
1196 height = parseInt( $textarea.css('height'), 10 ); |
1196 height = parseInt( $textarea.css('height'), 10 ); |
1197 } |
1197 } |
1198 |
1198 |
1199 $document.off( '.wp-editor-resize' ); |
1199 $document.off( '.wp-editor-resize' ); |
1200 |
1200 |
1201 // Sanity check: normalize height to stay within acceptable ranges. |
1201 // Confidence check: normalize height to stay within acceptable ranges. |
1202 if ( height && height > 50 && height < 5000 ) { |
1202 if ( height && height > 50 && height < 5000 ) { |
1203 setUserSetting( 'ed_size', height ); |
1203 setUserSetting( 'ed_size', height ); |
1204 } |
1204 } |
1205 } |
1205 } |
1206 |
1206 |
1301 var triggerElement = $( event.trigger ), |
1301 var triggerElement = $( event.trigger ), |
1302 successElement = $( '.success', triggerElement.closest( '.copy-to-clipboard-container' ) ); |
1302 successElement = $( '.success', triggerElement.closest( '.copy-to-clipboard-container' ) ); |
1303 |
1303 |
1304 // Clear the selection and move focus back to the trigger. |
1304 // Clear the selection and move focus back to the trigger. |
1305 event.clearSelection(); |
1305 event.clearSelection(); |
1306 // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680 |
|
1307 triggerElement.trigger( 'focus' ); |
|
1308 |
1306 |
1309 // Show success visual feedback. |
1307 // Show success visual feedback. |
1310 clearTimeout( copyAttachmentURLSuccessTimeout ); |
1308 clearTimeout( copyAttachmentURLSuccessTimeout ); |
1311 successElement.removeClass( 'hidden' ); |
1309 successElement.removeClass( 'hidden' ); |
1312 |
1310 |