Summary
Preserve text alignment (center, right, justify) when pasting content from Google Docs into SuperDoc.
Problem
When pasting from Google Docs, all text alignment is lost — everything becomes left-aligned. Google Docs sends text-align as an inline CSS style on <p> elements, but parseAttrs only reads data-* attributes.
Repro
- Create a Google Doc with centered, right-aligned, and justified paragraphs.
- Copy the content and paste into SuperDoc.
- All paragraphs are left-aligned.
Expected
Text alignment from the pasted content is preserved in SuperDoc.
Notes
parseAttrs in packages/super-editor/src/extensions/paragraph/helpers/parseAttrs.js only reads data-indent, data-spacing, and data-num-id/data-level attributes. It never checks node.style.textAlign.
Google Docs sends alignment as inline styles:
style="text-align: center; line-height: 1.38; margin-top: 12pt"
The fix should check node.style.textAlign in parseAttrs and map it to paragraphProperties.justification. The TextAlign extension already uses this path internally via commands.updateAttributes('paragraph', { 'paragraphProperties.justification': alignment }).
File: packages/super-editor/src/extensions/paragraph/helpers/parseAttrs.js
Want to work on this? Check the Contributing Guide to get started. Comment on the GitHub issue to let us know you're picking it up.
copy-paste-test.docx
Want to work on this? Check the Contributing Guide to get started. Comment on this issue to let us know you're picking it up.
Ref: SD-1978
Summary
Preserve text alignment (center, right, justify) when pasting content from Google Docs into SuperDoc.
Problem
When pasting from Google Docs, all text alignment is lost — everything becomes left-aligned. Google Docs sends
text-alignas an inline CSS style on<p>elements, butparseAttrsonly readsdata-*attributes.Repro
Expected
Text alignment from the pasted content is preserved in SuperDoc.
Notes
parseAttrsinpackages/super-editor/src/extensions/paragraph/helpers/parseAttrs.jsonly readsdata-indent,data-spacing, anddata-num-id/data-levelattributes. It never checksnode.style.textAlign.Google Docs sends alignment as inline styles:
The fix should check
node.style.textAligninparseAttrsand map it toparagraphProperties.justification. The TextAlign extension already uses this path internally viacommands.updateAttributes('paragraph', { 'paragraphProperties.justification': alignment }).File:
packages/super-editor/src/extensions/paragraph/helpers/parseAttrs.jsWant to work on this? Check the Contributing Guide to get started. Comment on the GitHub issue to let us know you're picking it up.
copy-paste-test.docx
Want to work on this? Check the Contributing Guide to get started. Comment on this issue to let us know you're picking it up.
Ref: SD-1978