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

feat: icon组件兼容sdk下使用svg object的情况 #8602

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

qkiroc
Copy link
Collaborator

@qkiroc qkiroc commented Nov 2, 2023

What

🤖 Generated by Copilot at 69f0826

Fixed icon rendering issues and improved import efficiency in icons.tsx. Added support for custom svg icons in icon schema.

🤖 Generated by Copilot at 69f0826

A bug in the icon rendering
Made some symbols look quite dismaying
But icons.tsx
Got a simple fix
With a fallback logic displaying

Why

How

🤖 Generated by Copilot at 69f0826

  • Fix icon rendering bug when svg symbol is not found (link)
  • Simplify import statement to only import createElement from react (link)

Copy link

github-actions bot commented Nov 2, 2023

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

@github-actions github-actions bot added the feat label Nov 2, 2023
}

// 直接传入svg字符串
if (typeof icon === 'string' && icon.startsWith('<svg')) {
return <i dangerouslySetInnerHTML={{__html: icon}} />;
const svgStr = /<svg .*?>(.*?)<\/svg>/.exec(icon);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '<svg ' and with many repetitions of '<svg '.
This
regular expression
that depends on
library input
may run slow on strings starting with '' and with many repetitions of '>a'.
@qkiroc qkiroc merged commit fdff931 into baidu:master Nov 2, 2023
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants