Chrome 中的 YUI 2.9.0 富文本编辑器填充,然后删除 editorHTML

YUI 2.9.0 Rich Text Editor in Chrome Populates, then removes editorHTML

本文关键字:填充 编辑器 然后 editorHTML 删除 文本编辑 文本 YUI 中的 Chrome      更新时间:2023-09-26

当双击行或单击"编辑"按钮并选择一行时,我正在通过数据行中的数据填充 YUI RTE。IE和FF按预期执行,但Chrome填充了html内容(我从chrome的检查el功能中的调试中知道这一点),然后几毫秒后,它会删除它。有什么建议吗??

以下是我构建 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();
}

我确实读过这篇文章,但问题似乎不匹配。正在填充 html 编辑器的上下文,然后删除...。因此,任何帮助将不胜感激。

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