Page 3 of 7
Basic methods
Here are the basic methods you should know when writing your plugin.
getError()
Since 2.3.1 Returns the last known error
getAllErrors()
Since 2.3.1 Returns an array of reported errors
getSelectedText(html)
Retrieves the highlighted text from the article
- html (optional): Return raw HTML instead of plain text
getDefaultText(text)
Same as LinkrHelper.getSelectedText, but returns the passed argument if no text was selected- text (required): Default text if no text was selected by user
insert(text)
Inserts text into the article at the cursor's position, replacing any highlighted text
- text (required): The text to insert into the article
insertAtEnd(text)
Inserts text at the end of an article, ignoring any highlighted text
- text (required): The text to insert into the article
link(url, text)
Shortcut to insert a link and close the lightbox
- url (required): URL to link
- text (required): Link text
- This method assumes that DOM elements with the following IDs exist:
- target
- linkTitle
- linkClass
- linkRelation
setReturnPage(func)
Since 2.3.1 Sets the page to load when Linkr is opened. Useful if user needs to insert several links and come back to the same page
- func (required): Function to call. Can be an array containing an object and method
NOTE: A function should be supplied as a string e.g. 'myFunction' and an object as an array of strings e.g. ['myObject', 'myMethod'].



