<details>
<summary>File</summary>
<ul class="shadow w-36">
+ <li><a @click="lastSession">Last Session</a></li>
<li><a @click="saveCSV">Export CSV</a></li>
<li><a @click="prCSV">Open PR</a></li>
</ul>
this.loadFonts();
this.loadCSV();
this.loadFamilyPangrams();
-
},
mounted() {
const urlParams = new URLSearchParams(window.location.search);
}
},
methods: {
+ saveSession() {
+ localStorage.setItem("tagData", this.tagsToCSV());
+ },
+ lastSession() {
+ if (localStorage.getItem("tagData")) {
+ this.tags = this.parseCSV(localStorage.getItem("tagData"));
+ }
+ this.history.push("Last session loaded");
+ },
async getFamilyData() {
let dat = await fetch("family_data.json").then(response => response.json()).then(data => {
let results = [];
edited(family) {
this.isEdited = true;
this.history.push(`* ${family.name},${family.category},${family.Weight}`);
+ this.saveSession();
},
parseUnicode(str) {
let ranges = str.split(",");
this.tags.push(newFamily);
this.history.push(`+ ${newFamily.displayName},${newFamily.category},${newFamily.score}`);
}
+ this.saveSession();
},
copyFamily() {
this.isEdited = true;
this.tags.push(newTag);
this.history.push(`+ ${newTag.Family},${newTag["Group/Tag"]},${newTag.Weight}`);
})
+ this.saveSession();
},
AddPlaceHolderTags() {
this.isEdited = true;
let tagKey = `${Family.name},${Family.category}`;
this.seen.delete(tagKey);
this.history.push(`- ${Family.displayName},${Family.category},${Family.score}`);
+ this.saveSession();
},
tagsToCSV() {
this.RemovePlaceHolderTags();
return response.text()
})
.then(csvText => {
- const lines = csvText.split("\r\n")
- lines.forEach((line) => {
- if (line === "") {
- return;
- }
- let family = FontTag.fromCsv(line);
- this.categories.add(family.category);
- this.tags.push(family);
- });
+ this.tags = this.parseCSV(csvText);
csvText = "Family,Group/Tag,Weight\r\n" + csvText;
})
+ },
+ parseCSV(text) {
+ const lines = text.split("\r\n");
+ let res = [];
+ lines.forEach((line) => {
+ if (line === "") {
+ return;
+ }
+ let family = FontTag.fromCsv(line);
+ this.categories.add(family.category);
+ res.push(family);
+ });
+ return res;
}
}
} // methods