Report an issue
Class

CKEDITOR.plugins.link

class singleton

Set of Link plugin helpers.

Filtering

Properties

  • deprecated 4.3.3 readonly

    emptyAnchorFix : Boolean

    For browsers that have editing issues with an empty anchor.

  • deprecated 4.3.3 readonly

    fakeAnchor : Boolean

    Opera and WebKit do not make it possible to select empty anchors. Fake elements must be used for them.

    Defaults to true

  • deprecated 4.3.3 readonly

    synAnchorSelector : Boolean

    For browsers that do not support CSS3 a[name]:empty(). Note that IE9 is included because of https://dev.ckeditor.com/ticket/7783.

Methods

  • since 4.3.3

    getEditorAnchors( editor ) → element[]

    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).

    Parameters

    editor : editor

    Returns

    element[]

    An array of anchor elements.

  • since 4.4.0

    getLinkAttributes( editor, data ) → Object

    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'
        ]
    }
    
  • 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

    element | element[] | null

    A single link element or an array of link elements relevant to the current selection.

  • since 4.4.0

    parseLinkAttributes( editor, element ) → Object

    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

    editor : editor
    element : element

    Returns

    Object

    An object of link data.

  • since 4.5.11

    showDisplayTextForElement( element, editor ) → Boolean

    Determines whether an element should have a "Display Text" field in the Link dialog.

    Parameters

    element : element | null

    Selected element, null if none selected or if a ranged selection is made.

    editor : editor

    The editor instance for which the check is performed.

    Returns

    Boolean
  • tryRestoreFakeAnchor( editor, element ) → element

    Returns an element representing a real anchor restored from a fake anchor.

    Parameters

    editor : editor
    element : element

    Returns

    element

    Restored anchor element or nothing if the passed element was not a fake anchor.