2
我已經嘗試在頁面中定義@media
風格以及我在配置中傳遞ckeditor的外部文件,但是當我單擊工具欄中的打印按鈕時,這兩個文件似乎都沒有任何效果。如何將@media打印樣式應用於ckeditor實例?
我已經嘗試在頁面中定義@media
風格以及我在配置中傳遞ckeditor的外部文件,但是當我單擊工具欄中的打印按鈕時,這兩個文件似乎都沒有任何效果。如何將@media打印樣式應用於ckeditor實例?
這個例子(框架)應該給你一些想法(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);
}
}
});