]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
tags: add ability to copy tags from another family
authorMarc Foley <m.foley.88@gmail.com>
Thu, 19 Dec 2024 09:40:20 +0000 (09:40 +0000)
committerMarc Foley <m.foley.88@gmail.com>
Thu, 19 Dec 2024 09:40:20 +0000 (09:40 +0000)
.ci/tags.html

index 12fcec9aaee672d0ea14694c1515cfcb4d2dd3c8..f0b97f41cacafcc3f91f6b81c61b6543b1fef460 100644 (file)
             <button class="join-item btn btn-xs">Add</button>
           </div>
         </form>
+        <div class="divider"></div>
+        <form @submit.prevent="copyFamily">
+          <div class="label lavel-xs">
+            <span class="label-text label-xs">Copy tags from a family</span>
+          </div>
+          <div class="join">
+            <input class="join-item input input-xs input-bordered" list="items" v-model="fromFamily" required placeholder="From Family">
+            <input class="join-item input input-xs input-bordered" list="items" v-model="toFamily" required placeholder="To Family">
+            <datalist id="items">
+              <option v-for="family in uniqueFamilies" :value="family">
+            </datalist>
+            <button class="join-item btn btn-xs">Copy</button>
+          </div>
+        </form>
       </div>
+
       <div class="divider"></div>
 
       <div class="panel-tile" style="max-height: 100px; overflow: scroll;">
         newTag: "",
         newFamily: '',
         newWeight: '',
+        fromFamily: "",
+        toFamily: "",
         CurrentCategory: "/Expressive/Calm",
         Categories: new Set(),
         Families: [],
         
         this.history.push(`+ ${newFamily.Family},${newFamily["Group/Tag"]},${newFamily.Weight}`);
       },
+      copyFamily() {
+        this.isEdited = true;
+        let fromTags = this.Families.filter(family => family.Family === this.fromFamily);
+        if (fromTags.length === 0) {
+          alert(`No tags found for Family "${this.toFamily}"`);
+          return;
+        }
+        fromTags.forEach((tag) => {
+          let newTag = {Family: this.toFamily, "Group/Tag": tag["Group/Tag"], Weight: tag.Weight};
+          this.Families.push(newTag);
+          this.history.push(`+ ${newTag.Family},${newTag["Group/Tag"]},${newTag.Weight}`);
+        })
+      },
       AddPlaceHolderTags() {
         this.isEdited = true;
         const existingTags = this.sortedFamilies