diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-05-13 22:25:47 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-05-15 15:23:22 +0300 |
commit | 4dae7f8ccef373f9ca03afdec0faae9761f50075 (patch) | |
tree | cdfbb1e8b9628a690e638cf2bcc452be54e519b2 | |
parent | 3d3fec4dd2d4a4e1c952f56069baf69e90e8da27 (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.css | 13 | ||||
-rw-r--r-- | js/previewplugin.js | 1 |
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') } }); |