Skip to content

fix(editor): avoid copying paraId on split#3412

Open
wookieb wants to merge 5 commits into
superdoc-dev:mainfrom
wookieb:fix/3405-prevent-duplicate-paraid-on-split
Open

fix(editor): avoid copying paraId on split#3412
wookieb wants to merge 5 commits into
superdoc-dev:mainfrom
wookieb:fix/3405-prevent-duplicate-paraid-on-split

Conversation

@wookieb
Copy link
Copy Markdown

@wookieb wookieb commented May 20, 2026

Summary

  • Prevent paragraph splits from carrying over DOCX paraId identity.
  • Avoid duplicate block IDs after pressing Enter in table separator paragraphs.

Closes #3405

Considerations

Regular splitRunToParagraph does not copy paraId on purpose. Split on empty paragraph is special, therefore I believe the best fix is to just mark attribute as ignored on split.

I was thinking about not having paraId at for table separator but I've noticed it was added on purpose in recent months. Unless... I'm wrong?

Prevent split-created paragraphs from inheriting DOCX paragraph
identity, which can create duplicate node IDs after splitting table
separator paragraphs.

Closes superdoc-dev#3405
@caio-pizzol caio-pizzol self-assigned this May 21, 2026
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wookieb thanks for the PR. this matches the editor split path, and the regression test covers the reported duplicate paraId case. lgtm once the inline is handled.

Comment thread packages/super-editor/src/editors/v1/extensions/paragraph/paragraph.js Outdated
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gpardhivvarma
Copy link
Copy Markdown
Contributor

gpardhivvarma commented May 21, 2026

after this + the textId change land, three sites will be nulling paraId/textId on split — keepOnSplit: false here, the spread in split-run.js:97-105, and the deletes in tables-adapter.ts:2119-2122. easy to update one and miss the others. worth routing splitBlockPatch through Attribute.getSplittedAttributes so this file is the only declaration site? rough sketch:

// split-run.js, replacing the spread at 97-105
const extensionAttrs = editor?.extensionService?.attributes ?? [];
paragraphAttrs = Attribute.getSplittedAttributes(extensionAttrs, node.type.name, node.attrs);

one wrinkle: getSplittedAttributes would also drop listRendering (also keepOnSplit: false), which the hand-rolled spread currently preserves — not sure if that's intentional.

@wookieb
Copy link
Copy Markdown
Author

wookieb commented May 21, 2026

That was a good tip @gpardhivvarma - Thank You :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create.table + Enter on trailing paragraph duplicates paraId, blocking subsequent Document API mutations

4 participants