Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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 <[email protected]>
  • Loading branch information
danxuliu authored and backportbot[bot] committed May 15, 2020
commit 4dae7f8ccef373f9ca03afdec0faae9761f50075
13 changes: 13 additions & 0 deletions css/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions js/previewplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ var isSecureViewerAvailable = function () {
var hideDownload = $('#hideDownload').val();
if (hideDownload === 'true') {
iframe.find('.download').addClass('hidden');
iframe.find('.pdfViewer').addClass('disabledTextSelection')
}
});

Expand Down