-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix sandbox
mode with UTF-16 characters
#5520
Fix sandbox
mode with UTF-16 characters
#5520
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5520 +/- ##
==========================================
- Coverage 5.73% 5.73% -0.01%
==========================================
Files 278 279 +1
Lines 41999 42005 +6
Branches 490 491 +1
==========================================
Hits 2409 2409
- Misses 39590 39596 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
😕 Not sure why the lint CI is failing now. Something to do with docs? |
There were some issues in develop, let's see if it passes now. |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
* develop: chore: Update docs chore: Add argos token to cypress config. chore: Remove cy.get('svg') calls Explain line breaks in `sequenceDiagram.md` add integration test fix note z position Correct the System_Boundary stereotype
@iansan5653, Thank you for the contribution! |
📑 Summary
btoa
is the native browser API for encoding strings to Base64, but it does not support UTF-16 code points:This in turn results in Mermaid crashing when attempting to render diagrams with, for example, emojis. Which causes Mermaid to render the diagram directly to the page, circumventing the sandbox mode and breaking the page.
This PR fixes the problem by down-encoding the string to UTF-8 before encoding it to Base64, as described on MDN. In addition, now that the encoded string is UTF-8 we need to specify an encoding in the
data
URL so that the browser knows how to render that text.📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.develop
branch