ContentEditable Class
Creates a component to work with an elemment.
Constructor
ContentEditable
()
Item 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:
_getHostValue
-
The
Retrieves a value from host attribute
Parameters:
-
The
Attrattribute which value should be returned from the host
_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
-
String
Set's the dir (language direction) attribute on the container.
Parameters:
-
String
ValueThe language direction
Returns:
_setExtraCSS
-
String
Set's the extra CSS on the instance.
Parameters:
-
String
CssThe 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
-
String
Set's the language value on the instance.
Parameters:
-
String
ValueThe language to be set
Returns:
_setLinkedCSS
-
String
Set's the linked CSS on the instance.
Parameters:
-
String
CssThe linkedcss value
Returns:
_validateLinkedCSS
()
private
Validates linkedcss property
delegate
-
type
-
fn
-
cont
-
sel
A delegate method passed to the instance's delegate method
Parameters:
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
NS
String
static
The namespace on which ContentEditable plugin will reside.
Default: 'contentEditable'
Attributes
container
String/HTMLElement/Node
The container to set contentEditable=true or to create on render.
Fires event containerChange
Fires when the value for the configuration attribute container
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
content
String
The string to inject as Editor content. Default '
'
Fires event contentChange
Fires when the value for the configuration attribute content
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
defaultblock
String
The default tag to use for block level items, defaults to: p
Fires event defaultblockChange
Fires when the value for the configuration attribute defaultblock
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
dir
String
The default text direction for this ContentEditable element. Default: ltr
Fires event dirChange
Fires when the value for the configuration attribute dir
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
extracss
String
A string of CSS to add to the Head of the Editor
Fires event extracssChange
Fires when the value for the configuration attribute extracss
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
id
String
Set the id of the new Node. (optional)
Fires event idChange
Fires when the value for the configuration attribute id
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
lang
String
The default language. Default: en-US
Fires event langChange
Fires when the value for the configuration attribute lang
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
linkedcss
String | Array
An array of url's to external linked style sheets
Fires event linkedcssChange
Fires when the value for the configuration attribute linkedcss
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
node
Node
The Node instance of the container.
Fires event nodeChange
Fires when the value for the configuration attribute node
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
use
Array
Array of modules to include in the scoped YUI instance at render time. Default: ['node-base', 'editor-selection', 'stylesheet']
Fires event useChange
Fires when the value for the configuration attribute use
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added: