## Class TinyMCE_Engine

    Object
       |
       +--TinyMCE_Engine

class TinyMCE_Engine

Defined in TinyMCE_Engine.class.js

Field Summary
`Object` | `buttonMap`
`Object` | `configs`
`Object` | `currentConfig`
`Object` | `dialogCounter`
`Object` | `eventHandlers`
`Object` | `idCounter`
`Object` | `instances`
`Object` | `isGecko`
`Object` | `isLoaded`
`Object` | `isMac`
`Object` | `isMSIE`
`Object` | `isMSIE5`
`Object` | `isMSIE5_0`
`Object` | `isNS7`
`Object` | `isNS71`
`Object` | `isOpera`
`Object` | `isSafari`
`Object` | `loadedFiles`
`Object` | `loadedPlugins`
`Object` | `majorVersion`
`Object` | `menus`
`Object` | `minorVersion`
`Object` | `plugins`
`Object` | `releaseDate`
`Object` | `switchClassCache`
`Object` | `themes`
`Object` | `windowArgs`

Constructor Summary
`TinyMCE_Engine ()` Core engine class for TinyMCE, a instance of this class is available as a global called tinyMCE.

Method Summary
`HTMLElement` | `_getElementById(<string> i<DOMDocument> d, d)` Returns a element by id, this will also search the form names to match the id.
`void` | `_removeInternal(<DOMNode> n)` Removes any internal content inserted by regexps.
`Object` | `accessibleEventHandler(<DOMEvent> e)` Accessibility handler that gets executed when the user hits a key in a select element.
`void` | `addButtonMap(<string> m)` Adds a list of buttons available in the tiled button image used by the button_tile_map option.
`string` | `addCSSClass(<HTMLElement> e, c, b)` Adds a CSS class to the specified element.
`void` | `addEvent(<HTMLElement> o, <string> n, <function> h)` Adds a event handler function to the specified object.
`void` | `addEventHandlers(<inst> inst)` Adds the handleEvent function to the specified editor instance.
`void` | `addMCEControl(<HTMLElement> replace_element, <string> form_element_name, <DOMDocument> target_document)` Adds a TinyMCE editor control instance to a specific form element.
`void` | `addMenu(<string> n, <TinyMCE_Menu> m)` Adds a floating menu instance to TinyMCE.
`void` | `addPlugin(n, <TinyMCE_Plugin> p)` Adds the specified plugin to the list of loaded plugins, this will also setup the baseURL property of the plugin.
`Object` | `addSelectAccessibility(<DOMEvent> e, <HTMLElement> s, <DOMWindow> w)` Adds accessibility keydown handler to the specified select element.
`void` | `addTheme(&l<TinyMCE_Theme> t;string> n, t)` Adds the specified theme in to the list of loaded themes.
`void` | `addToLang(<string> prefix, <Array> ar)` Adds language items to the global language array.
`string` | `applyTemplate(<string> h, <Array> as)` Replaces language, args and settings variables in a HTML string.
`boolean` | `callFunc(<<<Array> a href="TinyMCE_Control.html">TinyMCE_Control> ins, <string> p, <string> n, <int> m, a)` Executes callback chain.
`void` | `cancelEvent(<DOMEvent> e)` Cancels the specified event, this will disable the event from be passed to other listeners in event chain.
`void` | `cleanupAnchors(<DOMDocument> doc)` Moves the contents of a anchor outside and after the anchor.
`string` | `cleanupEventStr(<string> s)` Removes MSIE 5.5 specific event wrapper function form a event string.
`string` | `cleanupHTMLCode(<string> s)` Makes some preprocessing cleanup routines on the specified HTML string.
`Array` | `clearArray(a)` Returns a cleared array, since some external libraries tend to extend the Array core object arrays needs to be cleaned from these extended functions.
`void` | `closeWindow(<DOMWindow> win)` Closes the specified window.
`void` | `compressStyle(<Array> ar, <string> pr, <string> sf, <string> res)` Compresses larger styles into a smaller.
`void` | `confirmAdd(<DOMEvent> e, <Array> settings)` Displays a confirm dialog when a user clicks/focus a textarea that is to be converted into a TinyMCE instance.
`string` | `convertAbsoluteURLToRelativeURL(<string> base_url, <string> url_to_relative)` Converts an absolute path to relative path.
`void` | `convertAllRelativeURLs(<HTMLElement> body)` Converts all img and a element URLs to absolute URLs.
`void` | `convertFontsToSpans(<DOMDocument> doc)` Convers fonts to spans in the specified document.
`string` | `convertHexToRGB(<string> s)` Returns a rgb(n,n,n) string from a hexadecimal value.
`string` | `convertRelativeToAbsoluteURL(<string> base_url, <string> relative_url)` Converts an relative path to absolute path.
`string` | `convertRGBToHex(<string> s, <boolean> k)` Returns a hexadecimal version of the specified rgb(1,2,3) string.
`void` | `convertSpansToFonts(<DOMDocument> doc)` Converts span elements to font elements in the specified document instance.
`string` | `convertURL(<string> url, <HTMLElement> node, <boolean> on_save)` Converts the specified URL based in TinyMCE configuration settings.
`void` | `debug()` Debugs the specified message to a screen.
`Object` | `dispatchCallback(<TinyMCE_Control> i, <string> p, <string> n)` Dispatches the specified callback on all options, plugins and themes.
`string` | `entityDecode(<string> s)` HTML entity decode a string, replaces < with <.
`object` | `evalFunc(<string> f, <int> idx, <Array> a)` Evaluates the specified function and uses the array of arguments.
`void` | `execCommand(<string> command, <boolean> user_interface, <object> value)` Executes a command on the selected or last selected TinyMCE editor control instance.
`Object` | `execCommandCallback(<TinyMCE_Control> i, <string> p, <string> n)` Executes the specified execcommand callback on all options, plugins and themes.
`void` | `execInstanceCommand(<string> editor_id, <string> command, <boolean> user_interface, <object> value, <boolean> focus)` Executes a command on a specific editor instance by id.
`Object` | `executeCallback(<TinyMCE_Control> i, <string> p, <string> n)` Executes the specified callback on all options, plugins and themes.
`Array` | `explode(<string> d, <string> s)` Splits a string by the specified delimiter and skips any empty items.
`Object` | `extend(<Object> p, <Object> np)` Extends the specified prototype with new methods.
`string` | `fixGeckoBaseHREFBug(<boolean> m, <HTMLElement> e, <string> h)` Fixes a Gecko specific bug where href, src attribute values gets converted incorrectly when inserted into editor.
`TinyMCE_ElementPosition` | `getAbsPosition(<HTMLNode> n)` Returns the absolute x, y position of a node.
`string` | `getAttrib(<HTMLElement> elm, <string> name, <string> default_value)` Returns the attribute value of a element or the default value if it wasn't found.
`string` | `getButtonHTML(<string> id, <string> lang, <string> img, <string> cmd, <string> ui, <string> val)` Returns the HTML code for a normal button control.
`string` | `getContent(<string> editor_id)` Returns the HTML contents of the specified editor instance id.
`string` | `getControlHTML(<string> c)` Returns the HTML for the specified control this will loop through the theme and all plugins inorder to find the control.
`Array` | `getCSSClasses(<string> editor_id, <DOMDocument> doc)` Returns a array of CSS classes that is available in a document.
`string` | `getEditorId(<string> form_element)` Returns the editor instance id of a specific form element.
`HTMLElement` | `getElementByAttributeValue(<HTMLElement> n, <string> e, <string> a, <string> v)` Returns a element by a specific attribute and it's value.
`Array` | `getElementsByAttributeValue(<HTMLElement> n, <string> e, <string> a, <string> v)` Returns a element array by a specific attribute and it's value.
`TinyMCE_Control` | `getInstanceById(<string> editor_id)` Returns a TinyMCE editor instance by the specified editor id or null if it wasn't found.
`object` | `getLang(<string> name, <string> default_value, <boolean> parse_entities, <Array> va)` Returns a language variable value from the language packs.
`Array` | `getNodeTree(&l<int> t;HTMLNode> n, <Array> na, t, <string> nn)` Returns a array of nodes selected retrived from the child nodes of the specified node.
`string` | `getOuterHTML(<HTMLElement> e)` Returns the outer HTML of a element, this uses the outerHTML property in MSIE and Opera and a workaround for Gecko.
`object` | `getParam(<string> name, <string> default_value, <boolean> strip_whitespace, <string> split_chr)` Returns a specific configuration setting or the default value if it wasn't found.
`HTMLElement` | `getParentBlockElement(<HTMLNode> n)` Returns the first block element parent of the specified node.
`HTMLElement` | `getParentElement(<HTMLNode> node, <string> names, <string> attrib_name, <string> attrib_value)` Returns the parent element of the specified node based on the search criteria.
`DOMNode` | `getParentNode(<DOMNode> n, <function> f)` Returns a node by the specified selector function.
`string` | `getVisualAidClass(<string> class_name, <boolean> state)` Returns the visual aid class string, this will add/remove the visual aid class.
`Object` | `getWindowArg(<string> n, d)` Returns the window argument to be passed to TinyMCE popup.
`boolean` | `handleEvent(<DOMEvent> e)` Event handler function that gets executed each time a event occurs in a TinyMCE editor control instance.
`void` | `handleVisualAid(<HTMLElement> el, <boolean> deep, <boolean> state, <TinyMCE_Control> inst, skip_dispatch)` Adds visual aid classes to all elements that need them recursive in the DOM tree.
`boolean` | `hasMenu(<string> n)` Checks if the specified menu by name is added to TinyMCE.
`boolean` | `hasPlugin(<string> n)` Returns true/false if the specified plugin is loaded or not.
`boolean` | `hasTheme(<string> n)` Returns true/false if the specified theme is loaded or not.
`void` | `importCSS(<DOMDocument> doc, <string> css)` Imports a CSS file into a allready loaded document.
`void` | `importPluginLanguagePack(<string> name, <string> valid_languages)` Loads a plugin specific language pack.
`void` | `importThemeLanguagePack(<string> name)` Loads a theme specific language pack.
`void` | `init(settings)` Initializes TinyMCE with the specific configuration settings.
`void` | `insertAfter(<HTMLNode> n, <HTMLNode> r)` Inserts a node after the specific node.
`boolean` | `isBlockElement(<HTMLNode> n)` Returns true/false if the specified node is a block element or not.
`boolean` | `isInstance(<object> o)` Returns true/false if a specific object is a TinyMCE_Control instance or not.
`void` | `loadCSS(<string> url)` Loads the specified CSS by writing the a link tag to the current page.
`void` | `loadPlugin(<string> n, <string> u)` Load plugin from external URL.
`void` | `loadScript(<string> url)` Loads the specified script by writing the a script tag to the current page.
`HTMLElement` | `nextNode(<HTMLNode> e, <string> n)` Finds any element after the current one by name.
`boolean` | `onLoad()` Gets executed when the page loads or get intitialized.
`void` | `onMouseMove()` Mouse move handler function, this will be executed each time the mouse is moved within a editor instance.
`void` | `openWindow(<Array> template, <Array> args)` Opens a popup window based in the specified input data.
`Array` | `parseStyle(<string> str)` Parses the specified HTML style data.
`TinyMCE_URL_Item` | `parseURL(<string> url_str)` Parses a URL in to its diffrent components.
`HTMLElement` | `prevNode(<HTMLNode> e, <string> n)` Finds any previous element by name.
`boolean` | `queryInstanceCommandState(<string> editor_id, <string> command)` Queries a command state for a specific command on a specific editor instance.
`object` | `queryInstanceCommandValue(<string> editor_id, <string> command)` Queries a command value for a specific command on a specific editor instance.
`string` | `regexpReplace(<string> in_str, <string> reg_exp, <string> replace_str, opts)` Regexp replaces the contents of a string.
`string` | `removeCSSClass(<HTMLElement> e, c)` Removes the specified CSS class from the element.
`void` | `removeMCEControl(<string> editor_id)` Removes a TinyMCE editor control instance by id.
`void` | `removeTinyMCEFormElements(<HTMLElement> form_obj)` Removes/disables TinyMCE built in form elements such as select boxes for font sizes etc.
`void` | `renameElement(<HTMLElement> e, <string> n, <DOMDocument> d)` Renames the specified element to the specified name.
`string` | `replaceVar(<string> h, <string> r, <string> v)` Replaces a specific variable in the string with a nother string.
`void` | `resetForm(<int> form_index)` Resets a forms TinyMCE instances based on form index.
`Array` | `selectNodes(<DOMNode> n, <function> f, <Array> a)` Returns a array of nodes when the specified function matches a node.
`string` | `serializeStyle(<Array> ar)` Serializes the specified style item name/value array into a HTML string.
`string` | `serializeURL(<TinyMCE_URL_Item> up)` Serializes the specified URL object into a string.
`void` | `setAttrib(<HTMLElement> element, <string> name, <string> value, <boolean> fix_value)` Sets the attribute value for a specific attribute.
`void` | `setContent(<string> h)` Sets the HTML contents of the selected editor instance.
`void` | `setInnerHTML(<HTMLElement> e, <string> h)` Sets the innerHTML property of a element, this function also fixes a MSIE bug where the first comment is removed.
`void` | `setOuterHTML(<HTMLElement> e, <string> h)` Sets the outer HTML of a element, this uses the outerHTML property in MSIE and Opera and a workaround for Gecko.
`void` | `setPluginBaseURL(<string> n, <string> u)` Sets the baseURL of the specified plugin, this is useful if the plugin is loaded from a external location.
`void` | `setStyleAttrib(<HTMLElement> elm, <string> name, <string> value)` Sets a style attribute item value.
`void` | `setupContent(<string> editor_id)` Setups the contents of TinyMCE editor instance and fills it with contents.
`void` | `setWindowArg(<string> n, <string> v)` Sets the window argument to be passed to TinyMCE popup.
`string` | `storeAwayURLs(<string> s)` Stores away the src and href attribute values in separate mce_src and mce_href attributes.
`void` | `submitPatch()` Piggyback onsubmit event handler function, this will remove/hide the TinyMCE specific form elements call triggerSave to fill the textarea with the correct contents then call the old piggy backed event handler.
`void` | `switchClass(<HTMLElement> ei, <string> c)` Switches the CSS class of the specified element.
`void` | `triggerNodeChange(<boolean> focus, <boolean> setup_content)` Triggers a nodeChange event to every theme and plugin.
`void` | `triggerSave(<boolean> skip_cleanup, <boolean> skip_callback)` Moves the contents from a TinyMCE editor control instance to the hidden textarea that got replaced with TinyMCE.
`string` | `trim(<string> s)` Removes all prefix, suffix whitespace of a string.
`void` | `unloadHandler()` Unload document event handler function.
`void` | `updateContent(<string> form_element_name)` Moves the contents from the hidden textarea to the editor that gets inserted.
`string` | `xmlEncode(<string> s)` Encodes the string to raw XML entities.

