Opened 10 years ago
Last modified 3 years ago
#29288 new enhancement
Settings updated within the Customizer Preview are not synced up to main app Panel
Reported by: | westonruter | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | lowest |
Severity: | normal | Version: | 3.4 |
Component: | Customize | Keywords: | needs-patch |
Focuses: | javascript | Cc: |
Description
The Customizer has two copies of models for the registered settings: one set in in the Customizer panel parent frame, and changes to these result in the settings getting copied over to the preview either via postMessage or via a refreshing the preview entirely. Updating a setting model from within preview directly, however, does not propagate up to the model. There is currently a one-way-sync from the panel to the preview.
As a workaround, the preview can send messages to the panel for which handlers can apply the updates to the settings, but it would be good if this was automatic.
By implementing a bi-directional syncing of settings between the panel and preview, there would be lots of opportunities for inline front-end editor controls to more easily be added into the preview directly.
See also https://twitter.com/bradyvercher/status/502163462990995456
Change History (8)
This ticket was mentioned in Slack in #core-customize by celloexpressions. View the logs.
9 years ago
#4
follow-up:
↓ 5
@
9 years ago
- Milestone changed from Awaiting Review to Future Release
@westonruter how difficult do you think it would be to do this?
It'll definitely be useful once we can implement it, especially if we ever revisit the idea of front-end-editing integrated with the Customizer (this would obviously be a prerequisite).
#5
in reply to:
↑ 4
@
9 years ago
- Priority changed from low to lowest
Replying to celloexpressions:
@westonruter how difficult do you think it would be to do this?
Not difficult at all. As noted in my comment above, the Customize Inline Editing plugin shows how to do it. It's just that the functionality would need to be added to Core. That being said, it's easy for a plugin to add the functionality itself, so it's not really something that has to be added to Core.
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
8 years ago
#7
@
8 years ago
Updated examples for how a plugin can implement this without waiting for core:
Sending a setting from the preview to the pane: https://github.com/xwp/wp-customize-inline-editing/blob/5853efdebb894b3940bf618680090824651e30cb/js/customize-inline-editable-partial.js#L129-L139
Receiving a setting by the pane from the preview: https://github.com/xwp/wp-customize-inline-editing/blob/5853efdebb894b3940bf618680090824651e30cb/js/customize-pane.js#L25-L45
For the workaround, see what Customize Inline Editing does.
Preview sending message to pane: https://github.com/xwp/wp-customize-inline-editing/blob/6e0feab7e57b6b842743228cefaf015a4a497ee3/customize-preview.js#L49-L60
Pane receiving messages from preview: https://github.com/xwp/wp-customize-inline-editing/blob/6e0feab7e57b6b842743228cefaf015a4a497ee3/customize-pane.js#L12-L23