mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
When focusing iframe if the selection bar is visible focus that instead
This commit is contained in:
parent
9eea78f092
commit
7edad3048e
@ -546,12 +546,15 @@ class SelectionBar:
|
|||||||
if sd.get('show_selection_bar'):
|
if sd.get('show_selection_bar'):
|
||||||
self.container.style.display = 'block'
|
self.container.style.display = 'block'
|
||||||
self.state = WAITING
|
self.state = WAITING
|
||||||
self.container.focus()
|
self.focus()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_visible(self):
|
def is_visible(self):
|
||||||
return self.container.style.display is not 'none'
|
return self.container.style.display is not 'none'
|
||||||
|
|
||||||
|
def focus(self):
|
||||||
|
self.container.focus()
|
||||||
|
|
||||||
def update_position(self, dragged_handle):
|
def update_position(self, dragged_handle):
|
||||||
container = self.container
|
container = self.container
|
||||||
cs = self.view.currently_showing.selection
|
cs = self.view.currently_showing.selection
|
||||||
@ -718,7 +721,7 @@ class SelectionBar:
|
|||||||
if not apply_changes:
|
if not apply_changes:
|
||||||
self.state = WAITING
|
self.state = WAITING
|
||||||
self.update_position()
|
self.update_position()
|
||||||
self.container.focus()
|
self.focus()
|
||||||
return
|
return
|
||||||
ed = self.current_editor
|
ed = self.current_editor
|
||||||
self.current_editor = None
|
self.current_editor = None
|
||||||
@ -731,7 +734,7 @@ class SelectionBar:
|
|||||||
self.state = WAITING
|
self.state = WAITING
|
||||||
self.update_position()
|
self.update_position()
|
||||||
get_session_data().set('highlight_style', self.current_highlight_style.style)
|
get_session_data().set('highlight_style', self.current_highlight_style.style)
|
||||||
self.container.focus()
|
self.focus()
|
||||||
|
|
||||||
def editor_container_clicked(self, ev):
|
def editor_container_clicked(self, ev):
|
||||||
ev.stopPropagation(), ev.preventDefault()
|
ev.stopPropagation(), ev.preventDefault()
|
||||||
|
@ -630,7 +630,10 @@ class View:
|
|||||||
self.focus_iframe()
|
self.focus_iframe()
|
||||||
|
|
||||||
def focus_iframe(self):
|
def focus_iframe(self):
|
||||||
self.iframe.contentWindow.focus()
|
if self.selection_bar.is_visible:
|
||||||
|
self.selection_bar.focus()
|
||||||
|
else:
|
||||||
|
self.iframe.contentWindow.focus()
|
||||||
|
|
||||||
def show_chrome(self, data):
|
def show_chrome(self, data):
|
||||||
elements = {}
|
elements = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user