Media: Render attachment custom fields for new uploads.

Initialize attachment custom fields during the `add` callback, so that fields are present as soon as an attachment is uploaded but do not refresh when field values are changed. Follow up to #40909.

Props trepmal, adamsilverstein, joedolson.
Fixes #58051.

git-svn-id: https://develop.svn.wordpress.org/trunk@55649 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2023-04-12 23:42:20 +00:00
parent 68514c5136
commit ce28deee43

View File

@ -24,6 +24,11 @@ AttachmentCompat = View.extend(/** @lends wp.media.view.AttachmentCompat.prototy
'change textarea': 'save'
},
initialize: function() {
// Render the view when a new item is added.
this.listenTo( this.model, 'add', this.render );
},
/**
* @return {wp.media.view.AttachmentCompat} Returns itself to allow chaining.
*/