Jump to content

User talk:Gerbrant/edit/selection.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Gerbrant.edit.selection
Allows scripts to edit the selected text in textareas, in particular the selected text in the article editing textarea.
IE quirk: this script will cause the textarea in question to receive focus, because IE has no way to retreive the selection in textareas without focussing them.
Non-IE quirk: this script will set the selection in a setTimeout, because Firefox, Konqueror and others modify the selection or display other weird behaviour when scripts stop running and the value of a textarea has been changed.

Members

[edit]
replaceTextareaSelection(t, f)
If f is defined, replaces the selection text in textarea t with the result of applying f to it.
Returns the old selection text.
replaceSelection(f)
If f is defined, replaces the selection text in the article editing textarea with the result of applying f to it.
Returns the old selection text.