Open qctechjunkie opened 6 months ago
I believe I was experiencing this even without indexing paragraph nodes when the document was initially empty, with this extension setup:
import { TableOfContents as ToC } from "@tiptap-pro/extension-table-of-contents";
export const TableOfContents = ToC.extend({
anchorTypes: ["heading"],
});
Which packages did you experience the bug in?
react, extension-table-of-contents, extension-collaboration
What Tiptap version are you using?
2.1.16
What’s the bug you are facing?
We are seeing a bug where empty lines are created when running collab and table of contents (ToC) together. Specificlly when asking ToC to index paragraph nodes. Before collab sync is complete, ToC will index the empty editor's default placeholder paragraph.
<p id="8fa..." data-toc-id="8fa66..." data-placeholder="Body Copy" class="is-empty"><br class="ProseMirror-trailingBreak"></p>
anchorTypes: ['heading', 'paragraph'],
The reason collab begins with an empty editor instead of the content from the record is that TipTap has a duplication problem when starting with content provided in the
content
propIf the content is passed in client side, Collab sees this as a change/addition to the content it has, and doubles everything on each page load.
What browser are you using?
Chrome
Code example
No response
What did you expect to happen?
We would expect Table of Contents (ToC) to ignore empty paragraph nodes until content is actually in the node. Or have ToC wait for Collab sync, if Collab is enabled, before indexing the content.
Anything to add? (optional)
No response
Did you update your dependencies?
Are you sponsoring us?