Ticket #36521: 35612.1.diff
File 35612.1.diff, 1.1 KB (added by , 7 years ago) |
---|
-
src/wp-admin/js/customize-controls.js
1796 1796 1797 1797 control.setting.bind( function( value ) { 1798 1798 1799 var attachmentNeedsUpdating = control.params.attachment.id != value; 1800 1799 1801 // Send attachment information to the preview for possible use in `postMessage` transport. 1800 1802 wp.media.attachment( value ).fetch().done( function() { 1801 1803 wp.customize.previewer.send( control.setting.id + '-attachment-data', this.attributes ); 1804 1805 if ( attachmentNeedsUpdating ) { 1806 control.params.attachment = this.attributes; 1807 control.renderContent(); 1808 } 1802 1809 } ); 1803 1810 1804 // Re-render whenever the control's setting changes. 1805 control.renderContent(); 1811 if ( ! value ) { 1812 control.params.attachment = {}; 1813 } 1814 1815 if ( ! attachmentNeedsUpdating || ! value ) { 1816 // Re-render whenever the control's setting changes. 1817 control.renderContent(); 1818 } 1806 1819 } ); 1807 1820 }, 1808 1821