From 635c82c3162483c4819f84384db5a02d62159bae Mon Sep 17 00:00:00 2001 From: Liyas Thomas Date: Wed, 23 Oct 2019 08:54:05 +0530 Subject: [PATCH] :sparkles: Added 'Export JSON' button to download collections as json file --- components/collections/collection.vue | 8 +++---- components/collections/exportCollection.vue | 23 +++++++++++++++++++++ components/collections/folder.vue | 6 +++--- components/collections/request.vue | 10 ++++----- components/history.vue | 4 ++-- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/components/collections/collection.vue b/components/collections/collection.vue index 717f6d728..1faa92205 100644 --- a/components/collections/collection.vue +++ b/components/collections/collection.vue @@ -19,14 +19,14 @@
- +
diff --git a/components/collections/exportCollection.vue b/components/collections/exportCollection.vue index b4b927cf7..c0291eaa9 100644 --- a/components/collections/exportCollection.vue +++ b/components/collections/exportCollection.vue @@ -20,6 +20,14 @@
+
@@ -44,6 +52,21 @@ export default { hideModel() { this.$emit('hide-model'); }, + exportJSON() { + let text = this.collectionJson; + text = text.replace(/\n/g, '\r\n'); + let blob = new Blob([text], { + type: 'text/json' + }); + let anchor = document.createElement('a'); + anchor.download = 'postwoman-collection.json'; + anchor.href = window.URL.createObjectURL(blob); + anchor.target = '_blank'; + anchor.style.display = 'none'; + document.body.appendChild(anchor); + anchor.click(); + document.body.removeChild(anchor); + } }, }; diff --git a/components/collections/folder.vue b/components/collections/folder.vue index f396c4007..de1b5f3f1 100644 --- a/components/collections/folder.vue +++ b/components/collections/folder.vue @@ -10,12 +10,12 @@
- +
diff --git a/components/collections/request.vue b/components/collections/request.vue index 459628ed1..18f09b0ae 100644 --- a/components/collections/request.vue +++ b/components/collections/request.vue @@ -1,18 +1,18 @@ diff --git a/components/history.vue b/components/history.vue index bc9673826..5d29c5ae7 100644 --- a/components/history.vue +++ b/components/history.vue @@ -42,12 +42,12 @@
  • -
  • -