Class: tinymce.EditorManager

# tinymce.EditorManager

Namespace | tinymce
Class | EditorManager
Type | Singleton

This class is used to create multiple editor instances and contain them in a collection. So it's both a factory and a manager for editor instances.

## Public Properties

Property | Defined By
--- | ---
activeEditor : Editor [static] Currently active editor instance. | EditorManager
editors : Object [static] Collection of editor instances. | EditorManager

## Public Methods

Method | Defined By
--- | ---
add(e:Editor):Editor [static] Adds an editor instance to the editor collection. | EditorManager
addI18n(p:String, o:Object):void [static] Adds a language pack, this gets called by the loaded language files like en. | EditorManager
execCommand(c:String, u:Boolean, v:String):Boolean [static] Executes a specific command on the currently active editor. | EditorManager
execInstanceCommand(id:String, c:String, u:Boolean, v:String):Boolean Deprecated: Use the execCommand method of a editor instance instead. | EditorManager
get(id:String):Editor [static] Returns a editor instance by id. | EditorManager
getInstanceById(id:String):Editor Deprecated: Use get method instead. | EditorManager
init(s:Object):void [static] Initializes a set of editors. | EditorManager
preInit():void [static] Preinitializes the EditorManager class. | EditorManager
remove(e:Editor):Editor [static] Removes a editor instance from the collection. | EditorManager
triggerSave():void [static] Calls the save method on all editor instances in the collection. | EditorManager

## Property details

### activeEditorproperty

`public static activeEditor : Editor`
Currently active editor instance.

### editorsproperty

`public static editors : Object`
Collection of editor instances.

## Method details

### addmethod

`public static function add(e:Editor):Editor`
Adds an editor instance to the editor collection. This will also set it as the active editor.

#### Parameters

e:Editor | Editor instance to add to the collection.

#### Returns

Editor - The same instance that got passed in.

### addI18nmethod

`public static function addI18n(p:String, o:Object):void`
Adds a language pack, this gets called by the loaded language files like en.js.

#### Parameters

p:String | Prefix for the language items. For example en.myplugin
o:Object | Name/Value collection with items to add to the language group.

### execCommandmethod

`public static function execCommand(c:String, u:Boolean, v:String):Boolean`
Executes a specific command on the currently active editor.

#### Parameters

c:String | Command to perform for example Bold.
u:Boolean | Optional boolean state if a UI should be presented for the command or not.
v:String | Optional value parameter like for example an URL to a link.

#### Returns

Boolean - true/false if the command was executed or not.

### execInstanceCommandmethod

`public static function execInstanceCommand(id:String, c:String, u:Boolean, v:String):Boolean`
Deprecated: Use the execCommand method of a editor instance instead.
Executes a command on a specific editor by id. This method was added for compatibility with the 2.x branch.

#### Parameters

id:String | Editor id to perform the command on.
c:String | Command to perform for example Bold.
u:Boolean | Optional boolean state if a UI should be presented for the command or not.
v:String | Optional value parameter like for example an URL to a link.

#### Returns

Boolean - true/false if the command was executed or not.

### getmethod

`public static function get(id:String):Editor`
Returns a editor instance by id.

#### Parameters

id:String | Editor instance id to return.

#### Returns

Editor - Editor instance to return.

### getInstanceByIdmethod

`public static function getInstanceById(id:String):Editor`
Deprecated: Use get method instead.
Returns a editor instance by id. This method was added for compatibility with the 2.x branch.

#### Parameters

id:String | Editor instance id to return.

#### Returns

Editor - Editor instance to return.

#### See Also

- get

### initmethod

`public static function init(s:Object):void`
Initializes a set of editors. This method will create a bunch of editors based in the input.

#### Parameters

s:Object | Settings object to be passed to each editor instance.

### preInitmethod

`public static function preInit():void`
Preinitializes the EditorManager class. This method will be called automatically when the page loads and it will setup some important paths and URIs and attach some document events.

### removemethod

`public static function remove(e:Editor):Editor`
Removes a editor instance from the collection.

#### Parameters

e:Editor | Editor instance to remove.

#### Returns

Editor - The editor that got passed in will be return if it was found otherwise null.

### triggerSavemethod

`public static function triggerSave():void`
Calls the save method on all editor instances in the collection. This can be useful when a form is to be submitted.