{
- tags = tags.replace(/[^a-zA-Z,]/g, '').toLocaleLowerCase().replace(/ /g, '')
+ tags = tags.replace(/[^a-zA-Z,\-]/g, '').toLocaleLowerCase().replace(/ /g, '')
}} />
+
+ {#each searchTagList(tags) as tag}
+
+ {/each}
+
+
{#if char.license !== 'CC BY-NC-SA 4.0' && char.license !== 'CC BY-SA 4.0'}
License
@@ -104,7 +114,7 @@
import SelectInput from "../GUI/SelectInput.svelte";
import { CCLicenseData } from "src/ts/creation/license";
import OptionInput from "../GUI/OptionInput.svelte";
- import { parseMultilangString, sleep } from "src/ts/util";
+ import { TagList, parseMultilangString, searchTagList, sleep } from "src/ts/util";
import MultiLangInput from "../GUI/MultiLangInput.svelte";
export let close = () => {}
export let char:character
diff --git a/src/ts/util.ts b/src/ts/util.ts
index 359dfabb..b0c994bd 100644
--- a/src/ts/util.ts
+++ b/src/ts/util.ts
@@ -933,4 +933,29 @@ export const TagList = [
'inhuman', 'nonhuman', 'non-human-character', 'not-human'
]
}
-]
\ No newline at end of file
+]
+
+export const searchTagList = (query:string) => {
+ const splited = query.split(',').map(v => v.trim())
+ if(splited.length > 10){
+ return []
+ }
+ const realQuery = splited.at(-1).trim().toLowerCase()
+
+ let result = []
+
+ for(const tag of TagList){
+ if(tag.value.startsWith(realQuery)){
+ result.push(tag.value)
+ continue
+ }
+ for(const alias of tag.alias){
+ if(alias.startsWith(realQuery)){
+ result.push(tag.value)
+ break
+ }
+ }
+ }
+
+ return result.filter(v => splited.indexOf(v) === -1)
+}
\ No newline at end of file