dijit/Editor (version 1.10)

dijit/_editor/RichText

Summary

A rich text Editing widget

This widget provides basic WYSIWYG editing features, based on the browser's underlying rich text editing capability, accompanied by a toolbar (dijit.Toolbar). A plugin model is available to extend the editor's capabilities as well as the the options available in the toolbar. Content generation may vary across browsers, and clipboard operations may have different results, to name a few limitations. Note: this widget should not be used with the HTML <TEXTAREA> tag -- see dijit/_editor/RichText for details.

Usage

var foo = new Editor(params,srcNodeRef);
dijit/Editor
Parameter Type Description
params Object | null

Initial settings for any of the attributes, except readonly attributes.

srcNodeRef DOMNode

The editor replaces the specified DOMNode.

See the dijit/Editor reference documentation for more information.

Property Summary

  • _attrPairNames
  • _blankGifPath to a blank 1x1 image.
  • _editorCommandsLocalized
  • _focusManager
  • _local2NativeFormatNames
  • _mozSettingProps
  • _NAME_CONTENT_SEPUSed to separate name from content.
  • _native2LocalFormatNames
  • _qcaCache
  • _SEPARATORUsed to concat contents from multiple editors into a single string, so they can be saved into a single &lt;textarea&gt; node.
  • _setClassAttr
  • _setDirAttr
  • _setIdAttr
  • _setLangAttr
  • _setTypeAttr
  • _startedstartup() has completed.
  • _steps
  • _undoedSteps
  • _updateTimer
  • activeTrue if mouse was pressed while over this widget, and hasn&#39;t been released yet
  • attributeMapDeprecated.
  • baseClass
  • captureEventsEvents which should be connected to the underlying editing area, events in this array will be addListener with capture=true.
  • class
  • containerNodeDesignates where children of the source DOM node will be placed. &quot;Children&quot; in this case refers to both DOM nodes and widgets.
  • cssStateNodesSubclasses may define a cssStateNodes property that lists sub-nodes within the widget that need CSS classes applied on mouse hover/press and focus.
  • customUndoWhether we shall use custom undo/redo support instead of the native browser support.
  • dirBi-directional support, as defined by the HTML DIR attribute.
  • disabledThe editor is disabled; the text cannot be changed.
  • disableSpellCheckWhen true, disables the browser&#39;s native spell checking, if supported.
  • domNodeThis is our visible representation of the widget!
  • editActionIntervalWhen using customUndo, not every keystroke will be saved as a step.
  • eventsevents which should be connected to the underlying editing area
  • extraPluginsA list of extra plugin names which will be appended to plugins array
  • focusedThis widget or a widget it contains has focus, or is &quot;active&quot; because it was recently clicked.
  • focusOnLoadFocus into this widget when the page is loaded
  • heightSet height to fix the editor at a specific height, with scrolling.
  • hoveringTrue if cursor is over this widget
  • idA unique, opaque ID string that can be assigned by users or by the system.
  • inheritWidthwhether to inherit the parent&#39;s width or simply use 100%
  • isClosed
  • isLoaded
  • isTabIndentMake tab key and shift-tab indent and outdent rather than navigating.
  • langRarely used.
  • minHeightThe minimum height that the editor should have.
  • nameSpecifies the name of a (hidden) &lt;textarea&gt; node on the page that&#39;s used to save the editor content on page leave.
  • onLoadDeferredDeferred which is fired when the editor finishes loading.
  • ownerDocumentThe document this widget belongs to.
  • pluginsA list of plugin names (as strings) or instances (as objects) for this widget.
  • srcNodeRefpointer to original DOM node
  • styleHTML style attributes as cssText string or name/value hash
  • styleSheetssemicolon (&quot;;&quot;) separated list of css files for the editing area
  • titleHTML title attribute.
  • tooltipWhen this widget&#39;s title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.
  • updateInterval