Field Detail

### buttonMap

    Object buttonMap

### configs

    Object configs

### currentConfig

    Object currentConfig

### dialogCounter

    Object dialogCounter

### eventHandlers

    Object eventHandlers

### idCounter

    Object idCounter

### instances

    Object instances

### isGecko

    Object isGecko

### isLoaded

    Object isLoaded

### isMac

    Object isMac

### isMSIE

    Object isMSIE

### isMSIE5

    Object isMSIE5

### isMSIE5_0

    Object isMSIE5_0

### isNS7

    Object isNS7

### isNS71

    Object isNS71

### isOpera

    Object isOpera

### isSafari

    Object isSafari

### loadedFiles

    Object loadedFiles

### loadedPlugins

    Object loadedPlugins

### majorVersion

    Object majorVersion

### menus

    Object menus

### minorVersion

    Object minorVersion

### plugins

    Object plugins

### releaseDate

    Object releaseDate

### switchClassCache

    Object switchClassCache

### themes

    Object themes

### windowArgs

    Object windowArgs

Constructor Detail

### TinyMCE_Engine

    TinyMCE_Engine()

Core engine class for TinyMCE, a instance of this class is available as a global called tinyMCE.

Method Detail

### _getElementById

    HTMLElement _getElementById(<string> i<DOMDocument> d, d)

