-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@sanity): issue where hidden unicode characters were bloating doc…
…ument in PTE (#6440) * fix(portable-text-editor): issue shown in tests re stega. use duplicate code * test(playwright-ct): add test * chore(sanity): remove prettier linting * test(sanity): fix missing snapshot * test(sanity): update test after realising the test would pass always if comparing object number * chore: test unicode removal * chore: test unicode removal * chore(@sanity): remove old solution * fix(@sanity/block-tools): unicode issue. remove vercel/stega and move to block-tools * test(@sanity/block-tools): for unicode * fix(@sanity/block-tools): utf8 characters weren't beign filtered. using the vercel/stega * chore: update lock file * (chore): update pnpm lock
- Loading branch information
Showing
9 changed files
with
353 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/@sanity/block-tools/test/tests/HtmlDeserializer/stegaUnicodeCleaner/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import defaultSchema from '../../../fixtures/defaultSchema' | ||
import {type BlockTestFn} from '../types' | ||
|
||
const blockContentType = defaultSchema | ||
.get('blogPost') | ||
.fields.find((field: any) => field.name === 'body').type | ||
|
||
const testFn: BlockTestFn = (html, blockTools, commonOptions) => { | ||
return blockTools.htmlToBlocks(html, blockContentType, commonOptions) | ||
} | ||
|
||
export default testFn |
1 change: 1 addition & 0 deletions
1
packages/@sanity/block-tools/test/tests/HtmlDeserializer/stegaUnicodeCleaner/input.html
Large diffs are not rendered by default.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
packages/@sanity/block-tools/test/tests/HtmlDeserializer/stegaUnicodeCleaner/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[ | ||
{ | ||
"_key": "randomKey1", | ||
"_type": "block", | ||
"children": [ | ||
{ | ||
"_key": "randomKey10", | ||
"_type": "span", | ||
"marks": [], | ||
"text": "This is a test of the Sanity Portable Text renderer. We will use a variety of content to test its capabilities. Here are some unicode characters: ☺️👍🏽🌍🌞🌚🌝🌛🌜🌙💫⭐️🌟✨⚡️☄️💥🔥🌪🌈☀️🌤⛅️🌥☁️🌦🌧⛈🌩🌨❄️☃️⛄️🌬💨💧💦☔️☂️🌊🌫. Now let's try some markdown formatting: " | ||
}, | ||
{"_key": "randomKey11", "_type": "span", "marks": ["strong"], "text": "bold text"}, | ||
{"_key": "randomKey12", "_type": "span", "marks": [], "text": ", "}, | ||
{"_key": "randomKey13", "_type": "span", "marks": ["em"], "text": "italic text"}, | ||
{"_key": "randomKey14", "_type": "span", "marks": [], "text": ", ~~strikethrough~~, "}, | ||
{"_key": "randomKey15", "_type": "span", "marks": ["code"], "text": "code"}, | ||
{ | ||
"_key": "randomKey16", | ||
"_type": "span", | ||
"marks": [], | ||
"text": ", > blockquote, - list item, 1. numbered list item, " | ||
}, | ||
{"_key": "randomKey17", "_type": "span", "marks": ["randomKey0"], "text": "link"}, | ||
{"_key": "randomKey18", "_type": "span", "marks": [], "text": ", ."} | ||
], | ||
"markDefs": [{"_key": "randomKey0", "_type": "link", "href": "https://example.com/"}], | ||
"style": "normal" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", | ||
"tagDefinitions": [ | ||
{ | ||
"tagName": "@hidden", | ||
"syntaxKind": "block", | ||
"allowMultiple": true | ||
}, | ||
{ | ||
"tagName": "@todo", | ||
"syntaxKind": "block", | ||
"allowMultiple": true | ||
} | ||
], | ||
"supportForTags": { | ||
"@hidden": true, | ||
"@beta": true, | ||
"@internal": true, | ||
"@public": true, | ||
"@experimental": true, | ||
"@see": true, | ||
"@link": true, | ||
"@example": true, | ||
"@deprecated": true, | ||
"@alpha": true, | ||
"@param": true, | ||
"@returns": true, | ||
"@remarks": true, | ||
"@throws": true, | ||
"@defaultValue": true, | ||
"@todo": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/sanity/playwright-ct/tests/formBuilder/inputs/PortableText/copyPaste/input.ts
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.