jQuery Events for Metaboxes
|Reported by:||WraithKenny||Owned by:|
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).