fix: transform on <g> instead of <svg> as a safari fix#3691
fix: transform on <g> instead of <svg> as a safari fix#3691
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughgetShapeCSS now renders the SVG to a string, parses its viewBox when flips are requested, wraps the SVG contents in a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🤖 Pull request artifacts
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/block-components/image/get-shape-css.js`:
- Around line 43-49: The flip translation is wrong because minX/minY are parsed
then ignored and the viewBox regex only handles double quotes and
space-separated values; update the viewBox extraction to use a regex like
/viewBox=['"]([^'"]+)['"]/ and split the captured string with a separator that
handles spaces and commas (e.g. .split(/[\s,]+/)) to get numeric minX, minY,
width, height, then compute translateX and translateY using the origin-aware
formulas (e.g. translateX = shapeFlipX ? (2 * minX + width) : 0 and translateY =
shapeFlipY ? (2 * minY + height) : 0) so that the flipping in the code that
references viewBoxMatch, _minX/_minY, width, height, translateX, translateY and
svgString.match behaves correctly for non-zero viewBox origins.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ee9f800b-6e76-40fe-8254-a8505c466e4b
📒 Files selected for processing (1)
src/block-components/image/get-shape-css.js
fixes #3650
Safari doesn't support transform on the root element when used as a CSS mask. The fix is to wrap the content in a and apply the transform there instead.
Summary by CodeRabbit