Viewer: Fix typing values in font size adjust control not working

This commit is contained in:
Kovid Goyal 2020-07-19 12:17:34 +05:30
parent 6efd7915ee
commit c341ed4172
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -94,6 +94,15 @@ def create_font_size_panel(container, close):
set_quick_size(ev) set_quick_size(ev)
)) ))
def set_size(ev):
newval = ev.currentTarget.value
try:
q = int(newval)
except:
return
if MIN_FONT_SIZE <= q <= MAX_FONT_SIZE:
set_quick_size(ev)
container.appendChild(E.div( container.appendChild(E.div(
style='display: flex; margin-top: 1rem', style='display: flex; margin-top: 1rem',
E.input( E.input(
@ -102,7 +111,7 @@ def create_font_size_panel(container, close):
), ),
E.span('\xa0', E.input( E.span('\xa0', E.input(
value=f'{cfs}', type='text', oninput=set_quick_size, type='number', min=MIN_FONT_SIZE, max=MAX_FONT_SIZE, value=f'{cfs}', oninput=set_size, type='number', min=MIN_FONT_SIZE + '', max=MAX_FONT_SIZE + '',
step='1', style='width: 3em', step='1', style='width: 3em',
), '\xa0px') ), '\xa0px')
)) ))