]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
rm tag
authorMarc Foley <m.foley.88@gmail.com>
Fri, 11 Jul 2025 12:46:58 +0000 (13:46 +0100)
committerMarc Foley <m.foley.88@gmail.com>
Fri, 11 Jul 2025 12:46:58 +0000 (13:46 +0100)
tagger2/TagsByFont.js
tagger2/index.html

index 67700ee43d059d703cb43555d5a2df18723f2a5b..179a3912635a3d0bbac240bdcbbd56565e8f4608 100644 (file)
@@ -6,6 +6,11 @@ export default {
       return this.tags.filter(tag => tag.family && tag.family.name === this.font);
     }
   },
+  methods: {
+    removeTag(tag) {
+      this.$root.$emit('remove-tag', tag);
+    }
+  },
   template: `
     <div>
       <h3>Tags for fonter</h3>
@@ -16,7 +21,9 @@ export default {
       </select>
       <ul>
         <li v-for="tag in filteredTags" :key="tag.tagName + tag.family.name">
-          {{ tag.tagName }} (Score: {{ tag.score }})
+          {{ tag.tagName }}
+           <input type="number" v-model="tag.score" @change="$emit('update:tags', tags)" />
+           <button @click="removeTag(tag)">Remove</button>
         </li>
       </ul>
     </div>
index a93bb88daf9a20ea4b2bd76f9d22715715310ee3..b662b2ebcf020b65778d60e195e90f991f100f58 100644 (file)
     import TagsByFont from "./TagsByFont.js";
     import TagsByCategories from "./TagsByCategories.js";
     import Panel from "./Panel.js";
+    import TagView from "./TagView.js";
 
     Vue.component('tags-by-font', TagsByFont);
     Vue.component('tags-by-categories', TagsByCategories);
     Vue.component('panel', Panel);
+    Vue.component('tag-view', TagView);
     
     var app = new Vue({
       el: '#app',
         },
         removePanel(idx) {
           this.panels.splice(idx, 1);
+        },
+        removeTag(tag) {
+          console.log("Removing tag:", tag);
+          const index = this.tags.items.indexOf(tag)
+          if (index !== -1) {
+            this.tags.items.splice(index, 1);
+          }
         }
       },
       async created() {
@@ -54,6 +63,7 @@
         this.gf.loadFamilies();
         this.tags = new Tags(this.gf);
         this.tags.items = this.tags.items;
+        this.$root.$on("remove-tag", this.removeTag);
       }
     });
     window.app = app