[wp-trac] [WordPress Trac] #36842: More global event hooks using the media.events, like "modal:open", "modal:close", etc
WordPress Trac
noreply at wordpress.org
Sun May 15 00:30:06 UTC 2016
#36842: More global event hooks using the media.events, like "modal:open",
"modal:close", etc
----------------------------------------+-----------------------------
Reporter: jtsternberg | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Keywords:
Focuses: javascript, administration |
----------------------------------------+-----------------------------
There seem to be plentiful hooks in the media backbone system, but most
require listening to the frame/controller/etc vs having global
hooks/events to listen to. This, obviously, would be much like WP's
`do_action`. Each event should pass contextual info including the
frame/controller/etc object.
Select2 (as well as most JS modal libs) provides an example of prior art:
[https://select2.github.io/examples.html#events]
Using that implementation as an example, we could do something like:
`wp:media:open` is fired whenever the modal is opened. `wp:media:opening`
is fired before this and can be prevented.
`wp:media:close` is fired whenever the modal is closed. `wp:media:closing`
is fired before this and can be prevented.
`wp:media:highlight` is fired whenever a result is highlighted (clicked).
`wp:media:unhighlight` is fired whenever a result is unhighlighted.
`wp:media:select` is fired when a result is chosen and modal is closed.
`wp:media:selecting` is fired before this and can be prevented.
`wp:media:change` is fired whenever the modal changes state.
`wp:media:changing` is fired before this and can be prevented.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36842>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list