From b699fc98c2050f113e511868cfaa2d4400637f12 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Fri, 3 Jan 2025 19:12:25 +0100 Subject: [PATCH] Fix title layout of book details modal and apply of custom css deletion (#90) * Fix custom css cannot apply after deletion * Fix title layout of book details modal, closes #89 --- .../app/reader/components/settings/MiscPanel.tsx | 13 +++++++++---- apps/readest-app/src/components/BookDetailModal.tsx | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx b/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx index 56490fe0..3a695495 100644 --- a/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx +++ b/apps/readest-app/src/app/reader/components/settings/MiscPanel.tsx @@ -18,11 +18,13 @@ const MiscPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => { const [animated, setAnimated] = useState(viewSettings.animated!); const [isDisableClick, setIsDisableClick] = useState(viewSettings.disableClick!); const [draftStylesheet, setDraftStylesheet] = useState(viewSettings.userStylesheet!); + const [draftStylesheetSaved, setDraftStylesheetSaved] = useState(true); const [error, setError] = useState(null); const handleUserStylesheetChange = (e: React.ChangeEvent) => { const cssInput = e.target.value; setDraftStylesheet(cssInput); + setDraftStylesheetSaved(false); try { const { isValid, error } = cssValidate(cssInput); @@ -48,6 +50,7 @@ const MiscPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => { }); setDraftStylesheet(formattedCSS); + setDraftStylesheetSaved(true); viewSettings.userStylesheet = formattedCSS; setViewSettings(bookKey, viewSettings); @@ -93,7 +96,7 @@ const MiscPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => {

{_('Animation')}

-
+
{_('Paging Animation')} @@ -110,7 +113,7 @@ const MiscPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => {

{_('Behavior')}

-
+
{_('Disable Click-to-Flip')} @@ -127,7 +130,9 @@ const MiscPanel: React.FC<{ bookKey: string }> = ({ bookKey }) => {

{_('Custom CSS')}

-
+