Make sure the sharing url is up-to-date before switch from editor to preview

This commit is contained in:
Simon Cambier 2023-11-25 08:37:17 +01:00
parent f72b7f2f56
commit e1b7961f45

View File

@ -5,6 +5,7 @@
import { shareUrl, selectedLang } from '../store'
import ComboBox from './ComboBox.svelte'
import Icon from '@iconify/svelte'
import { goto } from '$app/navigation'
type Language = {
text: string
@ -80,6 +81,11 @@
function closeUrlInput() {
isUrlInputVisible = false
}
async function goToPreview() {
await updateShareUrl()
goto($shareUrl)
}
</script>
<div class={cssClass}>
@ -116,9 +122,9 @@
</button>
<!-- Switch to readonly view -->
<a class="button" href={$shareUrl}>
<button class="button" on:click={goToPreview}>
<Icon class="text-xl" icon="fluent:eye-12-regular" />
</a>
</button>
</div>
{/if}
</div>