[wp-trac] [WordPress Trac] #38229: Open link in new tab stays checked when creating new links.

WordPress Trac noreply at wordpress.org
Wed Oct 5 16:41:13 UTC 2016


#38229: Open link in new tab stays checked when creating new links.
--------------------------+----------------------
 Reporter:  JoelStransky  |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  TinyMCE       |     Version:  4.6.1
 Severity:  normal        |  Resolution:  wontfix
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by adamsilverstein):

 * status:  new => closed
 * resolution:   => wontfix
 * milestone:  Awaiting Review =>


Comment:

 Hi @JoelStransky - thanks for the bug report and the screen capture which
 clearly illustrates the issue.

 I agree that it would seem to make sense to reset the default values each
 time the link dialog is opened, and as you point out currently the setting
 persists until a browser refresh (even if you don't insert a link). //My
 concern is that users are probably used to and now expecting the current
 sticky setting behavior which has been in place since at least WordPress
 3.6.// Because this is now expected behavior I'm going to close as won't
 fix, and offer you a solution to adjust this for your own use via a theme
 or plugin...

 At the end of the `open` function in wpLink.js, we trigger an event on
 document: `$( document ).trigger( 'wplink-open', inputs.wrap );` You
 should be able to adjust the default behavior here by hooking in with a
 listener in a plugin or theme.

 Add this JS to wp admin pages (on `admin_head` for example):

 {{{
 jQuery( document ).on( 'wplink-open', function( e, wrap ) {
         jQuery( wrap ).find( '#wp-link-target' ).attr( 'checked', false );
 } );
 }}}

 I tested in my local by dropping this code into the console on the editor
 page and the checkbox is not unchecked for each open:

 https://cl.ly/2z2a3V302I2K

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38229#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list