@@ -95,6 +95,20 @@ export class UmbMediaWorkspaceViewInfoElement extends UmbLitElement {
95
95
this . _updateDate = Array . isArray ( variants ) ? variants [ 0 ] . updateDate || 'Unknown' : 'Unknown' ;
96
96
} ) ;
97
97
}
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
+ }
98
112
99
113
override render ( ) {
100
114
return html `
@@ -118,18 +132,12 @@ export class UmbMediaWorkspaceViewInfoElement extends UmbLitElement {
118
132
}
119
133
120
134
#renderLinksSection( ) {
121
- /** TODO Make sure link section is completed */
122
135
if ( this . _urls && this . _urls . length ) {
123
136
return html `
124
137
${ repeat (
125
138
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 ) ,
133
141
) }
134
142
` ;
135
143
} else {
@@ -141,6 +149,25 @@ export class UmbMediaWorkspaceViewInfoElement extends UmbLitElement {
141
149
}
142
150
}
143
151
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
+
144
171
#renderGeneralSection( ) {
145
172
return html `
146
173
<div class= "general-item" >
0 commit comments