最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to remove link target options in ckeditor? - Stack Overflow

programmeradmin7浏览0评论

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';

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';

Share Improve this question asked Oct 18, 2016 at 19:34 droohdrooh 6784 gold badges20 silver badges52 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 11

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');

  }
});
发布评论

评论列表(0)

  1. 暂无评论