mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1921572 [[Viewer] Ctrl+A doesn't work when some text is selected](https://bugs.launchpad.net/calibre/+bug/1921572)
This commit is contained in:
parent
57302df132
commit
9673e288be
@ -185,6 +185,12 @@ class IframeBoss:
|
||||
|
||||
def modify_selection(self, data):
|
||||
sel = window.getSelection()
|
||||
if data.granularity is 'all':
|
||||
r = document.createRange()
|
||||
r.selectNode(document.body)
|
||||
sel.removeAllRanges()
|
||||
sel.addRange(r)
|
||||
else:
|
||||
try:
|
||||
sel.modify('extend', data.direction, data.granularity)
|
||||
except:
|
||||
|
@ -581,6 +581,7 @@ class SelectionBar:
|
||||
forwarded = {
|
||||
'toggle_highlights': True,
|
||||
'edit_book': True,
|
||||
'select_all': True,
|
||||
}
|
||||
if sc_name is 'show_chrome':
|
||||
self.clear_selection()
|
||||
|
@ -344,6 +344,12 @@ def common_shortcuts(): # {{{
|
||||
_('Alter the current selection forward by a line'),
|
||||
),
|
||||
|
||||
'select_all': desc(
|
||||
v'["Ctrl+a"]',
|
||||
'ui',
|
||||
_('Select all')
|
||||
),
|
||||
|
||||
'shrink_selection_by_line': desc(
|
||||
v"['Shift+ArrowUp']",
|
||||
'ui',
|
||||
|
@ -559,6 +559,8 @@ class View:
|
||||
ui_operations.edit_book(current_spine_item(), self.current_file_progress_frac, self.currently_showing?.selection?.text)
|
||||
elif data.name is 'goto_location':
|
||||
self.overlay.show_ask_for_location()
|
||||
elif data.name is 'select_all':
|
||||
self.iframe_wrapper.send_message('modify_selection', granularity='all')
|
||||
elif data.name.startsWith('shrink_selection_by_'):
|
||||
self.iframe_wrapper.send_message('modify_selection', direction='backward', granularity=data.name.rpartition('_')[-1])
|
||||
elif data.name.startsWith('extend_selection_by_'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user