[wp-trac] [WordPress Trac] #50185: Expose the MediaFrame.MediaFrame frame via a ready trigger
WordPress Trac
noreply at wordpress.org
Sat May 16 13:04:29 UTC 2020
#50185: Expose the MediaFrame.MediaFrame frame via a ready trigger
-------------------------+-----------------------------
Reporter: soulseekah | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Keywords: has-patch
Focuses: javascript |
-------------------------+-----------------------------
It is currently impossible to grab the initial "manage" View (Frame)
(which contains all the other Subviews).
Use case: I'd like to make modifications to the modal, add some event
handlers, which I'm unable to do reliably I have nothing to do .on() with.
I have to wait for some of the components to appear. That means looping or
other dirty hacks. I propose to trigger a DOM even on the initial
container.
With the attached patch I can do something like:
{{{
jQuery( document ).on( 'wp-media-grid-ready', '##wp-media-grid', function(
e, frame ) {
frame.on( 'edit:attachment', function() {
// Code that runs when the modal is being opened.
}
} );
}}}
Related #35205
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50185>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list