CKEDITOR.plugins.link
Set of Link plugin helpers.
Filtering
Properties
-
emptyAnchorFix : Boolean
deprecated 4.3.3 readonly
For browsers that have editing issues with an empty anchor.
-
fakeAnchor : Boolean
deprecated 4.3.3 readonly
Opera and WebKit do not make it possible to select empty anchors. Fake elements must be used for them.
Defaults to
true
-
synAnchorSelector : Boolean
deprecated 4.3.3 readonly
For browsers that do not support CSS3
a[name]:empty()
. Note that IE9 is included because of https://dev.ckeditor.com/ticket/7783.
Methods
-
getEditorAnchors( editor ) → element[]
since 4.3.3
Collects anchors available in the editor (i.e. used by the Link plugin). Note that the scope of search is different for inline (the "global" document) and classic (
iframe
-based) editors (the "inner" document). -
getLinkAttributes( editor, data ) → Object
since 4.4.0
Converts link data produced by parseLinkAttributes into an object which consists of attributes to be set (with their values) and an array of attributes to be removed. This method can be used to compose or to update any link element with the given data.
Parameters
editor : editor
data : Object
Data in parseLinkAttributes format.
Returns
Object
An object consisting of two keys, i.e.:
{ // Attributes to be set. set: { href: 'http://foo.bar', target: 'bang' }, // Attributes to be removed. removed: [ 'id', 'style' ] }
-
getSelectedLink( editor, [ returnMultiple ] ) → element | element[] | null
since 3.2.1
Get the surrounding link element of the current selection.
CKEDITOR.plugins.link.getSelectedLink( editor ); // The following selections will all return the link element. <a href="#">li^nk</a> <a href="#">[link]</a> text[<a href="#">link]</a> <a href="#">li[nk</a>] [<b><a href="#">li]nk</a></b>] [<a href="#"><b>li]nk</b></a>
Parameters
editor : editor
[ returnMultiple ] : Boolean
Indicates whether the function should return only the first selected link or all of them.
Defaults to
false
Returns
-
parseLinkAttributes( editor, element ) → Object
since 4.4.0
Parses attributes of the link element and returns an object representing the current state (data) of the link. This data format is a plain object accepted e.g. by the Link dialog window and getLinkAttributes.
Note: Data model format produced by the parser must be compatible with the Link plugin dialog because it is passed directly to CKEDITOR.dialog.setupContent.
Parameters
Returns
Object
An object of link data.
-
showDisplayTextForElement( element, editor ) → Boolean
since 4.5.11
Determines whether an element should have a "Display Text" field in the Link dialog.
-
tryRestoreFakeAnchor( editor, element ) → element
Returns an element representing a real anchor restored from a fake anchor.