YUI().use('editor', 'console', function(Y) {
(new Y.Console().render( "#console" ));
Y.log('Interact with the Editor.');
var logFn = function(e) {
var node = e.changedNode, tag;
if (node) {
tag = node.get('tagName').toLowerCase();
Y.log('nodeChange Event: ' + e.changedType + ' on (' + tag + ')');
}
};
//Create the Base Editor
var editor = new Y.EditorBase({
content: '<p><b>This is <i class="foo">a test</i></b></p><p><b style="color: red; font-family: Comic Sans MS">This is <span class="foo">a test</span></b></p>',
extracss: '.foo { font-weight: normal; color: black; background-color: yellow; }'
});
editor.on('nodeChange', logFn);
//Rendering the Editor.
editor.render('#editor');
});