From a6f6556fcafce8444b196a868faebbd3a6f3edbe Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 3 Oct 2014 18:42:13 +0000 Subject: [PATCH] For `attachment-compat` fields, show a spinner while `wp.media.model.Attachment.saveCompat()` is firing. Fixes #27028. git-svn-id: https://develop.svn.wordpress.org/trunk@29831 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-views.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index eacbdb1394..439699e484 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -4840,6 +4840,8 @@ this.model.on( 'selection:single selection:unsingle', this.details, this ); this.details( this.model, this.controller.state().get('selection') ); } + + this.listenTo( this.controller, 'attachment:compat:waiting attachment:compat:ready', this.updateSave ); }, /** * @returns {wp.media.view.Attachment} Returns itself to allow chaining @@ -6908,7 +6910,12 @@ data[ pair.name ] = pair.value; }); - this.model.saveCompat( data ); + this.controller.trigger( 'attachment:compat:waiting', ['waiting'] ); + this.model.saveCompat( data ).always( _.bind( this.postSave, this ) ); + }, + + postSave: function() { + this.controller.trigger( 'attachment:compat:ready', ['ready'] ); } });