link/utils
@ckeditor/ckeditor5-link/src/utils
Filtering
Constants
-
LINK_KEYSTROKE
module:link/utils~LINK_KEYSTROKE
A keystroke used by the link UI feature.
Classes
-
AutomaticDecorators
module:link/utils~AutomaticDecorators
-
ManualDecorator
module:link/utils~ManualDecorator
Functions
-
addLinkProtocolIfApplicable() → String
module:link/utils~addLinkProtocolIfApplicable
Adds the protocol prefix to the specified
link
when:- it does not contain it already, and there is a
defaultProtocol
configuration value provided, - or the link is an email address.
Returns
String
- it does not contain it already, and there is a
-
createLinkElement( href, conversionApi ) → AttributeElement
module:link/utils~createLinkElement
Creates a link
AttributeElement
with the providedhref
attribute.Parameters
href : String
conversionApi : DowncastConversionApi
Returns
-
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>
module:link/utils~getLocalizedDecorators
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>
-
isEmail() → Boolean
module:link/utils~isEmail
-
isLinkElement( node ) → Boolean
module:link/utils~isLinkElement
-
isLinkableElement() → Boolean
module:link/utils~isLinkableElement
Returns
true
if the specifiedelement
can be linked (the element allows thelinkHref
attribute).Returns
Boolean
-
linkHasProtocol( link ) → Boolean
module:link/utils~linkHasProtocol
Checks if protocol is already included in the link.
Parameters
link : String
Returns
Boolean
-
normalizeDecorators( decorators ) → Array.<LinkDecoratorDefinition>
module:link/utils~normalizeDecorators
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>
-
openLink( link )
module:link/utils~openLink
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.