New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trac 32417: Media widget #215

Closed
wants to merge 22 commits into
base: master
from
Commits
Jump to file or symbol
Failed to load files and symbols.
+4 −4
Diff settings

Always

Just for now

Viewing a subset of changes. View all

Rename variable: attachmentJSON -> serializedAttachment

  • Loading branch information...
taggon committed Feb 24, 2017
commit 5349893013ae76b184cd4ba273bc89c4d96426cf
@@ -115,7 +115,7 @@
* @returns {void}
*/
renderFormView: function( widgetId, props, attachment ) {
var formView, attachmentJSON;
var formView, serializedAttachment;
// Start with container elements for the widgets page, customizer controls, and customizer preview.
formView = $( '.' + widgetId + ', #customize-control-widget_' + widgetId + ', #' + widgetId );
@@ -154,10 +154,10 @@
* This ensures that changes to attachment's caption or description will be shown in the
* preview since these are not in the widget's instance state.
*/
attachmentJSON = JSON.stringify( _.pick( attachment, 'id', 'title', 'caption', 'link', 'size' ) );
if ( formView.data( 'attachment' ) !== attachmentJSON && wp.customize && wp.customize.previewer ) {
serializedAttachment = JSON.stringify( _.pick( attachment, 'id', 'title', 'caption', 'link', 'size' ) );
if ( formView.data( 'attachment' ) !== serializedAttachment && wp.customize && wp.customize.previewer ) {
wp.customize.previewer.send( 'refresh-partial', 'widget[' + widgetId + ']' );
formView.data( 'attachment', attachmentJSON );
formView.data( 'attachment', serializedAttachment );
}
// Change button text
ProTip! Use n and p to navigate between commits in a pull request.