[wp-trac] [WordPress Trac] #21171: jQuery Events for Metaboxes
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 5 21:35:47 UTC 2012
#21171: jQuery Events for Metaboxes
-----------------------------+-----------------------------
Reporter: WraithKenny | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: minor | Keywords:
-----------------------------+-----------------------------
Currently, when a plugin adds a metabox with complex objects (like
TinyMCE, Maps, CodeMirror etc) care must be taken to refresh the objects
when the elements are moved (including hidden/shown).
After some digging, I've found that this seems to works in most cases:
{{{
var context = "#custom_meta_box_id";
$( '#adv-settings' ).on( 'click', context + '-hide, ', refresh );
$( context ).on( 'click', '.hndle, .handlediv', refresh );
$('.meta-box-sortables').bind( "sortstop", refresh );
}}}
which isn't terrible, but seems fragile if core changes in the future, and
there should just be a better way :-)
Two ideas from dev chat are triggering custom events or the (coming soon)
"js actions" which would be more robust (like php actions).
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21171>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list