Moritz Pfl
Moritz Pfl

Reputation: 11

How do I get a table of content with initial content in Tiptap?

I'm so frustrated with Tiptap's table of contents extension. I have initial content. However, the table of contents will be empty on page load.

As I have content in the editor I would expect, that the TOC already reflects this. But it's empty, until I edit the content manually.

Even the official Tiptap template has this issue: https://templates.tiptap.dev/rw9fKC8JrC

I have tried to setup a basic react app using Tiptap's template. And I simply can't get the TOC to show up after page load.

Can someone point me in the right direction?

Upvotes: 0

Views: 189

Answers (1)

Master_Kleisch
Master_Kleisch

Reputation: 79

Make sure to set the 'emitUpdate' parameter to 'true' when setting the content. This will signal the extension to update the table of content.

editor.commands.setContent(content, true)

Upvotes: 0

Related Questions