Returns a element by id, this will also search the form names to match the id.

Parameters:

`id` - Id of element.

`d` - Optional document.

Returns:

HTML element that matches the id.

### _removeInternal

    void _removeInternal(<DOMNode> n)

Removes any internal content inserted by regexps.

Parameters:

`n` - Node to remove internal content from.

### accessibleEventHandler

    Object accessibleEventHandler(<DOMEvent> e)

Accessibility handler that gets executed when the user hits a key in a select element. This handler trams the enter/return or space key and then executes the onchange event handler.

Parameters:

`e` - DOM event object instance.

### addButtonMap

    void addButtonMap(<string> m)

Adds a list of buttons available in the tiled button image used by the button_tile_map option.

Parameters:

`m` - Comma separated list of buttons that are available in tiled image.

### addCSSClass

    string addCSSClass(<HTMLElement> e, c, b)

Adds a CSS class to the specified element. It will remove any previous item with the same name so adding a class that already exists will move it to the end.

Parameters:

`e` - HTML element to add CSS class to.

`string` - ] c CSS class to add to HTML element.

`boolean` - ] b Optional parameter, if set to true, class will be added to the beginning.

Returns:

Returns the new class attribute value.

### addEvent

    void addEvent(<HTMLElement> o, <string> n, <function> h)

Adds a event handler function to the specified object.

Parameters:

`o` - Object to add event handler to.

`n` - Event name to listen to for example "click".

`h` - Function handler to execute when event occurs.

### addEventHandlers

    void addEventHandlers(<inst> inst)

Adds the handleEvent function to the specified editor instance.

Parameters:

`inst` - Editor control instance to add event handler to.

### addMCEControl

    void addMCEControl(<HTMLElement> replace_element, <string> form_element_name, <DOMDocument> target_document)

Adds a TinyMCE editor control instance to a specific form element.

Parameters:

`replace_element` - HTML element object to replace.

`form_element_name` - HTML form element name,

`target_document` - Target document that holds the element.

### addMenu

    void addMenu(<string> n, <TinyMCE_Menu> m)

Adds a floating menu instance to TinyMCE.

Parameters:

