Skip to content

Commit

Permalink
Merge pull request #4323 from serlo/fix-remove-editor-toolbar-in-edit…
Browse files Browse the repository at this point in the history
…or-preview

fix(page-editor-preview): hide editor toolbar artifacts
  • Loading branch information
LarsTheGlidingSquirrel authored Nov 29, 2024
2 parents 35d91de + 3006f43 commit 5688acf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/pages/___editor_preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function Content() {
value={{ editorVariant: 'serlo-org', userId: 'serlo-preview-user' }}
>
<main id="content" className="flex">
<section className="min-h-screen w-[50vw] border-4 border-r-0 border-editor-primary">
<section className="min-h-screen w-1/2 border-4 border-r-0 border-editor-primary">
<header className="mx-side flex justify-between align-middle font-bold">
<h2 className="mb-12 text-editor-primary">Edit</h2>
<div>
Expand Down Expand Up @@ -153,7 +153,7 @@ function Content() {
</header>
<div className="px-2">{editor}</div>
</section>
<section className="min-h-screen w-[50vw] border-4 border-editor-primary">
<section className="min-h-screen w-1/2 border-4 border-editor-primary">
<h2 className="mx-side mb-12 font-bold text-editor-primary">
Preview
</h2>
Expand Down
16 changes: 9 additions & 7 deletions packages/editor/src/core/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,27 @@ 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 (
<Provider store={store}>
<DndWrapper>
<HotkeysProvider initiallyActiveScopes={['global']}>
{/* only on serlo for now */}
{isSerlo ? (
{isSerlo && !isSerloEditorPreviewPage ? (
<>
<EditorToolbar />
<LocalStorageNotice
useStored={useStored}
setUseStored={setUseStored}
/>
</>
) : (
// For non serlo environments, we need to render the toaster
// https://react-hot-toast.com/docs/toaster (already gets rendered
// in the web project)
<Toaster />
)}
) : null}
{/* For non serlo environments, we need to render the toaster
(already gets rendered in the web project) */}
{!isSerlo ? <Toaster /> : null}
<div
className={cn(
'editor-core mb-24 text-lg leading-cozy',
Expand Down

0 comments on commit 5688acf

Please sign in to comment.