Opened 9 years ago
Closed 9 years ago
#32783 closed defect (bug) (fixed)
Ajax issue in the customizer when previewing a different theme
Reported by: | Fab1en | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 4.1 |
Component: | Customize | Keywords: | |
Focuses: | javascript, administration | Cc: |
Description
When a theme is activated, and another one is previewed using the customizer live preview, ajax requests are run against the old theme, not the one being previewed.
The easiest way to see this issue is to use the Header Image cropping function included in core.
- Install and activate a theme that has no
custom-header
feature (for example Modern Estate) - Go to the customizer, click on the change button to choose a new theme (for example, TwentyFifteen
- Use the Header Image panel to select and crop an image
- You get the following error :
There has been an error cropping your image.
- Activate TwentyFifteen and crop the same image again : error has disappeared
If a theme defines specific ajax actions, those actions will not be available in the live preview until the theme is really activated.
Attachments (3)
Change History (15)
This ticket was mentioned in Slack in #core-customize by fab1en. View the logs.
9 years ago
#3
@
9 years ago
- Milestone changed from Awaiting Review to 4.5
Need to make sure the theme
parameter is included in the Ajax requests.
#4
@
9 years ago
Note that generally in Core, Ajax requests initiated from the preview do not get the Customizer state applied. This has, however, been implemented in the transactions patch via jQuery.prefilter()
to inject the Customizer transaction UUID. So this issue will be resolved there.
However, this issue is specific to an Ajax request created in the Customizer pane, and so I think it is included in the scope of transactions.
#5
@
9 years ago
- Keywords has-patch added; needs-patch removed
I like that approach, to hook into the underlying doCrop
function, and extending an exposed doCropArgs
to inject the additional args.
#6
@
9 years ago
- Keywords dev-feedback added
@wonderboymusic thoughts on extending the wp.media.controller.Cropper.prototype.doCrop
in this way?
Probably should add the theme previewing logic to ajax calls, although I thought it already was. Needs investigating.