Fixed type errors

This commit is contained in:
J-onasJones 2024-06-15 22:18:11 +02:00
parent 4a658e8be4
commit 777c28899b
2 changed files with 22 additions and 3 deletions

View file

@ -24,6 +24,9 @@
let searchValue = ''; let searchValue = '';
/**
* @param {{ detail: string; }} event
*/
function handleSearch(event) { function handleSearch(event) {
searchValue = event.detail; searchValue = event.detail;
} }

View file

@ -5,10 +5,21 @@
import NotFound from "./NotFound.svelte"; import NotFound from "./NotFound.svelte";
import navigate from 'svelte-spa-router'; import navigate from 'svelte-spa-router';
export let params: {year?: string, month?: string, day?: string, title?: string} = {}; export let params: {year: string, month: string, day: string, title: string} = {
year: "",
month: "",
day: "",
title: ""
};
let posts: { id: any; }[] = []; let posts: { id: any; }[] = [];
let post: {id: String, date: String, title: String, author: String, description: String} = {}; let post: {id: string, date: string, title: string, author: string, description: string} = {
id: '',
date: '',
title: '',
author: '',
description: ''
};
let postTitle = ""; let postTitle = "";
let postAuthor = ""; let postAuthor = "";
@ -53,7 +64,10 @@
if (await content.ok) { if (await content.ok) {
let markdowncontent = await content.text(); let markdowncontent = await content.text();
markdowncontent = await marked.parse(removePostVars(markdowncontent)); markdowncontent = await marked.parse(removePostVars(markdowncontent));
document.getElementById('markdowncontent').innerHTML = await markdowncontent; const markdowncontentElement = document.getElementById('markdowncontent');
if (markdowncontentElement) {
markdowncontentElement.innerHTML = await markdowncontent;
}
loading = false; loading = false;
postTitle = post.title; postTitle = post.title;
postAuthor = post.author; postAuthor = post.author;
@ -129,6 +143,8 @@ function copyLink() {
<p class="postHead">by</p> <p class="postHead">by</p>
<h3 class="postHead">{postAuthor}</h3> <h3 class="postHead">{postAuthor}</h3>
<p class="postHead postDate">{postDate}</p> <p class="postHead postDate">{postDate}</p>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class="copy-link" on:click={copyLink}> <div class="copy-link" on:click={copyLink}>
<i class="fas fa-link"></i> <i class="fas fa-link"></i>
<span>{clickText}</span> <span>{clickText}</span>