✨ [amp story shopping] newline support in productData#37788
✨ [amp story shopping] newline support in productData#37788processprocess merged 6 commits intoampproject:mainfrom
Conversation
|
Hey @gmajoulet! These files were changed: |
| > | ||
| {activeProductData.productDetails} | ||
| {activeProductData.productDetails | ||
| // Removes spaces after \n. |
There was a problem hiding this comment.
I think you can replace both with:
.replace(/\n\s*\n/g, '\n\n')
i.e. Replace two newlines (even if they have 0 or more whitespace characters between them) with just two newlines.
https://jsfiddle.net/o2x45vrj/
|
Warning: disparity between this PR Percy build and its The Percy build for this PR was approved (either manually by a member of the AMP team, or automatically if there were no visual diffs). However, during a continuous integration step we generated another Percy build using the commit on the This is possibly an indication of an issue with this pull request, but could also be the result of flakiness. Please inspect the two builds < This PR's Percy build /
|
|
@ampproject/wg-approvers This might be a flake, not sure what caused it. Pinging @coreymasanto for context. |
\nas a newline by addingwhite-space: pre-lineto the text wrapper.A productDetails string like this:

"One newline after this. \n Two newlines after this. \n\n Four consecutive newlines after this, should become 2 newlines. \n\n\n\n Many consecutive newlines with different spacing and tabs after this, should become 2 newlines. \n \n\n \n \n \n \n \n I hope it works!"Renders like this:
Fixes #37787