TinyMCE:API/tinymce.Editor
From Moxiecode Documentation Wiki
Contents |
[edit]
Class: tinymce.Editor
This class contains the core logic for a TinyMCE editor.
[edit]
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();
[edit]
Constructor
- Editor
- Constructs a editor instance by id.
[edit]
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.
- 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.
- 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.
[edit]
Events
- onPreInit
- Pre initialization event.
- onBeforeRenderUI
- Gets dispatched before the UI is rendered to the browser.
- onPostRender
- Gets dispatched after the UI has been rendered to the browser.
- onInit
- Gets dispatched when the editor is ready for usage.
- onRemove
- Gets dispatched when the editor is removed from the document.
- onActivate
- Gets dispatched when the editor is activated/gets focus.
- onDeactivate
- Gets dispatched when the editor is deactivated/looses focus.
- onClick
- Gets dispatched when a user clicks inside the editor content.
- onEvent
- Gets dispatched when a user performs a DOM event inside the editor content.
- onMouseUp
- Gets dispatched when a user performs a mouse up inside the editor content.
- onMouseDown
- Gets dispatched when a user performs a mouse down inside the editor content.
- onDblClick
- Gets dispatched when a user performs a double click inside the editor content.
- onKeyDown
- Gets dispatched when a user performs a key down inside the editor content.
- onKeyUp
- Gets dispatched when a user performs a key up inside the editor content.
- onKeyPress
- Gets dispatched when a user performs a key press inside the editor content.
- onContextMenu
- Gets dispatched when a user performs a context menu click inside the editor content.
- onSubmit
- Gets dispatched when the form that the editor is located in gets submitted.
- onReset
- Gets dispatched when the form that the editor is located in gets restored to it's initial value.
- onPaste
- Gets dispatched when contents is pasted into the editor.
- onPreProcess
- Gets dispatched before serialization is done on a HTML fragment.
- onPostProcess
- Gets dispatched after the serialization is complete of a HTML fragment.
- onBeforeSetContent
- Gets dispatched before contents is placed into the editor.
- onBeforeGetContent
- Gets dispatched before contents is retrieved from the editor.
- onSetContent
- Gets dispatched after contents has placed into the editor.
- onGetContent
- Gets dispatched after contents has retrieved from the editor.
- onLoadContent
- Gets dispatched after contents has loaded from the textarea into the editor.
- onSaveContent
- Gets dispatched after contents has saved from the editor out to the textarea.
- onNodeChange
- Gets dispatched when the user moves the caret or when nodeChanged was called.
- onChange
- Gets dispatched when contents is changed in the editor.
- onBeforeExecCommand
- Gets dispatched before a command is executed.
- onExecCommand
- Gets dispatched before a after command has been executed.
- onUndo
- Gets dispatched after an undo action was performed.
- onRedo
- Gets dispatched after an redo action was performed.
- onVisualAid
- Gets dispatched when the visual aid state gets changed.
- onSetProgressState
- Gets dispatched when the setProgressState is called.
[edit]
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 command to the editor, you can also override existing commands with this method.
- addQueryValueHandler
- Adds a custom query state command to the editor, you can also override existing commands 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.
- 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.
- resizeToContent
- Resizes the editor to the current contents width and height.
- 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.
- 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 mathching the input.
