lägg till förkortning autostäd och ingen autocomplete

This commit is contained in:
botvid johansson 2025-02-11 07:53:34 +01:00
parent 956cdaad38
commit b23f0e299a
4 changed files with 7 additions and 6 deletions

View File

@ -42,9 +42,9 @@
*/ */
const sf = { const sf = {
listid: abbForm.target.value, listid: abbForm.target.value,
shortform: abbForm.shortform, shortform: abbForm.shortform.replace(/\s/g,"").toLowerCase(),
phrase: abbForm.phrase, phrase: abbForm.phrase.trim(),
used: new Date(0), last_used: new Date(0),
uses: 0, uses: 0,
remind: 0, remind: 0,
updated: Date.now(), updated: Date.now(),
@ -99,7 +99,7 @@
<Card.Description></Card.Description> <Card.Description></Card.Description>
</Card.Header> </Card.Header>
<Card.Content class="mx-auto"> <Card.Content class="mx-auto">
<form class="grid gap-4 py-4" method="post" enctype="multipart/form-data" on:submit={handleCreate}> <form class="grid gap-4 py-4" method="post" enctype="multipart/form-data" on:submit={handleCreate} autocomplete="off">
<div class="grid grid-cols-4 items-center gap-4"> <div class="grid grid-cols-4 items-center gap-4">
<Label>Förkortning</Label> <Label>Förkortning</Label>
<Input id="shortformEl" bind:value={abbForm.shortform} focus placeholder="" class="w-[290px]" /> <Input id="shortformEl" bind:value={abbForm.shortform} focus placeholder="" class="w-[290px]" />

View File

@ -110,6 +110,7 @@
on:keyup={change} on:keyup={change}
on:beforeinput={input} on:beforeinput={input}
bind:value={appState.text} bind:value={appState.text}
spellcheck="false"
></textarea> ></textarea>
</div> </div>

View File

@ -35,7 +35,7 @@ export class SkrivertDB extends Dexie {
super("skrivertdb"); super("skrivertdb");
this.version(1).stores({ this.version(1).stores({
syncInfo: "key, last_sync", syncInfo: "key, last_sync",
shortforms: "++id, [listid+shortform], phrase, last_use, uses, remind, updated", shortforms: "++id, [listid+shortform], phrase, used, uses, remind, updated",
lists: "++id, name, type, updated", lists: "++id, name, type, updated",
}); });
this.on("ready", async (db) => { this.on("ready", async (db) => {

View File

@ -59,7 +59,7 @@ export function expandShortform(
const shortform = ShortForm.toLowerCase(); const shortform = ShortForm.toLowerCase();
if (cache.has(shortform)) { if (cache.has(shortform)) {
const cachedShortform = cache.get(shortform); const cachedShortform = cache.get(shortform);
cachedShortform.last = u; cachedShortform.used = u;
cache.set(shortform, cachedShortform); cache.set(shortform, cachedShortform);
if (shortform.match(/(\d+)/) || ShortForm === shortform) { if (shortform.match(/(\d+)/) || ShortForm === shortform) {