`n` - TinyMCE menu id.

`m` - TinyMCE menu instance.

### addPlugin

    void addPlugin(n, <TinyMCE_Plugin> p)

Adds the specified plugin to the list of loaded plugins, this will also setup the baseURL property of the plugin.

Parameters:

`p` - Plugin instance to add.

`Plugin` - name/id.

### addSelectAccessibility

    Object addSelectAccessibility(<DOMEvent> e, <HTMLElement> s, <DOMWindow> w)

Adds accessibility keydown handler to the specified select element.

Parameters:

`e` - Event that gets passed when the element is focused.

`s` - Select element that the keydown handler gets added to.

`w` - DOM window reference to add.

### addTheme

    void addTheme(&l<TinyMCE_Theme> t;string> n, t)

Adds the specified theme in to the list of loaded themes.

Parameters:

`n` - Theme name/id to add the object reference to.

`t` - Theme instance to add to the loaded list.

### addToLang

    void addToLang(<string> prefix, <Array> ar)

Adds language items to the global language array.

Parameters:

`prefix` - Prefix string to add infront of every array item before adding it.

`ar` - Language item array to add to global language array.

### applyTemplate

    string applyTemplate(<string> h, <Array> as)

Replaces language, args and settings variables in a HTML string.

Parameters:

`h` - HTML string to replace language variables in.

`as` - Optional arguments array to take variables from.

Returns:

HTML string with replaced varliables.

### callFunc

    boolean callFunc(<<<Array> a href="TinyMCE_Control.html">TinyMCE_Control> ins, <string> p, <string> n, <int> m, a)

Executes callback chain. Callback TinyMCE_Engine.prototype.order = Option; Plugins, Themes.

Parameters:

`ins` - TinyMCE editor control instance to execute callback on.

`p` - TinyMCE callback parameter name.

`n` - Function name to execute.

`m` - Execution mode value, 0 = no chain, 1 = event chain, 2 = execcommand chain.

`a` - Array with function arguments.

Returns:

true - if the callback was executed, false if it wasn't.

### cancelEvent

    void cancelEvent(<DOMEvent> e)

Cancels the specified event, this will disable the event from be passed to other listeners in event chain.

Parameters:

`e` - Event to cancel.

### cleanupAnchors

    void cleanupAnchors(<DOMDocument> doc)

Moves the contents of a anchor outside and after the anchor. Only if the anchor doesn't have a href.

Parameters:

`doc` - DOM document instance to fix anchors in.

### cleanupEventStr

    string cleanupEventStr(<string> s)

Removes MSIE 5.5 specific event wrapper function form a event string. This will also remove the event blocker if it's added in front of the event.

Parameters:

`s` - String to replace event data in.

Returns:

Replaced string value.

### cleanupHTMLCode

    string cleanupHTMLCode(<string> s)

Makes some preprocessing cleanup routines on the specified HTML string. This includes forcing some tags to be open so MSIE doesn't fail. Forcing other to close and padding paragraphs with non breaking spaces. This function is used when the editor gets initialized with content.

Parameters:

`s` - HTML string to cleanup.

Returns:

Cleaned HTML string.

### clearArray

    Array clearArray(a)

Returns a cleared array, since some external libraries tend to extend the Array core object arrays needs to be cleaned from these extended functions. So this function simply sets any named properties back to null.

Parameters:

`Name` - /Value array to clear.

Returns:

Cleared name/value array.

### closeWindow

    void closeWindow(<DOMWindow> win)

Closes the specified window. This function is deprecated and should be replaced with tinyMCEPopup.close();.

Parameters:

`win` - Window reference to close.

Deprecated

### compressStyle

    void compressStyle(<Array> ar, <string> pr, <string> sf, <string> res)

Compresses larger styles into a smaller. Since MSIE automaticly converts border: 1px solid red to border-left: 1px solid red, border-righ: 1px solid red and so forth.' This will bundle them together again if the information is the same in each item.

Parameters:

`ar` - Style name/value array with items.

`pr` - Style item prefix to bundle for example border.

`sf` - Style item suffix to bunlde for example -width or -width.

`res` - Result name, for example border-width.

### confirmAdd

    void confirmAdd(<DOMEvent> e, <Array> settings)

Displays a confirm dialog when a user clicks/focus a textarea that is to be converted into a TinyMCE instance.

Parameters:

`e` - DOM event instance.

`settings` - Name/Value array of initialization settings.

### convertAbsoluteURLToRelativeURL

    string convertAbsoluteURLToRelativeURL(<string> base_url, <string> url_to_relative)

Converts an absolute path to relative path.

Parameters:

`base_url` - URL to make as a base path, URLs will be converted relative from this point.

`url_to_relative` - URL to convert into a relative URL.

Returns:

Relative URL based in input.

### convertAllRelativeURLs

    void convertAllRelativeURLs(<HTMLElement> body)

Converts all img and a element URLs to absolute URLs. This will use the mce_src or mce_href attribute values if they are provided. This function is used when the editor is initialized.

Parameters:

`body` - HTML element to convert all URLs in.

### convertFontsToSpans

    void convertFontsToSpans(<DOMDocument> doc)

Convers fonts to spans in the specified document. Todo: Move this function into a XHTML plugin or simmilar.

Parameters:

`doc` - Document instance to convert fonts in.

### convertHexToRGB

    string convertHexToRGB(<string> s)

Returns a rgb(n,n,n) string from a hexadecimal value.

Parameters:

`s` - Hexadecimal string to parse.

Returns:

rgb(n,n,n) string from a hexadecimal value.

### convertRelativeToAbsoluteURL

    string convertRelativeToAbsoluteURL(<string> base_url, <string> relative_url)

Converts an relative path to absolute path.

Parameters:

`base_url` - URL to make as a base path, URLs will be converted absolute from this point.

`relative_url` - URL to convert into a absolute URL.

Returns:

Absolute URL based in input.

### convertRGBToHex

    string convertRGBToHex(<string> s, <boolean> k)

Returns a hexadecimal version of the specified rgb(1,2,3) string.

Parameters:

`s` - RGB string to parse, if this doesn't isn't a rgb(n,n,n) it will passthrough the string.

`k` - Keep before/after contents. If enabled contents before after the rgb(n,n,n) will be intact.

