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

Add includeInvisibleContent option to extractTextContents #3412

Merged

Conversation

thomasdax98
Copy link
Member

@thomasdax98 thomasdax98 commented Feb 12, 2025

Description

Add includeInvisibleContent option to extractTextContents

This option controls if invisible blocks are included in the returned contents. The default is false.

Use cases:

includeInvisibleContent = false: content generation -> ignore invisible content

includeInvisibleContent = true: automatic translation of a whole document

Acceptance criteria

Example

Example blocks
[{"name":"RichText","visible":true,"output":{"draftContent":{"blocks":[{"key":"393ng","text":"Visible RichText","type":"paragraph-standard","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}},"additionalFields":{"userGroup":"All"}},{"name":"RichText","visible":false,"output":{"draftContent":{"blocks":[{"key":"d7n9g","text":"Invisible RichText","type":"paragraph-standard","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}},"additionalFields":{"userGroup":"All"}},{"name":"Columns","visible":true,"output":{"layout":"2-20-2","columns":[{"key":"b46ba4b9-4fd5-4821-834b-720bb413798b","visible":true,"props":{"blocks":[{"key":"9ea53870-1768-4770-b618-fe86ba4a6709","visible":true,"type":"richtext","props":{"draftContent":{"blocks":[{"key":"bldkm","text":"Visible Column","type":"paragraph-standard","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}}},{"key":"afccac23-52b4-4f1f-91bf-efba92e9d3ca","visible":false,"type":"richtext","props":{"draftContent":{"blocks":[{"key":"77ice","text":"Invisible Column","type":"paragraph-standard","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}}}]}}]},"additionalFields":{"userGroup":"All"}},{"name":"StandaloneCallToActionList","visible":true,"output":{"callToActionList":{"blocks":[{"key":"ac90a0c5-2d56-4c42-a67f-0d77d900b16f","visible":true,"props":{"textLink":{"link":{"attachedBlocks":[{"type":"internal","props":{}}],"activeType":"internal"},"text":"Visible List Item"},"variant":"Contained"}},{"key":"8daac125-3523-421f-b9c0-174a31419a2b","visible":false,"props":{"textLink":{"link":{"attachedBlocks":[{"type":"internal","props":{}}],"activeType":"internal"},"text":"Invisible List Item"},"variant":"Contained"}}]},"alignment":"left"},"additionalFields":{"userGroup":"All"}},{"name":"StandaloneCallToActionList","visible":true,"output":{"callToActionList":{"blocks":[{"key":"5a2b882c-bf91-4410-915c-fc865193da5a","visible":true,"props":{"textLink":{"link":{"attachedBlocks":[{"type":"internal","props":{}},{"type":"email","props":{"email":"invisible@email-one-of.com"}},{"type":"external","props":{"targetUrl":"https://visible.external-one-of.com","openInNewWindow":false}}],"activeType":"external"},"text":""},"variant":"Contained"}}]},"alignment":"left"},"additionalFields":{"userGroup":"All"}},{"name":"FullWidthImage","visible":true,"output":{"image":{"attachedBlocks":[{"type":"pixelImage","props":{}}],"activeType":"pixelImage"},"content":{"block":{"draftContent":{"blocks":[{"key":"9ln7p","text":"Disabled optional block","type":"paragraph-standard","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}},"visible":false}},"additionalFields":{"userGroup":"All"}}]
Output (`includeInvisibleContent` = false)
[
    "<p class=\"paragraph-standard\">Visible RichText</p>",
    "<p class=\"paragraph-standard\">Visible Column</p>",
    "Visible List Item",
    "https://visible.external-one-of.com"
]
Output (`includeInvisibleContent` = true)
[
    "<p class=\"paragraph-standard\">Visible RichText</p>",
    "<p class=\"paragraph-standard\">Invisible RichText</p>",
    "<p class=\"paragraph-standard\">Visible Column</p>",
    "<p class=\"paragraph-standard\">Invisible Column</p>",
    "Visible List Item",
    "Invisible List Item",
    "invisible@email-one-of.com",
    "https://visible.external-one-of.com",
    "<p class=\"paragraph-standard\">Disabled optional block</p>"
]

Further information

@thomasdax98 thomasdax98 changed the title Add includeInvisibleContent option to extractTextContents Add includeInvisibleContent option to extractTextContents Feb 12, 2025
@thomasdax98 thomasdax98 marked this pull request as ready for review February 12, 2025 08:57
@auto-assign auto-assign bot requested a review from johnnyomair February 12, 2025 08:57
thomasdax98 and others added 2 commits February 13, 2025 09:40
Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
@thomasdax98 thomasdax98 merged commit f5b1407 into feature/seo-tag-generation Feb 17, 2025
3 checks passed
@thomasdax98 thomasdax98 deleted the extractTextContents-visibility branch February 17, 2025 14:51
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