ContentEditable Class
yui3/src/editor/js/content-editable.js:2
Parent Module: editor
Creates a component to work with an elemment.
Constructor
ContentEditable
()
Index
Methods
- _defReadyFn
- _DOMPaste
- _getDefaultBlock
- _getDir
- _getExtraCSS
- _getHostValue
- _getHTML
- _instanceLoaded
- _onContentReady on the internal instance so that the modules are loaded properly.
- _onDomEvent
- _setDir
- _setExtraCSS
- _setHTML
- _setLang
- _setLinkedCSS
- _validateLinkedCSS
- delegate
- destructor
- focus
- getInstance
- hide
- initializer
- render
- show
- use
Properties
- _instance
- _rendered
- DOM_EVENTS static
- HTML static
- NAME static
- NS static
- THROTTLE_TIME static
Methods
_defReadyFn
()
private
Binds DOM events and fires the ready event
_DOMPaste
-
e
Simple pass thru handler for the paste event so we can do content cleanup
Parameters:
_getDefaultBlock
()
String
private
Retrieves defaultblock value from host attribute
Returns:
_getDir
()
String
private
Retrieves dir value from host attribute
Returns:
_getExtraCSS
()
String
private
Retrieves extracss value from host attribute
Returns:
_getHostValue
-
The
Retrieves a value from host attribute
Parameters:
-
The
Attrattribute which value should be returned from the host
Returns:
_getHTML
-
html
Get the content from the container
Parameters:
-
html
StringThe raw HTML from the container.
Returns:
_instanceLoaded
-
inst
Called from the first YUI instance that sets up the internal instance. This loads the content into the ContentEditable element and attaches the contentready event.
Parameters:
-
inst
YUIThe internal YUI instance bound to the ContentEditable element
_onContentReady
on the internal instance so that the modules are loaded properly.
()
private
Called once the content is available in the ContentEditable element and calls the final use call
_onDomEvent
-
e
Generic handler for all DOM events fired by the Editor container. This handler takes the current EventFacade and augments it to fire on the ContentEditable host. It adds two new properties to the EventFacade called frameX and frameY which adds the scroll and xy position of the ContentEditable element to the original pageX and pageY of the event so external nodes can be positioned over the element. In case of ContentEditable element these will be equal to pageX and pageY of the container.
Parameters:
_setDir
-
value
Sets the dir (language direction) attribute on the container.
Parameters:
-
value
StringThe language direction
Returns:
_setExtraCSS
-
css
Set's the extra CSS on the instance.
Parameters:
-
css
StringThe CSS style to be set as extra css
Returns:
_setHTML
-
html
Set the content of the container
Parameters:
-
html
StringThe raw HTML to set to the container.
Returns:
_setLang
-
value
Sets the language value on the instance.
Parameters:
-
value
StringThe language to be set
Returns:
_setLinkedCSS
-
css
Sets the linked CSS on the instance.
Parameters:
-
css
StringThe linkedcss value
Returns:
_validateLinkedCSS
()
private
Validates linkedcss property
delegate
-
type
-
fn
-
cont
-
sel
A delegate method passed to the instance's delegate method
Parameters:
-
type
StringThe type of event to listen for
-
fn
FunctionThe method to attach
-
cont
String, NodeThe container to act as a delegate, if no "sel" passed, the container is assumed.
-
sel
StringThe selector to match in the event (optional)
Returns:
The Event handle returned from Y.delegate
destructor
()
protected
Destroys the instance.
focus
-
fn
Set the focus to the container
Parameters:
-
fn
FunctionCallback function to execute after focus happens
Returns:
getInstance
()
YUI
Get a reference to the internal YUI instance.
Returns:
The internal YUI instance
initializer
()
protected
Initializes the ContentEditable instance
render
-
node
Parameters:
-
node
String/HTMLElement/NodeThe node to render to
Returns:
use
()
This is a scoped version of the normal YUI.use method & is bound to the ContentEditable element At setup, the inst.use method is mapped to this method.
Properties
_rendered
Boolean
private
Internal reference set when render is called.
DOM_EVENTS
Object
static
The DomEvents that the frame automatically attaches and bubbles
HTML
String
static
The template string used to create the ContentEditable element
NAME
String
static
The name of the class (contentEditable)
NS
String
static
The namespace on which ContentEditable plugin will reside.
Default: 'contentEditable'