Returns:

Hexadecimal version of the specified rgb(1,2,3) string.

### convertSpansToFonts

    void convertSpansToFonts(<DOMDocument> doc)

Converts span elements to font elements in the specified document instance. Todo: Move this function into a XHTML plugin or simmilar.

Parameters:

`doc` - Document instance to convert spans in.

### convertURL

    string convertURL(<string> url, <HTMLElement> node, <boolean> on_save)

Converts the specified URL based in TinyMCE configuration settings.

Parameters:

`url` - URL to convert based on config.

`node` - HTML element that holds the URL.

`on_save` - Is this convertion the final output URL.

Returns:

Converted URL string.

### debug

    void debug()

Debugs the specified message to a screen.

Parameters:

`Numerous` - arguments that will be outputed.

### dispatchCallback

    Object dispatchCallback(<TinyMCE_Control> i, <string> p, <string> n)

Dispatches the specified callback on all options, plugins and themes. This will not chain them, so all functions callbacks will be executed regardless if the return true/false.

Parameters:

`i` - TinyMCE editor control instance to execute callback on.

`p` - TinyMCE callback parameter to execute.

`n` - Function name to execute.

Returns:

true/false if they where dispatched.

### entityDecode

    string entityDecode(<string> s)

HTML entity decode a string, replaces < with <.

Parameters:

`s` - Entity string to decode into normal string.

Returns:

Entity decoded string.

### evalFunc

    object evalFunc(<string> f, <int> idx, <Array> a)

Evaluates the specified function and uses the array of arguments.

Parameters:

`f` - Function reference to execute.

`idx` - Index in array to start grabbing arguments from.

`a` - Array of function arguments.

Returns:

Value returned from the evaluated function.

### execCommand

    void execCommand(<string> command, <boolean> user_interface, <object> value)

Executes a command on the selected or last selected TinyMCE editor control instance. This function also handles some non instance specific commands like mceAddControl, mceRemoveControl, mceHelp or mceFocus.

Parameters:

`command` - Command name to execute, for example mceLink or Bold.

`user_interface` - True/false state if a UI (dialog) should be presented or not.

`value` - Optional command value, this can be anything.

### execCommandCallback

    Object execCommandCallback(<TinyMCE_Control> i, <string> p, <string> n)

Executes the specified execcommand callback on all options, plugins and themes. This will chain them, so callback chain will be broken if one function returns true.

Parameters:

`i` - TinyMCE editor control instance to execute callback on.

`p` - TinyMCE callback parameter to execute.

`n` - Function name to execute.

Returns:

true/false if a callback was executed.

### execInstanceCommand

    void execInstanceCommand(<string> editor_id, <string> command, <boolean> user_interface, <object> value, <boolean> focus)

Executes a command on a specific editor instance by id.

Parameters:

`editor_id` - TinyMCE editor control instance id to perform comman on.

`command` - Command name to execute, for example mceLink or Bold.

`user_interface` - True/false state if a UI (dialog) should be presented or not.

`value` - Optional command value, this can be anything.

`focus` - True/false if the editor instance should be focused first.

### executeCallback

    Object executeCallback(<TinyMCE_Control> i, <string> p, <string> n)

Executes the specified callback on all options, plugins and themes. This will chain them, so callback chain will be broken if one function returns false.

Parameters:

`i` - TinyMCE editor control instance to execute callback on.

`p` - TinyMCE callback parameter to execute.

`n` - Function name to execute.

Returns:

true/false if a callback was executed.

### explode

    Array explode(<string> d, <string> s)

Splits a string by the specified delimiter and skips any empty items.

Parameters:

`d` - Delimiter to split by.

`s` - String to split.

Returns:

Array with chunks from string.

### extend

    Object extend(<Object> p, <Object> np)

Extends the specified prototype with new methods.

Parameters:

`p` - Prototype to extend with new methods.

`np` - New prototype to extend the other one with.

Returns:

Extended prototype array.

### fixGeckoBaseHREFBug

    string fixGeckoBaseHREFBug(<boolean> m, <HTMLElement> e, <string> h)

Fixes a Gecko specific bug where href, src attribute values gets converted incorrectly when inserted into editor. This function will replace all src, href with mce_tsrc and mce_thref to keep the values from chaging when they get inserted.

Parameters:

`m` - Mode state, true is to replace the src, href attributes to mce_tsrc and mce_thref.

`e` - HTML element to replace them in. (Will be used if m is 0)

`h` - HTML code to replace them in. (Will be used if m is 1)

Returns:

Converted string or the specified HTML value depending on mode.

### getAbsPosition

    TinyMCE_ElementPosition getAbsPosition(<HTMLNode> n)

Returns the absolute x, y position of a node. The position will be returned in a object with two properties absLeft and absTop.

Parameters:

`n` - HTML element to get x, y position from.

Returns:

Absolute position of the specified element.

### getAttrib

    string getAttrib(<HTMLElement> elm, <string> name, <string> default_value)

Returns the attribute value of a element or the default value if it wasn't found.

Parameters:

`elm` - HTML element to get attribute from.

`name` - Attribute name to retrive.

`default_value` - Optional default value to return, this value defaults to a empty string.

Returns:

Attribute value or default value if it wasn't found in element.

### getButtonHTML

    string getButtonHTML(<string> id, <string> lang, <string> img, <string> cmd, <string> ui, <string> val)

Returns the HTML code for a normal button control.

Parameters:

`id` - Button control id, this will be the suffix for the element id, the prefix is the editor id.

`lang` - Language variable key name to insert as the title/alt of the button image.

`img` - Image URL to insert, {$themeurl} and {$pluginurl} will be replaced.

`cmd` - Command to execute when the user clicks the button.

`ui` - Optional user interface boolean for command.

`val` - Optional value for command.

Returns:

HTML code for a normal button based in input information.

### getContent

    string getContent(<string> editor_id)

Returns the HTML contents of the specified editor instance id.

Parameters:

`editor_id` - Editor instance id to retrive HTML code from.

Returns:

HTML contents of editor id or null if it wasn't found.

### getControlHTML

    string getControlHTML(<string> c)

Returns the HTML for the specified control this will loop through the theme and all plugins inorder to find the control. The callback for each theme and plugin is called getControlHTML.

