Provides the given targets to select from and a list of rules to set the default target for different types of links.

The configuration is provided as extension to CKEditor's link feature configuration:

ClassicEditor
.create( document.querySelector( '#editor' ), {
// ...
link: {
targets: [
// buttons will be created in this order.
"_self",
"_blank",
"_embed",
"_other",
// Will be transformed to:
// {
// name: "custom1",
// icon: custom1Icon,
// title: "custom1",
// }
"custom1",
{
name: "myCustomTarget",
icon: customTargetIcon,
title: "Custom Target",
},
],
defaultTargets: [
{
type: "externalLink",
target: "_blank",
}
]
}
} )
.then( ... )
.catch( ... );

where for example "self" is one of the pre-defined targets provided by this plugin, while "myCustomTarget" provides a custom fixed target. "myCustomTarget" will be represented in model by linkTarget="myCustomTarget" and will get a toggle button with given icon and title.

It is also possible to provide a filter instead of a type for the default target rules.

interface LinkTargetConfig {
    defaultTargets?: TargetDefaultRuleDefinition[];
    targets?: (LinkTargetOptionDefinition | DefaultTarget)[];
}

Properties

defaultTargets?: TargetDefaultRuleDefinition[]