Ckeditor 在新窗口中以html格式查看编辑器内容

Ckeditor 在新窗口中以html格式查看编辑器内容,ckeditor,Ckeditor,单击编辑器旁边的按钮时,如何在新模式窗口中以html形式查看编辑器内容。 下面是html <img src="Image/icons/preview.png" alt="Preview" id="img1" class="preview" /> <textarea rows="30" cols="22" id="txtHtmlHead" class="editor"></textarea> 上述文本区域的行为类似于

单击编辑器旁边的按钮时,如何在新模式窗口中以html形式查看编辑器内容。 下面是html

 <img  src="Image/icons/preview.png" alt="Preview" id="img1" class="preview"  />

                <textarea rows="30" cols="22" id="txtHtmlHead" class="editor"></textarea>

上述文本区域的行为类似于ckeditor


请帮帮我。

您可以使用
window.open()
和一个棘手的
url
来执行此操作():

该功能也是由官方提供的,因此您可能会发现它很有趣

CKEDITOR.replace( 'editor', {
    plugins: 'sourcearea,wysiwygarea,toolbar,basicstyles',
    height: 100
} );

// Executen on button click.
function show() {
    var url = 'javascript:void( function(){' +
        'document.open();' +    
        // Note that you may need to escape HTML entities here:
        'document.write( "' + CKEDITOR.instances.editor.getData() + '" );' +
        'document.close();' +
    '})()';    

    window.open( url );
}