Parameters:

`c` - Control name/id to get HTML code for.

Returns:

HTML code for the specified control or empty string if it wasn't found.

### getCSSClasses

    Array getCSSClasses(<string> editor_id, <DOMDocument> doc)

Returns a array of CSS classes that is available in a document. TinyMCE_Engine.prototype.Todo = Fix;this one, it's so ugly. :)

Parameters:

`editor_id` - Editor id to get CSS classes from.

`doc` - DOM document to get the CSS classes from.

Returns:

Array of CSS classes that is available in a document.

### getEditorId

    string getEditorId(<string> form_element)

Returns the editor instance id of a specific form element.

Parameters:

`form_element` - Form element name to get instance id for.

Returns:

TinyMCE editor instance id or null if it wasn't found.

### getElementByAttributeValue

    HTMLElement getElementByAttributeValue(<HTMLElement> n, <string> e, <string> a, <string> v)

Returns a element by a specific attribute and it's value.

Parameters:

`n` - Element to search in.

`e` - Element name to search for.

`a` - Attribute name to search for.

`v` - Attribute value to search for.

Returns:

HTML element that matched the criterias or null on failure.

### getElementsByAttributeValue

    Array getElementsByAttributeValue(<HTMLElement> n, <string> e, <string> a, <string> v)

Returns a element array by a specific attribute and it's value.

Parameters:

`n` - Element to search in.

`e` - Element name to search for.

`a` - Attribute name to search for.

`v` - Attribute value to search for.

Returns:

HTML element array that matched the criterias or null on failure.

### getInstanceById

    TinyMCE_Control getInstanceById(<string> editor_id)

Returns a TinyMCE editor instance by the specified editor id or null if it wasn't found.

Parameters:

`editor_id` - Editor id to get instance for.

Returns:

TinyMCE editor control instance or null if it wasn't found.

### getLang

    object getLang(<string> name, <string> default_value, <boolean> parse_entities, <Array> va)

Returns a language variable value from the language packs.

Parameters:

`name` - Name of the key to retrive.

`default_value` - Optional default value to return if it wasn't found.

`parse_entities` - Is HTML entities to be resolved or not.

`va` - Optional name/value array of variables to replace in language string.

Returns:

Language string value could be a number if it's a relative dimenstion.

### getNodeTree

    Array getNodeTree(&l<int> t;HTMLNode> n, <Array> na, t, <string> nn)

Returns a array of nodes selected retrived from the child nodes of the specified node.

Parameters:

`n` - Node to get children from.

`na` - Array to fill with children.

`t` - Node type to get.

`nn` - Node name of items to retrive.

Returns:

Node array.

### getOuterHTML

    string getOuterHTML(<HTMLElement> e)

Returns the outer HTML of a element, this uses the outerHTML property in MSIE and Opera and a workaround for Gecko.

Parameters:

`e` - HTML element to get outerHTML from.

Returns:

HTML content string.

### getParam

    object getParam(<string> name, <string> default_value, <boolean> strip_whitespace, <string> split_chr)

Returns a specific configuration setting or the default value if it wasn't found.

Parameters:

`name` - Configuration setting to get.

`default_value` - Default value to return if it wasn't found.

`strip_whitespace` - Optional remove all whitespace.

`split_chr` - Split char/regex/string.

Returns:

Number, string or other object based in parameter and default_value.

### getParentBlockElement

    HTMLElement getParentBlockElement(<HTMLNode> n)

Returns the first block element parent of the specified node.

Parameters:

`n` - Node get parent block element for.

Returns:

First block element parent of the specified node or null if it wasn't found.

### getParentElement

    HTMLElement getParentElement(<HTMLNode> node, <string> names, <string> attrib_name, <string> attrib_value)

Returns the parent element of the specified node based on the search criteria.

Parameters:

`node` - Node to get parent element of.

`names` - Comma separated list of element names to get.

`attrib_name` - Optional attribute name to match.

`attrib_value` - Optional attribute value to match.

Returns:

HTMLElement or null based on search criteras.

### getParentNode

    DOMNode getParentNode(<DOMNode> n, <function> f)

Returns a node by the specified selector function. This function will loop through all parent nodes and call the specified function for each node. If the function then returns true it will stop the execution and return that node.

Parameters:

`n` - HTML node to search parents on.

`f` - Selection function to execute on each node.

Returns:

DOMNode or null if it wasn't found.

### getVisualAidClass

    string getVisualAidClass(<string> class_name, <boolean> state)

Returns the visual aid class string, this will add/remove the visual aid class.

Parameters:

`class_name` - Class name value to add/remove visual aid classes from.

`state` - true/false if the classes should be added or removed.

Returns:

New class value containing the visual aid classes or not.

### getWindowArg

    Object getWindowArg(<string> n, d)

Returns the window argument to be passed to TinyMCE popup. TinyMCE_Engine.prototype.Use = tinyMCEPopup;.getWindowArg instead.

Parameters:

`n` - Window argument name.

Returns:

Argument value or default value if it wasn't found.

Deprecated

### handleEvent

    boolean handleEvent(<DOMEvent> e)

Event handler function that gets executed each time a event occurs in a TinyMCE editor control instance. TinyMCE_Engine.prototype.Todo = Fix;the return statements so they return true or false.

Parameters:

`e` - DOM event object reference.

Returns:

true - if the event is to be chained, false - if the event chain is to be canceled.

### handleVisualAid

    void handleVisualAid(<HTMLElement> el, <boolean> deep, <boolean> state, <TinyMCE_Control> inst, skip_dispatch)

Adds visual aid classes to all elements that need them recursive in the DOM tree.

Parameters:

`el` - HTML element to add visual aid classes to.

`deep` - Should they be added to all children aswell.

`state` - Should they be added or removed.

`inst` - TinyMCE editor control instance to add/remove them to/from.

### hasMenu

    boolean hasMenu(<string> n)

Checks if the specified menu by name is added to TinyMCE.

Parameters:

`n` - TinyMCE menu id.

Returns:

true/false if it exists or not.

### hasPlugin

    boolean hasPlugin(<string> n)

Returns true/false if the specified plugin is loaded or not.

Parameters:

