Changeset 23028
- Timestamp:
- 12/04/2012 05:45:24 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/js/media-views.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/media-views.js
r23024 r23028 745 745 this.props = new Backbone.Model({ url: '' }); 746 746 this.props.on( 'change:url', this.debouncedScan, this ); 747 this.props.on( 'change:url', this.refresh, this ); 747 748 this.on( 'scan', this.scanImage, this ); 748 749 }, … … 775 776 }, 776 777 778 refresh: function() { 779 this.frame.toolbar.get().refresh(); 780 }, 781 777 782 reset: function() { 778 783 this.props = new Backbone.Model({ url: '' }); 779 784 780 if ( this. id === this.frame.state().id)781 this. frame.toolbar.get().refresh();785 if ( this.active ) 786 this.refresh(); 782 787 } 783 788 }); … … 2209 2214 this.render(); 2210 2215 2211 selection.on( 'add remove reset', this.refresh, this ); 2212 library.on( 'add remove reset', this.refresh, this ); 2216 if ( selection ) 2217 selection.on( 'add remove reset', this.refresh, this ); 2218 if ( library ) 2219 library.on( 'add remove reset', this.refresh, this ); 2213 2220 }, 2214 2221 2215 2222 dispose: function() { 2216 this.selection.off( null, null, this ); 2217 this.library.off( null, null, this ); 2223 if ( this.selection ) 2224 this.selection.off( null, null, this ); 2225 if ( this.library ) 2226 this.library.off( null, null, this ); 2218 2227 return media.View.prototype.dispose.apply( this, arguments ); 2219 2228 }, … … 2279 2288 disabled = false; 2280 2289 2281 if ( requires.selection && ! selection.length )2290 if ( requires.selection && selection && ! selection.length ) 2282 2291 disabled = true; 2283 else if ( requires.library && ! library.length )2292 else if ( requires.library && library && ! library.length ) 2284 2293 disabled = true; 2285 2294 … … 2348 2357 initialize: function() { 2349 2358 _.defaults( this.options, { 2350 text: l10n.insertIntoPost 2359 text: l10n.insertIntoPost, 2360 requires: false 2351 2361 }); 2352 2362 2353 2363 media.view.Toolbar.Select.prototype.initialize.apply( this, arguments ); 2354 this.controller.state().props.on( 'change:url', this.refresh, this );2355 },2356 2357 dispose: function() {2358 this.controller.state().props.off( 'change:url', this.refresh, this );2359 media.view.Toolbar.Select.prototype.dispose.apply( this, arguments );2360 2364 }, 2361 2365
Note: See TracChangeset
for help on using the changeset viewer.