Skip to content

HAR-9432 Formatting - Line spacing#452

Merged
harbournick merged 1 commit intomainfrom
har-9432_spacing
Apr 15, 2025
Merged

HAR-9432 Formatting - Line spacing#452
harbournick merged 1 commit intomainfrom
har-9432_spacing

Conversation

@VladaHarbour
Copy link
Copy Markdown
Contributor

No description provided.


const pPr = node.elements?.find((el) => el.name === 'w:pPr');
const styleTag = pPr?.elements?.find((el) => el.name === 'w:pStyle');
const nestedRPr = pPr?.elements?.find((el) => el.name === 'w:rPr');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@harbournick sometimes empty paragraphs could have run properties with font details defined. We don't parse it and that is why SuperToolbar shows default font for such paragraphs. Since there is no text we can't apply marks. I decided to implement it through additional attributes but will be happy to hear your thoughts
@artem-harbour if you have any ideas or suggestions I will be happy to hear as well


const beforeSpacing = inLineSpacing?.['w:before'] || lineSpaceBefore || pDefaultSpacing?.['w:before'];
if (beforeSpacing) spacing.lineSpaceBefore = twipsToPixels(beforeSpacing);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@harbournick I tried to parse spaces and indents as accurate as possible but here is a document with w:beforeAutospacing and w:afterAutospacing defined. As far as I understood Word has its own way to handle it and I didn't found any specifics about it. I parse spaces based on font size in this case (according chatgpt suggestion).

Copy link
Copy Markdown
Collaborator

@harbournick harbournick left a comment

Choose a reason for hiding this comment

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

LGTM

@harbournick harbournick merged commit 2e98c8d into main Apr 15, 2025
6 checks passed
@harbournick harbournick deleted the har-9432_spacing branch April 15, 2025 20:22
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.

2 participants