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(@sanity): issue where hidden unicode characters were bloating document in PTE #6424

Merged
merged 7 commits into from
Apr 19, 2024

Conversation

RitaDias
Copy link
Contributor

Description

There was an issue where copy pasting text that had hidden unicode characters were bloating the document within the PTE. It was also visually showing the hidden unicode characters as spaces within PTE.

Before:

Screen.Recording.2024-04-19.at.09.55.55.mov

What to review

When copy and pasting for example the text from the "quickly" block into a PTE, no hidden characters will be pasted and no hidden characters will be picked up within the inspect doc.

Testing

When copy and pasting for example the text from the "quickly" block into a PTE, no hidden characters will be pasted and no hidden characters will be picked up within the inspect doc.

Can be done in any PTE within the test studio

Notes for release

Fixes issue where copy and pasting hidden unicode characters in PTE were bloating the document

@RitaDias RitaDias requested a review from a team April 19, 2024 08:33
@RitaDias RitaDias requested a review from a team as a code owner April 19, 2024 08:33
@RitaDias RitaDias requested review from sjelfull and ricokahler and removed request for a team April 19, 2024 08:33
Copy link

vercel bot commented Apr 19, 2024

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

Name Status Preview Comments Updated (UTC)
performance-studio ✅ Ready (Inspect) Visit Preview Apr 19, 2024 9:46am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2024 9:46am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Apr 19, 2024 9:46am

Copy link
Contributor

No changes to documentation

* Can take a `result` JSON from a `const {result} = client.fetch(query, params, {filterResponse: false})`
* and remove all stega-encoded data from it.
* @alpha
* @hidden
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hiding it since hopefully this will be added at some point to the vercel functionality (we've requested it)

@@ -0,0 +1,33 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Necessary to get the comments in vercelStegaCleanAll.ts to not scream about the @hidden and @todo tags

Copy link
Contributor

github-actions bot commented Apr 19, 2024

Component Testing Report Updated Apr 19, 2024 9:51 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 33s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 24s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 19s 6 3 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 32s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 4s 15 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 3s 18 0 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 21s 9 0 0

Copy link
Contributor

@jtpetty jtpetty left a comment

Choose a reason for hiding this comment

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

👍 - thanks for adding tests as well

@RitaDias RitaDias added this pull request to the merge queue Apr 19, 2024
Merged via the queue into next with commit ce46077 Apr 19, 2024
37 checks passed
@RitaDias RitaDias deleted the edx-1177-electric-boogaloo branch April 19, 2024 13:49
@skogsmaskin skogsmaskin restored the edx-1177-electric-boogaloo branch April 19, 2024 14:14
skogsmaskin added a commit that referenced this pull request Apr 19, 2024
@skogsmaskin
Copy link
Member

skogsmaskin commented Apr 19, 2024

I reverted this one in next.

Can we please remove the dep. to @vercel/stega in @sanity/portable-text-editor, because we try to keep this core module as tiny as possible and it's not the @portable-text-editors's repsonsibility directly to to this kind of clipboard preprocessing.

The HTML pre-processing should be added here instead:
https://github.com/sanity-io/sanity/tree/next/packages/@sanity/block-tools/src/HtmlDeserializer/preprocessors
along with similar code we have for that.

Could we do this stripping without bringing in that dep? I have a feeling this should be a more of a generic unused utf8-char stripper than a @vercel/stega specific one.

The tests should also be added to @sanity/block-tools so we are testing the data transformation aspect of this.

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