The Rich Text Editor is a UI control that replaces a standard HTML textarea; it allows for the rich formatting of text content, including common structural treatments like lists, formatting treatments like bold and italic text, and drag-and-drop inclusion and sizing of images. The Rich Text Editor's toolbar is extensible via a plugin architecture so that advanced implementations can achieve a high degree of customization.
Constructor
YAHOO.widget.Editor
(
el
,
attrs
)
- Parameters:
-
el
<String/HTMLElement>
The textarea element to turn into an editor.
-
attrs
<Object>
Object liternal containing configuration parameters.
Properties
The Toolbar items that should ALWAYS be disabled event if there is a selection present in the editor.
The Toolbar items that should ALWAYS be enabled event if there isn't a selection present in the editor.
The Toolbar items that should be disabled if there is no selection present in the editor.
CSS class applied to the body when the hiddenelements button is pressed.
CSS class applied to an element when it's found to have a local url.
The accessibility string for the element before the iFrame
The Title of the close button in the Editor Window
A note appearing in the Editor Window to tell the user that the Escape key will close the window
The label string for the image border.
The label string for the image copy and paste message for Opera and Safari
The label string for Original Image Size
The label string for the image padding.
The title for the Image Property Editor Window
The label string for Image Size
The label string for the image text flow.
The label string for Image Description
The label string for Image URL
The string for the open in a new window label.
The label string for the Remove link from text link inside the property editor.
The label string for the Link Property Editor Window.
The string for the link description.
The label string for the local file warning.
_alwaysDisabled,
_alwaysEnabled,
_baseHREF,
_blankImageLoaded,
_contentTimer,
_contentTimerCounter,
_defaultCSS,
_defaultToolbar,
_disabled,
_docType,
_fixNodesTimer,
_lastButton,
_lastImage,
_lastNodeChange,
_lastNodeChangeEvent,
_mask,
_nodeChangeTimer,
_rendered,
_selection,
_semantic,
_showingHiddenElements,
_tag2cmd,
afterElement,
beforeElement,
browser,
CLASS_CONTAINER,
CLASS_EDITABLE,
CLASS_EDITABLE_CONT,
CLASS_NOEDIT,
CLASS_PREFIX,
currentElement,
currentEvent,
currentFont,
currentWindow,
dompath,
DOMReady,
EDITOR_PANEL_ID,
editorDirty,
el,
invalidHTML,
operaEvent,
sel,
SEP_DOMPATH,
STOP_EXEC_COMMAND,
STOP_NODE_CHANGE,
STR_BEFORE_EDITOR,
STR_IMAGE_HERE,
STR_LEAVE_EDITOR,
STR_LINK_URL,
STR_TITLE,
toolbar
Methods
private
String
_cleanClassName
(
str
)
Makes a useable classname from dynamic data, by dropping it to lowercase and replacing spaces with -'s.
- Parameters:
-
str <String>
The classname to clean up
- Returns:
String
private
void
_closeWindow
(
ev
)
Close the currently open EditorWindow with the Escape key.
- Parameters:
-
ev <Event>
The keypress Event that we are trapping
- Returns:
void
private
void
_fixNodes
(
)
Fix href and imgs as well as remove invalid HTML.
private
void
_handleCreateLinkWindowClose
(
)
Handles the closing of the Link Properties Window.
private
void
_handleInsertImageClick
(
)
Opens the Image Properties Window when the insert Image button is clicked or an Image is Double Clicked.
private
void
_handleInsertImageWindowClose
(
)
Handles the closing of the Image Properties Window.
private
void
_handleKeyDown
(
ev
)
Override method that handles some new keydown events inside the iFrame document.
- Parameters:
-
ev <Event>
The event we are working on.
- Returns:
void
private
YAHOO.widget.Overlay
_renderPanel
(
)
Renders the panel used for Editor Windows to the document so we can start using it..
void
closeWindow
(
)
Close the currently open EditorWindow.
void
cmd_heading
(
value
)
This is an execCommand override method. It is called from execCommand when the execCommand('heading') is used.
- Parameters:
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
cmd_hiddenelements
(
value
)
This is an execCommand override method. It is called from execCommand when the execCommand('hiddenelements') is used.
- Parameters:
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
cmd_indent
(
value
)
This is an execCommand override method. It is called from execCommand when the execCommand('indent') is used.
- Parameters:
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
cmd_outdent
(
value
)
This is an execCommand override method. It is called from execCommand when the execCommand('outdent') is used.
- Parameters:
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
cmd_removeformat
(
value
)
This is an execCommand override method. It is called from execCommand when the execCommand('removeformat') is used.
- Parameters:
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
cmd_script
(
action
,
value
)
This is a combined execCommand override method. It is called from the cmd_superscript and cmd_subscript methods.
- Parameters:
-
action <object>
action passed from the execCommand method
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
cmd_subscript
(
value
)
This is an execCommand override method. It is called from execCommand when the execCommand('subscript') is used.
- Parameters:
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
cmd_superscript
(
value
)
This is an execCommand override method. It is called from execCommand when the execCommand('superscript') is used.
- Parameters:
-
value <object>
Value passed from the execCommand method
- Returns:
void
void
init
(
)
The Editor class' initialization method
void
initAttributes
(
attr
)
Initializes all of the configuration attributes used to create
the editor.
- Parameters:
-
attr <Object>
Object literal specifying a set of
configuration attributes used to create the editor.
- Returns:
void
void
moveWindow
(
force
)
Realign the window with the currentElement and reposition the knob above the panel.
- Parameters:
-
force <Boolean>
Boolean to tell it to move but not use any animation (Usually done the first time the window is loaded.)
- Returns:
void
void
openWindow
(
win
)
Opens a new "window/panel"
String
toString
(
)
Returns a string representing the editor.
_checkLoaded, _cleanClassName, _cleanIncomingHTML, _closeWindow, _createCurrentElement, _createIframe, _disableEditor, _fixNodes, _focusWindow, _getBlankImage, _getDoc, _getDomPath, _getRange, _getSelectedElement, _getSelection, _getWindow, _handleAfterNodeChange, _handleAlign, _handleClick, _handleColorPicker, _handleCreateLinkClick, _handleCreateLinkWindowClose, _handleDoubleClick, _handleFontSize, _handleInsertImageClick, _handleInsertImageWindowClose, _handleKeyDown, _handleKeyPress, _handleKeyUp, _handleMouseDown, _handleMouseUp, _handleToolbarClick, _hasParent, _hasSelection, _initEditor, _isElement, _isLocalFile, _isNonEditable, _listFix, _renderPanel, _selectNode, _setCurrentEvent, _setDesignMode, _setEditorStyle, _setInitialContent, _setMarkupType, _setupAfterElement, _swapEl, _toggleDesignMode, _updateMenuChecked, _writeDomPath, cleanHTML, clearEditorDoc, closeWindow, cmd_backcolor, cmd_createlink, cmd_fontname, cmd_fontsize, cmd_forecolor, cmd_inserthtml, cmd_insertimage, cmd_insertorderedlist, cmd_insertunorderedlist, cmd_list, cmd_unlink, destroy, execCommand, filter_all_rgb, filter_internals, filter_invalid_lists, filter_rgb, filter_safari, getEditorHTML, hide, init, initAttributes, moveWindow, nodeChange, openWindow, post_filter_linebreaks, pre_filter_linebreaks, render, saveHTML, setEditorHTML, show, toString
_registerHTMLAttr, addClass, addListener, appendChild, appendTo, fireQueue, getElementsByClassName, getElementsByTagName, getStyle, hasChildNodes, hasClass, initAttributes, insertBefore, on, removeChild, removeClass, removeListener, replaceChild, replaceClass, setStyle, subscribe
configureAttribute, fireBeforeChangeEvent, fireChangeEvent, get, getAttributeConfig, getAttributeKeys, refresh, register, resetAttributeConfig, resetValue, set, setAttributeConfig, setAttributes
Events
beforeHiddencssChangeEvent
(
eventInfo
)
Fires before the value for the configuration attribute 'hiddencss' changes. Return false to cancel the attribute change.
- Parameters:
-
eventInfo <{oldValue: any, newValue: any}>
An object containing the current attribute value and the new value.
beforeLocalfilewarningChangeEvent
(
eventInfo
)
Fires before the value for the configuration attribute 'localFileWarning' changes. Return false to cancel the attribute change.
- Parameters:
-
eventInfo <{oldValue: any, newValue: any}>
An object containing the current attribute value and the new value.
hiddencssChangeEvent
(
eventInfo
)
Fires when the value for the configuration attribute 'hiddencss' changes.
- Parameters:
-
eventInfo <{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
localFileWarningChangeEvent
(
eventInfo
)
Fires when the value for the configuration attribute 'localFileWarning' changes.
- Parameters:
-
eventInfo <{oldValue: any, newValue: any}>
An object containing the previous attribute value and the new value.
afterExecCommand, afterNodeChange, afterRender, animateChangeEvent, beforeAnimateChangeEvent, beforeBlankimageChangeEvent, beforeCssChangeEvent, beforeDisabledChangeEvent, beforeDompathChangeEvent, beforeExecCommand, beforeExtracssChangeEvent, beforeFocusatstartChangeEvent, beforeHandlesubmitChangeEvent, beforeHeightChangeEvent, beforeHtmlChangeEvent, beforeMarkupChangeEvent, beforeNodeChange, beforeRemovelinebreaksChangeEvent, beforeToolbarChangeEvent, beforeWidthChangeEvent, blankimageChangeEvent, cleanHTML, cssChangeEvent, disabledChangeEvent, dompathChangeEvent, editorContentLoaded, editorDoubleClick, editorKeyDown, editorKeyPress, editorKeyUp, editorMouseDown, editorMouseUp, extracssChangeEvent, focusAtStartChangeEvent, handleSubmitChangeEvent, heightChangeEvent, htmlChangeEvent, markupChangeEvent, removeLineBreaksChangeEvent, toolbarChangeEvent, toolbarLoaded, widthChangeEvent,
Configuration Attributes
The CSS used to show/hide hidden elements on the page, these rules must be prefixed with the class provided in this.CLASS_HIDDEN
Default Value:
.yui-hidden font, .yui-hidden strong, .yui-hidden b, .yui-hidden em, .yui-hidden i, .yui-hidden u, .yui-hidden div, .yui-hidden p, .yui-hidden span, .yui-hidden img, .yui-hidden ul, .yui-hidden ol, .yui-hidden li, .yui-hidden table {
border: 1px dotted #ccc;
}
.yui-hidden .yui-non {
border: none;
}
.yui-hidden img {
padding: 2px;
}
Should we throw the warning if we detect a file that is local to their machine?
Default Value: true
allowNoEdit, animate, blankimage, css, disabled, dompath, editor_wrapper, element_cont, extracss, focusAtStart, handleSubmit, height, html, iframe, limitCommands, markup, nodeChangeThreshold, panel, removeLineBreaks, textarea, toolbar, toolbar_cont, width,