mirror of
https://github.com/maputnik/editor.git
synced 2025-12-26 08:00:01 +00:00
Deref style on open
This commit is contained in:
@@ -119,11 +119,13 @@ export default class LayerEditor extends React.Component {
|
||||
onIdChange={newId => this.props.onLayerIdChange(this.props.layer.id, newId)}
|
||||
/>
|
||||
case 'source': return <div>
|
||||
{this.props.layer.filter &&
|
||||
<FilterEditor
|
||||
filter={this.props.layer.filter}
|
||||
properties={this.props.vectorLayers[this.props.layer['source-layer']]}
|
||||
onChange={f => this.onFilterChange(f)}
|
||||
/>
|
||||
}
|
||||
<SourceEditor
|
||||
source={this.props.layer.source}
|
||||
sourceLayer={this.props.layer['source-layer']}
|
||||
|
||||
@@ -76,7 +76,7 @@ class OpenModal extends React.Component {
|
||||
withCredentials: false,
|
||||
}, (error, response, body) => {
|
||||
if (!error && response.statusCode == 200) {
|
||||
const mapStyle = style.ensureMetadataExists(JSON.parse(body))
|
||||
const mapStyle = style.ensureStyleValidity(JSON.parse(body))
|
||||
console.log('Loaded style ', mapStyle.id)
|
||||
this.props.onStyleOpen(mapStyle)
|
||||
} else {
|
||||
@@ -91,7 +91,7 @@ class OpenModal extends React.Component {
|
||||
reader.readAsText(file, "UTF-8");
|
||||
reader.onload = e => {
|
||||
let mapStyle = JSON.parse(e.target.result)
|
||||
mapStyle = style.ensureMetadataExists(mapStyle)
|
||||
mapStyle = style.ensureStyleValidity(mapStyle)
|
||||
this.props.onStyleOpen(mapStyle);
|
||||
}
|
||||
reader.onerror = e => console.log(e.target);
|
||||
|
||||
Reference in New Issue
Block a user