javascript - How can I apply a @media print style to a ckeditor instance? -
i have tried defining @media style in page external file passing ckeditor in config neither seems have effect when click print button in toolbar.
this example (framed) should give ideas (jsfiddle):
ckeditor.replace( 'editor', { plugins: 'toolbar,wysiwygarea,sourcearea,print,basicstyles', on: { // when ckeditor dom loaded, append stuff <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 ); } } } );
Comments
Post a Comment