Académique Documents
Professionnel Documents
Culture Documents
5
Simple Use Case: YAHOO.widget.Editor Interesting Moments in Rich Text Editor & Toolbar YAHOO.widget.Editor:
See online docs for complete list of Rich Text Editor and Toolbar events. Methods
Markup: Event Fires...
<body class="yui-skin-sam"> render() Causes the toolbar and the
editorContentLoaded Fires after the editor iframe’s document fully loads. editor to render and replace the textarea.
<textarea id="msgpost">Preloaded HTML goes here. editorMouseUp, Fires in response to the corresponding Dom event.
setEditorHTML(string html)
editorMouseDown,
</textarea> editorDoubleClick, Loads HTML into the editor’s body.
</body> editorKeyUp, getEditorHTML() Returns the
editorKeyDown unprocessed HTML from the editor.
Script: beforeExecCommand, Fires at the beginning/end of the execCommand process.
saveHTML() Cleans the HTML
afterExecCommand Reference YAHOO.util.Element.html#addListener for more details.
var oEditor = new YAHOO.widget.Editor('msgpost', beforeOpenWindow, Fires before/after an editor window is opened. with the cleanHTML method and places
{ afterOpenWindow the string into the textarea.
height: '300px', closeWindow Fires after an editor window is closed. cleanHTML(string html)
toolbarExpanded, Fires when toolbar is expanded/collapsed via the collapse button. Processes the HTML with a few regexes
width: '500px' toolbarCollapsed to clean it up and stabilize the output.
}); buttonClick Fires when a toolbar button receives a click event. clearEditorDoc() Clears the
oEditor.render(); All Editor events are Custom Events (see Element docs); subscribe to these events using editor doc.
their subscribe method: oEditor.on(‘afterNodeChange’,fnMyHandler);. destroy() Destroys the editor along
Creates an Editor instance with default configurations. with all of its elements and objects.