From 1ee7bb209d0f3a66b00d34edc57661e31a846e49 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 15 Apr 2019 19:59:37 +0200 Subject: Added file preview css reset via iframe --- src/main/resources/css/fileview.css | 7 ++++++- src/main/resources/css/layout.css | 9 +++++++-- src/main/resources/js/fileview.js | 7 ++++--- src/main/resources/views/fileview.rocker.html | 2 +- 4 files changed, 18 insertions(+), 7 deletions(-) (limited to 'src/main/resources') diff --git a/src/main/resources/css/fileview.css b/src/main/resources/css/fileview.css index 349980b..8341a80 100644 --- a/src/main/resources/css/fileview.css +++ b/src/main/resources/css/fileview.css @@ -2,6 +2,11 @@ display: none; } -.prettyprint { +/* TODO: Fix duplicate scrollbars in previews */ +.prettyprint, .preview { + position: absolute; + min-height: 100%; + width: 100%; border: none !important; + overflow: visible; } diff --git a/src/main/resources/css/layout.css b/src/main/resources/css/layout.css index c11ee79..9c03575 100644 --- a/src/main/resources/css/layout.css +++ b/src/main/resources/css/layout.css @@ -1,7 +1,12 @@ html, body { font-family: Arial, Helvetica, sans-serif; + color: #424242; padding: 0; margin: 0; - min-width: 100%; - min-height: 100%; + min-width: 100vw !important; + min-height: 100vh !important; +} + +button { + color: #424242; } diff --git a/src/main/resources/js/fileview.js b/src/main/resources/js/fileview.js index c34ce27..78ed951 100644 --- a/src/main/resources/js/fileview.js +++ b/src/main/resources/js/fileview.js @@ -12,9 +12,10 @@ const originalContent = content.innerText; if (extension === "md" || extension === "html") { if (extension === "md") - preview.innerHTML = marked(originalContent); - else if (extension === "html") - preview.innerHTML = marked(originalContent); + preview.src = "data:text/html;charset=utf-8," + encodeURI(marked(originalContent)); + else if (extension === "html") { + preview.src = "data:text/html;charset=utf-8," + encodeURI(originalContent); + } preview.style.display = "block"; raw.style.display = "block"; diff --git a/src/main/resources/views/fileview.rocker.html b/src/main/resources/views/fileview.rocker.html index bef1ad0..e92f037 100644 --- a/src/main/resources/views/fileview.rocker.html +++ b/src/main/resources/views/fileview.rocker.html @@ -18,5 +18,5 @@
@content
-
+
}
--
cgit v1.2.3