mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Use selection.isCollapsed to check for empty selections.
This commit is contained in:
parent
b9797dbc42
commit
fcf0a96933
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue