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(block-tools): fix Google Docs preprocessing issue on Windows #4955

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

skogsmaskin
Copy link
Member

@skogsmaskin skogsmaskin commented Sep 27, 2023

Description

This will fix an issue on Windows when serializing a Google Docs HTML fragment into blocks.

The clipboard HTML was slightly different on Windows and our code didn't take that into account.

I have made some xpath matchers more specific and resilient now so they work both places.

I have also added tests for this.

What to review

That pasting from Google Docs into the PTE on Windows and MacOS will work correctly, without adding everything as bold.

Notes for release

  • Fix an issue where pasting from Google Docs into the Portable Text editor would make everything 'bold' on Windows computers.

On windows the Google Docs root-B was not stripped like it should be.
Slightly different document structure. Use a more explicit xpath
to get the Google Docs root node.

Also prefer textContent over innerText when extracting span text.
I was not able to have the tests running properly without this.
@vercel
Copy link

vercel bot commented Sep 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Sep 27, 2023 11:23am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2023 11:23am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Sep 27, 2023 11:23am

@skogsmaskin skogsmaskin marked this pull request as ready for review September 27, 2023 11:24
@skogsmaskin skogsmaskin requested review from rexxars and a team September 27, 2023 11:24
@github-actions
Copy link
Contributor

No changes to documentation

@github-actions
Copy link
Contributor

Component Testing Report Updated Sep 27, 2023 11:29 AM (UTC)

File Status Duration Passed Skipped Failed
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 9s 6 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 12s 9 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 43s 18 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 10s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 6s 3 0 0

Copy link
Contributor

@robinpyon robinpyon left a comment

Choose a reason for hiding this comment

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

Thanks @skogsmaskin! Tested and all LGTM

Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

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

👍

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.

3 participants