tinymce

Class tinymce
Type Singleton
Core namespace with core functionality for the TinyMCE API all sub classes will be added to this namespace/object.

Example

// Using each method
tinymce.each([1, 2, 3], function(v, i) {
  console.log(i + '=' + v);
});

// Checking for a specific browser
if (tinymce.isIE)
  console.log("IE");

Public Properties

Property Defined By
isAir : Boolean
[static] Constant that is true if the runtime is Adobe Air.
tinymce
isGecko : Boolean
[static] Constant that is true if the browser is Gecko.
tinymce
isIE : Boolean
[static] Constant that is true if the browser is IE.
tinymce
isIE6 : Boolean
[static] Constant that is true if the browser is IE 6 or older.
tinymce
isMac : Boolean
[static] Constant that is true if the os is Mac OS.
tinymce
isOpera : Boolean
[static] Constant that is true if the browser is Opera.
tinymce
isWebKit : Boolean
[static] Constant that is true if the browser is WebKit (Safari/Chrome).
tinymce

Public Methods

Method Defined By
addUnload(f:function, s:Object):function
[static] Adds an unload handler to the document.
tinymce
create(s:String, o:Object):void
[static] Creates a class, subclass or static singleton.
tinymce
createNS(n:String, o:Object):Object
[static] Creates a namespace on a specific object.
tinymce
each(o:Object, cb:function, s:Object):void
[static] Performs an iteration of all items in a collection such as an object or array.
tinymce
explode(s:string, d:string):void
[static] Splits a string but removes the whitespace before and after each value.
tinymce
extend(o:Object, e..n:Object):Object
[static] Extends an object with the specified other object(s).
tinymce
grep(a:Array, f:function):Array
[static] Filters out items from the input array by calling the specified function for each item.
tinymce
inArray(a:Array, v:Object):Number/String
[static] Returns the index of a value in an array, this method will return -1 if the item wasn't found.
tinymce
is(o:Object, t:string):Boolean
[static] Checks if a object is of a specific type for example an array.
tinymce
map(a:Array, f:function):Array
[static] Creates a new array by the return value of each iteration function call.
tinymce
removeUnload(f:function):function
[static] Removes the specified function form the unload handler list.
tinymce
resolve(n:String, o:Object):Object
[static] Resolves a string and returns the object from a specific structure.
tinymce
trim(s:String):String
[static] Removes whitespace from the beginning and end of a string.
tinymce
walk(o:Object, f:function, n:String, s:String):void
[static] Executed the specified function for each item in a object tree.
tinymce

Property details

isAirproperty

public static isAir : Boolean
Constant that is true if the runtime is Adobe Air.

isGeckoproperty

public static isGecko : Boolean
Constant that is true if the browser is Gecko.

isIEproperty

public static isIE : Boolean
Constant that is true if the browser is IE.

isIE6property

public static isIE6 : Boolean
Constant that is true if the browser is IE 6 or older.

isMacproperty

public static isMac : Boolean
Constant that is true if the os is Mac OS.

isOperaproperty

public static isOpera : Boolean
Constant that is true if the browser is Opera.

isWebKitproperty

public static isWebKit : Boolean
Constant that is true if the browser is WebKit (Safari/Chrome).

Method details

addUnloadmethod

public static function addUnload(f:function, s:Object):function
Adds an unload handler to the document. This handler will be executed when the document gets unloaded. This method is useful for dealing with browser memory leaks where it might be vital to remove DOM references etc.

Parameters

f:function Function to execute before the document gets unloaded.
s:Object Optional scope to execute the function in.

Returns

function - Returns the specified unload handler function.

createmethod

public static function create(s:String, o:Object):void
Creates a class, subclass or static singleton. More details on this method can be found in the Wiki.

Parameters

s:String Class name, inheritage and prefix.
o:Object Collection of methods to add to the class.

createNSmethod

public static function createNS(n:String, o:Object):Object
Creates a namespace on a specific object.

Parameters

n:String Namespace to create for example a.b.c.d.
o:Object Optional object to add namespace to, defaults to window.

Returns

Object - New namespace object the last item in path.

eachmethod

public static function each(o:Object, cb:function, s:Object):void
Performs an iteration of all items in a collection such as an object or array. This method will execure the callback function for each item in the collection, if the callback returns false the iteration will terminate. The callback has the following format: cb(value, key_or_index).

Parameters

o:Object Collection to iterate.
cb:function Callback function to execute for each item.
s:Object Optional scope to execute the callback in.

Example

tinymce.each([1, 2, 3], function(v, i) {
  console.log(i + '=' + v);
});

explodemethod

public static function explode(s:string, d:string):void
Splits a string but removes the whitespace before and after each value.

Parameters

s:string String to split.
d:string Delimiter to split by.

extendmethod

public static function extend(o:Object, e..n:Object):Object
Extends an object with the specified other object(s).

Parameters

o:Object Object to extend with new items.
e..n:Object Object(s) to extend the specified object with.

Returns

Object - o New extended object, same reference as the input object.

grepmethod

public static function grep(a:Array, f:function):Array
Filters out items from the input array by calling the specified function for each item. If the function returns false the item will be excluded if it returns true it will be included.

Parameters

a:Array Array of items to loop though.
f:function Function to call for each item. Include/exclude depends on it's return value.

Returns

Array - New array with values imported and filtered based in input.

inArraymethod

public static function inArray(a:Array, v:Object):Number/String
Returns the index of a value in an array, this method will return -1 if the item wasn't found.

Parameters

a:Array Array/Object to search for value in.
v:Object Value to check for inside the array.

Returns

Number/String - Index of item inside the array inside an object. Or -1 if it wasn't found.

ismethod

public static function is(o:Object, t:string):Boolean
Checks if a object is of a specific type for example an array.

Parameters

o:Object Object to check type of.
t:string Optional type to check for.

Returns

Boolean - true/false if the object is of the specified type.

mapmethod

public static function map(a:Array, f:function):Array
Creates a new array by the return value of each iteration function call. This enables you to convert one array list into another.

Parameters

a:Array Array of items to iterate.
f:function Function to call for each item. It's return value will be the new value.

Returns

Array - Array with new values based on function return values.

removeUnloadmethod

public static function removeUnload(f:function):function
Removes the specified function form the unload handler list.

Parameters

f:function Function to remove from unload handler list.

Returns

function - Removed function name or null if it wasn't found.

resolvemethod

public static function resolve(n:String, o:Object):Object
Resolves a string and returns the object from a specific structure.

Parameters

n:String Path to resolve for example a.b.c.d.
o:Object Optional object to search though, defaults to window.

Returns

Object - Last object in path or null if it couldn't be resolved.

trimmethod

public static function trim(s:String):String
Removes whitespace from the beginning and end of a string.

Parameters

s:String String to remove whitespace from.

Returns

String - New string with removed whitespace.

walkmethod

public static function walk(o:Object, f:function, n:String, s:String):void
Executed the specified function for each item in a object tree.

Parameters

o:Object Object tree to walk though.
f:function Function to call for each item.
n:String Optional name of collection inside the objects to walk for example childNodes.
s:String Optional scope to execute the function in.