mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Server viewer: Fix error when triple clicking in firefox
Firefox does not support extending selection to pargraphs so instead extend to line.
This commit is contained in:
parent
e759eefc28
commit
1247a0d512
@ -741,10 +741,19 @@ class IframeBoss:
|
|||||||
self.on_handle_navigation_shortcut(data)
|
self.on_handle_navigation_shortcut(data)
|
||||||
elif dtype is 'extend-to-paragraph':
|
elif dtype is 'extend-to-paragraph':
|
||||||
sel = window.getSelection()
|
sel = window.getSelection()
|
||||||
sel.modify('extend', 'forward', 'paragraphboundary')
|
try:
|
||||||
end_node, end_offset = sel.focusNode, sel.focusOffset
|
try:
|
||||||
sel.modify('extend', 'backward', 'paragraphboundary')
|
sel.modify('extend', 'forward', 'paragraphboundary')
|
||||||
sel.setBaseAndExtent(sel.focusNode, sel.focusOffset, end_node, end_offset)
|
except:
|
||||||
|
sel.modify('extend', 'forward', 'lineboundary')
|
||||||
|
end_node, end_offset = sel.focusNode, sel.focusOffset
|
||||||
|
try:
|
||||||
|
sel.modify('extend', 'backward', 'paragraphboundary')
|
||||||
|
except:
|
||||||
|
sel.modify('extend', 'backward', 'lineboundary')
|
||||||
|
sel.setBaseAndExtent(sel.focusNode, sel.focusOffset, end_node, end_offset)
|
||||||
|
except:
|
||||||
|
(console.error or console.log)('Failed to extend selection to paragraph')
|
||||||
elif dtype is 'drag-scroll':
|
elif dtype is 'drag-scroll':
|
||||||
self.scroll_to_extend_annotation(data.backwards)
|
self.scroll_to_extend_annotation(data.backwards)
|
||||||
elif dtype is 'edit-highlight':
|
elif dtype is 'edit-highlight':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user