#38229 closed defect (bug) (wontfix)
Open link in new tab stays checked when creating new links.
Reported by: | JoelStransky | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.6.1 |
Component: | TinyMCE | Keywords: | |
Focuses: | Cc: |
Description
If while creating a link in TinyMCE you check the "Open link in new tab" and save, creating an additional new link will have the box ticked by default.
http://g.recordit.co/bMX15RlmtG.gif
This appears be an oversite in wplink.js where
wpLink.setDefaultValues()
which is only called for brand new links, doesn't attempt to clear this box.
Suggested fix:
inputs.openInNewTab.prop( 'checked', false );
Change History (2)
Note: See
TracTickets for help on using
tickets.
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):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