Each editor running on a textarea is called an instance. Editor instances have their own variables
and methods that make it easy to edit textarea content. Active instance on the page can be accessed by the
variable "BUE.active".

A js button's script is executed in a function with the argument E that refers to BUE.active and the $ that refers to jQuery.
Here are the properties and variables of the istance E:

E.index: index of the instance in the array BUE.instances
E.textArea: textarea of the instance as an HTML object.
E.safeToPreview: initial state of html existance in the textarea.
E.tplid: template id used by the editor.
E.tpl: editor template that this instance uses.(one of BUE.templates)
E.UI: html object that wraps the instance interface. (<div class="bue-ui" id="bue-ui-%index"></div>)
E.buttons: array of buttons of the instance as HTML objects(input objects having the type "button" or "image")
E.bindex: latest/currently clicked button index that can be used in E.buttons. Ex: E.buttons[E.bindex]

E.focus():
Focus on the textarea of the instance.

E.getContent():
Returns the content of the textarea.

E.setContent(text):
Replaces the content of the textarea with the given text.

E.getSelection():
Returns the selected text in the textarea.

E.replaceSelection(text, cursor):
Replace the selected text in the textarea with the given text.
The optional second argument specifies the position of the caret after replacement.
if cursor='start', it is placed at the beginning of the replaced text.
if cursor='end', it is placed at the end of the replaced text.
if cursor is not defined, the selection is preserved containing the replaced text.

E.tagSelection(left, right, cursor):
Encloses the selected text in the textarea with the given left and right texts.
The optional third argument specifies the position of the caret after enclosing.
if cursor='start', it is placed at the beginning of the selected text.
if cursor='end', it is placed at the end of the selected text.
if cursor is not defined, the selection is preserved.

E.makeSelection(start, end):
Create a selection by selecting the characters between the indexes "start" and "end" where "end" is optional.

E.posSelection():
Returns the index values of selection start and selection end.
Returns {startXendY} where X is the start index and Y is the end index.
Note: No selection is also a selection where start=end=caret position.

E.buttonsDisabled(state, bindex):
Dynamically enable/disable buttons of the instance.
the first argument defines the state of the buttons and should be set to true or false.
the optional second argument defines the index of the button whose state will not change.
Ex: to disable all buttons except the pressed button;
jsE.buttonsDisabled(trueE.bindex);

E.stayClicked(state, bindex):
Add/remove "stay-clicked" class to/from a user defined button having the "bindex".
This method is usually used to toggle a stay-clicked effect on the active button without supplying the second argument.

Under supervision of Drupal :)