1

Topic: Changing default link target for link editor

We use a wrapper for tinyMCE, so we dont actually need to manually change the tinyMCE code itself (for upgrades). So I was wondering if there is any way to set the default target for the link editor, without having to change tinyMCE code (whether it be passing a callback or something in the tinyMCE.init, or what have you).

I dont want to force users to use a particular target, but I would just like for the default for all links to be opened in a new tab.

2

Re: Changing default link target for link editor

GOOD

3

Re: Changing default link target for link editor

freise29 wrote:

We use a wrapper for tinyMCE, so we dont actually need to manually change the tinyMCE code itself (for upgrades). So I was wondering if there is any way to set the default target for the link editor, without having to change tinyMCE code (whether it be passing a callback or something in the tinyMCE.init, or what have you).

I dont want to force users to use a particular target, but I would just like for the default for all links to be opened in a new tab.

As far as I know, the only way to do this is to hack the editor.

If you want to do this, go to the "themes/advanced/js" directory and edit the file "link.js".

Somewhere near line #145 you will see these three lines:

    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');
    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');

Re-arrange them any way you like. To make links open in a new tab/window, simply move the "target_blank" line (#3) up to the top (make it the #1 spot).

Hope this helps....

Last edited by Krupski (2012-06-13 18:31:33)

"Anything that is complex is not useful and anything that is useful is simple. This has been my whole life's motto." -- Mikhail T. Kalashnikov

4

Re: Changing default link target for link editor

Argh I was hoping it wouldnt come to that. Thanks, though.