feat: count characters consistently

This commit is contained in:
Sam 2023-04-02 22:50:22 +02:00
parent 80ca1cae00
commit 8433a1523a
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
9 changed files with 54 additions and 20 deletions

View file

@ -38,7 +38,7 @@
import type { PageData } from "./$types";
import { addToast, delToast } from "$lib/toast";
import { memberNameRegex } from "$lib/api/regex";
import renderMarkdown from "$lib/api/markdown";
import { charCount, renderMarkdown } from "$lib/utils";
const MAX_AVATAR_BYTES = 1_000_000;
@ -445,7 +445,7 @@
<textarea class="form-control" style="height: 200px;" bind:value={bio} />
</div>
<p class="text-muted mt-1">
Using {bio.length}/{MAX_DESCRIPTION_LENGTH} characters
Using {charCount(bio)}/{MAX_DESCRIPTION_LENGTH} characters
</p>
<p class="text-muted my-2">
<Icon name="info-circle-fill" aria-hidden /> Your bio supports limited

View file

@ -34,7 +34,7 @@
import ErrorAlert from "$lib/components/ErrorAlert.svelte";
import { addToast, delToast } from "$lib/toast";
import type { PageData } from "./$types";
import renderMarkdown from "$lib/api/markdown";
import { charCount, renderMarkdown } from "$lib/utils";
const MAX_AVATAR_BYTES = 1_000_000;
@ -373,7 +373,7 @@
<textarea class="form-control" style="height: 200px;" bind:value={bio} />
</div>
<p class="text-muted mt-1">
Using {bio.length}/{MAX_DESCRIPTION_LENGTH} characters
Using {charCount(bio)}/{MAX_DESCRIPTION_LENGTH} characters
</p>
<p class="text-muted my-2">
<Icon name="info-circle-fill" aria-hidden /> Your bio supports limited