mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-15 08:51:19 +01:00
Format style on download
This commit is contained in:
parent
c9fd00e2ed
commit
cb46ac5421
1 changed files with 2 additions and 2 deletions
|
@ -13,6 +13,7 @@ import MessagePanel from './MessagePanel'
|
||||||
|
|
||||||
import GlSpec from 'mapbox-gl-style-spec/reference/latest.js'
|
import GlSpec from 'mapbox-gl-style-spec/reference/latest.js'
|
||||||
import validateStyleMin from 'mapbox-gl-style-spec/lib/validate_style.min'
|
import validateStyleMin from 'mapbox-gl-style-spec/lib/validate_style.min'
|
||||||
|
import formatStyle from 'mapbox-gl-style-spec/lib/format'
|
||||||
import style from '../libs/style.js'
|
import style from '../libs/style.js'
|
||||||
import { initialStyleUrl, loadStyleUrl } from '../libs/urlopen'
|
import { initialStyleUrl, loadStyleUrl } from '../libs/urlopen'
|
||||||
import { undoMessages, redoMessages } from '../libs/diffmessage'
|
import { undoMessages, redoMessages } from '../libs/diffmessage'
|
||||||
|
@ -76,7 +77,7 @@ export default class App extends React.Component {
|
||||||
|
|
||||||
onStyleDownload() {
|
onStyleDownload() {
|
||||||
const mapStyle = this.state.mapStyle
|
const mapStyle = this.state.mapStyle
|
||||||
const blob = new Blob([JSON.stringify(mapStyle, null, 4)], {type: "application/json;charset=utf-8"});
|
const blob = new Blob([formatStyle(mapStyle)], {type: "application/json;charset=utf-8"});
|
||||||
saveAs(blob, mapStyle.id + ".json");
|
saveAs(blob, mapStyle.id + ".json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,4 +225,3 @@ export default class App extends React.Component {
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue