Ticket #43620: 43620_convert_to_metabox_for_classiand_gutenberg_2.diff
File 43620_convert_to_metabox_for_classiand_gutenberg_2.diff, 5.0 KB (added by , 7 years ago) |
---|
-
src/wp-admin/css/edit.css
740 740 } 741 741 742 742 .policy-text-more, 743 .folded .privacy-text-copy,744 743 .folded .policy-text-less { 745 744 display: none; 746 745 } 747 746 747 .folded .privacy-text-copy { 748 display: none !important; 749 } 750 748 751 .folded .policy-text-more { 749 752 display: inline; 750 753 } -
src/wp-admin/includes/admin-filters.php
137 137 add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check' ), 20 ); 138 138 139 139 // Show a "postbox" with the text suggestions for a privacy policy. 140 add_action( 'edit_form_after_title', array( 'WP_Privacy_Policy_Content', 'privacy_policy_postbox' ) ); 140 function add_privacy_policies_metabox( $post_type, $post ) { 141 $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); 142 $post_id = $post->ID; 141 143 144 if ( ! empty( $privacy_policy_page_id ) && $post_id == $privacy_policy_page_id ) { 145 add_meta_box( 146 'Privacy Policies', 147 __( 'Privacy Policies' ), 148 array( 'WP_Privacy_Policy_Content', 'privacy_policy_postbox' ), 149 'page', 150 'normal', 151 'high' 152 ); 153 } 154 } 155 add_action( 'add_meta_boxes', 'add_privacy_policies_metabox', 10, 2 ); 156 142 157 // Add the suggested policy text from WordPress. 143 158 add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_content' ), 15 ); 144 159 -
src/wp-admin/includes/misc.php
1604 1604 1605 1605 ?> 1606 1606 <div id="privacy-text-box" class="privacy-text-box postbox <?php echo postbox_classes( 'privacy-text-box', 'page' ); ?>"> 1607 <button type="button" class="handlediv" aria-expanded="true"> 1608 <span class="screen-reader-text"><?php _e( 'Toggle panel: Suggested privacy policy text' ); ?></span> 1609 <span class="toggle-indicator" aria-hidden="true"></span> 1610 </button> 1611 <div class="privacy-text-box-head hndle"> 1607 <div class="privacy-text-box-head"> 1612 1608 <h2><?php _e( 'This suggested privacy policy text comes from plugins and themes you have installed.' ); ?></h2> 1613 1609 <p> 1614 1610 <?php _e( 'We suggest reviewing this text then copying and pasting it into your privacy policy page.' ); ?> -
src/wp-admin/js/post.js
1269 1269 } ); 1270 1270 1271 1271 } )( jQuery, new wp.utils.WordCounter() ); 1272 1273 ( function( $ ) {1274 // Privacy policy postbox, copy button.1275 $( document ).on( 'click', function( event ) {1276 var $target = $( event.target );1277 var node, range;1278 1279 if ( $target.is( 'button.privacy-text-copy' ) ) {1280 node = $target.parent().parent().find( 'div.policy-text' )[0];1281 1282 if ( node ) {1283 try {1284 window.getSelection().removeAllRanges();1285 range = document.createRange();1286 range.selectNodeContents( node );1287 window.getSelection().addRange( range );1288 1289 document.execCommand( 'copy' );1290 window.getSelection().removeAllRanges();1291 } catch ( er ) {}1292 }1293 } else if ( $target.is( 'button.policy-text-more' ) ) {1294 $target.parents( '.privacy-text-section' ).removeClass( 'folded' )1295 .find( '.policy-text' ).attr( 'aria-expanded', 'true' );1296 } else if ( $target.is( 'button.policy-text-less' ) ) {1297 $target.parents( '.privacy-text-section' ).addClass( 'folded' )1298 .find( '.policy-text' ).attr( 'aria-expanded', 'false' );1299 }1300 });1301 1302 } )( jQuery ); -
src/wp-admin/js/postbox.js
444 444 }; 445 445 446 446 }(jQuery)); 447 448 ( function( $ ) { 449 // Privacy policy postbox, copy button. 450 $( document ).on( 'click', function( event ) { 451 var $target = $( event.target ); 452 var node, range; 453 454 if ( $target.is( 'button.privacy-text-copy' ) ) { 455 node = $target.parent().parent().find( 'div.policy-text' )[0]; 456 457 if ( node ) { 458 try { 459 window.getSelection().removeAllRanges(); 460 range = document.createRange(); 461 range.selectNodeContents( node ); 462 window.getSelection().addRange( range ); 463 464 document.execCommand( 'copy' ); 465 window.getSelection().removeAllRanges(); 466 } catch ( er ) {} 467 } 468 } else if ( $target.is( 'button.policy-text-more' ) ) { 469 $target.parents( '.privacy-text-section' ).removeClass( 'folded' ) 470 .find( '.policy-text' ).attr( 'aria-expanded', 'true' ); 471 } else if ( $target.is( 'button.policy-text-less' ) ) { 472 $target.parents( '.privacy-text-section' ).addClass( 'folded' ) 473 .find( '.policy-text' ).attr( 'aria-expanded', 'false' ); 474 } 475 }); 476 477 } )( jQuery ); 478 No newline at end of file