Show:

CKEditor plugin which automatically generates links when user types text which looks like URL.

Constructor

Methods

_getLastWord

() String protected

Retrieves the last word introduced by the user. Reads from the current caret position backwards until it finds the first white space.

Returns:

String:

The last word introduced by user

_onKeyDown

(
  • event
)
protected

Listens to the keydown event and if the keycode is Backspace, removes the previously created link.

Parameters:

  • event EventFacade

    EventFacade object

_onKeyUp

(
  • event
)
protected

Listens to the Enter and Space key events in order to check if the last word introduced by the user should be replaced by a link element.

Parameters:

  • event EventFacade

    EventFacade object

_subscribeToKeyEvent

() protected

Subscribe to a key event of the editable aria.

init

(
  • editor
)

Initialization of the plugin, part of CKEditor plugin lifecycle. The function registers the keyup event on the editing area.

Parameters:

  • editor Object

    The current editor instance

isValidURL

(
  • link
)
Boolean protected

Checks if the given link is a valid URL.

Parameters:

  • link String

    The link we want to know if it is a valid URL

Returns:

Boolean:

Returns true if the link is a valid URL, false otherwise

Events

autolinkAdd

Fired when a URL is detected in text and converted to a link.

Event Payload:

  • el CKEDITOR.dom.element

    Node of the created link.