How Can I Apply A @media Print Style To A Ckeditor Instance?
I have tried defining a @media style in the page as well as the external file that I am passing ckeditor in the config but neither seems to have any effect when I click the print b
Solution 1:
This example (framed) should give you some ideas (jsFiddle):
CKEDITOR.replace( 'editor', {
plugins: 'toolbar,wysiwygarea,sourcearea,print,basicstyles',
on: {
// When CKEditor DOM is loaded, append stuff to <head>.
contentDom: function() {
var doc = this.document,
head = doc.getHead();
// Via <link> tag.
doc.createElement( 'link', {
attributes: {
rel: 'stylesheet',
type: 'text/css',
href: 'print.css',
media: 'print'
}
} ).appendTo( head );
// Via <style> tag.
var style = doc.createElement( 'style', {
attributes: {
type: 'text/css'
}
} );
style.setText( '@media print { * { color: red } }' );
style.appendTo( head );
}
}
} );
Post a Comment for "How Can I Apply A @media Print Style To A Ckeditor Instance?"