From b3ea7288abc65a320664111c6c76d33bba1b415c Mon Sep 17 00:00:00 2001 From: Abdo Date: Mon, 6 Dec 2021 11:40:26 +0300 Subject: [PATCH] Flip arrows of Bootstrap-styled `s for RTL langs * Use the dir attribute to set document direction * Remove unused variable and fix use of CSS var --- qt/aqt/webview.py | 15 +++++++-------- sass/base.scss | 7 +++++++ ts/lib/i18n/utils.ts | 2 ++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 8d515c7db..fa2e3eccc 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -438,15 +438,9 @@ div[contenteditable="true"]:focus {{ window_bg_day = self.get_window_bg_color(False).name() window_bg_night = self.get_window_bg_color(True).name() - body_bg = window_bg_night if theme_manager.night_mode else window_bg_day - - if is_rtl(anki.lang.current_lang): - lang_dir = "rtl" - else: - lang_dir = "ltr" return f""" -body {{ zoom: {zoom}; background-color: --window-bg; direction: {lang_dir}; }} +body {{ zoom: {zoom}; background-color: var(--window-bg); }} html {{ {font} }} {button_style} :root {{ --window-bg: {window_bg_day} }} @@ -496,9 +490,14 @@ html {{ {font} }} else: doc_class = "" + if is_rtl(anki.lang.current_lang): + lang_dir = "rtl" + else: + lang_dir = "ltr" + html = f""" - + {self.title} {head} diff --git a/sass/base.scss b/sass/base.scss index 372e88712..57b5f71e8 100644 --- a/sass/base.scss +++ b/sass/base.scss @@ -68,3 +68,10 @@ samp { .isLin { --base-font-size: 14px; } + +[dir=rtl] { + .form-select { + /* flip