Method Summary

  • _adaptIEFormatAreaAndExec(command) Function to handle IE's quirkiness regarding how it handles format commands on a word.
  • _adaptIEList(command,argument) This function handles normalizing the IE list behavior as much as possible.
  • _adaptIESelection() Function to adapt the IE range by removing leading 'newlines' Needed to fix issue with bold/italics/underline not working if range included leading 'newlines'.
  • _adjustNodeAndOffset(node,offset) In the case there are multiple text nodes in a row the offset may not be within the node.
  • _applyAttributes() Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.
  • _applyEditingAreaStyleSheets() apply the specified css files in styleSheets
  • _attrToDom(attr,value,commands) Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter.
  • _backcolorImpl(argument) This function implements the backcolor command
  • _beginEditing() Called when the user starts typing alphanumeric characters.
  • _boldImpl(argument) This function implements an over-ride of the bold command.
  • _browserQueryCommandEnabled(command) Implementation to call to the native queryCommandEnabled of the browser.
  • _changeAttrValue(name,value) Internal helper for directly changing an attribute value.
  • _changeToStep(from,to) Reverts editor to "to" setting, from the undo stack.
  • _clipboardCommand(cmd) Function to handle processing clipboard commands (or at least try to).
  • _copyEnabledImpl(argument) This function implements the test for if the copy command should be enabled or not.
  • _copyImpl() Over-ride of copy command control to make execCommand cleaner
  • _createlinkEnabledImpl(argument) This function implements the test for if the create link command should be enabled or not.
  • _cssMouseEvent(event) Handler for CSS event on this.domNode.
  • _cutEnabledImpl(argument) This function implements the test for if the cut command should be enabled or not.
  • _cutImpl() Over-ride of cut command control to make execCommand cleaner
  • _endEditing() Called when the user stops typing alphanumeric characters.
  • _fontnameImpl(argument) This function implements the fontname command
  • _fontsizeImpl(argument) This function implements the fontsize command
  • _forecolorImpl(argument) This function implements the forecolor command
  • _get(name) Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters.
  • _getAttrNames(name) Helper function for get() and set().
  • _getBookmark() Get the currently selected text
  • _getIframeDocTxt() Generates the boilerplate text of the document inside the iframe (ie, <html><head>...</head><body/></html>).
  • _getNodeChildrenHeight(node) An internal function for computing the cumulative height of all child nodes of 'node'
  • _getValueAttr() Hook to make attr("value") work
  • _handleTextColorOrProperties(command,argument) This function handles applying text color as best it is able to do so when the selection is collapsed, making the behavior cross-browser consistent.
  • _hilitecolorImpl(argument) This function implements the hilitecolor command
  • _inserthorizontalruleImpl(argument) This function implements the insertion of HTML 'HR' tags. into a point on the page.
  • _inserthtmlImpl(argument) This function implements the insertion of HTML content into a point on the page.
  • _insertorderedlistImpl(argument) This function implements the insertorderedlist command
  • _inserttableEnabledImpl(argument) This function implements the test for if the inserttable command should be enabled or not.
  • _insertunorderedlistImpl(argument) This function implements the insertunorderedlist command
  • _introspect() Collect metadata about this widget (only once per class, not once per instance): - list of attributes with custom setters, storing in this.constructor._setterAttrs - generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
  • _isNodeEmpty(node,startOffset) Function to test if a node is devoid of real content.
  • _italicImpl(argument) This function implements an over-ride of the italic command.
  • _localizeEditorCommands() When IE is running in a non-English locale, the API actually changes, so that we have to say (for example) danraku instead of p (for paragraph).
  • _moveToBookmark(b) Selects the text specified in bookmark b
  • _normalizeCommand(cmd,argument) Used as the advice function to map our normalized set of commands to those supported by the target browser.
  • _normalizeFontStyle(html) Convert 'strong' and 'em' to 'b' and 'i'.
  • _pasteEnabledImpl(argument) c This function implements the test for if the paste command should be enabled or not.
  • _pasteImpl() Over-ride of paste command control to make execCommand cleaner
  • _postFilterContent(dom,nonDestructive) filter the output after getting the content of the editing area
  • _preDomFilterContent(dom) filter the input's live DOM.
  • _preFilterContent(html) Filter the input before setting the content of the editing area.
  • _preFixUrlAttributes(html) Pre-filter to do fixing to href attributes on <a> and <img> tags
  • _queryCommandAvailable(command) See queryCommandAvailable().
  • _removeMozBogus(html) Post filter to remove unwanted HTML attributes generated by mozilla
  • _removeStartingRangeFromRange(node,range) Function to adjust selection range by removing the current start node.
  • _removeWebkitBogus(html) Post filter to remove unwanted HTML attributes generated by webkit
  • _restoreSelection() Re-select the text specified in _savedSelection attribute; see _saveSelection().
  • _saveContent() Saves the content in an onunload event if the editor has not been closed
  • _saveSelection() Save the currently selected text in _savedSelection attribute
  • _sCall(name,args) Deprecated, remove for 2.0.
  • _set(name,value) Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.
  • _setDisabledAttr(value)
  • _setDisableSpellCheckAttr(disabled)
  • _setFocusedAttr(val)
  • _setOwnerDocumentAttr(val)
  • _setStateClass()
  • _setStyleAttr(value) Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string
  • _setTextDirAttr(value) Sets textDir attribute.
  • _setValueAttr(value) Registers that attr("value", foo) should call setValue(foo)
  • _strikethroughImpl(argument) This function implements an over-ride of the strikethrough command.
  • _stripBreakerNodes(node) Function for stripping out the breaker spans inserted by the formatting command.
  • _stripTrailingEmptyNodes(node) Function for stripping trailing nodes without any text, excluding trailing nodes like or , even though they don't have text either.
  • _subnodeCssMouseEvent(node,clazz,evt) Handler for hover/active mouse event on widget's subnode
  • _subscriptImpl(argument) This function implements an over-ride of the superscript command.
  • _superscriptImpl(argument) This function implements an over-ride of the superscript command.
  • _tagNamesForCommand(command) Function to return the tab names that are associated with a particular style.
  • _trackMouseState(node,clazz) Track mouse/focus events on specified node and set CSS class on that node to indicate current state.
  • _underlineImpl(argument) This function implements an over-ride of the underline command.
  • _unlinkEnabledImpl(argument) This function implements the test for if the unlink command should be enabled or not.
  • _unlinkImpl(argument) This function implements the unlink of an 'a' tag.
  • addKeyHandler(key,ctrl,shift,handler) Add a handler for a keyboard shortcut
  • addPlugin(plugin,index) takes a plugin name as a string or a plugin instance and adds it to the toolbar and associates it with this editor instance.
  • addStyleSheet(uri) add an external stylesheet for the editing area
  • attr(name,value) This method is deprecated, use get() or set() directly.
  • beginEditing(cmd) Called to note that the user has started typing alphanumeric characters, if it's not already noted.
  • blur() Remove focus from this instance.
  • buildRendering() Construct the UI for this widget, setting this.domNode.
  • close(save) Kills the editor and optionally writes back the modified contents to the element from which it originated.
  • connect(obj,event,method) Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.
  • create(params,srcNodeRef) Kick off the life-cycle of a widget
  • defer(fcn,delay) Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed.
  • destroy()
  • destroyDescendants(preserveDom) Recursively destroy the children of this widget and their descendants.
  • destroyRecursive(preserveDom) Destroy this widget and its descendants
  • destroyRendering(preserveDom) Destroys the DOM nodes associated with this widget.
  • disconnect(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • emit(type,eventObj,callbackArgs) Used by widgets to signal that a synthetic event occurred, ex: myWidget.emit("attrmodified-selectedChildWidget", {}).
  • endEditing(ignore_caret) Called to note that the user has stopped typing alphanumeric characters, if it's not already noted.
  • escapeXml(str,noSingleQuotes) Adds escape sequences for special characters in XML.
  • execCommand(cmd) Main handler for executing any commands to the editor, like paste, bold, etc.
  • focus() Move focus to this editor
  • get(name) Get a property from a widget.
  • getChildren() Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget.
  • getDescendants() Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
  • getFooterHeight() A function for obtaining the height of the footer node
  • getHeaderHeight() A function for obtaining the height of the header node
  • getNodeChildrenHtml(dom) Deprecated.
  • getNodeHtml(node) Deprecated.
  • getParent() Returns the parent widget of this widget.
  • getValue(nonDestructive) Return the current content of the editing area (post filters are applied).
  • isFocusable() Return true if this widget can currently be focused and false if not
  • isLeftToRight() Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
  • layout() Called from dijit/layout/_LayoutWidget.resize().
  • on(type,func)
  • open(element) Transforms the node referenced in this.domNode into a rich text editing node.
  • own() Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.
  • placeAt(reference,position) Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.
  • placeCursorAtEnd() Place the cursor at the end of the editing area.
  • placeCursorAtStart() Place the cursor at the start of the editing area.
  • postCreate()
  • postMixInProperties() Extension to make sure a deferred is in place before certain functions execute, like making sure all the plugins are properly inserted.
  • postscript(params,srcNodeRef) Kicks off widget instantiation.
  • queryCommandAvailable(command) Tests whether a command is supported by the host.
  • queryCommandEnabled(cmd) Returns true if specified editor command is enabled.
  • queryCommandState(command) Check the state of a given command and returns true or false.
  • queryCommandValue(command) Check the value of a given command.
  • redo() Handler for editor redo (ex: ctrl-y) operation
  • removeStyleSheet(uri) remove an external stylesheet for the editing area
  • replaceValue(html) over-ride of replaceValue to support custom undo and stack maintenance.
  • resize(size) Resize the editor to the specified size, see dijit/layout/_LayoutWidget.resize()
  • set(name,value) Set a property on a widget
  • setAttribute(attr,value) Deprecated.
  • setDisabled(disabled) Deprecated, use set('disabled', ...) instead.
  • setupDefaultShortcuts() Add some default key handlers
  • setValue(html) This function sets the content.
  • startup()
  • subscribe(t,method) Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
  • toString() Returns a string that represents the widget.
  • undo() Handler for editor undo (ex: ctrl-z) operation
  • uninitialize() Deprecated.
  • unsubscribe(handle) Deprecated, will be removed in 2.0, use handle.remove() instead.
  • watch(name,callback) Watches a property for changes

Event Summary

  • _onBlur() Called from focus manager when focus has moved away from this editor
  • _onFocus(e) Called from focus manager when focus has moved into this editor
  • _onIEMouseDown(e) IE only to prevent 2 clicks to focus
  • _onMap(type) Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove").
  • _onShow() Internal method called when this widget is made visible.
  • onBeforeActivate()
  • onBeforeDeactivate(e) Called on IE right before focus is lost.
  • onBlur() Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.
  • onChange(newContent) This is fired if and only if the editor loses focus and the content is changed.
  • onClick() Handler for when editor is clicked
  • onClose() Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden.
  • onDblClick(event) Connect to this function to receive notifications of mouse double click events.
  • onDisplayChanged(e) This event will be fired every time the display context changes and the result needs to be reflected in the UI.
  • onFocus() Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.
  • onHide() Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.
  • onKeyDown(e) Handler for onkeydown event.
  • onKeyPress(event) Connect to this function to receive notifications of printable keys being typed.
  • onKeyPressed() Handler for after the user has pressed a key, and the display has been updated. (Runs on a timer so that it runs after the display is updated)
  • onKeyUp(e) Handler for onkeyup event
  • onLoad(html) Handler after the iframe finishes loading.
  • onMouseDown(event) Connect to this function to receive notifications of when the mouse button is pressed down.
  • onMouseEnter(event) Connect to this function to receive notifications of when the mouse moves onto this widget.
  • onMouseLeave(event) Connect to this function to receive notifications of when the mouse moves off of this widget.
  • onMouseMove(event) Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
  • onMouseOut(event) Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
  • onMouseOver(event) Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
  • onMouseUp(event) Connect to this function to receive notifications of when the mouse button is released.
  • onNormalizedDisplayChanged() This event is fired every updateInterval ms or more
  • onShow() Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Properties

_attrPairNames
Defined by: dijit/_WidgetBase
_blankGif
Defined by: dijit/_WidgetBase

Path to a blank 1x1 image. Used by <img> nodes in templates that really get their image via CSS background-image.

_editorCommandsLocalized
_focusManager
Defined by: dijit/_FocusMixin
_local2NativeFormatNames
_mozSettingProps
_NAME_CONTENT_SEP

USed to separate name from content. Just a colon isn't safe.

_native2LocalFormatNames
_qcaCache
_SEPARATOR

Used to concat contents from multiple editors into a single string, so they can be saved into a single <textarea> node. See "name" attribute.

_setClassAttr
Defined by: dijit/_WidgetBase
_setDirAttr
Defined by: dijit/_WidgetBase
_setIdAttr
Defined by: dijit/_WidgetBase
_setLangAttr
Defined by: dijit/_WidgetBase
_setTypeAttr
Defined by: dijit/_WidgetBase
_started
Defined by: dijit/_WidgetBase

startup() has completed.

_steps
Defined by: dijit/Editor
_undoedSteps
Defined by: dijit/Editor
_updateTimer
active
Defined by: dijit/_CssStateMixin

True if mouse was pressed while over this widget, and hasn't been released yet

attributeMap
Defined by: dijit/_WidgetBase

Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute for each XXX attribute to be mapped to the DOM.

attributeMap sets up a "binding" between attributes (aka properties) of the widget and the widget's DOM. Changes to widget attributes listed in attributeMap will be reflected into the DOM.

For example, calling set('title', 'hello') on a TitlePane will automatically cause the TitlePane's DOM to update with the new title.

attributeMap is a hash where the key is an attribute of the widget, and the value reflects a binding to a:

  • DOM node attribute

    focus: {node: "focusNode", type: "attribute"} Maps this.focus to this.focusNode.focus

  • DOM node innerHTML

    title: { node: "titleNode", type: "innerHTML" } Maps this.title to this.titleNode.innerHTML

  • DOM node innerText

    title: { node: "titleNode", type: "innerText" } Maps this.title to this.titleNode.innerText

  • DOM node CSS class

    myClass: { node: "domNode", type: "class" } Maps this.myClass to this.domNode.className

If the value is an array, then each element in the array matches one of the formats of the above list.

There are also some shorthands for backwards compatibility:

  • string --> { node: string, type: "attribute" }, for example:
"focusNode" ---> { node: "focusNode", type: "attribute" }
  • "" --> { node: "domNode", type: "attribute" }
baseClass
captureEvents

Events which should be connected to the underlying editing area, events in this array will be addListener with capture=true.

class
Defined by: dijit/_WidgetBase
containerNode
Defined by: dijit/_WidgetBase

Designates where children of the source DOM node will be placed. "Children" in this case refers to both DOM nodes and widgets. For example, for myWidget:

<div data-dojo-type=myWidget>
    <b> here's a plain DOM node
    <span data-dojo-type=subWidget>and a widget</span>
    <i> and another plain DOM node </i>
</div>

containerNode would point to:

<b> here's a plain DOM node
<span data-dojo-type=subWidget>and a widget</span>
<i> and another plain DOM node </i>

In templated widgets, "containerNode" is set via a data-dojo-attach-point assignment.

containerNode must be defined for any widget that accepts innerHTML (like ContentPane or BorderContainer or even Button), and conversely is null for widgets that don't, like TextBox.

cssStateNodes
Defined by: dijit/_CssStateMixin

Subclasses may define a cssStateNodes property that lists sub-nodes within the widget that need CSS classes applied on mouse hover/press and focus.

Each entry in this optional hash is a an attach-point name (like "upArrowButton") mapped to a CSS class name (like "dijitUpArrowButton"). Example:

{
    "upArrowButton": "dijitUpArrowButton",
    "downArrowButton": "dijitDownArrowButton"
}

The above will set the CSS class dijitUpArrowButton to the this.upArrowButton DOMNode when it

is hovered, etc.

customUndo
Defined by: dijit/Editor

Whether we shall use custom undo/redo support instead of the native browser support. By default, we now use custom undo. It works better than native browser support and provides a consistent behavior across browsers with a minimal performance hit. We already had the hit on the slowest browser, IE, anyway.

dir
Defined by: dijit/_WidgetBase

Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's default direction.

disabled

The editor is disabled; the text cannot be changed.

disableSpellCheck

When true, disables the browser's native spell checking, if supported. Works only in Firefox.

domNode
Defined by: dijit/_WidgetBase

This is our visible representation of the widget! Other DOM Nodes may by assigned to other properties, usually through the template system's data-dojo-attach-point syntax, but the domNode property is the canonical "top level" node in widget UI.

editActionInterval
Defined by: dijit/Editor

When using customUndo, not every keystroke will be saved as a step. Instead typing (including delete) will be grouped together: after a user stops typing for editActionInterval seconds, a step will be saved; if a user resume typing within editActionInterval seconds, the timeout will be restarted. By default, editActionInterval is 3 seconds.

events

events which should be connected to the underlying editing area

extraPlugins
Defined by: dijit/Editor

A list of extra plugin names which will be appended to plugins array

focused
Defined by: dijit/_FocusMixin

This widget or a widget it contains has focus, or is "active" because it was recently clicked.

focusOnLoad

Focus into this widget when the page is loaded

height

Set height to fix the editor at a specific height, with scrolling. By default, this is 300px. If you want to have the editor always resizes to accommodate the content, use AlwaysShowToolbar plugin and set height="". If this editor is used within a layout widget, set height="100%".

hovering
Defined by: dijit/_CssStateMixin

True if cursor is over this widget

id
Defined by: dijit/_WidgetBase

A unique, opaque ID string that can be assigned by users or by the system. If the developer passes an ID which is known not to be unique, the specified ID is ignored and the system-generated ID is used instead.

inheritWidth

whether to inherit the parent's width or simply use 100%

isClosed
isLoaded
isTabIndent

Make tab key and shift-tab indent and outdent rather than navigating. Caution: sing this makes web pages inaccessible to users unable to use a mouse.

lang
Defined by: dijit/_WidgetBase

Rarely used. Overrides the default Dojo locale used to render this widget, as defined by the HTML LANG attribute. Value must be among the list of locales specified during by the Dojo bootstrap, formatted according to RFC 3066 (like en-us).

minHeight

The minimum height that the editor should have.

name

Specifies the name of a (hidden) <textarea> node on the page that's used to save the editor content on page leave. Used to restore editor contents after navigating to a new page and then hitting the back button.

onLoadDeferred

Deferred which is fired when the editor finishes loading. Call myEditor.onLoadDeferred.then(callback) it to be informed when the rich-text area initialization is finalized.

ownerDocument
Defined by: dijit/_WidgetBase

The document this widget belongs to. If not specified to constructor, will default to srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global

plugins
Defined by: dijit/Editor

A list of plugin names (as strings) or instances (as objects) for this widget.

When declared in markup, it might look like:

plugins="['bold',{name:'dijit._editor.plugins.FontChoice', command:'fontName', generic:true}]"
srcNodeRef
Defined by: dijit/_WidgetBase

pointer to original DOM node

style
Defined by: dijit/_WidgetBase

HTML style attributes as cssText string or name/value hash

styleSheets

semicolon (";") separated list of css files for the editing area

title
Defined by: dijit/_WidgetBase

HTML title attribute.

For form widgets this specifies a tooltip to display when hovering over the widget (just like the native HTML title attribute).

For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer, etc., it's used to specify the tab label, accordion pane title, etc. In this case it's interpreted as HTML.

tooltip
Defined by: dijit/_WidgetBase

When this widget's title attribute is used to for a tab label, accordion pane title, etc., this specifies the tooltip to appear when the mouse is hovered over that text.

updateInterval

Methods

_adaptIEFormatAreaAndExec(command)

Function to handle IE's quirkiness regarding how it handles format commands on a word. This involves a lit of node splitting and format cloning.

Parameter Type Description
command undefined

The format command, needed to check if the desired command is true or not.

Returns:boolean
_adaptIEList(command,argument)

This function handles normalizing the IE list behavior as much as possible.

Parameter Type Description
command undefined

The list command to execute.

argument undefined

Any additional argument.

Returns:boolean
_adaptIESelection()

Function to adapt the IE range by removing leading 'newlines' Needed to fix issue with bold/italics/underline not working if range included leading 'newlines'. In IE, if a user starts a selection at the very end of a line, then the native browser commands will fail to execute correctly. To work around the issue, we can remove all empty nodes from the start of the range selection.

_adjustNodeAndOffset(node,offset)

In the case there are multiple text nodes in a row the offset may not be within the node. If the offset is larger than the node length, it will attempt to find the next text sibling until it locates the text node in which the offset refers to

Parameter Type Description
node DomNode

The node to check.

offset Int

The position to find within the text node

Returns:object
_applyAttributes()
Defined by dijit/_WidgetBase

Step during widget creation to copy widget attributes to the DOM according to attributeMap and _setXXXAttr objects, and also to call custom _setXXXAttr() methods.

Skips over blank/false attribute values, unless they were explicitly specified as parameters to the widget, since those are the default anyway, and setting tabIndex="" is different than not setting tabIndex at all.

For backwards-compatibility reasons attributeMap overrides _setXXXAttr when _setXXXAttr is a hash/string/array, but _setXXXAttr as a functions override attributeMap.

_applyEditingAreaStyleSheets()

apply the specified css files in styleSheets

Returns:string
_attrToDom(attr,value,commands)
Defined by dijit/_WidgetBase

Reflect a widget attribute (title, tabIndex, duration etc.) to the widget DOM, as specified by commands parameter. If commands isn't specified then it's looked up from attributeMap. Note some attributes like "type" cannot be processed this way as they are not mutable.

Parameter Type Description
attr String

Name of member variable (ex: "focusNode" maps to this.focusNode) pointing to DOMNode inside the widget, or alternately pointing to a subwidget

value String
commands Object
Optional
_backcolorImpl(argument)

This function implements the backcolor command

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_beginEditing()
Defined by dijit/Editor

Called when the user starts typing alphanumeric characters. Deals with saving undo; see editActionInterval parameter.

_boldImpl(argument)

This function implements an over-ride of the bold command.

Parameter Type Description
argument undefined

Not used, operates by selection.

Returns:undefined
_browserQueryCommandEnabled(command)

Implementation to call to the native queryCommandEnabled of the browser.

Parameter Type Description
command undefined

The command to check.

Returns:boolean | undefined
_changeAttrValue(name,value)
Defined by dojo/Stateful

Internal helper for directly changing an attribute value.

Directly change the value of an attribute on an object, bypassing any accessor setter. Also handles the calling of watch and emitting events. It is designed to be used by descendant class when there are two values of attributes that are linked, but calling .set() is not appropriate.

Parameter Type Description
name String

The property to set.

value Mixed

The value to set in the property.

Returns:function

Internal helper for directly changing an attribute value.

_changeToStep(from,to)
Defined by dijit/Editor

Reverts editor to "to" setting, from the undo stack.

Parameter Type Description
from undefined
to undefined
_clipboardCommand(cmd)
Defined by dijit/Editor

Function to handle processing clipboard commands (or at least try to).

Parameter Type Description
cmd undefined
Returns:boolean
_copyEnabledImpl(argument)

This function implements the test for if the copy command should be enabled or not.

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_copyImpl()
Defined by dijit/Editor

Over-ride of copy command control to make execCommand cleaner

Returns:undefined
_createlinkEnabledImpl(argument)

This function implements the test for if the create link command should be enabled or not.

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_cssMouseEvent(event)

Handler for CSS event on this.domNode. Sets hovering and active properties depending on mouse state, which triggers _setStateClass() to set appropriate CSS classes for this.domNode.

Parameter Type Description
event Event
_cutEnabledImpl(argument)

This function implements the test for if the cut command should be enabled or not.

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_cutImpl()
Defined by dijit/Editor

Over-ride of cut command control to make execCommand cleaner

Returns:undefined
_endEditing()
Defined by dijit/Editor

Called when the user stops typing alphanumeric characters. Deals with saving undo; see editActionInterval parameter.

_fontnameImpl(argument)

This function implements the fontname command

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_fontsizeImpl(argument)

This function implements the fontsize command

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_forecolorImpl(argument)

This function implements the forecolor command

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_get(name)
Defined by dijit/_WidgetBase

Helper function to get value for specified property stored by this._set(), i.e. for properties with custom setters. Used mainly by custom getters.

For example, CheckBox._getValueAttr() calls this._get("value").

Parameter Type Description
name String
Returns:undefined
_getAttrNames(name)
Defined by dijit/_WidgetBase

Helper function for get() and set(). Caches attribute name values so we don't do the string ops every time.

Parameter Type Description
name undefined
Returns:undefined | object
_getBookmark()
Defined by dijit/Editor

Get the currently selected text

Returns:undefined
_getIframeDocTxt()

Generates the boilerplate text of the document inside the iframe (ie, <html><head>...</head><body/></html>). Editor content (if not blank) should be added afterwards.

Returns:undefined
_getNodeChildrenHeight(node)

An internal function for computing the cumulative height of all child nodes of 'node'

Parameter Type Description
node undefined

The node to process the children of;

Returns:number
_getValueAttr()

Hook to make attr("value") work

Returns:undefined
_handleTextColorOrProperties(command,argument)

This function handles applying text color as best it is able to do so when the selection is collapsed, making the behavior cross-browser consistent. It also handles the name and size for IE.

Parameter Type Description
command undefined

The command.

argument undefined

Any additional arguments.

Returns:boolean
_hilitecolorImpl(argument)

This function implements the hilitecolor command

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_inserthorizontalruleImpl(argument)

This function implements the insertion of HTML 'HR' tags. into a point on the page. IE doesn't to it right, so we have to use an alternate form

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_inserthtmlImpl(argument)

This function implements the insertion of HTML content into a point on the page.

Parameter Type Description
argument undefined

The content to insert, if any.

Returns:undefined
_insertorderedlistImpl(argument)

This function implements the insertorderedlist command

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_inserttableEnabledImpl(argument)

This function implements the test for if the inserttable command should be enabled or not.

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_insertunorderedlistImpl(argument)

This function implements the insertunorderedlist command

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_introspect()
Defined by dijit/_WidgetBase

Collect metadata about this widget (only once per class, not once per instance):

- list of attributes with custom setters, storing in this.constructor._setterAttrs
- generate this.constructor._onMap, mapping names like "mousedown" to functions like onMouseDown
_isNodeEmpty(node,startOffset)

Function to test if a node is devoid of real content.

Parameter Type Description
node undefined

The node to check.

startOffset undefined
Returns:undefined | boolean
_italicImpl(argument)

This function implements an over-ride of the italic command.

Parameter Type Description
argument undefined

Not used, operates by selection.

Returns:undefined
_localizeEditorCommands()

When IE is running in a non-English locale, the API actually changes, so that we have to say (for example) danraku instead of p (for paragraph). Handle that here.

_moveToBookmark(b)
Defined by dijit/Editor

Selects the text specified in bookmark b

Parameter Type Description
b undefined
_normalizeCommand(cmd,argument)

Used as the advice function to map our normalized set of commands to those supported by the target browser.

Parameter Type Description
cmd String
argument Anything
Optional
Returns:string
_normalizeFontStyle(html)

Convert 'strong' and 'em' to 'b' and 'i'.

Moz can not handle strong/em tags correctly, so to help mozilla and also to normalize output, convert them to 'b' and 'i'.

Note the IE generates 'strong' and 'em' rather than 'b' and 'i'

Parameter Type Description
html String
Returns:undefined
_pasteEnabledImpl(argument)

c This function implements the test for if the paste command should be enabled or not.

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:boolean | undefined
_pasteImpl()
Defined by dijit/Editor

Over-ride of paste command control to make execCommand cleaner

Returns:undefined
_postFilterContent(dom,nonDestructive)

filter the output after getting the content of the editing area

post-filtering allows plug-ins and users to specify any number of transforms over the editor's content, enabling many common use-cases such as transforming absolute to relative URLs (and vice-versa), ensuring conformance with a particular DTD, etc. The filters are registered in the contentDomPostFilters and contentPostFilters arrays. Each item in the contentDomPostFilters array is a function which takes a DOM Node or array of nodes as its only argument and returns the same. It is then passed down the chain for further filtering. The contentPostFilters array behaves the same way, except each member operates on strings. Together, the DOM and string-based filtering allow the full range of post-processing that should be necessaray to enable even the most agressive of post-editing conversions to take place.

If nonDestructive is set to "true", the nodes are cloned before filtering proceeds to avoid potentially destructive transforms to the content which may still needed to be edited further. Once DOM filtering has taken place, the serialized version of the DOM which is passed is run through each of the contentPostFilters functions.

Parameter Type Description
dom DomNode | DomNode[] | String
Optional

a node, set of nodes, which to filter using each of the current members of the contentDomPostFilters and contentPostFilters arrays.

nonDestructive Boolean
Optional

defaults to "false". If true, ensures that filtering happens on a clone of the passed-in content and not the actual node itself.

Returns:string
_preDomFilterContent(dom)

filter the input's live DOM. All filter operations should be considered to be "live" and operating on the DOM that the user will be interacting with in their editing session.

Parameter Type Description
dom DomNode
_preFilterContent(html)

Filter the input before setting the content of the editing area. DOM pre-filtering may happen after this string-based filtering takes place but as of 1.2, this is not guaranteed for operations such as the inserthtml command.

Parameter Type Description
html String
Returns:String
_preFixUrlAttributes(html)

Pre-filter to do fixing to href attributes on <a> and <img> tags

Parameter Type Description
html String
Returns:undefined
_queryCommandAvailable(command)

See queryCommandAvailable().

Parameter Type Description
command String
Returns:boolean | undefined
_removeMozBogus(html)

Post filter to remove unwanted HTML attributes generated by mozilla

Parameter Type Description
html String
Returns:undefined
_removeStartingRangeFromRange(node,range)

Function to adjust selection range by removing the current start node.

Parameter Type Description
node undefined

The node to remove from the starting range.

range undefined

The range to adapt.

Returns:undefined

The range to adapt.

_removeWebkitBogus(html)

Post filter to remove unwanted HTML attributes generated by webkit

Parameter Type Description
html String
Returns:undefined
_restoreSelection()
Defined by dijit/Editor

Re-select the text specified in _savedSelection attribute; see _saveSelection().

_saveContent()

Saves the content in an onunload event if the editor has not been closed

_saveSelection()
Defined by dijit/Editor

Save the currently selected text in _savedSelection attribute

_sCall(name,args)

Deprecated, remove for 2.0. New code should access this.selection directly. Run the named method of dijit/selection over the current editor instance's window, with the passed args.

Parameter Type Description
name undefined
args undefined
Returns:undefined
_set(name,value)
Defined by dijit/_WidgetBase

Helper function to set new value for specified property, and call handlers registered with watch() if the value has changed.

Parameter Type Description
name String
value anything
_setDisabledAttr(value)
Defined by dijit/Editor
Parameter Type Description
value Boolean
_setDisableSpellCheckAttr(disabled)
Parameter Type Description
disabled Boolean
_setFocusedAttr(val)
Defined by dijit/_Widget
Parameter Type Description
val undefined
_setOwnerDocumentAttr(val)
Defined by dijit/_WidgetBase
Parameter Type Description
val undefined
_setStateClass()
Defined by dijit/Editor
_setStyleAttr(value)
Defined by dijit/_WidgetBase

Sets the style attribute of the widget according to value, which is either a hash like {height: "5px", width: "3px"} or a plain string

Determines which node to set the style on based on style setting in attributeMap.

Parameter Type Description
value String | Object
_setTextDirAttr(value)

Sets textDir attribute. Sets direction of editNode accordingly.

Parameter Type Description
value String
_setValueAttr(value)

Registers that attr("value", foo) should call setValue(foo)

Parameter Type Description
value String
_strikethroughImpl(argument)

This function implements an over-ride of the strikethrough command.

Parameter Type Description
argument undefined

Not used, operates by selection.

Returns:undefined
_stripBreakerNodes(node)

Function for stripping out the breaker spans inserted by the formatting command. Registered as a filter for IE, handles the breaker spans needed to fix up How bold/italic/etc, work when selection is collapsed (single cursor).

Parameter Type Description
node DOMNode
Returns:DOMNode
_stripTrailingEmptyNodes(node)

Function for stripping trailing nodes without any text, excluding trailing nodes like or

, even though they don't have text either.

Parameter Type Description
node DOMNode
Returns:DOMNode
_subnodeCssMouseEvent(node,clazz,evt)

Handler for hover/active mouse event on widget's subnode

Parameter Type Description
node undefined
clazz undefined
evt undefined
_subscriptImpl(argument)

This function implements an over-ride of the superscript command.

Parameter Type Description
argument undefined

Not used, operates by selection.

Returns:undefined
_superscriptImpl(argument)

This function implements an over-ride of the superscript command.

Parameter Type Description
argument undefined

Not used, operates by selection.

Returns:undefined
_tagNamesForCommand(command)

Function to return the tab names that are associated with a particular style.

Parameter Type Description
command String

The command to return tags for.

Returns:Array
_trackMouseState(node,clazz)

Track mouse/focus events on specified node and set CSS class on that node to indicate current state. Usually not called directly, but via cssStateNodes attribute.

Given class=foo, will set the following CSS class on the node

  • fooActive: if the user is currently pressing down the mouse button while over the node
  • fooHover: if the user is hovering the mouse over the node, but not pressing down a button
  • fooFocus: if the node is focused

Note that it won't set any classes if the widget is disabled.

Parameter Type Description
node DomNode

Should be a sub-node of the widget, not the top node (this.domNode), since the top node is handled specially and automatically just by mixing in this class.

clazz String

CSS class name (ex: dijitSliderUpArrow)

_underlineImpl(argument)

This function implements an over-ride of the underline command.

Parameter Type Description
argument undefined

Not used, operates by selection.

Returns:undefined
_unlinkEnabledImpl(argument)

This function implements the test for if the unlink command should be enabled or not.

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
_unlinkImpl(argument)

This function implements the unlink of an 'a' tag.

Parameter Type Description
argument undefined

arguments to the exec command, if any.

Returns:undefined
addKeyHandler(key,ctrl,shift,handler)

Add a handler for a keyboard shortcut

Parameter Type Description
key String | Number
ctrl Boolean
shift Boolean
handler Function
addPlugin(plugin,index)
Defined by dijit/Editor

takes a plugin name as a string or a plugin instance and adds it to the toolbar and associates it with this editor instance. The resulting plugin is added to the Editor's plugins array. If index is passed, it's placed in the plugins array at that index. No big magic, but a nice helper for passing in plugin names via markup.

Parameter Type Description
plugin String | Object | Function

String, args object, plugin instance, or plugin constructor

index Integer
Optional

Used when creating an instance from something already in this.plugins. Ensures that the new instance is assigned to this.plugins at that index.

addStyleSheet(uri)

add an external stylesheet for the editing area

Parameter Type Description
uri dojo/_base/url

Url of the external css file

attr(name,value)
Defined by dijit/_Widget

This method is deprecated, use get() or set() directly.

Parameter Type Description
name String | Object

The property to get or set. If an object is passed here and not a string, its keys are used as names of attributes to be set and the value of the object as values to set in the widget.

value Object
Optional

Optional. If provided, attr() operates as a setter. If omitted, the current value of the named property is returned.

Returns:undefined
beginEditing(cmd)
Defined by dijit/Editor

Called to note that the user has started typing alphanumeric characters, if it's not already noted. Deals with saving undo; see editActionInterval parameter.

Parameter Type Description
cmd undefined
blur()

Remove focus from this instance.

buildRendering()
Defined by dijit/_WidgetBase

Construct the UI for this widget, setting this.domNode. Most widgets will mixin dijit._TemplatedMixin, which implements this method.

close(save)

Kills the editor and optionally writes back the modified contents to the element from which it originated.

Parameter Type Description
save Boolean
Optional

Whether or not to save the changes. If false, the changes are discarded.

connect(obj,event,method)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.

Connects specified obj/event to specified method of this object and registers for disconnect() on widget destroy.

Provide widget-specific analog to dojo.connect, except with the implicit use of this widget as the target object. Events connected with this.connect are disconnected upon destruction.

Parameter Type Description
obj Object | null
event String | Function
method String | Function
Returns:any | undefined

A handle that can be passed to disconnect in order to disconnect before the widget is destroyed.

Examples

Example 1

var btn = new Button();
// when foo.bar() is called, call the listener we're going to
// provide in the scope of btn
btn.connect(foo, "bar", function(){
    console.debug(this.toString());
});
create(params,srcNodeRef)
Defined by dijit/_WidgetBase

Kick off the life-cycle of a widget

Create calls a number of widget methods (postMixInProperties, buildRendering, postCreate, etc.), some of which of you'll want to override. See http://dojotoolkit.org/reference-guide/dijit/_WidgetBase.html for a discussion of the widget creation lifecycle.

Of course, adventurous developers could override create entirely, but this should only be done as a last resort.

Parameter Type Description
params Object | null

Hash of initialization parameters for widget, including scalar values (like title, duration etc.) and functions, typically callbacks like onClick. The hash can contain any of the widget's properties, excluding read-only properties.

srcNodeRef DOMNode | String
Optional

If a srcNodeRef (DOM node) is specified:

  • use srcNodeRef.innerHTML as my contents
  • if this is a behavioral widget then apply behavior to that srcNodeRef
  • otherwise, replace srcNodeRef with my generated DOM tree
defer(fcn,delay)
Defined by dijit/_WidgetBase

Wrapper to setTimeout to avoid deferred functions executing after the originating widget has been destroyed. Returns an object handle with a remove method (that returns null) (replaces clearTimeout).

Parameter Type Description
fcn Function

Function reference.

delay Number
Optional

Delay, defaults to 0.

Returns:object
destroy()
Defined by dijit/Editor
destroyDescendants(preserveDom)
Defined by dijit/_WidgetBase

Recursively destroy the children of this widget and their descendants.

Parameter Type Description
preserveDom Boolean
Optional

If true, the preserveDom attribute is passed to all descendant widget's .destroy() method. Not for use with _Templated widgets.

destroyRecursive(preserveDom)
Defined by dijit/_WidgetBase

Destroy this widget and its descendants

This is the generic "destructor" function that all widget users should call to cleanly discard with a widget. Once a widget is destroyed, it is removed from the manager object.

Parameter Type Description
preserveDom Boolean
Optional

If true, this method will leave the original DOM structure alone of descendant Widgets. Note: This will NOT work with dijit._TemplatedMixin widgets.

destroyRendering(preserveDom)
Defined by dijit/_WidgetBase

Destroys the DOM nodes associated with this widget.

Parameter Type Description
preserveDom Boolean
Optional

If true, this method will leave the original DOM structure alone during tear-down. Note: this will not work with _Templated widgets yet.

disconnect(handle)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use handle.remove() instead.

Disconnects handle created by connect.

Parameter Type Description
handle undefined
emit(type,eventObj,callbackArgs)
Defined by dijit/_WidgetBase

Used by widgets to signal that a synthetic event occurred, ex:

myWidget.emit("attrmodified-selectedChildWidget", {}).

Emits an event on this.domNode named type.toLowerCase(), based on eventObj. Also calls onType() method, if present, and returns value from that method. By default passes eventObj to callback, but will pass callbackArgs instead, if specified. Modifies eventObj by adding missing parameters (bubbles, cancelable, widget).

Parameter Type Description
type String
eventObj Object
Optional
callbackArgs Array
Optional
Returns:undefined
endEditing(ignore_caret)
Defined by dijit/Editor

Called to note that the user has stopped typing alphanumeric characters, if it's not already noted. Deals with saving undo; see editActionInterval parameter.

Parameter Type Description
ignore_caret undefined
escapeXml(str,noSingleQuotes)

Adds escape sequences for special characters in XML. Optionally skips escapes for single quotes

Parameter Type Description
str String
noSingleQuotes Boolean
Returns:undefined
execCommand(cmd)
Defined by dijit/Editor

Main handler for executing any commands to the editor, like paste, bold, etc. Called by plugins, but not meant to be called by end users.

Parameter Type Description
cmd undefined
Returns:undefined
focus()

Move focus to this editor

get(name)
Defined by dijit/_WidgetBase

Get a property from a widget.

Get a named property from a widget. The property may potentially be retrieved via a getter method. If no getter is defined, this just retrieves the object's property.

For example, if the widget has properties foo and bar and a method named _getFooAttr(), calling: myWidget.get("foo") would be equivalent to calling widget._getFooAttr() and myWidget.get("bar") would be equivalent to the expression widget.bar2

Parameter Type Description
name undefined

The property to get.

Returns:undefined
getChildren()
Defined by dijit/_WidgetBase

Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent is this widget. Note that it does not return all descendants, but rather just direct children. Analogous to Node.childNodes, except containing widgets rather than DOMNodes.

The result intentionally excludes internally created widgets (a.k.a. supporting widgets) outside of this.containerNode.

Note that the array returned is a simple array. Application code should not assume existence of methods like forEach().

Returns:Array
getDescendants()
Defined by dijit/_Widget

Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode. This method should generally be avoided as it returns widgets declared in templates, which are supposed to be internal/hidden, but it's left here for back-compat reasons.

Returns:Array
getFooterHeight()

A function for obtaining the height of the footer node

Returns:undefined
getHeaderHeight()

A function for obtaining the height of the header node

Returns:undefined
getNodeChildrenHtml(dom)

Deprecated. Use dijit/_editor/html::getChildrenHtml() instead.

Parameter Type Description
dom DomNode
Returns:undefined
getNodeHtml(node)

Deprecated. Use dijit/_editor/html::_getNodeHtml() instead.

Parameter Type Description
node DomNode
Returns:undefined
getParent()
Defined by dijit/_WidgetBase

Returns the parent widget of this widget.

Returns:undefined
getValue(nonDestructive)

Return the current content of the editing area (post filters are applied). Users should call get('value') instead.

Parameter Type Description
nonDestructive Boolean
Optional

defaults to false. Should the post-filtering be run over a copy of the live DOM? Most users should pass "true" here unless they really know that none of the installed filters are going to mess up the editing session.

Returns:undefined
isFocusable()
Defined by dijit/_WidgetBase

Return true if this widget can currently be focused and false if not

Returns:undefined
isLeftToRight()
Defined by dijit/_WidgetBase

Return this widget's explicit or implicit orientation (true for LTR, false for RTL)

Returns:undefined
layout()
Defined by dijit/Editor

Called from dijit/layout/_LayoutWidget.resize(). This shouldn't be called directly

on(type,func)
Defined by dijit/_Widget
Parameter Type Description
type String | Function

protected

func Function
Returns:undefined
open(element)

Transforms the node referenced in this.domNode into a rich text editing node.

Sets up the editing area asynchronously. This will result in the creation and replacement with an iframe.

Parameter Type Description
element DomNode
Optional
own()
Defined by dijit/Destroyable

Track specified handles and remove/destroy them when this instance is destroyed, unless they were already removed/destroyed manually.

Returns:any | undefined

The array of specified handles, so you can do for example:

var handle = this.own(on(...))[0];
placeAt(reference,position)
Defined by dijit/_WidgetBase

Place this widget somewhere in the DOM based on standard domConstruct.place() conventions.

A convenience function provided in all _Widgets, providing a simple shorthand mechanism to put an existing (or newly created) Widget somewhere in the dom, and allow chaining.

Parameter Type Description
reference String | DomNode | DocumentFragment | dijit/_WidgetBase

Widget, DOMNode, DocumentFragment, or id of widget or DOMNode

position String | Int
Optional

If reference is a widget (or id of widget), and that widget has an ".addChild" method, it will be called passing this widget instance into that method, supplying the optional position index passed. In this case position (if specified) should be an integer.

If reference is a DOMNode (or id matching a DOMNode but not a widget), the position argument can be a numeric index or a string "first", "last", "before", or "after", same as dojo/dom-construct::place().

Returns:dijit/_WidgetBase | function

Provides a useful return of the newly created dijit._Widget instance so you can "chain" this function by instantiating, placing, then saving the return value to a variable.

Examples

Example 1

// create a Button with no srcNodeRef, and place it in the body:
var button = new Button({ label:"click" }).placeAt(win.body());
// now, 'button' is still the widget reference to the newly created button
button.on("click", function(e){ console.log('click'); }));

