YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

editor  2.5.0

Yahoo! UI Library > editor > YAHOO.widget.Editor

Show Private Show Protected

Class YAHOO.widget.Editor - extends YAHOO.widget.SimpleEditor

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

_alwaysDisabled - private Object

The Toolbar items that should ALWAYS be disabled event if there is a selection present in the editor.

_alwaysEnabled - private Object

The Toolbar items that should ALWAYS be enabled event if there isn't a selection present in the editor.

_disabled - private Array

The Toolbar items that should be disabled if there is no selection present in the editor.

CLASS_HIDDEN - protected String

CSS class applied to the body when the hiddenelements button is pressed.

CLASS_LOCAL_FILE - protected String

CSS class applied to an element when it's found to have a local url.

STR_BEFORE_EDITOR - String

The accessibility string for the element before the iFrame

STR_CLOSE_WINDOW - String

The Title of the close button in the Editor Window

STR_CLOSE_WINDOW_NOTE - String

A note appearing in the Editor Window to tell the user that the Escape key will close the window

STR_IMAGE_BORDER - String

The label string for the image border.

STR_IMAGE_COPY - String

The label string for the image copy and paste message for Opera and Safari

STR_IMAGE_ORIG_SIZE - String

The label string for Original Image Size

STR_IMAGE_PADDING - String

The label string for the image padding.

STR_IMAGE_PROP_TITLE - String

The title for the Image Property Editor Window

STR_IMAGE_SIZE - String

The label string for Image Size

STR_IMAGE_TEXTFLOW - String

The label string for the image text flow.

STR_IMAGE_TITLE - String

The label string for Image Description

STR_IMAGE_URL - String

The label string for Image URL

STR_LINK_NEW_WINDOW - String

The string for the open in a new window label.

STR_LINK_PROP_REMOVE - String

The label string for the Remove link from text link inside the property editor.

STR_LINK_PROP_TITLE - String

The label string for the Link Property Editor Window.

STR_LINK_TITLE - String

The string for the link description.

STR_LOCAL_FILE_WARNING - String

The label string for the local file warning.

Properties inherited from YAHOO.util.Element:

Properties inherited from YAHOO.util.AttributeProvider:

Methods

_cleanClassName

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

_closeWindow

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

_fixNodes

private void _fixNodes ( )
Fix href and imgs as well as remove invalid HTML.
Returns: void

_handleCreateLinkWindowClose

private void _handleCreateLinkWindowClose ( )
Handles the closing of the Link Properties Window.
Returns: void

_handleInsertImageClick

private void _handleInsertImageClick ( )
Opens the Image Properties Window when the insert Image button is clicked or an Image is Double Clicked.
Returns: void

_handleInsertImageWindowClose

private void _handleInsertImageWindowClose ( )
Handles the closing of the Image Properties Window.
Returns: void

_handleKeyDown

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

_renderPanel

private YAHOO.widget.Overlay _renderPanel ( )
Renders the panel used for Editor Windows to the document so we can start using it..

closeWindow

void closeWindow ( )
Close the currently open EditorWindow.
Returns: void

cmd_heading

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

cmd_hiddenelements

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

cmd_indent

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

cmd_outdent

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

cmd_removeformat

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

cmd_script

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

cmd_subscript

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

cmd_superscript

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

init

void init ( )
The Editor class' initialization method
Returns: void

initAttributes

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

moveWindow

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

openWindow

void openWindow ( win )
Opens a new "window/panel"
Parameters:
win <YAHOO.widget.EditorWindow> A YAHOO.widget.EditorWindow instance
Returns: void

toString

String toString ( )
Returns a string representing the editor.
Returns: String

Events

beforeHiddencssChange

beforeHiddencssChange ( 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.

beforeLocalfilewarningChange

beforeLocalfilewarningChange ( 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.

hiddencssChange

hiddencssChange ( 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.

localFileWarningChange

localFileWarningChange ( 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.

Configuration Attributes

hiddencss - String

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;
}

localFileWarning - Boolean

Should we throw the warning if we detect a file that is local to their machine?
Default Value: true

Configuration attributes inherited from YAHOO.util.Element:


Copyright © 2007 Yahoo! Inc. All rights reserved.