Customize: Add edit shortcuts in customizer preview to visually expose editable elements and focus on the corresponding controls when clicked.

* Edit shortcuts show initially for a moment and then fade away so as to not get in the way of the preview. 
* Visibility of edit shortcuts is toggled by clicking/touching anywhere inert in the document.
* Implements UI for mobile and touch devices which do not support shift-click.
* Adds `editShortcutVisibility` state.
* Adds new methods to `wp.customize.selectiveRefresh.Partial` for managing edit shortcuts.

Incorporates aspects of the Customize Direct Manipulation feature plugin.

Props sirbrillig, mattwiebe, celloexpressions, melchoyce, westonruter, afercia.
Fixes #27403.


git-svn-id: https://develop.svn.wordpress.org/trunk@38967 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2016-10-26 20:02:51 +00:00
parent 67420e4986
commit fda4409f40
8 changed files with 394 additions and 7 deletions

View File

@@ -184,6 +184,11 @@ final class WP_Customize_Selective_Refresh {
'renderQueryVar' => self::RENDER_QUERY_VAR,
'l10n' => array(
'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
'clickEditMenu' => __( 'Click to edit this menu.' ),
'clickEditWidget' => __( 'Click to edit this widget.' ),
'clickEditTitle' => __( 'Click to edit the site title.' ),
'clickEditMisc' => __( 'Click to edit this element.' ),
'editShortcutVisibilityToggle' => __( 'Toggle edit shortcuts' ),
/* translators: %s: document.write() */
'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ),
),