Example 2

// create a button out of a node with id="src" and append it to id="wrapper":
var button = new Button({},"src").placeAt("wrapper");

Example 3

// place a new button as the first element of some div
var button = new Button({ label:"click" }).placeAt("wrapper","first");

Example 4

// create a contentpane and add it to a TabContainer
var tc = dijit.byId("myTabs");
new ContentPane({ href:"foo.html", title:"Wow!" }).placeAt(tc)
placeCursorAtEnd()

Place the cursor at the end of the editing area.

placeCursorAtStart()

Place the cursor at the start of the editing area.

postCreate()
Defined by dijit/Editor
postMixInProperties()
Defined by dijit/Editor

Extension to make sure a deferred is in place before certain functions execute, like making sure all the plugins are properly inserted.

postscript(params,srcNodeRef)
Defined by dijit/_WidgetBase

Kicks off widget instantiation. See create() for details.

Parameter Type Description
params Object
Optional
srcNodeRef DomNode | String
queryCommandAvailable(command)

Tests whether a command is supported by the host. Clients SHOULD check whether a command is supported before attempting to use it, behaviour for unsupported commands is undefined.

Parameter Type Description
command String

The command to test for

Returns:undefined
queryCommandEnabled(cmd)
Defined by dijit/Editor

Returns true if specified editor command is enabled. Used by the plugins to know when to highlight/not highlight buttons.

