]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
tags.html: add Open PR button 8029/head
authorMarc Foley <m.foley.88@gmail.com>
Thu, 15 Aug 2024 12:33:07 +0000 (13:33 +0100)
committerMarc Foley <m.foley.88@gmail.com>
Thu, 15 Aug 2024 12:33:07 +0000 (13:33 +0100)
.ci/tags.html

index 424f0236f1ca1db17044ee2f83c74c39aa011b1f..d9d6113ee5b2439c9d6c9b7fd8122ba88613f774 100644 (file)
@@ -13,8 +13,6 @@
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 
     <h1>Google Fonts Tagger</h1>
-    <p>When you're done editing, please save the csv and open a pull request in the Google Fonts repo that replaces the <a href="https://github.com/google/fonts/blob/main/tags/all/families.csv">families.csv</a> file.</p>
-
 
     <div id="panel">
       <div class="panel-tile">
@@ -36,6 +34,7 @@
       </div>
       <div class="panel-tile">
         <button @click="saveCSV">Save CSV</button>
+        <button @click="prCSV">Open Pull Request</button>
       </div>
       <div v-if="isEdited" id="edited-panel">Edited</div>
     </div>
         document.body.removeChild(a);
         URL.revokeObjectURL(url);
       },
+      prCSV() {
+        this.Families = this.Families.filter((t) => t.Family !== "");
+        console.log(this.Families);
+        let csv = Papa.unparse(this.Families,
+          {
+            columns: ["Family", "Group/Tag", "Weight"],
+            skipEmptyLines: true,
+          }
+        );
+        alert("Tag data copied to clipboard. A github pull request page will open in a new tab. Please remove the old data and paste in the new.");
+        navigator.clipboard.writeText(csv);
+        window.open("https://github.com/google/fonts/edit/main/tags/all/families.csv")
+      },
       loadCSV() {
         const csvFilePath = 'https://raw.githubusercontent.com/google/fonts/main/tags/all/families.csv'; // Update this path to your CSV file
         fetch(csvFilePath)