web: remove built-in sveltekit announcer (for real this time)

This commit is contained in:
dumbmoron 2024-09-07 15:57:53 +00:00
parent 3fdfd44515
commit b4f17487b4
No known key found for this signature in database
2 changed files with 11 additions and 6 deletions

View file

@ -3,8 +3,6 @@
import "@fontsource/ibm-plex-mono/400-italic.css"; import "@fontsource/ibm-plex-mono/400-italic.css";
import "@fontsource/ibm-plex-mono/500.css"; import "@fontsource/ibm-plex-mono/500.css";
import { beforeUpdate } from "svelte";
import { page } from "$app/stores"; import { page } from "$app/stores";
import { updated } from "$app/stores"; import { updated } from "$app/stores";
import { browser } from "$app/environment"; import { browser } from "$app/environment";
@ -35,10 +33,6 @@
document.querySelector("[data-first-focus]"); document.querySelector("[data-first-focus]");
to_focus?.focus(); to_focus?.focus();
}); });
beforeUpdate(() => {
document.getElementById("svelte-announcer")?.remove();
})
</script> </script>
<svelte:head> <svelte:head>

View file

@ -10,6 +10,17 @@ const config = {
// for more information about preprocessors // for more information about preprocessors
extensions: [".svelte", ".md"], extensions: [".svelte", ".md"],
preprocess: [ preprocess: [
{
name: "strip-announcer",
markup: ({ content: code }) => {
code = code.replace(
/<div id="svelte-announcer" [\s\S]*?<\/div>/,
'<svelte:component this={null} />'
);
return { code }
}
},
sveltePreprocess(), sveltePreprocess(),
mdsvex({ mdsvex({
extensions: ['.md'], extensions: ['.md'],