mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Media Grid: add disambiguation between generic frames and routers and the router specifically interacting with the grid's frame.
See #24716. Built from https://develop.svn.wordpress.org/trunk@29074 git-svn-id: http://core.svn.wordpress.org/trunk@28860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7a438ad0dc
commit
41f71c7938
@ -153,7 +153,7 @@
|
||||
},
|
||||
|
||||
createRouter: function() {
|
||||
this.gridRouter = new media.view.Frame.Router( this );
|
||||
this.gridRouter = new media.view.MediaFrame.Manage.Router();
|
||||
|
||||
// Verify pushState support and activate
|
||||
if ( window.history && window.history.pushState ) {
|
||||
@ -335,14 +335,7 @@
|
||||
/**
|
||||
* A router for handling the browser history and application state
|
||||
*/
|
||||
media.view.Frame.Router = Backbone.Router.extend({
|
||||
|
||||
mediaFrame: '',
|
||||
|
||||
initialize: function( mediaFrame ){
|
||||
this.mediaFrame = mediaFrame;
|
||||
},
|
||||
|
||||
media.view.MediaFrame.Manage.Router = Backbone.Router.extend({
|
||||
routes: {
|
||||
'upload.php?item=:slug': 'showitem',
|
||||
'upload.php?search=:query': 'search',
|
||||
@ -363,18 +356,18 @@
|
||||
|
||||
// Show the modal with a specific item
|
||||
showitem: function( query ) {
|
||||
var library = this.mediaFrame.state().get('library');
|
||||
var library = media.frame.state().get('library');
|
||||
|
||||
// Remove existing modal if present
|
||||
this.closeModal();
|
||||
// Trigger the media frame to open the correct item
|
||||
this.mediaFrame.trigger( 'edit:attachment', library.findWhere( { id: parseInt( query, 10 ) } ) );
|
||||
media.frame.trigger( 'edit:attachment', library.findWhere( { id: parseInt( query, 10 ) } ) );
|
||||
},
|
||||
|
||||
// Close the modal if set up
|
||||
closeModal: function() {
|
||||
if ( 'undefined' !== typeof this.mediaFrame.editAttachmentFrame ) {
|
||||
this.mediaFrame.editAttachmentFrame.modal.close();
|
||||
if ( media.frame.modal ) {
|
||||
media.frame.modal.close();
|
||||
}
|
||||
},
|
||||
|
||||
|
2
wp-includes/js/media-grid.min.js
vendored
2
wp-includes/js/media-grid.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user