From b9804823f310ba8c83be35ffeffe393eb3ecd238 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 15 Jun 2017 14:13:15 +0100 Subject: [PATCH] handle off-screen selection when toggling the logs button the selection is off-screen and selection.toString() is empty even when there is a selected range. Can check for selection.type being "Range" instead. --- .../web/public/coffee/ide/pdfng/directives/pdfViewer.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee index ea521a74d1..ae9421cef3 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee @@ -442,7 +442,10 @@ define [ _hasSelection = () -> selection = window.getSelection() - return _isSelectionWithinPDF(selection) and selection.toString() != '' + # check the selection type in preference to using + # selection.toString() as the latter is "" when the + # selection is hidden (e.g. while viewing logs) + return _isSelectionWithinPDF(selection) and selection.type is 'Range' _isSelectionWithinPDF = (selection) -> if selection.rangeCount == 0