Parameter Type Description
cmd undefined
Returns:boolean | undefined
queryCommandState(command)

Check the state of a given command and returns true or false.

Parameter Type Description
command undefined
Returns:boolean | undefined
queryCommandValue(command)

Check the value of a given command. This matters most for custom selections and complex values like font value setting.

Parameter Type Description
command undefined
Returns:boolean | undefined
redo()
Defined by dijit/Editor

Handler for editor redo (ex: ctrl-y) operation

Returns:boolean
removeStyleSheet(uri)

remove an external stylesheet for the editing area

Parameter Type Description
uri dojo/_base/url
replaceValue(html)
Defined by dijit/Editor

over-ride of replaceValue to support custom undo and stack maintenance.

Parameter Type Description
html String
resize(size)
Defined by dijit/Editor

Resize the editor to the specified size, see dijit/layout/_LayoutWidget.resize()

Parameter Type Description
size undefined
set(name,value)
Defined by dijit/_WidgetBase

Set a property on a widget

Sets named properties on a widget which may potentially be handled by a setter in the widget.

For example, if the widget has properties foo and bar and a method named _setFooAttr(), calling myWidget.set("foo", "Howdy!") would be equivalent to calling widget._setFooAttr("Howdy!") and myWidget.set("bar", 3) would be equivalent to the statement widget.bar = 3;

set() may also be called with a hash of name/value pairs, ex:

myWidget.set({
    foo: "Howdy",
    bar: 3
});

This is equivalent to calling set(foo, "Howdy") and set(bar, 3)

Parameter Type Description
name undefined

The property to set.

value undefined

The value to set in the property.

Returns:function | string

Set a property on a widget

setAttribute(attr,value)
Defined by dijit/_Widget

Deprecated. Use set() instead.

Parameter Type Description
attr String
value anything
setDisabled(disabled)

Deprecated, use set('disabled', ...) instead.

Parameter Type Description
disabled Boolean
setupDefaultShortcuts()

Add some default key handlers

Overwrite this to setup your own handlers. The default implementation does not use Editor commands, but directly executes the builtin commands within the underlying browser support.

setValue(html)

This function sets the content. No undo history is preserved. Users should use set('value', ...) instead.

Parameter Type Description
html String
startup()
Defined by dijit/Editor
subscribe(t,method)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.

Subscribes to the specified topic and calls the specified method of this object and registers for unsubscribe() on widget destroy.

Provide widget-specific analog to dojo.subscribe, except with the implicit use of this widget as the target object.

Parameter Type Description
t String

The topic

method Function

The callback

Returns:undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
toString()
Defined by dijit/_WidgetBase

