Commit Graph

24 Commits

Author SHA1 Message Date
Weston Ruter
509e706c13 Customize: Run a partial's fallback behavior (full refresh) when selective refresh fails due to a script error.
This ensures that 3rd-party scripts that users paste into Text widgets will gracefully recover and result in the expected preview.

See #27355.
Fixes #40658.

Built from https://develop.svn.wordpress.org/trunk@40771


git-svn-id: http://core.svn.wordpress.org/trunk@40629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-17 00:01:40 +00:00
Weston Ruter
31d4d81039 Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!

Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.

Built from https://develop.svn.wordpress.org/trunk@40640


git-svn-id: http://core.svn.wordpress.org/trunk@40501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-11 21:11:44 +00:00
Weston Ruter
f3644a702e Customize: Ensure edit shortcuts get re-created for nested partials when a parent partial is refreshed.
Fixes issue where the edit shortcut for a nav menu gets dropped when the containing Custom Menu widget is updated.

See #39101.
Fixes #39353.

Built from https://develop.svn.wordpress.org/trunk@40055


git-svn-id: http://core.svn.wordpress.org/trunk@39992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-11 03:35:43 +00:00
Weston Ruter
f7ba137f19 Customize: Fix visible edit shortcuts for wp_nav_menu() instances using the menu arg (such as in the Custom Menu widget) instead of the theme_location arg.
Also fix logic for `focus-control-for-setting` handler to focus on the first control (lowest `priority` value) associated with a given setting instead of the last control encountered when iterating over all controls, as this ensures the first control in a `nav_menu` section is focused rather than the last one.

Props westonruter, sirbrillig.
See #27403.
Fixes #39101.

Built from https://develop.svn.wordpress.org/trunk@39622


git-svn-id: http://core.svn.wordpress.org/trunk@39562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-20 22:05:43 +00:00
Weston Ruter
8a89a50c69 Customize: Prevent edit shortcut from losing event handler after selective refresh.
Props sirbrillig.
See #27403.
Fixes #39100.

Built from https://develop.svn.wordpress.org/trunk@39581


git-svn-id: http://core.svn.wordpress.org/trunk@39521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-12 07:52:43 +00:00
Weston Ruter
6b5d960453 Customize: Clean up docs and code style for customize changes in 4.7.
* Adds missing `resolve`/`fail` for promise returned by `loadThemePreview`.
* Adds missing jsdoc blocks and tags.
* Adds missing phpdoc and makes corrections.

See #37770.
Fixes #38908.

Built from https://develop.svn.wordpress.org/trunk@39345


git-svn-id: http://core.svn.wordpress.org/trunk@39285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-23 06:05:32 +00:00
Sergey Biryukov
2fadd7a895 Docs: Use 3-digit, x.x.x style semantic versioning for @since 4.7.0 entries.
See #37770.
Built from https://develop.svn.wordpress.org/trunk@39281


git-svn-id: http://core.svn.wordpress.org/trunk@39221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-17 18:28:30 +00:00
Weston Ruter
4664f80711 Customize: Prevent edit shortcut buttons from being inserted into container elements in the head or into elements which should not get interactive children.
See #27403, #38672.
Fixes #38830.

Built from https://develop.svn.wordpress.org/trunk@39270


git-svn-id: http://core.svn.wordpress.org/trunk@39210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-16 20:37:30 +00:00
Weston Ruter
2185609a33 Customize: Remove left-margin guard from edit shortcuts and adjust for small screen sizes.
Removes the `.customize-partial-edit-shortcut-left-margin` class which was not effective on some themes, created a worse experience for other themes, and which did not recalculate when the preview was reflowed or resized. Now some small-width media queries are added to handle common cases while more dramatic issues can be handled by the theme. Also renames `Partial.positionEditShortcut()`to `Partial.addEditShortcutToPlacement()` which is a more accurate description of its function.

Props sirbrillig, sstoqnov.
See #38651, #27403.

Built from https://develop.svn.wordpress.org/trunk@39202


git-svn-id: http://core.svn.wordpress.org/trunk@39142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-11 09:47:43 +00:00
Weston Ruter
8f9f75598b Customize: Remove edit shortcut toggle button from preview since visibility is now linked with pane visibility.
Amends [39131].
Props westonruter, sirbrillig.
See #27403.
Fixes #38668.

Built from https://develop.svn.wordpress.org/trunk@39144


git-svn-id: http://core.svn.wordpress.org/trunk@39084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 20:54:30 +00:00
Weston Ruter
f4c3b8352e Customize: Use button with svg as click target instead of :before content, improving clickability of edit shortcuts in Firefox.
Props sirbrillig, celloexpressions, delawski.
See #38532.

Built from https://develop.svn.wordpress.org/trunk@39136


git-svn-id: http://core.svn.wordpress.org/trunk@39076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:16:26 +00:00
Weston Ruter
726cd04bac Customize: Let edit shortcuts be persistently visible when controls pane is expanded, hidden when collapsed, and always visible in mobile preview. Remove initial flash of edit shortcuts.
Props westonruter, sirbrillig.
Fixes #27403.

Built from https://develop.svn.wordpress.org/trunk@39131


