Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_pdfviewer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-05-13 22:25:47 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-05-15 15:23:36 +0300
commit4100a2900a9d0aa683606bbeed0f779dbf5add15 (patch)
tree41fc14843f6debf6b55e9b3e297d066d87105ae2
parentb6dd29615ea021af91c8c47adf1c63d010f588e9 (diff)
Prevent text selection when download is hidden
When the PDF is rendered PDFViewer creates canvases with the contents of the pages and, in front of them, it creates too a layer with HTML text elements that makes possible to select it. That text layer is used too by the search function to highlight the results, so it can not be removed. Instead of that the selection of the text is prevented using CSS. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r--css/viewer.css13
-rw-r--r--js/previewplugin.js1
2 files changed, 14 insertions, 0 deletions
diff --git a/css/viewer.css b/css/viewer.css
index 297a8a7..9d4594c 100644
--- a/css/viewer.css
+++ b/css/viewer.css
@@ -29,3 +29,16 @@ html .doorHangerRight:before {
display: none;
}
}
+
+/* Prevent text selection when the download of a share is hidden. */
+.pdfViewer.disabledTextSelection .textLayer {
+ user-select: none;
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+}
+
+/* Override text cursor in descendants. */
+.pdfViewer.disabledTextSelection .textLayer * {
+ cursor: default;
+}
diff --git a/js/previewplugin.js b/js/previewplugin.js
index 8e56124..67835fe 100644
--- a/js/previewplugin.js
+++ b/js/previewplugin.js
@@ -101,6 +101,7 @@ var isSecureViewerAvailable = function () {
var hideDownload = $('#hideDownload').val();
if (hideDownload === 'true') {
iframe.find('.download').addClass('hidden');
+ iframe.find('.pdfViewer').addClass('disabledTextSelection')
}
});