diff --git a/apps/studio/components/interfaces/ReportsV2/editor/supa-editor.tsx b/apps/studio/components/interfaces/ReportsV2/editor/supa-editor.tsx index a69e6d292b3..29da7d83f41 100644 --- a/apps/studio/components/interfaces/ReportsV2/editor/supa-editor.tsx +++ b/apps/studio/components/interfaces/ReportsV2/editor/supa-editor.tsx @@ -8,6 +8,9 @@ import { SlashCommand, getSlashCommandSuggestions } from './slash-commands' import { TrailingNode } from './trailing-node' import Placeholder from '@tiptap/extension-placeholder' +// to get local storage in SSR +const ls = typeof window !== 'undefined' ? window.localStorage : null + export function SupaEditor() { const editor = useEditor({ extensions: [ @@ -30,8 +33,10 @@ export function SupaEditor() { } return true }, - content: - '

Welcome to Supabase Reports v2

Try typing a slash / in a new line.

', + content: JSON.parse(ls?.getItem('editorContent') || '{}'), + onUpdate: ({ editor }) => { + ls?.setItem('editorContent', JSON.stringify(editor.getJSON())) + }, editorProps: { handleDOMEvents: { keydown: (view, event) => {