Quantcast
Channel: CKEditor™ Provider for DNN®
Viewing all articles
Browse latest Browse all 1992

New Post: Customize default target = "_blank" in the link button

$
0
0
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

Viewing all articles
Browse latest Browse all 1992

Trending Articles