Class Xinha

Object
   |
   +--Xinha

class Xinha

Defined in XinhaCore.js

Version: $Rev: 819 $ $LastChangedDate: 2007-04-20 01:20:22 +0200 (Fr, 20 Apr 2007) $


Nested Class Summary
<static class> Xinha.Config
 
Field Summary
 integer __htmlarea_id_num
          running number that identifies the current editor
 document _doc
          The document object of the iframe.
Use this property to perform DOM operations on the edited document
 Object framework parts _framework
          Holds the parts (table cells) of the UI (toolbar, panels, statusbar)
 window _iframe
          This is the actual editable area.
Technically it's an iframe that's made editable using window.designMode = 'on', respectively document.body.contentEditable = true (IE).
Use this property to get a grip on the iframe's window features
 DomNode statusbar div _statusBar
          The statusbar container
 DomNode textarea _textArea
          This property references the original textarea, which is at the same time the editor in text mode
 Xinha.Config config
          The configuration used in the editor
<static>  Object _addClasses
          Alias of Xinha.addClasses()
<static>  Object _closingTags
          
<static>  Array _eventFlushers
          Holds the events to be flushed
<static>  Object _removeClasses
          Alias of Xinha.removeClasses()
<static>  Object addClass
          Alias of Xinha._addClass()
<static>  string ie_version
          Version Number, if browser is Microsoft Internet Explorer
<static>  string is_gecko
          Browserengine is Gecko (Mozilla)
<static>  string is_ie
          Browser is Microsoft Internet Explorer
<static>  string is_khtml
          Browserengine is KHTML (Konqueror, Safari)
<static>  string is_mac
          OS is MacOS
<static>  string is_mac_ie
          Browser is Microsoft Internet Explorer Mac
<static>  string is_opera
          Browser is Opera
<static>  string is_safari
          Browser is Safari
<static>  string is_win_ie
          Browser is Microsoft Internet Explorer Windows
<static>  string opera_version
          Version Number, if browser is Opera
<static>  RegExp RE_body
          Finds body section in HTML
<static>  RegExp RE_doctype
          Exracts DOCTYPE string from HTML
<static>  RegExp RE_email
          Identifies email addresses
<static>  RegExp RE_head
          Finds head section in HTML
<static>  RegExp RE_tagName
          Identifies HTML tag names
<static>  RegExp RE_url
          Identifies URLs
<static>  Object removeClass
          Alias of Xinha.Xinha._removeClass()
<static>  Object version
          
 
Constructor Summary
Xinha(<String|DomNode> textarea, <Xinha.Config> config)
            Creates a new Xinha object
 
Method Summary
 DomNode|null _activeElement(sel)
           Alias of activeElement()
 void _clearFonts()
           Removes <font> tags; always cleans the whole editor content
 void _createImplicitBlock(type)
           What's this?
 Range _createRange(<Selection> sel)
           Alias of createRange()
 Object _editorEvent(<Event> ev)
           A generic event handler for things that happen in the IFRAME's document.
It provides two hooks for the "firePluginEvent" system:
"onKeyPress"
"onMouseDown"
 DomNode|null _getAncestorBlock(<Selection> sel)
           Traverses the DOM upwards and returns the first element that is a block level element
 DomNode|null _getFirstAncestor(<Selection> sel, <Array> types)
           Traverses the DOM upwards and returns the first element that is of one of the specified types
 Selection _getSelection()
           Alias of getSelection()
 void _popupDialog(<String> url, <Function> action, <Mixed> init)
           Modal popup dialogs
 Boolean _selectionEmpty(<Selection> sel)
           Alias of selectionEmpty()
 void _splitBlock()
          
 Boolean _toggleBorders()
           Use some CSS trickery to toggle borders on tables
 void _wordClean()
           Cleans dirty HTML from MS word; always cleans the whole editor content
 DomNode|null activeElement(sel)
           Returns the selected element, if any.
 DomNode addPanel(<String> side)
           Creates a panel in the panel container on the specified side
 DomNode convertNode(<DomNode> el, <String> newTagName)
           Changes the type of a given node
 Range createRange(<Selection> sel)
           Create a Range object from the given selection.
 void debugTree()
           Utility function: Outputs the structure of the edited document
 void disableToolbar(<Array> except)
           Disables (greys out) the buttons of the toolbar
 void enableToolbar()
           Enables the toolbar again when disabled by disableToolbar()
 Boolean execCommand(<String> cmdID, <Boolean> UI, <Mixed> param)
           This is a wrapper for the browser's execCommand function that handles things like formatting, inserting elements, etc.
It intercepts some commands and replaces them with our own implementation.
It provides a hook for the "firePluginEvent" system ("onExecCommand").

For reference see:
Mozilla implementation
MS implementation
 Boolean firePluginEvent(<String> methodName)
           Call a method of all plugins which define the method using the supplied arguments.

 document focusEditor()
           Focuses the iframe window.
 void forceRedraw()
           Sometimes the display has to be refreshed to make DOM changes visible (?) (Gecko bug?)
 Boolean generate()
           Creates the Xinha object and replaces the textarea with it.
 Array getAllAncestors()
           Returns an array with all the ancestor nodes of the selection or current cursor position.
 String getEditorContent()
           Get the edited HTML
 String getKey(<Event> keyEvent)
           Return the character (as a string) of a keyEvent - ie, press the 'a' key and this method will return 'a', press SHIFT-a and it will return 'A'.
 DomNode getParentElement(<Selection> sel)
           Get the parent element of the supplied or current selection.
 String getSelectedHTML()
           Get the HTML of the current selection.
 Selection getSelection()
           Get a Selection object of the current selection.
 Boolean hasSelectedText()
           Return true if we have some selection
 void hidePanel(<DomNode> panel)
           Hides a panel
 void hidePanels(<Array> sides)
           Hides the panel(s) on one or more sides
 String imgURL(<String> file, <String> plugin)
           Creates a path in the form _editor_url + "plugins/" + plugin + "/img/" + file
 void insertHTML(<String> html)
           Insert HTML at the current position, deleting the selection if any.
 void insertNodeAtSelection(<DomNode> toBeInserted)
           Insert a node at the current selection point.
 Boolean isKeyEvent(<Event> event)
           Determine if the given event object is a keydown/press event.
 Boolean isShortCut(<Event> keyEvent)
           Determines if the given key event object represents a combination of CTRL-, which for Xinha is a shortcut.
 void notifyOf(ev, args)
          
 void notifyOn(ev, fn)
          
 String popupURL(<String> file)
           Creates a path
 void registerPanel(<string> side, object)
           FIXME: Never used, what is this for?
 Object registerPlugin()
           Create the specified plugin and register it with this Xinha return the plugin created to allow refresh when necessary.
This is only useful if Xinha is generated without using Xinha.makeEditors()
 void removeLoadingMessage()
          
 void removePanel(<DomNode> panel)
           Removes a panel
 void restoreSelection(<Range> savedSelection)
           Restores a selection previously stored
 Range saveSelection()
           Returns a range object to be stored and later restored with Xinha.prototype.restoreSelection()
 Object scrollPos(<Window> scope)
           Detect the current scroll position
 void scrollToElement(<DomNode> e)
           Scrolls the editor iframe to a given element or to the cursor
 Boolean selectionEmpty(<Selection> sel)
           Determines if the given selection is empty (collapsed).
 void selectNodeContents(<DomNode> node,<Integer> pos)
           Selects the contents of the given node.
 void setEditorContent(<String> html)
           Completely change the HTML inside the editor
 void setLoadingMessage(string)
          
 Object setMode(<String> mode)
           Switches editor mode between wysiwyg and text (HTML)
 void showPanel(<DomNode> panel)
           Shows a panel
 void showPanels(<Array> sides)
           Shows the panel(s) on one or more sides
 void sizeEditor(<string> width, <string> height, <Boolean> includingBars, <Boolean> includingPanels)
           Size the editor to a specific size, or just refresh the size (when window resizes for example)
 String stripBaseURL(<String> string)
           Strips host-part of URL which is added by browsers to links relative to server root
 void updateToolbar(<Boolean> noStatus)
           Updates enabled/disable/active state of the toolbar elements, the statusbar and other things This function is called on every key stroke as well as by a timer on a regular basis.
