From fcf0a969330daa1649ba7edaca74f89f56c47ac2 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 15 Jun 2017 16:16:30 +0100 Subject: [PATCH] Use selection.isCollapsed to check for empty selections. --- .../public/coffee/ide/pdfng/directives/pdfViewer.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee index fe7ea3d427..241cee1c33 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee @@ -442,10 +442,10 @@ define [ _hasSelection = () -> selection = window.getSelection?() - # 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 selection? and _isSelectionWithinPDF(selection) and selection.type is 'Range' + # check the selection collapsed state in preference to + # using selection.toString() as the latter is "" when + # the selection is hidden (e.g. while viewing logs) + return selection? and _isSelectionWithinPDF(selection) and !selection.isCollapsed _isSelectionWithinPDF = (selection) -> if selection.rangeCount == 0