WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 22 months ago

#43045 new enhancement

Trigger events equivalent to editor:image-edit and editor:image-update in media-image-widget.js

Reported by: danielbachhuber Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Widgets Keywords: needs-patch
Focuses: javascript Cc:
PR Number:

Description

The wpeditimage TinyMCE plugin has helpful editor:image-edit and editor:image-update events for hooking additional metadata onto the Image object. Here's an example:

wp.media.events.on('editor:image-edit',function(event){
	event.metadata.pinterest_text = event.editor.$(event.image).attr('data-pin-description');
});
wp.media.events.on('editor:image-update',function(event){
	event.editor.$(event.image).attr('data-pin-description', event.metadata.pinterest_text);
});

Although the new Image Widget reuses the image-details frame, it doesn't fire these equivalent events, making integration difficult. It would be helpful if the ImageWidgetControl implemented equivalent events.

Change History (1)

#1 @westonruter
22 months ago

  • Keywords needs-patch added

Discovery should be done to see why these events aren't firing.

Note: See TracTickets for help on using tickets.