// find the textare of the current page and add a a link to show the html editor dialog var ta = find_my_ta(); Ext.DomHelper.insertAfter(ta, { tag: 'p', html: 'html edit' }); // the editor dialog var ed = new Ext.Window({ layout:'fit', width:500, height:300, closeAction:'hide', maximizable: true, plain: true, items: new Perlmonks.HtmlEditor({ id: 'html_editor' }), buttons: new Array ( { text:'Ok', handler: function(){ ta.value = Ext.getCmp('html_editor').getValue(); ed.hide(); } }, { text: 'Cancel', handler: function(){ ed.hide(); } } ) }); ed.on('show', function(){ Ext.getCmp('html_editor').setValue(ta.value); }); Ext.get('show_html_edit').dom.onclick = function (event) { try { ed.show(); } catch (e) { alert(e); } return false; };