Clear the From URL view in the media modal after inserting an image. Improve button enable checks.
Props koopersmith fixes #22740 git-svn-id: http://core.svn.wordpress.org/trunk@23065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b6982a0804
commit
c4d04dd476
|
@ -786,7 +786,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.props = new Backbone.Model({ url: '' });
|
this.props.clear().set({ url: '' });
|
||||||
|
|
||||||
if ( this.active )
|
if ( this.active )
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
@ -2422,7 +2422,7 @@
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
var url = this.controller.state().props.get('url');
|
var url = this.controller.state().props.get('url');
|
||||||
this.get('select').model.set( 'disabled', ! url || /^https?:\/\/$/.test(url) );
|
this.get('select').model.set( 'disabled', ! url || url === 'http://' );
|
||||||
|
|
||||||
media.view.Toolbar.Select.prototype.refresh.apply( this, arguments );
|
media.view.Toolbar.Select.prototype.refresh.apply( this, arguments );
|
||||||
}
|
}
|
||||||
|
@ -3772,11 +3772,14 @@
|
||||||
this.model.on( 'change', this.updateChanges, this );
|
this.model.on( 'change', this.updateChanges, this );
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
prepare: function() {
|
||||||
this.$el.html( this.template( _.defaults({
|
return _.defaults({
|
||||||
model: this.model.toJSON()
|
model: this.model.toJSON()
|
||||||
}, this.options ) ) );
|
}, this.options );
|
||||||
|
},
|
||||||
|
|
||||||
|
render: function() {
|
||||||
|
media.View.prototype.render.apply( this, arguments );
|
||||||
// Select the correct values.
|
// Select the correct values.
|
||||||
_( this.model.attributes ).chain().keys().each( this.update, this );
|
_( this.model.attributes ).chain().keys().each( this.update, this );
|
||||||
return this;
|
return this;
|
||||||
|
@ -4026,23 +4029,16 @@
|
||||||
model: this.model.props
|
model: this.model.props
|
||||||
}).render();
|
}).render();
|
||||||
|
|
||||||
this._settings = new media.View();
|
this.views.set([ this.url ]);
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.model.on( 'change:type', this.refresh, this );
|
this.model.on( 'change:type', this.refresh, this );
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
|
||||||
this.$el.html([ this.url.el, this._settings.el ]);
|
|
||||||
this.url.focus();
|
|
||||||
this.views.render();
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
settings: function( view ) {
|
settings: function( view ) {
|
||||||
view.render();
|
if ( this._settings )
|
||||||
this._settings.$el.replaceWith( view.$el );
|
this._settings.remove();
|
||||||
this._settings.remove();
|
|
||||||
this._settings = view;
|
this._settings = view;
|
||||||
|
this.views.add( view );
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
|
@ -4096,9 +4092,14 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.input.value = this.model.get('url') || 'http://';
|
this.input.value = this.model.get('url') || 'http://';
|
||||||
|
media.View.prototype.render.apply( this, arguments );
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
ready: function() {
|
||||||
|
this.focus();
|
||||||
|
},
|
||||||
|
|
||||||
url: function( event ) {
|
url: function( event ) {
|
||||||
this.model.set( 'url', event.target.value );
|
this.model.set( 'url', event.target.value );
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue