I want to remove the option for the "other" dialog in ckeditor (links -> protocol).
It's confusing for the user; they don't specify a protocol, then the link looks for a file on my server (instead of an external link, confusing the user).
I tried removing the "other" option from link.js, but that didn't work (still shows up). If I remove it from the language files, I get "undefined" instead of other. I've tried searching for everything like "ckeditor remove link protocol" without luck.
Can anyone help me with this?
I found the solution - by making changes to the config.js file. (I always look for hours, finally decide to ask SO, then get a new idea and find the solution only a bit later >< )
CKEDITOR.on( 'dialogDefinition', function( ev )
{
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're
// interested in (the 'link' dialog).
if ( dialogName == 'link' )
{
dialogDefinition.getContents('info').get('protocol')['items'].splice(4, 1);
This part is somewhat well documented. Google search for "removing dropdown options" was more succesful.
dialogDefinition.getContents()
gets the tab
get('protocol')
gets the input item
['items'].splice(4, 1)
gets the item property of the object returned above, and removes the last element from the list (I think I could use pop but whatever). So there's nolonger the other
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With