From c341ed41728c07bf3fb9d3e5d24ce4da26279124 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 19 Jul 2020 12:17:34 +0530 Subject: [PATCH] Viewer: Fix typing values in font size adjust control not working --- src/pyj/read_book/prefs/font_size.pyj | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/prefs/font_size.pyj b/src/pyj/read_book/prefs/font_size.pyj index 91f8d3014c..5de1076b51 100644 --- a/src/pyj/read_book/prefs/font_size.pyj +++ b/src/pyj/read_book/prefs/font_size.pyj @@ -94,6 +94,15 @@ def create_font_size_panel(container, close): 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( style='display: flex; margin-top: 1rem', E.input( @@ -102,7 +111,7 @@ def create_font_size_panel(container, close): ), 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', ), '\xa0px') ))