Plugins have the opportunity to implement a prototype.onUpdateToolbar() method, which will also be called by this function.
 void whenDocReady(<Function> f)
           Delay a function until the document is ready for operations.
<static> void _addClass(<DomNode> el, <String> className)
           Adds one CSS class to a given element (that is, it expands its className property by the given string, separated by a space)
<static> void _addEvent(<DomNode> el, <String> evname, <function> func)
           adds an event listener for the specified element and event type
<static> void _addEvents(<DomNode> el, <Array> evs, <function> func)
           add several events at once to one element
<static> String _colorToRgb(<String|Integer> v)
           Returns hexadecimal color representation from a number or a rgb-style color.
<static> void _getback(<String> url, <Function> handler)
           Use XMLHTTPRequest to receive some data from the server and do something with the it (asyncronously!)
<static> Object _geturlcontent(<String> url)
           Use XMLHTTPRequest to receive some data from the server syncronously
<static> Boolean _hasClass(<DomNode> el, <String> className)
           Checks if one element has set the given className
<static> Object _lc(<String> string, <String> context, <Object> replace)
           Return a localised string.
<static> Object _loadback(<String> url, <Object> callback, <Object> scope, <Object> bonus)
           Load a javascript file by inserting it in the HEAD tag and eventually call a function when loaded
<static> String _makeColor(v)
           Creates a rgb-style rgb(r,g,b) color from a (24bit) number
<static> void _postback(<String> url, <Object> data, <Function> handler)
           Use XMLHTTPRequest to post some data back to the server and do something with the response (asyncronously!), this is used by such things as the tidy functions
<static> void _removeClass(<DomNode> el, <String> className)
           Removes one CSS class (that is one of possible more parts separated by spaces) from a given element
<static> void _removeEvent(<DomNode> el, <String> evname, <function> func)
           removes an event listener previously added
<static> void _removeEvents(<DomNode> el, <Array> evs, <function> func)
           remove several events at once to from element
<static> Object _resolveRelativeUrl( base, url )
          
<static> void _stopEvent(<event> ev)
           stops bubbling of the event, if no further listeners should be triggered
<static> void addClasses(<DomNode> el, <String> classes)
           Adds CSS classes to a given element (that is, it expands its className property by the given string, separated by a space, thereby checking that no class is doubly added)
<static> void addDom0Event(<DomNode> el, <String> ev, <function> fn)
           Adds a standard "DOM-0" event listener to an element.
<static> Boolean arrayContainsArray(<Array> a1, <Array> a2)
           Returns true if all elements of a2 are also contained in a1 (at least I think this is what it does)
<static> Array arrayFilter(<Array> a1, <Function> filterfn)
           Walks through an array and applies a filter function to each item
<static> String base64_decode(<String> input)
           Utility function to base64_decode some arbitrary data, uses the builtin atob() if it exists (Moz)
<static> String base64_encode(<String> input)
           Utility function to base64_encode some arbitrary data, uses the builtin btoa() if it exists (Moz)
<static> Array collectionToArray(<Collection> collection)
           Converts a Collection object to an array
<static> Object createLoadingMessage(textarea,text)
          
<static> void createLoadingMessages(xinha_editors)
          
<static> Object escapeStringForRegExp(<string> string)
           When dynamically creating a RegExp from an arbtrary string, some charactes that have special meanings in regular expressions have to be escaped.
<static> Integer findPosX(obj)
           Find left pixel position of an element in the DOM.
<static> Integer findPosY(obj)
           Find top pixel position of an element in the DOM.
<static> DomNode getElementById(<String> tag, <String> id)
           FIX: Internet Explorer returns an item having the _name_ equal to the given id, even if it's not having any id.
<static> Object getElementTopLeft(<DomNode> element)
           Calculate the top and left pixel position of an element in the DOM.
