Make WordPress Core

Opened 7 years ago

Last modified 4 years ago

#43045 new enhancement

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

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

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 (2)

#1 @westonruter
7 years 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.