CKEDITOR.plugins.ae_autolink Class
src/plugins/autolink.js:30
CKEditor plugin which automatically generates links when user types text which looks like URL.
Constructor
CKEDITOR.plugins.ae_autolink
()
Index
Methods
Events
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:
The last word introduced by user
_onKeyDown
-
event
Listens to the keydown
event and if the keycode is Backspace
, removes the previously
created link.
Parameters:
-
event
EventFacadeEventFacade object
_onKeyUp
-
event
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
EventFacadeEventFacade object
_removeLink
()
protected
Removes the created link element, and replaces it by its text.
_replaceContentByLink
-
content
Replaces content by a link element.
Parameters:
-
content
StringThe text that has to be replaced by an link element
_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
ObjectThe current editor instance
isValidURL
-
link
Checks if the given link is a valid URL.
Parameters:
-
link
StringThe link we want to know if it is a valid URL
Returns:
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.elementNode of the created link.