Widgets: Ensure title field for media widget will update with sanitized value after change event in addition to input event.

Aligns behavior of field with Text widget and other widgets whereby the server-sanitized title (via the `widget-update` request) is supplied into the field after the `change` event.

See #32417.
Fixes #40805.


git-svn-id: https://develop.svn.wordpress.org/trunk@40785 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-05-18 21:03:12 +00:00
parent 5bfb77bc22
commit 1b702cf09c

View File

@ -483,7 +483,7 @@ wp.mediaWidgets = ( function( $ ) {
control.listenTo( control.model, 'change', control.render );
// Update the title.
control.$el.on( 'input', '.title', function updateTitle() {
control.$el.on( 'input change', '.title', function updateTitle() {
control.model.set({
title: $.trim( $( this ).val() )
});