Returns a string that represents the widget.

When a widget is cast to a string, this method will be used to generate the output. Currently, it does not implement any sort of reversible serialization.

Returns:string
undo()
Defined by dijit/Editor

Handler for editor undo (ex: ctrl-z) operation

Returns:boolean
uninitialize()
Defined by dijit/_WidgetBase

Deprecated. Override destroy() instead to implement custom widget tear-down behavior.

Returns:boolean
unsubscribe(handle)
Defined by dijit/_WidgetBase

Deprecated, will be removed in 2.0, use handle.remove() instead.

Unsubscribes handle created by this.subscribe. Also removes handle from this widget's list of subscriptions

Parameter Type Description
handle Object
watch(name,callback)
Defined by dojo/Stateful

Watches a property for changes

Parameter Type Description
name String
Optional

Indicates the property to watch. This is optional (the callback may be the only parameter), and if omitted, all the properties will be watched

callback Function

The function to execute when the property changes. This will be called after the property has been changed. The callback will be called with the |this| set to the instance, the first argument as the name of the property, the second argument as the old value and the third argument as the new value.

Returns:any | object

An object handle for the watch. The unwatch method of this object can be used to discontinue watching this property:

var watchHandle = obj.watch("foo", callback);
watchHandle.unwatch(); // callback won't be called now

