From dd693dd905b5d1f093bb2be961271970ede2e202 Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 29 Nov 2024 09:16:16 +0100 Subject: [PATCH 1/2] fix(page-editor-preview): hide editor toolbar artifacts --- apps/web/src/pages/___editor_preview.tsx | 4 ++-- packages/editor/src/core/editor.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/web/src/pages/___editor_preview.tsx b/apps/web/src/pages/___editor_preview.tsx index d8c5f5e66c..edfec5e8c3 100644 --- a/apps/web/src/pages/___editor_preview.tsx +++ b/apps/web/src/pages/___editor_preview.tsx @@ -105,7 +105,7 @@ function Content() { value={{ editorVariant: 'serlo-org', userId: 'serlo-preview-user' }} >
-
+

Edit

@@ -153,7 +153,7 @@ function Content() {
{editor}
-
+

Preview

diff --git a/packages/editor/src/core/editor.tsx b/packages/editor/src/core/editor.tsx index daccd146d0..23f1de76b8 100644 --- a/packages/editor/src/core/editor.tsx +++ b/packages/editor/src/core/editor.tsx @@ -31,6 +31,10 @@ export function Editor(props: EditorProps) { // New store for every editor instance const store = useMemo(() => createStore(), []) + const isSerloEditorPreviewPage = + window?.location?.href && + window?.location?.href.includes('___editor_preview') + return ( @@ -38,7 +42,7 @@ export function Editor(props: EditorProps) { {/* only on serlo for now */} {isSerlo ? ( <> - + {isSerloEditorPreviewPage ? null : } Date: Fri, 29 Nov 2024 09:59:04 +0100 Subject: [PATCH 2/2] refactor(web): hide localstorage notice on editor-preview as well --- packages/editor/src/core/editor.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/editor/src/core/editor.tsx b/packages/editor/src/core/editor.tsx index 23f1de76b8..01c4711e35 100644 --- a/packages/editor/src/core/editor.tsx +++ b/packages/editor/src/core/editor.tsx @@ -40,20 +40,18 @@ export function Editor(props: EditorProps) { {/* only on serlo for now */} - {isSerlo ? ( + {isSerlo && !isSerloEditorPreviewPage ? ( <> - {isSerloEditorPreviewPage ? null : } + - ) : ( - // For non serlo environments, we need to render the toaster - // https://react-hot-toast.com/docs/toaster (already gets rendered - // in the web project) - - )} + ) : null} + {/* For non serlo environments, we need to render the toaster + (already gets rendered in the web project) */} + {!isSerlo ? : null}