Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#28095 closed defect (bug) (fixed)

wpLink modal no longer triggers open event

Reported by: bradyvercher's profile bradyvercher Owned by: azaozz's profile azaozz
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.9
Component: Editor Keywords: has-patch
Focuses: javascript Cc:

Description

With the move away from wpdialog in WP 3.9, the wpLink modal no longer triggers an 'open' event.

I was using that event in a plugin to allow users to automatically search using text that was selected in the editor (a similar feature was proposed and reverted in #16276).

Without the event, it's not possible to reliably determine when the wpLink modal is opened in order to interact with it. The attached patch adds a new event to maintain similar functionality with previous versions.

Attachments (2)

28095.patch (373 bytes) - added by bradyvercher 11 years ago.
28095.2.patch (515 bytes) - added by bradyvercher 11 years ago.

Download all attachments as: .zip

Change History (9)

@bradyvercher
11 years ago

#1 @SergeyBiryukov
11 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.9.2

#2 @bradyvercher
11 years ago

Any chance I can get someone to take a look at this for 4.0?

#3 @DrewAPicture
11 years ago

  • Focuses javascript added

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.


11 years ago

#5 @azaozz
11 years ago

  • Milestone changed from 3.9.2 to 4.0

Sounds good. Maybe better if the event is fired on the document or fire triggerHandler (no propagation) on the wrapper?

open: function( editorId ) {
...
$( document ).trigger( 'wplink-open', inputs.wrap );
}

close: function() {
...
$( document ).trigger( 'wplink-close', inputs.wrap );
}

#6 @bradyvercher
11 years ago

Good idea on not sending a generic event up the DOM. Here's a revised patch based on your suggestion.

#7 @azaozz
11 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 29335:

wpLink: add custom open and close events, props bradyvercher, fixes #28095.

Note: See TracTickets for help on using tickets.