Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove link target options in ckeditor?

I would like to either remove some of the options from the link target select element or specify which options to show. For example, the default has several that I don't need such as frame and popup window.

My question is, how can you specify the link target options or remove certain target options on ckeditor?

Please see screenshot

note that I have already removed the advanced tab using

config.removeDialogTabs = 'link:advanced';
config.removeDialogTabs = 'image:advanced';

enter image description here

like image 359
drooh Avatar asked Oct 18 '16 19:10

drooh


1 Answers

using the example here.

You can set the items using this:-

CKEDITOR.on('dialogDefinition', function(ev) {

  var dialogName = ev.data.name;

  if (dialogName == 'link') {

    var dialogDefinition = ev.data.definition;
    var informationTab = dialogDefinition.getContents('target');
    var targetField = informationTab.get('linkTargetType');

    // just <not set> and New Window (_blank)
    targetField.items = targetField.items.filter(x => x[1] == '_blank' || x[1] == 'notSet');

  }
});
like image 129
BenG Avatar answered Oct 27 '22 00:10

BenG