diff --git a/packages/editor/core/src/hooks/use-editor.tsx b/packages/editor/core/src/hooks/use-editor.tsx index b92252ac6e..238f954365 100644 --- a/packages/editor/core/src/hooks/use-editor.tsx +++ b/packages/editor/core/src/hooks/use-editor.tsx @@ -134,7 +134,7 @@ export const useEditor = ({ editorRef.current?.commands.clearContent(); }, setEditorValue: (content: string) => { - editorRef.current?.commands.setContent(content); + editorRef.current?.commands.setContent(content, false, { preserveWhitespace: "full" }); }, setEditorValueAtCursorPosition: (content: string) => { if (savedSelection) { diff --git a/packages/editor/core/src/hooks/use-read-only-editor.tsx b/packages/editor/core/src/hooks/use-read-only-editor.tsx index 8b16d1e766..4dc492d359 100644 --- a/packages/editor/core/src/hooks/use-read-only-editor.tsx +++ b/packages/editor/core/src/hooks/use-read-only-editor.tsx @@ -52,7 +52,7 @@ export const useReadOnlyEditor = ({ // for syncing swr data on tab refocus etc useEffect(() => { if (initialValue === null || initialValue === undefined) return; - if (editor && !editor.isDestroyed) editor?.commands.setContent(initialValue); + if (editor && !editor.isDestroyed) editor?.commands.setContent(initialValue, false, { preserveWhitespace: "full" }); }, [editor, initialValue]); const editorRef: MutableRefObject = useRef(null); @@ -62,7 +62,7 @@ export const useReadOnlyEditor = ({ editorRef.current?.commands.clearContent(); }, setEditorValue: (content: string) => { - editorRef.current?.commands.setContent(content); + editorRef.current?.commands.setContent(content, false, { preserveWhitespace: "full" }); }, getMarkDown: (): string => { const markdownOutput = editorRef.current?.storage.markdown.getMarkdown();