Text editors

How to change default Target in the TinyMCE 'Insert/Edit Link' dialog box?

 
Picture of Juan F
How to change default Target in the TinyMCE 'Insert/Edit Link' dialog box?
 

Just what the subject states.  I need to find out how to change the default Target in the TinyMCE 'Insert/Edit Link' dialog box to "open in new window (_blank)".

Thanks!

 
Average of ratings: -
moi!!! it is what is is...
Re: How to change default Target in the TinyMCE 'Insert/Edit Link' dialog box?
Documentation writersParticularly helpful Moodlers

I am not sure you actually can, easily that is. I suspect it has to be a hack so you will have to find the relevant code in the codebase and add in or change the default code. You will probably have to start looking for what you want in lib/editor/tinymce and somewhere there you will likely find a page called link or autolink or somesuch, depending on your version I think. Sorry I can't help more than that, but it is something I have considered in the past, but just takes up too much time for me. Good luck.

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: How to change default Target in the TinyMCE 'Insert/Edit Link' dialog box?
 

Colin is right, there is no setting for this change but you need to edit file lib/editor/tinymce/tiny_mce/version of tinymce/plugins/advlink/js/advlink.js and there move line

    html += '<option value="_blank">' + tinyMCEPopup.getLang('advlink_dlg.target_blank') + ' (_blank)</option>';

before line

    html += '<option value="_self">' + tinyMCEPopup.getLang('advlink_dlg.target_same') + '</option>';

Save the file and test. If the change does not have effect immediately purge all caches (Site administration > Development > Purge all caches)

If you have not edited files of moodle before take a copy of that file first so that if something goes wrong in editing you have the original file available...

 
Average of ratings: Useful (3)
Picture of Andy Chaplin
Re: How to change default Target in the TinyMCE 'Insert/Edit Link' dialog box?
 

Thanks very much!  that worked great!

 
Average of ratings: -
Picture of Eddy Sunderland
Re: How to change default Target in the TinyMCE 'Insert/Edit Link' dialog box?
 
Here is a short video on how that all links entered in a tinymce text editor open in a new window.  I also googled this question just today and during my search, I could not find the answer, so I tried something and it worked. So I figured I should share it. I made a short video without my ugly voice. I hope this helps even though this question was asked a long time ago.
 
Average of ratings: -