# Embedding in a modal > Drop the editor into a Radix Dialog (or any modal) without breaking drag-and-drop. Source: https://docs.docmosaic.com/docs/recipes/embedding-in-modal The editor works inside a modal as long as one detail is right: don't re-mount the ``. `Editor.Root` already mounts one - if your modal wraps the editor in another `react-dnd` provider, drags break silently. ## The pattern ```tsx import * as Dialog from '@radix-ui/react-dialog'; import { Editor } from '@docmosaic/react'; import '@docmosaic/react/styles.css'; export function EditorModal() { return ( Open editor ); } ``` ## Gotchas - **Don't mount inside the trigger.** Mount the editor inside ``. Mounting in the trigger renders the entire editor unconditionally and defeats the lazy-mount benefit. - **Use `inset-` for sizing.** The editor fills its container - give the dialog `inset-4` (or explicit `width` / `height`) so the canvas has room. - **Re-mounting resets the document.** Closing and re-opening the dialog re-runs `Editor.Root`'s init. For draft persistence, lift state via controlled mode + a state container outside the dialog. ## With persistence ```tsx const [draft, setDraft] = useState(null); {/* ... */} ; ``` Now the draft survives close-and-reopen - perfect for "save draft" / "send" flows. ## See also - [Editor.Root](/docs/primitives/root) - [Controlled vs uncontrolled](/docs/get-started/controlled-vs-uncontrolled)