Events

_onBlur()
Defined by: dijit/Editor

Called from focus manager when focus has moved away from this editor

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onFocus(e)

Called from focus manager when focus has moved into this editor

Parameter Type Description
e Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onIEMouseDown(e)
Defined by: dijit/Editor

IE only to prevent 2 clicks to focus

Parameter Type Description
e Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onMap(type)
Defined by: dijit/_WidgetBase

Maps on() type parameter (ex: "mousemove") to method name (ex: "onMouseMove"). If type is a synthetic event like touch.press then returns undefined.

Parameter Type Description
type String | Function
Returns:undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
_onShow()
Defined by: dijit/_Widget

Internal method called when this widget is made visible. See onShow for details.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onBeforeActivate()
Defined by: dijit/Editor

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onBeforeDeactivate(e)
Defined by: dijit/Editor

Called on IE right before focus is lost. Saves the selected range.

Parameter Type Description
e undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onBlur()
Defined by: dijit/_FocusMixin

Called when the widget stops being "active" because focus moved to something outside of it, or the user clicked somewhere outside of it, or the widget was hidden.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onChange(newContent)

This is fired if and only if the editor loses focus and the content is changed.

Parameter Type Description
newContent undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onClick()
Defined by: dijit/Editor

Handler for when editor is clicked

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onClose()
Defined by: dijit/_Widget

