Ticket #22740: 22740.2.diff
| File 22740.2.diff, 2.2 KB (added by koopersmith, 6 months ago) |
|---|
-
wp-includes/js/media-views.js
786 786 }, 787 787 788 788 reset: function() { 789 this.props = new Backbone.Model({ url: '' });789 this.props.clear().set({ url: '' }); 790 790 791 791 if ( this.active ) 792 792 this.refresh(); … … 2422 2422 2423 2423 refresh: function() { 2424 2424 var url = this.controller.state().props.get('url'); 2425 this.get('select').model.set( 'disabled', ! url || /^https?:\/\/$/.test(url));2425 this.get('select').model.set( 'disabled', ! url || url === 'http://' ); 2426 2426 2427 2427 media.view.Toolbar.Select.prototype.refresh.apply( this, arguments ); 2428 2428 } … … 3772 3772 this.model.on( 'change', this.updateChanges, this ); 3773 3773 }, 3774 3774 3775 render: function() {3776 this.$el.html( this.template(_.defaults({3775 prepare: function() { 3776 return _.defaults({ 3777 3777 model: this.model.toJSON() 3778 }, this.options ) ) ); 3778 }, this.options ); 3779 }, 3779 3780 3781 render: function() { 3782 media.View.prototype.render.apply( this, arguments ); 3780 3783 // Select the correct values. 3781 3784 _( this.model.attributes ).chain().keys().each( this.update, this ); 3782 3785 return this; … … 4026 4029 model: this.model.props 4027 4030 }).render(); 4028 4031 4029 this. _settings = new media.View();4032 this.views.set([ this.url ]); 4030 4033 this.refresh(); 4031 4034 this.model.on( 'change:type', this.refresh, this ); 4032 4035 }, 4033 4036 4034 render: function() {4035 this.$el.html([ this.url.el, this._settings.el ]);4036 this.url.focus();4037 this.views.render();4038 return this;4039 },4040 4041 4037 settings: function( view ) { 4042 view.render(); 4043 this._settings.$el.replaceWith( view.$el ); 4044 this._settings.remove(); 4038 if ( this._settings ) 4039 this._settings.remove(); 4045 4040 this._settings = view; 4041 this.views.add( view ); 4046 4042 }, 4047 4043 4048 4044 refresh: function() { … … 4096 4092 return; 4097 4093 4098 4094 this.input.value = this.model.get('url') || 'http://'; 4095 media.View.prototype.render.apply( this, arguments ); 4099 4096 return this; 4100 4097 }, 4101 4098 4099 ready: function() { 4100 this.focus(); 4101 }, 4102 4102 4103 url: function( event ) { 4103 4104 this.model.set( 'url', event.target.value ); 4104 4105 },
