File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 <div class =" right" >
2727 <AppActionButton
2828 v-tooltip =" i18n.t('saveScreenshot')"
29- @click =" onSaveScreenshot"
29+ @click =" onSaveScreenshot('png') "
3030 >
31+ PNG   ;
32+ <UniconsFileDownload />
33+ </AppActionButton >
34+ <AppActionButton
35+ v-tooltip =" i18n.t('saveScreenshot')"
36+ @click =" onSaveScreenshot('svg')"
37+ >
38+ SVG   ;
3139 <UniconsFileDownload />
3240 </AppActionButton >
3341 </div >
@@ -174,12 +182,20 @@ const init = () => {
174182 hljs .registerAliases (' graphqlschema' , { languageName: ' graphql' })
175183}
176184
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+ }
179195
180196 const a = document .createElement (' a' )
181197 a .href = data
182- a .download = ` ${props .name }.png `
198+ a .download = ` ${props .name }.${ type } `
183199 a .click ()
184200
185201 track (' snippets/create-screenshot' )
@@ -274,6 +290,10 @@ init()
274290 align-items : center ;
275291 display : flex ;
276292 }
293+ .right {
294+ display : flex ;
295+ gap : var (--spacing-xs );
296+ }
277297 }
278298 .content {
279299 flex : 1 ;
Original file line number Diff line number Diff line change 1515 border : none ;
1616 background-color : transparent ;
1717 outline : none ;
18+ color : var (--color-text );
1819 :deep (svg ) {
1920 fill : var (--color-button-action );
2021 }
You can’t perform that action at this time.
0 commit comments