我已经使用contentsCss
选项将CSS文件路径传递给了我的CKEditor实例,效果很好。但是,我需要能够动态添加更多我无法在CSS文件中添加的样式。在版本3中,看起来可以使用addCss
函数(see this forum post)。不幸的是,这似乎不适用于版本4(see this forum post)。有没有人有其他选择?我正在使用jQuery适配器,因此使用任一API的解决方案都可以使用。
答案 0 :(得分:0)
我认为你可以做点什么
$(window).on('print',function(e){
e.preventDefault();
var styles = '<style>'+/*calculation of styles*/+'</style>'
$('head').append(styles);
window.print();
});
或
$(window).on('load',function(e){
var styles = '<style>'+/*calculation of media query print styles*/+'</style>'
$('head').append(styles);
});