Repository navigation
feat(portable-text): support interactive SVG/JS htmlBlocks in Astro preview and Sanity Studio - #744
Open
codercatdev wants to merge 1 commit into
Open
codercatdev wants to merge 1 commit into
codercatdev wants to merge 1 commit into
Conversation
…raft preview and Sanity Studio
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Supports interactive HTML/SVG + JS
htmlBlockembeds (such as the Five Layers of Agentic Context: Situation -> Canon Wheel in Sanity draftdrafts.12da09be-f4cd-4fd4-be7e-0333dace2024) across both Astro draft preview and Sanity Studio:apps/site/src/components/portable-text/PtHtml.astro: Strips invisible zero-width Unicode Stega watermark characters ([\u200B-\u200F\u202A-\u202E\u2060-\u206F\uFEFF]|\uDB40[\uDC20-\uDC7F]) fromnode.htmlbefore passing toset:htmlso inline<script>,<style>, and<svg>blocks execute cleanly in draft/preview mode without syntax errors while preserving 100% of author markup.apps/sanity/components/HTMLPreview.tsx: Re-hydrates inline<script>elements insideHTMLPreviewviauseEffectand strips Stega characters so interactive HTML/SVG widgets animate and respond to clicks directly inside the Sanity Studio Portable Text editor preview.