File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 26
26
<div class =" right" >
27
27
<AppActionButton
28
28
v-tooltip =" i18n.t('saveScreenshot')"
29
- @click =" onSaveScreenshot"
29
+ @click =" onSaveScreenshot('png') "
30
30
>
31
+ PNG   ;
32
+ <UniconsFileDownload />
33
+ </AppActionButton >
34
+ <AppActionButton
35
+ v-tooltip =" i18n.t('saveScreenshot')"
36
+ @click =" onSaveScreenshot('svg')"
37
+ >
38
+ SVG   ;
31
39
<UniconsFileDownload />
32
40
</AppActionButton >
33
41
</div >
@@ -174,12 +182,20 @@ const init = () => {
174
182
hljs .registerAliases (' graphqlschema' , { languageName: ' graphql' })
175
183
}
176
184
177
- const onSaveScreenshot = async () => {
178
- const data = await domToImage .toPng (snippetRef .value ! )
185
+ const onSaveScreenshot = async (type : ' png' | ' svg' = ' png' ) => {
186
+ let data = ' '
187
+
188
+ if (type === ' png' ) {
189
+ data = await domToImage .toPng (snippetRef .value ! )
190
+ }
191
+
192
+ if (type === ' svg' ) {
193
+ data = await domToImage .toSvg (snippetRef .value ! )
194
+ }
179
195
180
196
const a = document .createElement (' a' )
181
197
a .href = data
182
- a .download = ` ${props .name }.png `
198
+ a .download = ` ${props .name }.${ type } `
183
199
a .click ()
184
200
185
201
track (' snippets/create-screenshot' )
@@ -274,6 +290,10 @@ init()
274
290
align-items : center ;
275
291
display : flex ;
276
292
}
293
+ .right {
294
+ display : flex ;
295
+ gap : var (--spacing-xs );
296
+ }
277
297
}
278
298
.content {
279
299
flex : 1 ;
Original file line number Diff line number Diff line change 15
15
border : none ;
16
16
background-color : transparent ;
17
17
outline : none ;
18
+ color : var (--color-text );
18
19
:deep (svg ) {
19
20
fill : var (--color-button-action );
20
21
}
You can’t perform that action at this time.
0 commit comments