<static> Object getInnerText(<DomNode> el)
           Extracts the textual content of a given node
<static> String getOuterHTML(<DomNode> element)
           Return the HTML string of the given Element, including the Element.
<static> XMLHTTPRequest getXMLHTTPRequestObject()
           Get a new XMLHTTPRequest Object ready to be used.
<static> Boolean hasDisplayedChildren(<DomNode> el)
           Walks through the children of a given element and checks if any of the are visible (= not display:none)
<static> Boolean hasParentNode(<DomNode> el)
           Checks if some element has a parent node
<static> String htmlEncode(<String> str)
           Performs HTML encoding of some given string (converts HTML special characters to entities)
<static> void init()
          
<static> Boolean isBlockElement(<DomNode> el)
           Checks if one element is in the list of elements that are defined as block level elements in HTML
<static> Boolean isParaContainer(<DomNode> el)
           Checks if one element is in the list of elements that are allowed to contain a paragraph in HTML
<static> Boolean loadPlugin(<String> pluginName, <Function> callback, <String> plugin_file)
           Static function that loads the given plugin
<static> Boolean loadPlugins(<Array> plugins, <Function> callbackIfNotReady)
           Static function that loads the plugins (see xinha_plugins in NewbieGuide)
<static> void loadStyle(<String> style, <String> plugin, <String> id)
           Adds a stylesheet to the document
<static> Object makeEditors(<Array> editor_names, <Xinha.Config> default_config, <Array> plugin_names)
           Xinha's main loading function (see NewbieGuide)
<static> Boolean needsClosingTag(<DomNode> el)
           Checks if one element is in the list of elements for which the end tag is not optional or forbidden in HTML
<static> void notImplemented(methodName)
          
<static> Array objectProperties(<Object> obj)
           Returns an array containig all properties that are set in an object
<static> void onload()
          
<static> Object pageSize(<Window> scope)
           Detect the size of the whole document
<static> void prependDom0Event(el, ev, fn)
           See addDom0Event, the difference is that handlers registered using prependDom0Event will be triggered before existing DOM-0 events of the same name on the same element.
<static> Object removeClasses(<DomNode> el, classes)
           Removes CSS classes (that is one or more of possibly several parts separated by spaces) from a given element
<static> DomNode removeFromParent(<DomNode> el)
           Removes a node from the DOM
<static> void removeLoadingMessages(xinha_editors)
          
<static> Object replace(<string> id, config)
           Helper function: replaces the TEXTAREA with the given ID with Xinha.
<static> void replaceAll(config)
           Helper function: replace all TEXTAREA-s in the document with Xinha-s.
<static> void setLoadingMessage(string)
          
<static> void startEditors(<Object> editors)
           Another main loading function (see NewbieGuide)
<static> String uniq(<String> prefix)
           Returns a string that is unique on the page
<static> Object viewportSize(<Window> scope)
           Detect the size of visible area

Field Detail

__htmlarea_id_num

integer __htmlarea_id_num

_doc

document _doc

_framework

Object framework parts _framework

_iframe

window _iframe

_statusBar

DomNode statusbar div _statusBar

_textArea

DomNode textarea _textArea

config

Xinha.Config config

_addClasses

<static> Object _addClasses

_closingTags

<static> Object _closingTags

_eventFlushers

<static> Array _eventFlushers

_removeClasses

<static> Object _removeClasses

addClass

<static> Object addClass

ie_version

<static> string ie_version

is_gecko

<static> string is_gecko

is_ie

<static> string is_ie

is_khtml

<static> string is_khtml

is_mac

<static> string is_mac

is_mac_ie

<static> string is_mac_ie

is_opera

<static> string is_opera

is_safari

<static> string is_safari

is_win_ie

<static> string is_win_ie

opera_version

<static> string opera_version

RE_body

<static> RegExp RE_body

RE_doctype

<static> RegExp RE_doctype

RE_email

<static> RegExp RE_email

RE_head

<static> RegExp RE_head

RE_tagName

<static> RegExp RE_tagName

