2012-04-12 98 views
0

当双击该行或者单击“编辑”按钮并选择一行时,我通过数据行中的数据填充YUI RTE。 IE和FF的执行效果与预期的一样,但Chrome填充了html内容(我通过在chrome的检查el功能中进行调试了解到这一点),然后几毫秒后它就会将其擦除。有什么建议么??YUI 2.9.0 Chrome中的富文本编辑器填充,然后删除编辑器HTML

这里是我如何构建YUI RTE

function CreateRTE() { 

    //create the RTE: 
    emailEditor = new YAHOO.widget.Editor('txtEmlBody', { width: '468px', height: '200px' }); 

    //After the Editor renders it, we will hide it so the iframe doesn't bleed through 
    emailEditor.on('afterRender', emailEditor.hide); 

    //Add the insert token button when the toolbar is loaded 
    emailEditor.on('toolbarLoaded', function() { 

     //Create the button configuration 
     var config = { type: 'menu', label: 'Insert Token', value: 'inserttoken', menu: tokenMenu }; 

     //Add the button to the toolbar 
     emailEditor.toolbar.addButtonToGroup(config, 'insertitem'); 

     //Add the event handler for a menu item click 
     emailEditor.toolbar.on('inserttokenClick', function (ev) { this.execCommand('inserthtml', ev.button.value); }, emailEditor, true); 

    }); 

    //render the editor explicitly into a container within the Dialog's DOM: 
    emailEditor.render(); 


} 

这里就是我如何填充RTE当行被双击或者选择一个行单击编辑按钮。

function EditEmail() { 

    //Get the record from the datatable 
    var dt = grids.tblEmails.dataTable; 
    var tr = dt.getSelectedRows()[0]; 
    var row = dt.getRecord(tr); 

    //Populate the form 
    YAHOO.util.Dom.get('hidEmlId').value = row.getData('ID'); 
    YAHOO.util.Dom.get('hidEmlType').value = row.getData('Type'); 
    YAHOO.util.Dom.get('txtEmlSubject').value = row.getData('Title'); 

    emailEditor.setEditorHTML(row.getData('Body')); 

    //Show the dialog 
    dialogs.dlgEmail.show(); 

} 

我的确看过this这篇文章,但是这个问题似乎并不符合。 HTML编辑器的上下文正在填充,然后删除.... sooo,任何帮助将非常感激。

回答

2

尝试在设置编辑器的html (emailEditor.setEditorHTML(row.getData('Body'));)之前使用html (row.getData('Body')),更新编辑器的支持文本区域。这应该允许它在Chrome/Safari中工作。

+1

你是个天才。谢谢。 – wakurth 2012-04-13 14:24:12