Reputation: 825
How to view ckeditor content as html in new modal window when a button is clicked which is placed beside the editor. below is the html
<img src="Image/icons/preview.png" alt="Preview" id="img1" class="preview" />
<textarea rows="30" cols="22" id="txtHtmlHead" class="editor"></textarea>
The above textarea behaves as a ckeditor .
Please help me..
Upvotes: 0
Views: 793
Reputation: 15895
You can use window.open()
with a tricky url
to do that (fiddle):
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 );
}
Such feature is also provided by the official Preview plugin so you might find it interesting.
Upvotes: 0