From d5ea3e96ef67e091d55354f6c5342801a9e8b48e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 16 Apr 2019 08:04:00 +0200 Subject: [PATCH] Add theme to print page Before, the printed page didn't have any usable CSS. Now, it uses the css files available in the application. It means that custom CSS can be add to target printed page. See #2149 --- p/scripts/main.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index d85a3ae15..4fd91235e 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -859,15 +859,11 @@ function init_stream(stream) { el = ev.target.closest('.item.share > a[href="#"]'); if (el) { //Print - const content = '' + - el.closest('.flux_content').querySelector('.content').innerHTML + - ''; const tmp_window = window.open(); - tmp_window.document.writeln(content); + for (var i = 0; i < document.styleSheets.length; i++) { + tmp_window.document.writeln(''); + } + tmp_window.document.writeln(el.closest('.flux_content').querySelector('.content').innerHTML); tmp_window.document.close(); tmp_window.focus(); tmp_window.print();