Skip to content

Commit

Permalink
Merge pull request #8757 from google/tags-copy
Browse files Browse the repository at this point in the history
tags: add ability to copy tags from another family
  • Loading branch information
m4rc1e authored Dec 19, 2024
2 parents a861d93 + a95d05a commit 0c424c5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
30 changes: 30 additions & 0 deletions .ci/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,22 @@
<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;">
Expand Down Expand Up @@ -154,6 +169,8 @@
newTag: "",
newFamily: '',
newWeight: '',
fromFamily: "",
toFamily: "",
CurrentCategory: "/Expressive/Calm",
Categories: new Set(),
Families: [],
Expand Down Expand Up @@ -317,6 +334,19 @@

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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
python-version: ['3.10']
os: [windows-latest, macos-13, ubuntu-latest]
os: [windows-latest, macos-13, ubuntu-22.04]
steps:
- name: Cancel previous
uses: styfle/[email protected]
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

diffenator:
name: Diffenate fonts
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
continue-on-error: true

steps:
Expand Down

0 comments on commit 0c424c5

Please sign in to comment.