Show:
Defined in: src/core/link.js:8

Link class utility. Provides methods for create, delete and update links.

Constructor

Methods

_getCompleteURI

(
  • URI
)
String protected

Checks if the URI begins with a '#' symbol to determine if it's an on page bookmark. If it doesn't, it then checks if the URI has an '@' symbol. If it does and the URI looks like an email and doesn't have 'mailto:', 'mailto:' is added to the URI. If it doesn't and the URI doesn't have a scheme, the default 'http' scheme with hierarchical path '//' is added to the URI.

Parameters:

  • URI String

    The URI of the link.

Returns:

String:

The URI updated with the protocol.

advanceSelection

(
  • link
)

Defined in src/core/link.js:23

Advances the editor selection to the next available position after a given link or the one in the current selection.

Parameters:

  • link CKEDITOR.dom.element

    The link element which link style should be removed.

create

(
  • attrs
  • modifySelection
  • URI
)

Defined in src/core/link.js:55

Create a link with given URI as href.

Parameters:

  • attrs Object

    A config object with link attributes. These might be arbitrary DOM attributes.

  • modifySelection Object

    A config object with an advance attribute to indicate if the selection should be moved after the link creation.

  • URI String

    The URI of the link.

debounce

(
  • args
  • callback
  • timeout
  • context
)
static

Debounce util function. If a function execution is expensive, it might be debounced. This means that it will be executed after some amount of time after its last call. For example, if we attach a a function on scroll event, it might be called hundreds times per second. In this case it may be debounced with, let's say 100ms. The real execution of this function will happen 100ms after last scroll event.

Parameters:

  • args Array

    An array of arguments which the callback will receive.

  • callback Function

    The callback which has to be called after given timeout.

  • timeout Number

    Timeout in milliseconds after which the callback will be called.

  • context Object

    The context in which the callback will be called. This argument is optional.

getFromSelection

() CKEDITOR.dom.element

Defined in src/core/link.js:98

Retrieves a link from the current selection.

Returns:

CKEDITOR.dom.element:

The retrieved link or null if not found.

remove

(
  • link
  • modifySelection
)

Removes a link from the editor.

Parameters:

  • link CKEDITOR.dom.element

    The link element which link style should be removed.

  • modifySelection Object

    A config object with an advance attribute to indicate if the selection should be moved after the link creation.

update

(
  • link
  • attrs
  • modifySelection
)

Updates the href of an already existing link.

Parameters:

  • link CKEDITOR.dom.element

    The link element which href should be removed.

  • attrs Object | String

    The attributes to update or remove. Attributes with null values will be removed.

  • modifySelection Object

    A config object with an advance attribute to indicate if the selection should be moved after the link creation.