Skip to content

Commit

Permalink
Merge pull request #12 from CatsJuice/feature/auto-preview-on-share
Browse files Browse the repository at this point in the history
feat: auto open preview when open a share link
  • Loading branch information
CatsJuice authored Jul 27, 2023
2 parents 0eae04b + 1b107fd commit f048c3d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/SvgPreviewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { download, svgCode2Url } from '~/utils/helper'
interface Props {
svgCode: string
openOnMount?: boolean
}
withDefaults(defineProps<Props>(), {})
const props = withDefaults(defineProps<Props>(), {})
const minGap = 20
const $el = ref<HTMLElement>()
Expand All @@ -32,6 +33,9 @@ onMounted(() => {
else if (hovered.value)
preview()
})
if (props.openOnMount)
preview()
})
useEventListener('resize', () => {
Expand Down
1 change: 1 addition & 0 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function debugPane() {
</ClientOnly>
<SvgPreviewer
v-if="svg"
:open-on-mount="!!shared"
:svg-code="svg"
/>

Expand Down

0 comments on commit f048c3d

Please sign in to comment.