diff --git a/src/app/[sdSlug]/admin/site/pages/[id]/ContentEditorClient.tsx b/src/app/[sdSlug]/admin/site/pages/[id]/ContentEditorClient.tsx index 6276c31e..ebe07974 100644 --- a/src/app/[sdSlug]/admin/site/pages/[id]/ContentEditorClient.tsx +++ b/src/app/[sdSlug]/admin/site/pages/[id]/ContentEditorClient.tsx @@ -19,8 +19,9 @@ export function ContentEditorClient(props: Props) { const loadData = async (id: string) => await ApiHelper.get("/pages/" + UserHelper.currentUserChurch.church.id + "/tree?id=" + id, "ContentApi"); - const handleDone = () => { - redirect("/admin/site/pages/preview/" + id); + const handleDone = (url?: string) => { + if (url && url !== '') redirect(url); + else redirect("/admin/site/pages/preview/" + id); }; return ( diff --git a/src/components/admin/ContentEditor/ContentEditor.tsx b/src/components/admin/ContentEditor/ContentEditor.tsx index 74c7943d..8650b5cf 100644 --- a/src/components/admin/ContentEditor/ContentEditor.tsx +++ b/src/components/admin/ContentEditor/ContentEditor.tsx @@ -27,7 +27,7 @@ interface Props extends WrapperPageProps { loadData: (id:string) => Promise, pageId?: string, blockId?: string - onDone?: () => void + onDone?: (url?: string) => void }; export default function ContentEditor(props: Props) { @@ -140,6 +140,18 @@ export default function ContentEditor(props: Props) { } } + const handleDone = () => { + let url = ''; + if (props.pageId) { + const page = container as PageInterface; + if (page.layout === "embed") { + if (page.url.includes("/member")) url = '/admin'; + else if (page.url.includes("/stream")) url='/admin/video/settings'; + } + } + props.onDone(url); + } + /*Todo: affix the sidebar with CSS instead*/ useEffect(() => { const onScroll = (e:any) => { setScrollTop(e.target.documentElement.scrollTop); }; @@ -224,7 +236,7 @@ export default function ContentEditor(props: Props) {
- +