From eb289835f7bf30ddadb17b1705da3a884e3d8366 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 20 Jun 2014 16:29:47 +0000 Subject: [PATCH] Further adjustments after [8364], listen to an editor instance event instead of delegating a body click when attempting to pause all players belonging to a particular MCE view. Props avryl. Fixes #27971. git-svn-id: https://develop.svn.wordpress.org/trunk@28784 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/mce-view.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js index feb7607e2a..baaaf72928 100644 --- a/src/wp-includes/js/mce-view.js +++ b/src/wp-includes/js/mce-view.js @@ -417,7 +417,9 @@ window.wp = window.wp || {}; this.shortcode = options.shortcode; _.bindAll( this, 'setPlayer', 'pausePlayers' ); $( this ).on( 'ready', this.setPlayer ); - $( 'body' ).on( 'click', '.wp-switch-editor', this.pausePlayers ); + $( this ).on( 'ready', function( event, editor ) { + editor.on( 'hide', this.pausePlayers ); + } ); $( document ).on( 'media:edit', this.pausePlayers ); }, @@ -558,7 +560,9 @@ window.wp = window.wp || {}; this.attachments = []; this.shortcode = options.shortcode; - $( 'body' ).on( 'click', '.wp-switch-editor', this.pausePlayers ); + $( this ).on( 'ready', function( event, editor ) { + editor.on( 'hide', this.pausePlayers ); + } ); $( document ).on( 'media:edit', this.pausePlayers ); this.fetch();