From c0480a50eab9e3005750bb4731727dd46591adb7 Mon Sep 17 00:00:00 2001
From: orangemug
Date: Sun, 15 Jul 2018 22:51:57 +0100
Subject: [PATCH] Option to download styles with own tokens.
---
src/components/modals/ExportModal.jsx | 32 ++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/components/modals/ExportModal.jsx b/src/components/modals/ExportModal.jsx
index c08a9c6..c6f397d 100644
--- a/src/components/modals/ExportModal.jsx
+++ b/src/components/modals/ExportModal.jsx
@@ -235,10 +235,24 @@ class ExportModal extends React.Component {
}
downloadStyle() {
- const blob = new Blob([styleSpec.format(stripAccessTokens(this.props.mapStyle))], {type: "application/json;charset=utf-8"});
+ const tokenStyle = styleSpec.format(stripAccessTokens(style.replaceAccessToken(this.props.mapStyle)));
+
+ const blob = new Blob([tokenStyle], {type: "application/json;charset=utf-8"});
saveAs(blob, this.props.mapStyle.id + ".json");
}
+ changeMetadataProperty(property, value) {
+ const changedStyle = {
+ ...this.props.mapStyle,
+ metadata: {
+ ...this.props.mapStyle.metadata,
+ [property]: value
+ }
+ }
+ this.props.onStyleChanged(changedStyle)
+ }
+
+
render() {
return
Download a JSON style to your computer.
+
+
+
+
+
+
+
+
+
+