Customize default target = "_blank" in the link button

Jul 8, 2015 at 1:53 AM
It's possible to set de default target to "_Blank" via javascript or xml?

I try to made it in this way:

http://handsomedogstudio.com/ckeditor-set-default-target-blank

but not work :(

Can you help me?
Jul 8, 2015 at 11:17 AM
Sure. Create a custom js file and paste the js code from the web site in
CKEDITOR.on('dialogDefinition', function(ev) {

    try {

        /* this just gets the name of the dialog */

var dialogName = ev.data.name;

/* this just gets the contents of the opened dialog */

var dialogDefinition = ev.data.definition;

 

/* Make sure that the dialog opened is the link plugin ... otherwise do nothing */

if(dialogName == 'link') {

    /* Getting the contents of the Target tab */

    var informationTab = dialogDefinition.getContents('target');

    /* Getting the contents of the dropdown field "Target" so we can set it */

    var targetField = informationTab.get('linkTargetType');

    /* Now that we have the field, we just set the default to _blank

    A good modification would be to check the value of the URL field

    and if the field does not start with "mailto:" or a relative path,

    then set the value to "_blank" */

    targetField['default'] = '_blank';

}

    } catch(exception) {

        alert('Error ' + ev.message);

    }

});
then save it to any file you want and upload it to the Home folder of your dnn portal by default "../Portals/0" You need to upload it via the dnn file manager, or sync the folder after you upload it.

To make sure the file shows up js extensions needs to be set as allowed file extension in the host settings.

Then you can open the Editor Provider Settings under Custom JS File you can select the js file. Then Clear the browser cache reload the editor and the default target is _blank
Jul 8, 2015 at 7:40 PM
Thank you :)