WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#35616 closed enhancement (fixed)

Align settings in Customizer preview with settings in Customizer pane

Reported by: westonruter Owned by: westonruter
Milestone: 4.5 Priority: normal
Severity: normal Version: 3.4
Component: Customize Keywords: has-patch
Focuses: javascript Cc:

Description

The JS models for Customizer settings in the Customizer preview are somewhat shallow representations of the settings in the Customizer pane. Indeed, the objects in the preview are mere wp.customize.Value objects as opposed to wp.customize.Setting objects. A few issues:

  • The setting objects in the preview lack an id property.
  • When new settings get instantiated in the pane and get synced into the preview, the settings are just silently ignored as opposed to being created on demand as is when the settings message is received by the preview.
  • The _dirty flags for settings in the preview don't always correspond to the corresponding settings in the pane, e.g. they get reset after a refresh and they fail to reset after saved.

These improvements are key for performing more logic inline to the preview, such as selective refresh (#27355).

Attachments (2)

35616.0.diff (2.9 KB) - added by westonruter 5 years ago.
35616.1.diff (3.2 KB) - added by westonruter 5 years ago.
Mark dynamically-created settings as dirty so they will get posted

Download all attachments as: .zip

Change History (5)

@westonruter
5 years ago

#1 @westonruter
5 years ago

  • Keywords has-patch added

In 35616.0.diff:

  • Ensure that setting Value objects in preview get initial _dirty flag set if values among POST data.
  • Upon saved event, send saved message to preview with the response to trigger saved event there.
  • Reset _dirty flag for all setting Value objects in preview upon saved.
  • Continue to create settings synced from pane even after initial bootstrap.
  • Ensure that id property is set for setting Value objects in preview.

#2 @westonruter
5 years ago

  • Owner set to westonruter
  • Status changed from new to accepted

@westonruter
5 years ago

Mark dynamically-created settings as dirty so they will get posted

#3 @westonruter
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 36407:

Customizer: Improve parity between JS Setting models in preview with JS Setting models in pane.

  • Ensure that Setting Value objects in preview get initial _dirty flag set if values among POST data.
  • Upon saved event, send saved message to preview with the response to trigger saved event there.
  • Reset _dirty flag for all setting Value objects in preview upon saved.
  • Continue to create settings synced from pane even after initial bootstrap, and create them as dirty.
  • Ensure that id property is set for setting Value objects in preview.

See #27355.
Fixes #35616.

Note: See TracTickets for help on using tickets.