[wp-trac] [WordPress Trac] #44588: Denote the Copy action is complete by updating the Copy button to state 'Copied'

WordPress Trac noreply at wordpress.org
Tue Jan 7 07:01:47 UTC 2020


#44588: Denote the Copy action is complete by updating the Copy button to state
'Copied'
-------------------------------------------------+-------------------------
 Reporter:  garrett-eclipse                      |       Owner:  garrett-
                                                 |  eclipse
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  5.4
Component:  Privacy                              |     Version:  4.9.6
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-screenshots needs-     |     Focuses:
  testing dev-feedback 2nd-opinion               |  administration
-------------------------------------------------+-------------------------

Comment (by xkon):

 Hey @nickylimjj & @garrett-eclipse, thanks for the patches!

 I've checked both [attachment:"44588.2.diff"] and
 [attachment:"44588.3.diff"] and they look promising but there are a couple
 of issues that need to be addressed to get this finalized.

 The existing code is targetting the nearest "wp-suggested-test" and copies
 its inner code. Since the patches introduce the clipboard.js the copied
 information has to be added to the button.

 The code on the patches currently is as:
 `$content .= sprintf( '<button type="button" class="privacy-text-copy
 button" data-clipboard-text="%1$s">', esc_attr( self::get_default_content(
 false, false ) ) );`

 This means that all clipboard buttons are forced to copy the default text
 due to `self::get_default_content( false, false )`. This should be changed
 to `$section['policy_text']` instead so each button has it's own section
 text available to get copied.

 Also, note that since "everything" will actually be copied now the
 clipboard text ends up having the parent `<div class="wp-suggested-text">`
 wrapper which is not needed.

 As far as I can see from various plugins that I've installed to test this
 we most likely need to strip the wrapper mentioned as well as all the
 `class="privacy-policy-tutorial"` as they are not needed for copying and
 they might interfere with any front-end styling. This should leave a clean
 text with just headings and paragraphs for copying.

 I hope this makes sense & tell me if you need any help with bumping a .4
 patch with these changes so I can take a closer look!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44588#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list