Make sure the sharing url is up-to-date before switch from editor to preview
This commit is contained in:
parent
f72b7f2f56
commit
e1b7961f45
|
@ -5,6 +5,7 @@
|
||||||
import { shareUrl, selectedLang } from '../store'
|
import { shareUrl, selectedLang } from '../store'
|
||||||
import ComboBox from './ComboBox.svelte'
|
import ComboBox from './ComboBox.svelte'
|
||||||
import Icon from '@iconify/svelte'
|
import Icon from '@iconify/svelte'
|
||||||
|
import { goto } from '$app/navigation'
|
||||||
|
|
||||||
type Language = {
|
type Language = {
|
||||||
text: string
|
text: string
|
||||||
|
@ -80,6 +81,11 @@
|
||||||
function closeUrlInput() {
|
function closeUrlInput() {
|
||||||
isUrlInputVisible = false
|
isUrlInputVisible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function goToPreview() {
|
||||||
|
await updateShareUrl()
|
||||||
|
goto($shareUrl)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={cssClass}>
|
<div class={cssClass}>
|
||||||
|
@ -116,9 +122,9 @@
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- Switch to readonly view -->
|
<!-- Switch to readonly view -->
|
||||||
<a class="button" href={$shareUrl}>
|
<button class="button" on:click={goToPreview}>
|
||||||
<Icon class="text-xl" icon="fluent:eye-12-regular" />
|
<Icon class="text-xl" icon="fluent:eye-12-regular" />
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user