fix: save the window position of each webapp separately

This commit is contained in:
Bao Nguyen
2023-02-19 20:32:19 +07:00
parent 90c3fcff9e
commit 02b16f134b

View File

@@ -14,6 +14,7 @@
export let self; export let self;
export let parentNode; export let parentNode;
export let webapp; export let webapp;
let webapp_url;
export let exec_path; export let exec_path;
let iframe; let iframe;
@@ -21,7 +22,7 @@
let background = webapp?.background || '#ffffff'; let background = webapp?.background || '#ffffff';
onMount(async () => { onMount(async () => {
webapp.url = transform(webapp.url) webapp_url = transform(webapp.url)
}) })
export async function destroy(){ export async function destroy(){
@@ -196,7 +197,7 @@
return url.href; return url.href;
} }
async function send_message(data){ async function send_message(data){
iframe.contentWindow.postMessage(data, (new URL(webapp.url)).origin); iframe.contentWindow.postMessage(data, (new URL(webapp_url)).origin);
} }
</script> </script>
@@ -217,7 +218,7 @@
<!-- svelte-ignore a11y-missing-attribute --> <!-- svelte-ignore a11y-missing-attribute -->
<iframe <iframe
class="w-full h-full {!iframe_loaded ? 'hidden' : ''} {window?.z_index == $zIndex ? 'pointer-events-auto' : 'pointer-events-none'}" class="w-full h-full {!iframe_loaded ? 'hidden' : ''} {window?.z_index == $zIndex ? 'pointer-events-auto' : 'pointer-events-none'}"
bind:this={iframe} src={webapp.url} bind:this={iframe} src={webapp_url}
allow="gamepad *;" frameborder="0" allowfullscreen allow="gamepad *;" frameborder="0" allowfullscreen
style:background-color="{background}" style:background-color="{background}"
on:load={setup_webapp}> on:load={setup_webapp}>