diff --git a/src/sources/editor.jsx b/src/sources/editor.jsx
index 7580ff8..9cf2c70 100644
--- a/src/sources/editor.jsx
+++ b/src/sources/editor.jsx
@@ -21,6 +21,7 @@ class UnsupportedSource extends React.Component {
class VectorSource extends React.Component {
static propTypes = {
source: React.PropTypes.instanceOf(Immutable.Map).isRequired,
+ onSourceChanged: React.PropTypes.func.isRequired,
}
constructor(props) {
@@ -30,7 +31,11 @@ class VectorSource extends React.Component {
render() {
return
-
+ this.props.onSourceChanged(this.props.source.set('url', e.target.value))}
+ name="url" label="TileJSON url"
+ value={this.props.source.get("url")}
+ />
@@ -41,6 +46,7 @@ export class SourceEditor extends React.Component {
static propTypes = {
sourceId: React.PropTypes.string.isRequired,
source: React.PropTypes.instanceOf(Immutable.Map).isRequired,
+ onSourceChanged: React.PropTypes.func.isRequired,
}
constructor(props) {
@@ -58,6 +64,7 @@ export class SourceEditor extends React.Component {
sourceFromType(type) {
if (type === "vector") {
return this.props.onSourceChanged(this.props.sourceId, s)}
source={this.props.source}
/>
}
diff --git a/src/sources/list.jsx b/src/sources/list.jsx
index 061a3d7..19b67fd 100644
--- a/src/sources/list.jsx
+++ b/src/sources/list.jsx
@@ -14,6 +14,7 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
export class SourceList extends React.Component {
static propTypes = {
sources: React.PropTypes.instanceOf(Immutable.Map).isRequired,
+ onSourcesChanged: React.PropTypes.func.isRequired,
}
constructor(props) {
@@ -21,12 +22,18 @@ export class SourceList extends React.Component {
this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
}
+ onSourceChanged(sourceId, changedSource) {
+ const changedSources = this.props.sources.set(sourceId, changedSource)
+ this.props.onSourcesChanged(changedSources)
+ }
+
render() {
const sourceEditors = this.props.sources.map((source, sourceId) => {
return
}).toIndexedSeq()
diff --git a/src/workspace.jsx b/src/workspace.jsx
index 63c6a89..69f1ca7 100644
--- a/src/workspace.jsx
+++ b/src/workspace.jsx
@@ -22,11 +22,17 @@ export class WorkspaceDrawer extends React.Component {
this.props.onStyleChanged(changedStyle)
}
+ onSourcesChanged(changedSources) {
+ const changedStyle = this.props.mapStyle.set('sources', changedSources)
+ this.props.onStyleChanged(changedStyle)
+ }
+
render() {
let workspaceContent = null
if(this.props.workContext === "sources") {
workspaceContent =
}