hopefully fixing issues

This commit is contained in:
2026-01-22 10:44:59 +01:00
parent 8a2f05de71
commit aa550c96b7
14 changed files with 545 additions and 417 deletions

View File

@@ -4,9 +4,9 @@
let locked = $derived(appState.locked);
let imageInput = $state<HTMLInputElement>(undefined!);
let soundInput = $state<HTMLInputElement>(undefined!);
let videoInput = $state<HTMLInputElement>(undefined!);
let imageInput: HTMLInputElement | null = $state(null);
let soundInput: HTMLInputElement | null = $state(null);
let videoInput: HTMLInputElement | null = $state(null);
function getSpawnPosition() {
return {
@@ -56,11 +56,22 @@
function addEmbed() {
const url = prompt('Enter URL to embed:');
if (!url) return;
try {
const parsed = new URL(url);
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
alert('Only HTTP/HTTPS URLs are allowed');
return;
}
} catch {
alert('Invalid URL');
return;
}
const id = crypto.randomUUID();
const pos = getSpawnPosition();
const escapedUrl = url.replace(/"/g, '&quot;');
appState.addItem({
id,
html: `<iframe src="${url}" frameborder="0" allowfullscreen></iframe>`,
html: `<iframe src="${escapedUrl}" frameborder="0" allowfullscreen></iframe>`,
css: `iframe {
width: 100%;
height: 100%;
@@ -185,9 +196,9 @@
<div class="palette">
<button onclick={addTile} title="Tile"><Square size={14} /></button>
<button onclick={addText} title="Text"><Type size={14} /></button>
<button onclick={() => imageInput.click()} title="Image"><Image size={14} /></button>
<button onclick={() => soundInput.click()} title="Sound"><Music size={14} /></button>
<button onclick={() => videoInput.click()} title="Video"><Video size={14} /></button>
<button onclick={() => imageInput?.click()} title="Image"><Image size={14} /></button>
<button onclick={() => soundInput?.click()} title="Sound"><Music size={14} /></button>
<button onclick={() => videoInput?.click()} title="Video"><Video size={14} /></button>
<button onclick={addEmbed} title="Embed"><Globe size={14} /></button>
<input