Make WordPress Core

Opened 12 years ago

Closed 3 months ago

#21171 closed enhancement (wontfix)

jQuery Events for Metaboxes

Reported by: wraithkenny's profile WraithKenny Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Administration Keywords: needs-patch
Focuses: javascript Cc:

Description

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).

Change History (4)

#1 @scribu
12 years ago

Related: #21170

#2 @DrewAPicture
10 years ago

  • Component changed from General to Administration
  • Focuses javascript added

Related: #19173

#3 @wonderboymusic
9 years ago

  • Keywords needs-patch added
  • Type changed from feature request to enhancement

#4 @adamsilverstein
3 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

Closing this as wontfix due to a lack of activity and interest. Given the shift in development away from jQuery and meta boxes we can close this. If I missed some important/relevant use case, please feel free to re-open.

Two ideas from dev chat are triggering custom events or the (coming soon) "js actions" which would be more robust (like php actions).

we do now have wp.hooks with JS actions, in case someone wants to implement this.

Note: See TracTickets for help on using tickets.