0

行がダブルクリックされるか、[編集]ボタンがクリックされて行が選択されたときに、データ行からのデータを介してYUIRTEにデータを入力しています。IEとFFは期待どおりに動作しますが、Chromeはhtmlコンテンツを入力し(これはchromeのinspect el機能でのデバッグからわかります)、数ミリ秒後に消去されます。助言がありますか??

これが私がYUIRTEを構築する方法です

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エディタのコンテキストが入力され、その後削除されています....すっごく、どんな助けでも大歓迎です。

4

1 に答える 1

2

( row.getData('Body') ),エディターの html を設定する前に、エディターのバッキング テキスト領域を html で更新してみてください(emailEditor.setEditorHTML(row.getData('Body'));)。これにより、Chrome/Safari で動作するようになります。

于 2012-04-13T13:39:04.113 に答える