`n` - Plugin name to look for.

Returns:

true/false if the specified plugin is loaded or not.

### hasTheme

    boolean hasTheme(<string> n)

Returns true/false if the specified theme is loaded or not.

Parameters:

`n` - Theme name/id to check for.

Returns:

true/false if the specified theme is loaded or not.

### importCSS

    void importCSS(<DOMDocument> doc, <string> css)

Imports a CSS file into a allready loaded document. This will add a link element to the head element of the document.

Parameters:

`doc` - DOM Document to load CSS into.

`css` - CSS File URL to load or comma separated list of files.

### importPluginLanguagePack

    void importPluginLanguagePack(<string> name, <string> valid_languages)

Loads a plugin specific language pack.

Parameters:

`name` - Plugin name/id to load language pack for.

`valid_languages` - Comma separated list of valid languages for the plugin.

### importThemeLanguagePack

    void importThemeLanguagePack(<string> name)

Loads a theme specific language pack.

Parameters:

`name` - Optional name of the theme to load language pack from.

### init

    void init(settings)

Initializes TinyMCE with the specific configuration settings. This method may be called multiple times when multiple instances with diffrent settings is to be created.

Parameters:

`Name` - /Value array of initialization settings.

### insertAfter

    void insertAfter(<HTMLNode> n, <HTMLNode> r)

Inserts a node after the specific node.

Parameters:

`n` - New node to insert.

`r` - Reference node to insert after.

### isBlockElement

    boolean isBlockElement(<HTMLNode> n)

Returns true/false if the specified node is a block element or not.

Parameters:

`n` - Node to verify.

Returns:

true/false if the specified node is a block element or not.

### isInstance

    boolean isInstance(<object> o)

Returns true/false if a specific object is a TinyMCE_Control instance or not.

Parameters:

`o` - Object to check.

Returns:

true/false if it's a control or not.

### loadCSS

    void loadCSS(<string> url)

Loads the specified CSS by writing the a link tag to the current page. This will also check if the file has been loaded before. This function should only be used when the page is loading.

Parameters:

`url` - CSS file URL to load or comma separated list of files.

### loadPlugin

    void loadPlugin(<string> n, <string> u)

Load plugin from external URL.

Parameters:

`n` - Plugin name for example \"emotions\".

`u` - URL of plugin directory to load.

### loadScript

    void loadScript(<string> url)

Loads the specified script by writing the a script tag to the current page. This will also check if the file has been loaded before. This function should only be used when the page is loading.

Parameters:

`url` - Script URL to load.

### nextNode

    HTMLElement nextNode(<HTMLNode> e, <string> n)

Finds any element after the current one by name. This will loop through the siblings inorder to find the specified element by name. If the element wasn't found it will return a null value.

Parameters:

`e` - HTML node to search from.

`n` - Comma separated list of element names to search for.

Returns:

HTML Element or null if it wasn't found.

### onLoad

    boolean onLoad()

Gets executed when the page loads or get intitialized. This function will then convert all textareas/divs that is to be converted into TinyMCE editor controls.

Returns:

true - if the event is to be chained, false - if the event chain is to be canceled.

### onMouseMove

    void onMouseMove()

Mouse move handler function, this will be executed each time the mouse is moved within a editor instance. This function stores away the current selection in MSIE this will then be used when a undo/redo level is added.

### openWindow

    void openWindow(<Array> template, <Array> args)

Opens a popup window based in the specified input data. This function is used for all popup windows in TinyMCE. These are the current template TinyMCE_Engine.prototype.keys = file; width, height, close_previous.

Parameters:

`template` - Popup template data such as with, height etc.

`args` - Popup arguments that is to be passed to the popup such as custom data.

### parseStyle

    Array parseStyle(<string> str)

Parses the specified HTML style data. This will parse for example "border-left: 1px; background-color: red" into an key/value array.

Parameters:

`str` - Style data to parse.

Returns:

Name/Value array of style items.

### parseURL

    TinyMCE_URL_Item parseURL(<string> url_str)

Parses a URL in to its diffrent components.

Parameters:

`url_str` - URL string to parse into a URL object.

Returns:

URL object based on input string.

### prevNode

    HTMLElement prevNode(<HTMLNode> e, <string> n)

Finds any previous element by name. This will loop through the siblings inorder to find the specified element by name. If the element wasn't found it will return a null value.

Parameters:

`e` - HTML node to search from.

`n` - Comma separated list of element names to search for.

Returns:

HTML Element or null if it wasn't found.

### queryInstanceCommandState

    boolean queryInstanceCommandState(<string> editor_id, <string> command)

Queries a command state for a specific command on a specific editor instance.

Parameters:

`editor_id` - Editor id to query command state on.

`command` - Command to query for.

Returns:

Command state passed from browser.

### queryInstanceCommandValue

    object queryInstanceCommandValue(<string> editor_id, <string> command)

Queries a command value for a specific command on a specific editor instance.

Parameters:

`editor_id` - Editor id to query command value on.

`command` - Command to query for.

Returns:

Command value passed from browser.

### regexpReplace

    string regexpReplace(<string> in_str, <string> reg_exp, <string> replace_str, opts)

Regexp replaces the contents of a string. Use normal replace instead.

Parameters:

`in_str` - String to replace in.

`in_str` - Optional regexp options like "gi".

`reg_exp` - Regexp to replace.

`replace_str` - String to replace with.

Returns:

Replaced string value.

Deprecated

### removeCSSClass

    string removeCSSClass(<HTMLElement> e, c)

Removes the specified CSS class from the element.

Parameters:

`e` - HTML element to remove CSS class to.

`string` - ] c CSS class to remove to HTML element.

Returns:

Returns the new class attribute value.

### removeMCEControl

    void removeMCEControl(<string> editor_id)

Removes a TinyMCE editor control instance by id.

Parameters:

`editor_id` - Id of editor instance to remove.

### removeTinyMCEFormElements

    void removeTinyMCEFormElements(<HTMLElement> form_obj)

Removes/disables TinyMCE built in form elements such as select boxes for font sizes etc. These are disabled when the user submits a form so they don't get picked up by the backend script that intercepts the contents.

Parameters:

`form_obj` - Form object to loop through for TinyMCE specific form elements.

