TinyMCE:API/tinymce.Editor

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Class: tinymce.Editor

This class contains the core logic for a TinyMCE editor.

Examples

// Add a class to all paragraphs in the editor.
tinyMCE.activeEditor.dom.addClass(tinyMCE.activeEditor.dom.select('p'), 'someclass');

// Gets the current editors selection as text
tinyMCE.activeEditor.selection.getContent({format : 'text'});

// Creates a new editor instance
var ed = new tinymce.Editor('textareaid', {
   some_setting : 1
});

// Select each item the user clicks on
ed.onClick.add(function(ed, e) {
   ed.selection.select(e.target);
});

ed.render();

Constructor

Editor
Constructs an editor instance by id.

Properties

baseURI
URI instance for the location of the TinyMCE API.
controlManager
Instance of the control manager that creates and maintains all UI controls.
documentBaseURI
URI instance for the editors document location.
dom
DOMUtils instance for the editor contents.
formatter
Formatter instance.
id
Editor instance id, normally the same as the div/textarea that was replaced.
isNotDirty
State to force the editor to return false on a isDirty call.
plugins
Plugin collection, used to get the editors plugin instances.
schema
Schema instance, enables you to validate elements and it's children.
selection
Selection instance used to manage the content selection.
serializer
Serialization engine instance, used for DOM serialization to HTML strings.
settings
Settings collected used to configure the Editor instance.
theme
Reference to the theme instance that was used to generate the UI.
undoManager
Undo manager instance, responsible for handling undo levels.
windowManager
WindowManager instance for the editor. Used to open dialogs and alerts.

Events

onActivate
Gets dispatched when the editor is activated/gets focus.
onBeforeExecCommand
Gets dispatched before a command is executed.
onBeforeGetContent
Gets dispatched before contents is retrieved from the editor.
onBeforeRenderUI
Gets dispatched before the UI is rendered to the browser.
onBeforeSetContent
Gets dispatched before contents is placed into the editor.
onChange
Gets dispatched when contents is changed in the editor.
onClick
Gets dispatched when a user clicks inside the editor content.
onContextMenu
Gets dispatched when a user performs a context menu click inside the editor content.
onDblClick
Gets dispatched when a user performs a double click inside the editor content.
onDeactivate
Gets dispatched when the editor is deactivated/looses focus.
onEvent
Gets dispatched when a user performs a DOM event inside the editor content.
onExecCommand
Gets dispatched after a command has been executed.
onGetContent
Gets dispatched after contents has retrieved from the editor.
onInit
Gets dispatched when the editor is ready for usage.
onKeyDown
Gets dispatched when a user performs a key down inside the editor content.
onKeyPress
Gets dispatched when a user performs a key press inside the editor content.
onKeyUp
Gets dispatched when a user performs a key up inside the editor content.
onLoadContent
Gets dispatched after contents has loaded from the textarea into the editor.
onMouseDown
Gets dispatched when a user performs a mouse down inside the editor content.
onMouseUp
Gets dispatched when a user performs a mouse up inside the editor content.
onNodeChange
Gets dispatched when the user moves the caret or when nodeChanged was called.
onPaste
Gets dispatched when content is pasted into the editor.
onPostProcess
Gets dispatched after the serialization is complete of a HTML fragment.
onPostRender
Gets dispatched after the UI has been rendered to the browser.
onPreInit
Pre initialization event.
onPreProcess
Gets dispatched before serialization is done on a HTML fragment.
onRedo
Gets dispatched after an redo action was performed.
onRemove
Gets dispatched when the editor is removed from the document.
onReset
Gets dispatched when the form that the editor is located in gets restored to it's initial value.
onSaveContent
Gets dispatched after contents has saved from the editor out to the textarea.
onSetContent
Gets dispatched after contents has placed into the editor.
onSetProgressState
Gets dispatched when the setProgressState is called.
onSubmit
Gets dispatched when the form that the editor is located in gets submitted.
onUndo
Gets dispatched after an undo action was performed.
onVisualAid
Gets dispatched when the visual aid state gets changed.

Methods

addButton
Adds a button that later gets created by the ControlManager.
addCommand
Adds a custom command to the editor, you can also override existing commands with this method.
addQueryStateHandler
Adds a custom query state handler to the editor, you can also override existing handlers with this method.
addQueryValueHandler
Adds a custom query value handler to the editor, you can also override existing handlers with this method.
addShortcut
Adds a keyboard shortcut for some command or function.
addVisual
Adds visual aid for tables, anchors etc so they can be more easily edited inside the editor.
convertURL
URL converter function this gets executed each time a user adds an img, a or any other element that has a URL in it.
destroy
Destroys the editor instance by removing all events, element references or other resources that could leak memory.
execCallback
Executes a legacy callback.
execCommand
Executes a command on the current instance.
focus
Focuses/activates the editor.
getBody
Returns the iframes body element.
getContainer
Returns the editors container element.
getContent
Gets the content from the editor instance, this will cleanup the content before it gets returned using the different cleanup rules options.
getContentAreaContainer
Returns the editors content area container element.
getDoc
Returns the iframes document object.
getElement
Returns the element that got replaced by an editor for example the textarea.
getLang
Returns a language pack item by name/key.
getParam
Returns a configuration parameter by name.
getWin
Returns the iframes window object.
hide
Hides the editor and shows any textarea/div that the editor is supposed to replace.
init
Initializes the editor this will be called automatically when all plugins/themes and language packs are loaded by the rendered method.
isDirty
Returns true/false if the editor is dirty or not.
isHidden
Returns true/false if the editor is hidden or not.
load
Loads contents from the textarea or div element that got converted into an editor instance.
nodeChanged
Distpaches out a onNodeChange event to all observers.
queryCommandState
Returns a command specific state, for example if bold is enabled or not.
queryCommandValue
Returns a command specific value, for example the current font size.
remove
Removes the editor from the dom and EditorManager collection.
render
Renderes the editor/adds it to the page.
save
Saves the contents from a editor out to the textarea or div element that got converted into an editor instance.
setContent
Sets the specified content to the editor instance, this will cleanup the content before it gets set using the different cleanup rules options.
setProgressState
Sets the progress state, this will display a throbber/progess for the editor.
setupContentEditable
Sets up the contentEditable mode.
setupIframe
This method gets called by the init method once the iframe is loaded.
show
Shows the editor and hides any textarea/div that the editor is supposed to replace.
translate
Translates the specified string by replacing variables with language pack items it will also check if there is a key matching the input.
Personal tools