From d02988d4660ce6794be2775da47cf95371e8b7e7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Apr 2022 10:49:05 +0530 Subject: [PATCH] Use standard titlebar for lookup panel Also fix cancel button for adding a custom lookup not working. Fixes #1967459 [[Enhancement - Content server] Make the Lookup page layout more similar to other pages](https://bugs.launchpad.net/calibre/+bug/1967459) --- src/pyj/read_book/overlay.pyj | 8 +------- src/pyj/read_book/word_actions.pyj | 5 +++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pyj/read_book/overlay.pyj b/src/pyj/read_book/overlay.pyj index e22660ec47..a7563ca603 100644 --- a/src/pyj/read_book/overlay.pyj +++ b/src/pyj/read_book/overlay.pyj @@ -522,13 +522,7 @@ class WordActionsOverlay: # {{{ pass # Dont allow panel to be closed by a click def show(self, container): - container.style.backgroundColor = get_color('window-background') - container.appendChild(E.div( - style='padding: 1ex 1em; border-bottom: solid 1px currentColor; display:flex; justify-content: space-between', - E.h2(_('Lookup: {}').format(self.word)), - E.div(svgicon('close'), style='cursor:pointer', onclick=def(event):event.preventDefault(), event.stopPropagation(), self.overlay.hide_current_panel(event);, class_='simple-link'), - )) - container.appendChild(E.div()) + simple_overlay_title(_('Lookup: {}').format(self.word), self.overlay, container) create_word_actions_panel(container, self.word, self.overlay.hide) # }}} diff --git a/src/pyj/read_book/word_actions.pyj b/src/pyj/read_book/word_actions.pyj index 004e6843a8..f2994fb0c7 100644 --- a/src/pyj/read_book/word_actions.pyj +++ b/src/pyj/read_book/word_actions.pyj @@ -63,10 +63,10 @@ def add_custom(container_id): E.tr(E.td('\xa0'), E.td('\xa0')), E.tr(E.td(_('URL:') + '\xa0'), E.td(E.input(type='url', name='url'))), ))) - container.append(E.div(style='margin: 1rem', + container.append(E.div(style='margin: 1rem; display: flex', create_button(_('Add'), 'plus', add.bind(None, container_id), highlight=True), '\xa0', - create_button(_('Cancel'), toggle_custom_container.bind(None, container_id, False)), + create_button(_('Cancel'), action=toggle_custom_container.bind(None, container_id, False)), )) container.querySelector('input').focus() @@ -135,6 +135,7 @@ def create_word_actions_panel(container, word, close_panel_func): nonlocal current_data word = str.replace(word, '\u00ad', '') current_data = word, close_panel_func + container.appendChild(E.div()) container.appendChild(E.div(style='display:none')) populate_list(container)