File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
packages/react-lightning/src/element Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @plexinc/react-lightning " : patch
3+ ---
4+
5+ Adds support for svgs that use data urls
Original file line number Diff line number Diff line change @@ -29,6 +29,17 @@ export class LightningImageElement extends LightningViewElement<
2929
3030 public set src ( v ) {
3131 this . node . src = v ;
32+
33+ // Attempt to set the svg imageType for data urls if not already set.
34+ // Lightning doesn't handle svgs that are data urls, so this adds support
35+ // for that.
36+ if ( this . node . imageType == null && v ) {
37+ const src = v . toLowerCase ( ) ;
38+ const isSvg =
39+ src . endsWith ( '.svg' ) || src . startsWith ( 'data:image/svg+xml,' ) ;
40+
41+ this . setNodeProp ( 'imageType' , isSvg ? 'svg' : null ) ;
42+ }
3243 }
3344
3445 protected override _handleTextureLoaded ( event : NodeLoadedPayload ) : void {
You can’t perform that action at this time.
0 commit comments