@@ -95,6 +95,20 @@ export class UmbMediaWorkspaceViewInfoElement extends UmbLitElement {
9595 this . _updateDate = Array . isArray ( variants ) ? variants [ 0 ] . updateDate || 'Unknown' : 'Unknown' ;
9696 } ) ;
9797 }
98+ #openSvg( imagePath : string ) {
99+ const popup = window . open ( '' , '_blank' ) ;
100+ if ( ! popup ) return ;
101+
102+ const html = `<!doctype html>
103+ <body style="background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(135deg, transparent 75%, #ccc 75%); background-size:30px 30px; background-position:0 0, 15px 0, 15px -15px, 0px 15px;">
104+ <img src="${ imagePath } "/>
105+ <script>history.pushState(null, null, "${ window . location . href } ");</script>
106+ </body>` ;
107+
108+ popup . document . open ( ) ;
109+ popup . document . write ( html ) ;
110+ popup . document . close ( ) ;
111+ }
98112
99113 override render ( ) {
100114 return html `
@@ -118,18 +132,12 @@ export class UmbMediaWorkspaceViewInfoElement extends UmbLitElement {
118132 }
119133
120134 #renderLinksSection( ) {
121- /** TODO Make sure link section is completed */
122135 if ( this . _urls && this . _urls . length ) {
123136 return html `
124137 ${ repeat (
125138 this . _urls ,
126- ( url ) => url . url ,
127- ( url ) => html `
128- <a href= ${ url . url } target= "_blank" class = "link- item with- href">
129- <span class= "link-content" > ${ url . url } </ span>
130- <uui- icon name= "icon-out" > </ uui- icon>
131- </ a>
132- ` ,
139+ ( item ) => item . url ,
140+ ( item ) => this . #renderLinkItem( item ) ,
133141 ) }
134142 ` ;
135143 } else {
@@ -141,6 +149,25 @@ export class UmbMediaWorkspaceViewInfoElement extends UmbLitElement {
141149 }
142150 }
143151
152+ #renderLinkItem( item : MediaUrlInfoModel ) {
153+ const ext = item . url . split ( / [ # ? ] / ) [ 0 ] . split ( '.' ) . pop ( ) ?. trim ( ) ;
154+ if ( ext === 'svg' ) {
155+ return html `
156+ <a href= "#" target = "_blank" class= "link- item with- href" @click = ${ ( ) => this . #openSvg( item . url ) } >
157+ <span class= "link-content" > ${ item . url } </ span>
158+ <uui- icon name= "icon-out" > </ uui- icon>
159+ </ a>
160+ ` ;
161+ } else {
162+ return html `
163+ <a href= ${ item . url } target= "_blank" class = "link- item with- href">
164+ <span class= "link-content" > ${ item . url } </ span>
165+ <uui- icon name= "icon-out" > </ uui- icon>
166+ </ a>
167+ ` ;
168+ }
169+ }
170+
144171 #renderGeneralSection( ) {
145172 return html `
146173 <div class= "general-item" >
0 commit comments