link/utils
@ckeditor/ckeditor5-link/src/utils
Filtering
Classes
-
Helper class that ties together all
LinkDecoratorAutomaticDefinition
and provides a downcast dispatcher for them. -
Helper class that stores manual decorators with observable
value
to support integration with the UI state. An instance of this class is a model with the state of individual manual decorators. These decorators are kept as collections inmanualDecorators
.
Functions
-
createLinkElement( href ) → AttributeElement
static
Creates link
AttributeElement
with the providedhref
attribute. -
ensureSafeUrl( url ) → String
protected static
Returns a safe URL based on a given value.
A URL is considered safe if it is safe for the user (does not contain any malicious code).
If a URL is considered unsafe, a simple
"#"
is returned.Parameters
url : *
Returns
String
Safe URL.
-
getLocalizedDecorators( t, The ) → Array.<LinkDecoratorDefinition>
static
Returns the
config.link.decorators
configuration processed to respect the locale of the editor, i.e. to display the label in the correct language.Note: Only the few most commonly used labels are translated automatically. Other labels should be manually translated in the
config.link.decorators
configuration.Parameters
t : Locale#t
shorthand for Locale#t
The : Array.<LinkDecoratorDefinition>
decorator reference where the label values should be localized.
Returns
Array.<LinkDecoratorDefinition>
-
isLinkElement( node ) → Boolean
static
Returns
true
if a given view node is the link element. -
normalizeDecorators( decorators ) → Array.<LinkDecoratorDefinition>
static
Converts an object with defined decorators to a normalized array of decorators. The
id
key is added for each decorator and is used as the attribute's name in the model.Parameters
decorators : Object.<String, LinkDecoratorDefinition>
Returns
Array.<LinkDecoratorDefinition>