diff --git a/src/app/dashboard/[subdomain]/editor/page.tsx b/src/app/dashboard/[subdomain]/editor/page.tsx index 0d5ab838..ac6ee476 100644 --- a/src/app/dashboard/[subdomain]/editor/page.tsx +++ b/src/app/dashboard/[subdomain]/editor/page.tsx @@ -209,6 +209,7 @@ export default function SubdomainEditor() { const isMobileLayout = useIsMobileLayout() const [isRendering, setIsRendering] = useState(false) + const [previewVisible, setPreviewVisible] = useState(true) const savePage = async (published: boolean) => { const check = await checkPageSlug({ @@ -558,77 +559,72 @@ export default function SubdomainEditor() { : "min-w-[840px] h-screen " }`} > -
-
-
- { - if (e.key === "Enter" && !e.nativeEvent.isComposing) { - view?.focus() - } +
+
+ { + if (e.key === "Enter" && !e.nativeEvent.isComposing) { + view?.focus() + } + }} + onChange={(e) => updateValue("title", e.target.value)} + className="h-12 ml-1 inline-flex items-center border-none text-3xl font-bold w-full focus:outline-none bg-white" + placeholder={t("Title goes here...") || ""} + /> +
+
+ { + setCurrentScrollArea("editor") + }} + /> + {((!isMobileLayout && previewVisible) || + (isMobileLayout && !isRendering)) && ( + { + setCurrentScrollArea("preview") }} - onChange={(e) => updateValue("title", e.target.value)} - className="h-12 ml-1 inline-flex items-center border-none text-3xl font-bold w-full focus:outline-none bg-white" - placeholder={t("Title goes here...") || ""} /> -
-
- {isMobileLayout ? ( - !isRendering ? ( - { - setCurrentScrollArea("editor") - }} - /> - ) : ( - { - setCurrentScrollArea("preview") - }} - > - ) - ) : ( - <> - { - setCurrentScrollArea("editor") - }} - /> - { - setCurrentScrollArea("preview") - }} - > - - )} -
+ )} + + {!isMobileLayout && ( +
+
setPreviewVisible(!previewVisible)} + > + {previewVisible ? ( + + ) : ( + + )} +
+
+ )}
{!isMobileLayout && ( @@ -720,7 +716,7 @@ const EditorExtraProperties: FC<{ const site = useGetSite(subdomain) return ( -
+