### renameElement

    void renameElement(<HTMLElement> e, <string> n, <DOMDocument> d)

Renames the specified element to the specified name.

Parameters:

`e` - Element to rename.

`n` - New name of the element.

`d` - Optional document reference.

### replaceVar

    string replaceVar(<string> h, <string> r, <string> v)

Replaces a specific variable in the string with a nother string.

Parameters:

`h` - String to search in for the variable.

`r` - Variable name to search for.

`v` - Value to insert where a variable is found.

Returns:

String with replaced variable.

### resetForm

    void resetForm(<int> form_index)

Resets a forms TinyMCE instances based on form index.

Parameters:

`form_index` - Form index to reset.

### selectNodes

    Array selectNodes(<DOMNode> n, <function> f, <Array> a)

Returns a array of nodes when the specified function matches a node.

Parameters:

`n` - Node to select children from.

`f` - Function that returns true/false if the node is to be added or not.

`a` - Optional array to fill with nodes.

Returns:

Array with selected nodes.

### serializeStyle

    string serializeStyle(<Array> ar)

Serializes the specified style item name/value array into a HTML string. This function will force HEX colors in Firefox and convert the URL items of a style correctly.

Parameters:

`ar` - Name/Value array of items to serialize.

Returns:

Serialized HTML string containing the items.

### serializeURL

    string serializeURL(<TinyMCE_URL_Item> up)

Serializes the specified URL object into a string.

Parameters:

`up` - URL object to serialize.

Returns:

Serialized URL object.

### setAttrib

    void setAttrib(<HTMLElement> element, <string> name, <string> value, <boolean> fix_value)

Sets the attribute value for a specific attribute.

Parameters:

`element` - HTML element to set attribute on.

`name` - Attribute name to set.

`value` - Attribute value to set.

`fix_value` - Optional fix value state, if true only number data will be accepted.

### setContent

    void setContent(<string> h)

Sets the HTML contents of the selected editor instance.

Parameters:

`h` - HTML contents to set in the selected instance.

Deprecated

### setInnerHTML

    void setInnerHTML(<HTMLElement> e, <string> h)

Sets the innerHTML property of a element, this function also fixes a MSIE bug where the first comment is removed.

Parameters:

`e` - Element to insert HTML in.

`h` - HTML code to insert into innerHTML.

### setOuterHTML

    void setOuterHTML(<HTMLElement> e, <string> h)

Sets the outer HTML of a element, this uses the outerHTML property in MSIE and Opera and a workaround for Gecko.

Parameters:

`e` - HTML element to set outerHTML on.

`h` - HTML string to set in property.

### setPluginBaseURL

    void setPluginBaseURL(<string> n, <string> u)

Sets the baseURL of the specified plugin, this is useful if the plugin is loaded from a external location.

Parameters:

`n` - Plugin name/id to set base URL on. This have to be added before.

`u` - Base URL of plugin, this string should be the URL prefix for the plugin without a trailing slash.

### setStyleAttrib

    void setStyleAttrib(<HTMLElement> elm, <string> name, <string> value)

Sets a style attribute item value.

Parameters:

`elm` - HTML element to set style attribute item on.

`name` - Style item name to set.

`value` - Style item value to set.

### setupContent

    void setupContent(<string> editor_id)

Setups the contents of TinyMCE editor instance and fills it with contents.

Parameters:

`editor_id` - TinyMCE editor instance control id to fill.

### setWindowArg

    void setWindowArg(<string> n, <string> v)

Sets the window argument to be passed to TinyMCE popup.

Parameters:

`n` - Window argument name.

`v` - Window argument value.

### storeAwayURLs

    string storeAwayURLs(<string> s)

Stores away the src and href attribute values in separate mce_src and mce_href attributes. This is needed since both MSIE and Gecko messes with these attributes. The old src and href will be intact, this simply adds them to a separate attribute.

Parameters:

`s` - HTML string to replace src and href attributes in.

Returns:

HTML string with replaced src and href attributes.

### submitPatch

    void submitPatch()

Piggyback onsubmit event handler function, this will remove/hide the TinyMCE specific form elements call triggerSave to fill the textarea with the correct contents then call the old piggy backed event handler.

### switchClass

    void switchClass(<HTMLElement> ei, <string> c)

Switches the CSS class of the specified element. This method also caches the elements in a lookup table for performance. This should only be used for TinyMCE main UI controls like buttons or select elements.

Parameters:

`ei` - Element to set CSS class on.

`c` - CSS class to set.

### triggerNodeChange

    void triggerNodeChange(<boolean> focus, <boolean> setup_content)

Triggers a nodeChange event to every theme and plugin. This will be executed when the cursor moves or when a command that modifies the editor contents is executed.

Parameters:

`focus` - Optional state if the last selected editor instance is to be focused or not.

`setup_content` - Optional state if it's called from setup content function or not.

### triggerSave

    void triggerSave(<boolean> skip_cleanup, <boolean> skip_callback)

Moves the contents from a TinyMCE editor control instance to the hidden textarea that got replaced with TinyMCE. This is executed automaticly on for example form submit.

Parameters:

`skip_cleanup` - Optional Skip cleanup, simply move the contents as fast as possible.

`skip_callback` - Optional Skip callback, don't call the save_callback function.

### trim

    string trim(<string> s)

Removes all prefix, suffix whitespace of a string.

Parameters:

`s` - String to replace whitespace in.

Returns:

Replaced string value.

### unloadHandler

    void unloadHandler()

Unload document event handler function. This function will be executed when the page is unloaded, this will automaticly move the current editor contents to the textarea element this enables the editor to restore it's state when the user presses the back button in the browser. This will execute the triggerSave function.

### updateContent

    void updateContent(<string> form_element_name)

Moves the contents from the hidden textarea to the editor that gets inserted.

Parameters:

`form_element_name` - Form element name to move contents from.

Deprecated

### xmlEncode

    string xmlEncode(<string> s)

Encodes the string to raw XML entities. This will only convert the most common ones. For real entity encoding use the xmlEncode method of the Cleanup class.

Parameters:

`s` - String to encode.

Returns:

XML Encoded string.

Documentation generated by JSDoc on Fri Apr 14 21:59:23 2006