From c4a51940295d514dd52f48b6f18638ac554224f4 Mon Sep 17 00:00:00 2001
From: Zero~Informatique
Date: Wed, 29 Jan 2020 05:35:35 +0100
Subject: viewer: Tag auto-completion should be more flexible. Resolves #38

---
 viewer/src/components/LdTagInput.vue | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'viewer/src/components/LdTagInput.vue')

diff --git a/viewer/src/components/LdTagInput.vue b/viewer/src/components/LdTagInput.vue
index 71131e6..7c9981f 100644
--- a/viewer/src/components/LdTagInput.vue
+++ b/viewer/src/components/LdTagInput.vue
@@ -42,6 +42,7 @@
 <script lang="ts">
 import { Component, Vue } from "vue-property-decorator";
 import { Operation } from "@/@types/tag/Operation";
+import Tools from "@/tools";
 
 @Component
 export default class LdTagInput extends Vue {
@@ -92,18 +93,20 @@ export default class LdTagInput extends Vue {
     category: string,
     disambiguation: string
   ): Tag.Search[] {
+    disambiguation = Tools.normalize(disambiguation);
     return Object.values(tags)
       .filter(node => node.tag.includes(category))
       .flatMap(node =>
         Object.values(node.children)
-          .filter(child => child.tag.includes(disambiguation))
+          .filter(child => child.tagfiltered.includes(disambiguation))
           .map(child => ({ ...child, parent: node, operation, display: `${operation}${node.tag}:${child.tag}` }))
       );
   }
 
   searchTagsFromFilter(tags: Tag.Index, operation: Operation, filter: string): Tag.Search[] {
+    filter = Tools.normalize(filter);
     return Object.values(tags)
-      .filter(node => node.tag.includes(filter))
+      .filter(node => node.tagfiltered.includes(filter))
       .map(node => ({ ...node, operation, display: `${operation}${node.tag}` }));
   }
 
-- 
cgit v1.2.3

