-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cannot access SVG files through ToastUI CDN #313
Comments
This works for me: https://unpkg.com/[email protected]/dist/svg/icon-a.svg |
Currently, svg does not guarantee normal behavior in an external resource (cross domain) environment. This part will be carefully improved after further testing. |
Perhaps there could be a way to load this locally as well, so as to avoid the image editor from having to fetch the resources at runtime. Imagine being able to just import the SVG's like so: import { iconA, iconB, iconC, iconD } from 'tui-image-editor/dist/svg-icons.js'; ...and using them on the config like so: const theme = {
// ...
'menu.normalIcon': iconD,
'menu.activeIcon': iconB,
'menu.disabledIcon': iconA,
'menu.hoverIcon': iconC,
// ...
}; There could simply be an additional JS file (svg-icons.js) on the build where the SVG content is defined as a module: const iconA = `
<svg>
<symbol id="icon-a-ic-apply" viewBox="0 0 24 24">
<g fill="none" fill-rule="evenodd">
<path d="M0 0h24v24H0z"/>
<path stroke="#434343" d="M4 12.011l5 5L20.011 6"/>
</g>
</symbol>
<symbol ...></symbol>
<!-- other symbols -->
</svg>
`;
export { iconA, ... }; |
Version
Latest
Development Environment
OpenSUSE Linux + Firefox
Current Behavior
I modified blackTheme to load the SVG files (icon-a through d) from the ToastUI CDN (URL: https://uicdn.toast.com/tui-image-editor/latest/svg/icon-a.svg). However, the icons are not loading correctly, and I get the error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://uicdn.toast.com/tui-image-editor/latest/svg/icon-d.svg. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)
Expected Behavior
Expected: no error, and icons load properly
The text was updated successfully, but these errors were encountered: