fix(import): check hash on hash change
This commit is contained in:
parent
c220815b89
commit
29f16cbe5b
1 changed files with 7 additions and 1 deletions
|
|
@ -14,11 +14,17 @@
|
||||||
let mobileView = $state<'edit' | 'preview' | 'split'>('split');
|
let mobileView = $state<'edit' | 'preview' | 'split'>('split');
|
||||||
let showPicker = $state(false);
|
let showPicker = $state(false);
|
||||||
|
|
||||||
onMount(() => {
|
function checkHash() {
|
||||||
const hash = window.location.hash.slice(1);
|
const hash = window.location.hash.slice(1);
|
||||||
if (hash && (hash.startsWith('c1.') || hash.startsWith('t1.'))) {
|
if (hash && (hash.startsWith('c1.') || hash.startsWith('t1.'))) {
|
||||||
importData = hash;
|
importData = hash;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
checkHash();
|
||||||
|
window.addEventListener('hashchange', checkHash);
|
||||||
|
return () => window.removeEventListener('hashchange', checkHash);
|
||||||
});
|
});
|
||||||
|
|
||||||
function closeImport() {
|
function closeImport() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue