diff --git a/src/js/_enqueues/admin/privacy-tools.js b/src/js/_enqueues/admin/privacy-tools.js
index 802ec88f4b..ff1c280b4b 100644
|
a
|
b
|
|
| 4 | 4 | * @output wp-admin/js/privacy-tools.js |
| 5 | 5 | */ |
| 6 | 6 | |
| | 7 | /* global ClipboardJS, wp */ |
| | 8 | |
| 7 | 9 | // Privacy request action handling |
| 8 | 10 | jQuery( document ).ready( function( $ ) { |
| 9 | | var strings = window.privacyToolsL10n || {}; |
| | 11 | |
| | 12 | var __ = wp.i18n.__, |
| | 13 | strings = window.privacyToolsL10n || {}, |
| | 14 | clipboard = new ClipboardJS( '.privacy-text-copy' ); |
| 10 | 15 | |
| 11 | 16 | function setActionState( $action, state ) { |
| 12 | 17 | $action.children().addClass( 'hidden' ); |
| … |
… |
jQuery( document ).ready( function( $ ) { |
| 77 | 82 | |
| 78 | 83 | appendResultsAfterRow( $requestRow, 'notice-success', summaryMessage, [] ); |
| 79 | 84 | $this.hide(); |
| 80 | | |
| | 85 | |
| 81 | 86 | if ( 'undefined' !== typeof zipUrl ) { |
| 82 | 87 | window.location = zipUrl; |
| 83 | 88 | } else if ( ! sendAsEmail ) { |
| … |
… |
jQuery( document ).ready( function( $ ) { |
| 230 | 235 | doNextErasure( 1, 1 ); |
| 231 | 236 | }); |
| 232 | 237 | |
| 233 | | // Privacy policy page, copy button. |
| 234 | | $( document ).on( 'click', function( event ) { |
| 235 | | var $target = $( event.target ); |
| 236 | | var $parent, $container, range; |
| 237 | | |
| 238 | | if ( $target.is( 'button.privacy-text-copy' ) ) { |
| 239 | | $parent = $target.parent().parent(); |
| 240 | | $container = $parent.find( 'div.wp-suggested-text' ); |
| 241 | | |
| 242 | | if ( ! $container.length ) { |
| 243 | | $container = $parent.find( 'div.policy-text' ); |
| 244 | | } |
| 245 | | |
| 246 | | if ( $container.length ) { |
| 247 | | try { |
| 248 | | window.getSelection().removeAllRanges(); |
| 249 | | range = document.createRange(); |
| 250 | | $container.addClass( 'hide-privacy-policy-tutorial' ); |
| | 238 | // Copy 'Suggested Privacy' section. |
| | 239 | clipboard.on( 'success', function( e ) { |
| | 240 | var $wrapper = $( e.trigger ).closest( 'div' ); |
| | 241 | $( '.success', $wrapper ).addClass( 'visible' ); |
| 251 | 242 | |
| 252 | | range.selectNodeContents( $container[0] ); |
| 253 | | window.getSelection().addRange( range ); |
| 254 | | document.execCommand( 'copy' ); |
| | 243 | e.clearSelection(); |
| 255 | 244 | |
| 256 | | $container.removeClass( 'hide-privacy-policy-tutorial' ); |
| 257 | | window.getSelection().removeAllRanges(); |
| 258 | | } catch ( er ) {} |
| 259 | | } |
| 260 | | } |
| 261 | | }); |
| | 245 | wp.a11y.speak( __( 'Privacy Policy Guide section has been copied to your clipboard.' ) ); |
| | 246 | } ); |
| 262 | 247 | }); |
| 263 | 248 | |
diff --git a/src/wp-admin/css/edit.css b/src/wp-admin/css/edit.css
index 090f3eee94..7a1d123b09 100644
|
a
|
b
|
form#tags-filter { |
| 714 | 714 | padding-bottom: 6px; |
| 715 | 715 | } |
| 716 | 716 | |
| | 717 | .privacy-text-actions .success { |
| | 718 | display: none; |
| | 719 | color: #40860a; |
| | 720 | float: right; |
| | 721 | padding-right: 1em; |
| | 722 | } |
| | 723 | |
| | 724 | .privacy-text-actions .success.visible { |
| | 725 | display: inline-block; |
| | 726 | height: 32px; |
| | 727 | } |
| | 728 | |
| 717 | 729 | .wp-privacy-policy-guide .policy-text h2 { |
| 718 | 730 | margin: 1.2em 0 1em; |
| 719 | 731 | padding: 0; |
diff --git a/src/wp-admin/includes/class-wp-privacy-policy-content.php b/src/wp-admin/includes/class-wp-privacy-policy-content.php
index 65f27470a3..6e1affbb04 100644
|
a
|
b
|
final class WP_Privacy_Policy_Content { |
| 371 | 371 | public static function privacy_policy_guide() { |
| 372 | 372 | |
| 373 | 373 | $content_array = self::get_suggested_policy_text(); |
| 374 | | |
| 375 | 374 | $content = ''; |
| 376 | 375 | $toc = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' ); |
| 377 | 376 | $date_format = __( 'F j, Y' ); |
| 378 | | $copy = __( 'Copy this section to clipboard' ); |
| 379 | | $return_to_top = '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>'; |
| 380 | 377 | |
| 381 | 378 | foreach ( $content_array as $section ) { |
| 382 | 379 | $class = ''; |
| … |
… |
final class WP_Privacy_Policy_Content { |
| 413 | 410 | $content .= '<h2>' . sprintf( __( 'Source: %s' ), $plugin_name ) . '</h2>'; |
| 414 | 411 | $content .= $removed; |
| 415 | 412 | |
| 416 | | $content .= '<div class="policy-text">' . $section['policy_text'] . '</div>'; |
| 417 | | $content .= $return_to_top; |
| | 413 | $content .= '<div class="policy-text" id="policy-text-' . sanitize_title( $plugin_name ) . '">' . $section['policy_text'] . '</div>'; |
| | 414 | $content .= '<a href="#" class="return-to-top">' . __( '↑ Return to Top' ) . '</a>'; |
| 418 | 415 | |
| 419 | 416 | if ( empty( $section['removed'] ) ) { |
| 420 | | $content .= '<div class="privacy-text-actions">'; |
| 421 | | $content .= '<button type="button" class="privacy-text-copy button">'; |
| 422 | | $content .= $copy; |
| 423 | | $content .= '<span class="screen-reader-text">'; |
| 424 | | /* translators: %s: Plugin name. */ |
| 425 | | $content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name ); |
| 426 | | $content .= '</span>'; |
| 427 | | $content .= '</button>'; |
| 428 | | $content .= '</div>'; |
| | 417 | $content .= '<div class="privacy-text-actions">'; |
| | 418 | $content .= '<button type="button" class="privacy-text-copy button" data-clipboard-target="#policy-text-' . esc_attr( sanitize_title( $plugin_name ) ) . '">'; |
| | 419 | $content .= __( 'Copy this section to clipboard' ); |
| | 420 | $content .= '<span class="screen-reader-text">'; |
| | 421 | /* translators: %s: Plugin name. */ |
| | 422 | $content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name ); |
| | 423 | $content .= '</span>'; |
| | 424 | $content .= '</button>'; |
| | 425 | |
| | 426 | /* on Copy success feedback */ |
| | 427 | $content .= '<span class="success" aria-hidden="true">' . __( 'Copied!' ) . '</span>'; |
| | 428 | $content .= '</div>'; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | $content .= "</div>\n"; // End of .privacy-text-section. |
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 0267f9cd11..9783369155 100644
|
a
|
b
|
function wp_default_scripts( &$scripts ) { |
| 1469 | 1469 | $scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 ); |
| 1470 | 1470 | $scripts->set_translations( 'site-health' ); |
| 1471 | 1471 | |
| 1472 | | $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery' ), false, 1 ); |
| | 1472 | $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'clipboard', 'jquery', 'wp-a11y', 'wp-i18n' ), false, 1 ); |
| 1473 | 1473 | did_action( 'init' ) && $scripts->localize( |
| 1474 | 1474 | 'privacy-tools', |
| 1475 | 1475 | 'privacyToolsL10n', |