Basically I removed the ancho开发者_StackOverflowr button so there should not be a link to anchor option in my link window.
Any way to remove that dropdown option
?Figured it out
if ( dialogName == 'link' )
{
var infoTab = dialogDefinition.getContents( 'info' );
var linktypeField = infoTab.get( 'linkType' );
/* Remove it from the array of items */
linktypeField['items'].splice(1, 1);
}
dialogDefinition allows you to completely redesign dialog boxes.
I did it this way, based on the example at http://nightly.ckeditor.com/7156/_samples/api_dialog.html
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 on (the "Link" dialog).
if ( dialogName == 'link' )
{
// Get a reference to the "Link Info" tab.
var infoTab = dialogDefinition.getContents( 'info' );
infoTab.remove( 'linkType' );
}
});
$("#mydiv").ckeditor(function(){}, {
removeDialogTabs: 'link:advanced;link:target'
// any other customizations go here.
});
This's my solution:
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') {
// Remove the 'Target' and 'Advanced' tabs from the 'Link' dialog.
//dialogDefinition.removeContents('target');
//dialogDefinition.removeContents('advanced');
// Get a reference to the 'Link Info' tab.
var infoTab = dialogDefinition.getContents('info');
infoTab.remove('protocol');
infoTab.get('linkType').style = 'display: none';
}
});
If you get rid of Link Type using infoTab.remove('linkType');
it will fails to create the link
精彩评论