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
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-05-20 17:49:34 +0300
commitcd7eedd05b4f96376551c86821cc25b4616894bb (patch)
treefb58cfc86306a86ae25cd8f3f7bdba47704f9149
parent35997bf079750784e921444d20ded6823123c986 (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 ad3b338..5f7646d 100644
--- a/js/previewplugin.js
+++ b/js/previewplugin.js
@@ -97,6 +97,7 @@
var hideDownload = $('#hideDownload').val();
if (hideDownload === 'true') {
iframe.find('.download').addClass('hidden');
+ iframe.find('.pdfViewer').addClass('disabledTextSelection')
}
});