From e7a62361687bac11755175ad4bc2974043ffb771 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Thu, 18 Feb 2016 17:49:21 +0000 Subject: [PATCH] Media Library: After [36546] restore the "Add new" functionality. Rework handling of the `'toggle:upload:attachment'` event using `.on` vs `.listenTo` for better compatibility with the current version of Backbone. Props adamsilverstein. See #34350. Fixes #35853. git-svn-id: https://develop.svn.wordpress.org/trunk@36575 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-views.js | 2 +- src/wp-includes/js/media/views/attachments/browser.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 9e08201541..f9c5555049 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -3754,7 +3754,7 @@ AttachmentsBrowser = View.extend({ AttachmentView: wp.media.view.Attachment.Library }); - this.listenTo( this.controller, 'toggle:upload:attachment', _.bind( this.toggleUploader, this ) ); + this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this ); this.controller.on( 'edit:selection', this.editSelection ); this.createToolbar(); if ( this.options.sidebar ) { diff --git a/src/wp-includes/js/media/views/attachments/browser.js b/src/wp-includes/js/media/views/attachments/browser.js index c97ebfb813..7ca001bb1f 100644 --- a/src/wp-includes/js/media/views/attachments/browser.js +++ b/src/wp-includes/js/media/views/attachments/browser.js @@ -38,7 +38,7 @@ AttachmentsBrowser = View.extend({ AttachmentView: wp.media.view.Attachment.Library }); - this.listenTo( this.controller, 'toggle:upload:attachment', _.bind( this.toggleUploader, this ) ); + this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this ); this.controller.on( 'edit:selection', this.editSelection ); this.createToolbar(); if ( this.options.sidebar ) {