sibiraj-s / svelte-tiptap

Svelte components for tiptap v2
https://sibiraj-s.github.io/svelte-tiptap/
MIT License
244 stars 21 forks source link

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'element') at init #9

Closed joshuavachon25 closed 2 years ago

joshuavachon25 commented 2 years ago

I get this error when trying to implement the plugin in my Sveltekit Project (Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'element') at init_).

The code comes from the readme with a few exceptions, because I don't use Typescript:

<script >
    import { onMount, onDestroy } from 'svelte';
    import { createEditor, EditorContent } from 'svelte-tiptap';
    import StarterKit from "@tiptap/starter-kit";

    let editor

    onMount(() => {
        editor = createEditor({
            extensions: [
                StarterKit,
        ],
            content: `Hello world!`,
        });
    });
</script>

<EditorContent editor={editor} />
ranjanified commented 2 years ago

I get this error when trying to implement the plugin in my Sveltekit Project (Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'element') at init_).

The code comes from the readme with a few exceptions, because I don't use Typescript:

<script >
    import { onMount, onDestroy } from 'svelte';
    import { createEditor, EditorContent } from 'svelte-tiptap';
    import StarterKit from "@tiptap/starter-kit";

    let editor

    onMount(() => {
        editor = createEditor({
            extensions: [
                StarterKit,
        ],
            content: `Hello world!`,
        });
    });
</script>

<EditorContent editor={editor} />

@joshuavachon25 ... Does this help?

<EditorContent editor={$editor} />
sibiraj-s commented 2 years ago

Hi, Sorry I missed the issue. I hope @ranjanified's solution will fix the issue. You can also look at the repl for example.

Closing the issue for now. Feel free to re-open if it doesn't work. will look into this.

sibiraj-s commented 2 years ago

Thanks @ranjanified

github-actions[bot] commented 5 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.