git-svn-id: http://core.svn.wordpress.org/trunk@39071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:13:57 +00:00
Weston Ruter
ddea523daf Customize: Prevent toggling edit shortcuts when doing shift-click or when clicking on a descendent of an interactive element.
See #38532, #27403.
Fixes #38554.

Built from https://develop.svn.wordpress.org/trunk@39018


git-svn-id: http://core.svn.wordpress.org/trunk@38960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 14:59:31 +00:00
Gary Pendergast
582c8a12d2 Customize: Remove an unused variable.
The cleanup in [38972] missed a variable that is no longer being used.

Fixes #27403.


Built from https://develop.svn.wordpress.org/trunk@38973


git-svn-id: http://core.svn.wordpress.org/trunk@38916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-27 00:31:29 +00:00
Weston Ruter
022ee8ec36 Customize: Remove unnecessary code for edit shortcuts which is no longer required due to moving buttons inside of partial placement containers.
Props sirbrillig.
Amends [38967].
See #27403.

Built from https://develop.svn.wordpress.org/trunk@38972


git-svn-id: http://core.svn.wordpress.org/trunk@38915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 22:38:33 +00:00
Weston Ruter
71afe657b6 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.

Built from https://develop.svn.wordpress.org/trunk@38967


git-svn-id: http://core.svn.wordpress.org/trunk@38910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 20:03:32 +00:00
Weston Ruter
f1ba1918c9 Customize: Implement customized state persistence with changesets.
Includes infrastructure developed in the Customize Snapshots feature plugin.

See https://make.wordpress.org/core/2016/10/12/customize-changesets-technical-design-decisions/

Props westonruter, valendesigns, utkarshpatel, stubgo, lgedeon, ocean90, ryankienstra, mihai2u, dlh, aaroncampbell, jonathanbardo, jorbin.
See #28721.
See #31089.
Fixes #30937.
Fixes #31517.
Fixes #30028.
Fixes #23225.
Fixes #34142.
Fixes #36485.

Built from https://develop.svn.wordpress.org/trunk@38810


git-svn-id: http://core.svn.wordpress.org/trunk@38753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-18 20:05:31 +00:00
Weston Ruter
76681c40e3 Customize: Opt to disable IE8 support via conditional comments instead of using unreliable Array.prototype.indexOf feature detection.
Deprecate/remove `WP_Customize_Manager::customize_preview_html5()` and remove `document.head` polyfill, both of which were only in place for IE8 support.

Props ryankienstra, westonruter.
Fixes #38021.

Built from https://develop.svn.wordpress.org/trunk@38649


git-svn-id: http://core.svn.wordpress.org/trunk@38592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-25 04:35:32 +00:00
Weston Ruter
1c2324f834 Customize: Update server-sent setting validation notifications as changes are entered.
Send back setting validities with full refreshes and selective refreshes so that invalid settings can have notifications displayed immediately before attempting save, and so that these notifications can be cleared as soon as the input is corrected.

* Splits out JS logic for listing controls into separate methods  `wp.customize.Setting.prototype.findControls()` and `wp.customize.findControlsForSettings()`.
* Adds a `setting` property to the `data` on notifications added to controls that are synced from their settings.
* Adds `selective-refresh-setting-validities` message sent from preview to pane.
* Changes `WP_Customize_Manager::validate_setting_values()` to return when settings are valid as well as invalid.
* Adds `WP_Customize_Manager::prepare_setting_validity_for_js()`.
* Add setting validities to data exported to JS in Customizer Preview and in selective refresh responses.

Fixes #36944.

Built from https://develop.svn.wordpress.org/trunk@37700


git-svn-id: http://core.svn.wordpress.org/trunk@37666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-14 19:17:28 +00:00
Weston Ruter
f3f84d2f21 Customize: Require opt-in for selective refresh of widgets.
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.

See #27355.
Fixes #35855.

Built from https://develop.svn.wordpress.org/trunk@37040


git-svn-id: http://core.svn.wordpress.org/trunk@37007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-21 21:59:29 +00:00
Weston Ruter
8c9c4b2698 Customize: Remove unused JS variable to fix jshint error introduced in [36890].
See #36164.

Built from https://develop.svn.wordpress.org/trunk@36892


git-svn-id: http://core.svn.wordpress.org/trunk@36859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 05:05:27 +00:00
Weston Ruter
d27ae61355 Customize: Remove selective refresh error message from appearing inline within the preview.
The error message will still be available in the developer console.

Removes part of [36586].
See #27355.
Fixes #36164.

Built from https://develop.svn.wordpress.org/trunk@36890


git-svn-id: http://core.svn.wordpress.org/trunk@36857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-09 04:37:28 +00:00
Dominik Schilling
e5ea82d81a Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective).
Props obrienlabs, thewanderingbrit.
Fixes #34887.
Built from https://develop.svn.wordpress.org/trunk@36709


git-svn-id: http://core.svn.wordpress.org/trunk@36676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 12:53:27 +00:00
Weston Ruter
6b775d4afe Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.
See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.

Built from https://develop.svn.wordpress.org/trunk@36586


git-svn-id: http://core.svn.wordpress.org/trunk@36553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-19 18:41:28 +00:00