This commit is contained in:
Kovid Goyal 2019-11-17 11:32:59 +05:30
parent 941e31aa46
commit 144d17ef68
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -61,13 +61,13 @@ def create_location_overlay(current_position_data, overlay, container):
current_cfi = current_position_data.cfi current_cfi = current_position_data.cfi
if current_cfi: if current_cfi:
container.appendChild(E.div( container.appendChild(E.div(
style='margin: 1rem; display: flex; align-items: baseline', style='margin: 1rem; margin-bottom: calc(1rem - 1ex); display: flex; align-items: baseline; flex-wrap: wrap',
E.input( E.div(
type='text', readonly='readonly', value=_('Current location: {}').format(current_cfi), name='current_location', _('Current location: {}').format(current_cfi),
style='border-width: 0; background-color: transparent; outline: none; flex-grow: 10; font-family: inherit' style='flex-grow: 10; text-overflow: ellipsis; margin-bottom: 1ex'
), ),
create_button(_('Copy'), action=def(): create_button(_('Copy'), action=def():
src = document.querySelector(f'#{container_id} [name=current_location]') src = document.querySelector(f'#{container_id} input')
orig = src.value orig = src.value
src.value = current_cfi src.value = current_cfi
src.focus() src.focus()
@ -76,7 +76,6 @@ def create_location_overlay(current_position_data, overlay, container):
document.execCommand('copy') document.execCommand('copy')
finally: finally:
src.value = orig src.value = orig
src.blur()
) )
)) ))
@ -109,7 +108,7 @@ def create_location_overlay(current_position_data, overlay, container):
container.appendChild(E.div( container.appendChild(E.div(
style='margin: 1rem;', style='margin: 1rem;',
E.div( E.div(
style='display: flex; align-items: baseline', style='display: flex; align-items: baseline; flex-wrap: wrap',
E.label(_('Go to:'), style='margin-right: 1rem'), E.label(_('Go to:'), style='margin-right: 1rem'),
E.input(name='newpos', type='text', min='0', max=str(current_position_data.book_length), step='0.1', style='flex-grow: 10; margin-right: 1rem', onkeydown=def(ev): E.input(name='newpos', type='text', min='0', max=str(current_position_data.book_length), step='0.1', style='flex-grow: 10; margin-right: 1rem', onkeydown=def(ev):
if ev.key is 'Enter': if ev.key is 'Enter':