mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 07:39:07 +03:00
store in localstorage
This commit is contained in:
1 parent
643c3cb8a8
commit
1059f65669
1 file changed
+7
-2
@@ -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:
|
||||
'<h1>Welcome to Supabase Reports v2</h1><p>Try typing a slash <code>/</code> in a new line.</p>',
|
||||
content: JSON.parse(ls?.getItem('editorContent') || '{}'),
|
||||
onUpdate: ({ editor }) => {
|
||||
ls?.setItem('editorContent', JSON.stringify(editor.getJSON()))
|
||||
},
|
||||
editorProps: {
|
||||
handleDOMEvents: {
|
||||
keydown: (view, event) => {
|
||||
|
||||
Reference in new issue
Block a user