Called when this widget is being displayed as a popup (ex: a Calendar popped up from a DateTextBox), and it is hidden. This is called from the dijit.popup code, and should not be called directly.

Also used as a parameter for children of dijit/layout/StackContainer or subclasses. Callback if a user tries to close the child. Child will be closed if this function returns true.

Returns:boolean

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onDblClick(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of mouse double click events.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onDisplayChanged(e)

This event will be fired every time the display context changes and the result needs to be reflected in the UI.

If you don't want to have update too often, onNormalizedDisplayChanged should be used instead

Parameter Type Description
e Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onFocus()
Defined by: dijit/_FocusMixin

Called when the widget becomes "active" because it or a widget inside of it either has focus, or has recently been clicked.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onHide()
Defined by: dijit/_Widget

Called when another widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Also called to indicate hide of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyDown(e)
Defined by: dijit/Editor

Handler for onkeydown event.

Parameter Type Description
e undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyPress(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of printable keys being typed.

Parameter Type Description
event undefined

key Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyPressed()

Handler for after the user has pressed a key, and the display has been updated. (Runs on a timer so that it runs after the display is updated)

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onKeyUp(e)

Handler for onkeyup event

Parameter Type Description
e undefined

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onLoad(html)

Handler after the iframe finishes loading.

Parameter Type Description
html String

Editor contents should be set to this value

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseDown(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse button is pressed down.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseEnter(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves onto this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseLeave(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves off of this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseMove(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseOut(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseOver(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onMouseUp(event)
Defined by: dijit/_Widget

Connect to this function to receive notifications of when the mouse button is released.

Parameter Type Description
event undefined

mouse Event

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onNormalizedDisplayChanged()

This event is fired every updateInterval ms or more

If something needs to happen immediately after a user change, please use onDisplayChanged instead.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
onShow()
Defined by: dijit/_Widget

Called when this widget becomes the selected pane in a dijit/layout/TabContainer, dijit/layout/StackContainer, dijit/layout/AccordionContainer, etc.

Also called to indicate display of a dijit.Dialog, dijit.TooltipDialog, or dijit.TitlePane.

Examples

Example 1

var btn = new Button();
// when /my/topic is published, this button changes its label to
// be the parameter of the topic.
btn.subscribe("/my/topic", function(v){
    this.set("label", v);
});
Error in the documentation? Can’t find what you are looking for? Let us know!