RE_url

<static> RegExp RE_url

removeClass

<static> Object removeClass

version

<static> Object version

Constructor Detail

Xinha

Xinha(<String|DomNode> textarea, <Xinha.Config> config)

Method Detail

_activeElement

DomNode|null _activeElement(sel)

_clearFonts

void _clearFonts()

_createImplicitBlock

void _createImplicitBlock(type)

_createRange

Range _createRange(<Selection> sel)

_editorEvent

Object _editorEvent(<Event> ev)

_getAncestorBlock

DomNode|null _getAncestorBlock(<Selection> sel)

_getFirstAncestor

DomNode|null _getFirstAncestor(<Selection> sel, <Array> types)

_getSelection

Selection _getSelection()

_popupDialog

void _popupDialog(<String> url, <Function> action, <Mixed> init)

_selectionEmpty

Boolean _selectionEmpty(<Selection> sel)

_splitBlock

void _splitBlock()

_toggleBorders

Boolean _toggleBorders()

_wordClean

void _wordClean()

activeElement

DomNode|null activeElement(sel)

addPanel

DomNode addPanel(<String> side)

convertNode

DomNode convertNode(<DomNode> el, <String> newTagName)

createRange

Range createRange(<Selection> sel)

debugTree

void debugTree()

disableToolbar

void disableToolbar(<Array> except)

enableToolbar

void enableToolbar()

execCommand

Boolean execCommand(<String> cmdID, <Boolean> UI, <Mixed> param)

firePluginEvent

Boolean firePluginEvent(<String> methodName)

focusEditor

document focusEditor()

forceRedraw

void forceRedraw()

generate

Boolean generate()

getAllAncestors

Array getAllAncestors()

getEditorContent

String getEditorContent()

getKey

String getKey(<Event> keyEvent)

getParentElement

DomNode getParentElement(<Selection> sel)

getSelectedHTML

String getSelectedHTML()

getSelection

Selection getSelection()

hasSelectedText

Boolean hasSelectedText()

hidePanel

void hidePanel(<DomNode> panel)

hidePanels

void hidePanels(<Array> sides)

imgURL

String imgURL(<String> file, <String> plugin)

insertHTML

void insertHTML(<String> html)

insertNodeAtSelection

void insertNodeAtSelection(<DomNode> toBeInserted)

isKeyEvent

Boolean isKeyEvent(<Event> event)

isShortCut

Boolean isShortCut(<Event> keyEvent)

notifyOf

void notifyOf(ev, args)

notifyOn

void notifyOn(ev, fn)

popupURL

String popupURL(<String> file)

registerPanel

void registerPanel(<string> side, object)

registerPlugin

Object registerPlugin()

removeLoadingMessage

void removeLoadingMessage()

removePanel

void removePanel(<DomNode> panel)

restoreSelection

void restoreSelection(<Range> savedSelection)

saveSelection

Range saveSelection()

scrollPos

Object scrollPos(<Window> scope)

scrollToElement

void scrollToElement(<DomNode> e)

selectionEmpty

Boolean selectionEmpty(<Selection> sel)

selectNodeContents

void selectNodeContents(<DomNode> node,<Integer> pos)

setEditorContent

void setEditorContent(<String> html)

setLoadingMessage

void setLoadingMessage(string)

setMode

Object setMode(<String> mode)

showPanel

void showPanel(<DomNode> panel)

showPanels

void showPanels(<Array> sides)

sizeEditor

void sizeEditor(<string> width, <string> height, <Boolean> includingBars, <Boolean> includingPanels)

stripBaseURL

String stripBaseURL(<String> string)

updateToolbar

void updateToolbar(<Boolean> noStatus)

whenDocReady

void whenDocReady(<Function> f)

_addClass

<static> void _addClass(<DomNode> el, <String> className)

_addEvent

<static> void _addEvent(<DomNode> el, <String> evname, <function> func)

_addEvents

<static> void _addEvents(<DomNode> el, <Array> evs, <function> func)

_colorToRgb

<static> String _colorToRgb(<String|Integer> v)

_getback

