Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix style being missed on patchDocument #2387

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

wilkmaia
Copy link
Contributor

@wilkmaia wilkmaia commented Oct 18, 2023

There were scenarios in which patching a document would result in loss of style for the template runs and, possibly, their right-adjacent run as well (post-splitting). That was due to the run style elements not being added to the newly created runs.

This commit addresses this issue by introducing a new, optional, flag for the patchDocument function: keepOriginalStyles. It defaults to false (current behavior) and, when true, ensures that there is no loss of styling.

This should address #2293. Fixes #2293.

wilkmaia and others added 2 commits October 18, 2023 12:58
There were scenarios in which patching a document would result in loss
of style for the template runs and, possibly, their right-adjacent run
as well (post-splitting). That was due to the run style elements not
being added to the newly created runs.

This commit addresses this issue by introducing a new, optional, flag
for the `patchDocument` function: `keepOriginalStyles`. It defaults to
`false` (current behavior) and, when `true`, ensures that there is no
loss of styling.

This should address dolanmiu#2293.
@dolanmiu
Copy link
Owner

dolanmiu commented Nov 1, 2023

Fixes #2293

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d5d8055) 99.93% compared to head (d23b0d0) 99.94%.
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2387   +/-   ##
=======================================
  Coverage   99.93%   99.94%           
=======================================
  Files         329      329           
  Lines       13157    13183   +26     
  Branches     1365     1367    +2     
=======================================
+ Hits        13149    13176   +27     
+ Misses          8        7    -1     
Files Coverage Δ
src/patcher/from-docx.ts 100.00% <100.00%> (ø)
src/patcher/paragraph-token-replacer.ts 100.00% <100.00%> (+1.33%) ⬆️
src/patcher/replacer.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dolanmiu dolanmiu merged commit 438d11d into dolanmiu:master Nov 1, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to make the content after patchDocument have the same style as the key?
2 participants