-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Summary
Preserve line spacing and paragraph indentation when pasting content from Google Docs into SuperDoc.
Problem
Line spacing (single, 1.5x, double) and paragraph indentation are lost when pasting from Google Docs. Everything pastes as default spacing with no indentation.
Repro
- Create a Google Doc with different line spacings (single, 1.5, double) and indented paragraphs.
- Copy the content and paste into SuperDoc.
- All spacing is default and indentation is gone.
Expected
Line spacing and indentation from pasted content are preserved in SuperDoc.
Notes
parseAttrs reads data-indent and data-spacing JSON attributes (SuperDoc's internal format), but Google Docs uses inline CSS on <p> elements:
- Line height:
lineHeight: "1.2"(single),"1.8"(1.5x),"2.4"(double) - Margins:
marginTop/marginBottomin pt - Indentation:
marginLeft: "30pt"(indented),"60pt"(double-indented) - Blockquote: Google Docs sends
marginLeft: "30pt"as a<p>, not a<blockquote>tag
The fix should extract node.style.lineHeight, node.style.marginLeft, node.style.marginTop, and node.style.marginBottom in parseAttrs, then convert them to paragraphProperties.spacing and paragraphProperties.indent.
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.
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-1980