diff client/src/lib/mixins.js @ 3965:2aaa1948b525 diagram-cleanup

client: diagrams: moved downloadPDF function to mixin and thereby unified how titles are created
author Markus Kottlaender <markus@intevation.de>
date Fri, 12 Jul 2019 15:32:15 +0200
parents afc7bca44df4
children c10897e0273b
line wrap: on
line diff
--- a/client/src/lib/mixins.js	Fri Jul 12 15:18:15 2019 +0200
+++ b/client/src/lib/mixins.js	Fri Jul 12 15:32:15 2019 +0200
@@ -185,6 +185,16 @@
     ...mapState("user", ["user"])
   },
   methods: {
+    downloadPDF() {
+      this.generatePDF({
+        templateData: this.templateData,
+        diagramTitle: this.title
+      });
+
+      this.pdf.doc.save(
+        this.title.replace(/\s/g, "_").replace(/[():,]/g, "") + ".pdf"
+      );
+    },
     addDiagram(position, offset, width, height) {
       let x = offset.x,
         y = offset.y;