<static> void _getback(<String> url, <Function> handler)

_geturlcontent

<static> Object _geturlcontent(<String> url)

_hasClass

<static> Boolean _hasClass(<DomNode> el, <String> className)

_lc

<static> Object _lc(<String> string, <String> context, <Object> replace)

_loadback

<static> Object _loadback(<String> url, <Object> callback, <Object> scope, <Object> bonus)

_makeColor

<static> String _makeColor(v)

_postback

<static> void _postback(<String> url, <Object> data, <Function> handler)

_removeClass

<static> void _removeClass(<DomNode> el, <String> className)

_removeEvent

<static> void _removeEvent(<DomNode> el, <String> evname, <function> func)

_removeEvents

<static> void _removeEvents(<DomNode> el, <Array> evs, <function> func)

_resolveRelativeUrl

<static> Object _resolveRelativeUrl( base, url )

_stopEvent

<static> void _stopEvent(<event> ev)

addClasses

<static> void addClasses(<DomNode> el, <String> classes)

addDom0Event

<static> void addDom0Event(<DomNode> el, <String> ev, <function> fn)

arrayContainsArray

<static> Boolean arrayContainsArray(<Array> a1, <Array> a2)

arrayFilter

<static> Array arrayFilter(<Array> a1, <Function> filterfn)

base64_decode

<static> String base64_decode(<String> input)

base64_encode

<static> String base64_encode(<String> input)

collectionToArray

<static> Array collectionToArray(<Collection> collection)

createLoadingMessage

<static> Object createLoadingMessage(textarea,text)

createLoadingMessages

<static> void createLoadingMessages(xinha_editors)

escapeStringForRegExp

<static> Object escapeStringForRegExp(<string> string)

findPosX

<static> Integer findPosX(obj)

findPosY

<static> Integer findPosY(obj)

getElementById

<static> DomNode getElementById(<String> tag, <String> id)

getElementTopLeft

<static> Object getElementTopLeft(<DomNode> element)

getInnerText

<static> Object getInnerText(<DomNode> el)

getOuterHTML

<static> String getOuterHTML(<DomNode> element)

getXMLHTTPRequestObject

<static> XMLHTTPRequest getXMLHTTPRequestObject()

hasDisplayedChildren

<static> Boolean hasDisplayedChildren(<DomNode> el)

hasParentNode

<static> Boolean hasParentNode(<DomNode> el)

htmlEncode

<static> String htmlEncode(<String> str)

init

<static> void init()

isBlockElement

<static> Boolean isBlockElement(<DomNode> el)

isParaContainer

<static> Boolean isParaContainer(<DomNode> el)

loadPlugin

<static> Boolean loadPlugin(<String> pluginName, <Function> callback, <String> plugin_file)

loadPlugins

<static> Boolean loadPlugins(<Array> plugins, <Function> callbackIfNotReady)

loadStyle

<static> void loadStyle(<String> style, <String> plugin, <String> id)

makeEditors

<static> Object makeEditors(<Array> editor_names, <Xinha.Config> default_config, <Array> plugin_names)

needsClosingTag

<static> Boolean needsClosingTag(<DomNode> el)

notImplemented

<static> void notImplemented(methodName)

objectProperties

<static> Array objectProperties(<Object> obj)

onload

<static> void onload()

pageSize

<static> Object pageSize(<Window> scope)

prependDom0Event

<static> void prependDom0Event(el, ev, fn)

removeClasses

<static> Object removeClasses(<DomNode> el, classes)

removeFromParent

<static> DomNode removeFromParent(<DomNode> el)

removeLoadingMessages

<static> void removeLoadingMessages(xinha_editors)

replace

<static> Object replace(<string> id, config)

replaceAll

<static> void replaceAll(config)

setLoadingMessage

<static> void setLoadingMessage(string)

startEditors

<static> void startEditors(<Object> editors)

uniq

<static> String uniq(<String> prefix)

viewportSize

<static> Object viewportSize(<Window> scope)


Documentation generated by JSDoc on Fri Apr 20 01:21:21 2007