mirror of
https://github.com/Damillora/Shioriko.git
synced 2024-11-22 04:17:33 +00:00
Add autocomplete to edit
This commit is contained in:
parent
16c9f998d5
commit
2cc9705845
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getPost, postUpdate } from "../api.js";
|
import { getPost, postUpdate, getTagAutocomplete } from "../api.js";
|
||||||
import { navigate } from "svelte-routing";
|
import { navigate } from "svelte-routing";
|
||||||
import Tags from "svelte-tags-input";
|
import Tags from "svelte-tags-input";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
@ -26,6 +26,11 @@
|
|||||||
form.tags = value.detail.tags;
|
form.tags = value.detail.tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onAutocomplete = async () => {
|
||||||
|
const list = await getTagAutocomplete();
|
||||||
|
return list;
|
||||||
|
};
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
const response = await postUpdate(id, form);
|
const response = await postUpdate(id, form);
|
||||||
navigate(`/post/${response.id}`);
|
navigate(`/post/${response.id}`);
|
||||||
@ -71,6 +76,7 @@
|
|||||||
tags={form.tags}
|
tags={form.tags}
|
||||||
addKeys={[9, 32]}
|
addKeys={[9, 32]}
|
||||||
on:tags={onTagChange}
|
on:tags={onTagChange}
|
||||||
|
autoComplete={onAutocomplete}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user