Returns values necessary for editor functions to work on contentEditable elements
a contentEditable element
The content of the element, the position of the caret, the position of the end of the visual selection
Returns line and column number.
Returns values necessary for editor functions to work on textarea/input elements
the element
The content of the element, the position of the caret, the position of the end of the visual selection
Detects the boundaries of a word in text according to the wordpattern setting. If POSITION is in a word, the boundaries of this word are returned. If POSITION is out of a word and BEFORE is true, the word before POSITION is returned. If BEFORE is false, the word after the caret is returned.
Take an editor function as parameter and wrap it in a function that will handle error conditions
Change text in contentEditable elements in a non-destructive way (i.e. C-z will undo changes).
The content editable element
The new content the element should have. null if you just want to move the caret around
The new caret position. null if you just want to change text.
The end of the visual selection. null if you just want to move the caret.
Change text in regular textarea/input fields. Note: this destroys the field's history (i.e. C-z won't work).
The element
The new content of the element, null if it shouldn't change
The new position of the caret, null if the caret shouldn't move
The end of the visual selection, null if you just want to move the caret
Shuffles input string
string to be shuffled
Take an editor function as parameter and return it wrapped in a function that will handle grabbing text and caret position from the HTML element it takes as parameter
boolean Whether the editor function was actually called or not
Applies a function to an element. If the element is an HTMLInputElement and its type isn't "text", it is first turned into a "text" element. This is necessary because some elements (e.g. "email") do not have a selectionStart/selectionEnd. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange .