From 53cb3171551ac8a591049a3ac6bee4d4a77cf543 Mon Sep 17 00:00:00 2001 From: orangemug Date: Thu, 25 Jan 2018 08:30:23 +0000 Subject: [PATCH 1/4] Fix for safari modal appearing below the overlay. Fixes #225 --- src/styles/_modal.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/styles/_modal.scss b/src/styles/_modal.scss index 5674060..6ec5109 100644 --- a/src/styles/_modal.scss +++ b/src/styles/_modal.scss @@ -6,6 +6,7 @@ background-color: $color-black; box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.3); z-index: 3; + position: relative; } .maputnik-modal-section { From 9d96525f12ca5d5247eab3483a9f20defd8470ce Mon Sep 17 00:00:00 2001 From: orangemug Date: Thu, 25 Jan 2018 19:12:04 +0000 Subject: [PATCH 2/4] Added support for mapbox:// urls. --- config/webpack.loaders.js | 11 +++++++++++ package.json | 1 + src/components/App.jsx | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/config/webpack.loaders.js b/config/webpack.loaders.js index f931b7b..f4004e9 100644 --- a/config/webpack.loaders.js +++ b/config/webpack.loaders.js @@ -4,6 +4,17 @@ module.exports = [ exclude: /(node_modules|bower_components|public)/, loaders: ['react-hot-loader/webpack'] }, + // HACK: This is a massive hack and reaches into the mapbox-gl private API. + // We have to include this for access to `normalizeSourceURL`. We should + // remove this ASAP, see + { + test: /.*node_modules[\/\\]mapbox-gl[\/\\]src[\///]util[\/\\].*\.js/, + loader: 'babel-loader', + query: { + presets: ['env', 'react', 'flow'], + plugins: ['transform-runtime', 'transform-decorators-legacy', 'transform-class-properties'], + } + }, { test: /\.jsx?$/, exclude: /(.*node_modules(?![\/\\]@mapbox[\/\\]mapbox-gl-style-spec)|bower_components|public)/, diff --git a/package.json b/package.json index b0742a9..819fd7f 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.1", + "babel-preset-flow": "^6.23.0", "babel-preset-react": "^6.24.1", "babel-runtime": "^6.26.0", "base64-loader": "^1.0.0", diff --git a/src/components/App.jsx b/src/components/App.jsx index d90415a..b9935ff 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -21,6 +21,10 @@ import LayerWatcher from '../libs/layerwatcher' import tokens from '../config/tokens.json' import isEqual from 'lodash.isequal' +import MapboxGl from 'mapbox-gl' +import mapboxUtil from 'mapbox-gl/src/util/mapbox' + + function updateRootSpec(spec, fieldName, newValues) { return { ...spec, @@ -199,7 +203,8 @@ export default class App extends React.Component { }; if(!this.state.sources.hasOwnProperty(key) && val.type === "vector") { - const url = val.url; + const url = mapboxUtil.normalizeSourceURL(val.url, MapboxGl.accessToken); + fetch(url) .then((response) => { return response.json(); From 0ebb299fd0e653fea579aa7ca74b7c7bf2cab10a Mon Sep 17 00:00:00 2001 From: orangemug Date: Thu, 25 Jan 2018 19:40:54 +0000 Subject: [PATCH 3/4] Added try/catch around mapboxUtil.normalizeSourceURL --- src/components/App.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/App.jsx b/src/components/App.jsx index b9935ff..c76bf70 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -203,7 +203,12 @@ export default class App extends React.Component { }; if(!this.state.sources.hasOwnProperty(key) && val.type === "vector") { - const url = mapboxUtil.normalizeSourceURL(val.url, MapboxGl.accessToken); + let url = val.url; + try { + url = mapboxUtil.normalizeSourceURL(url, MapboxGl.accessToken); + } catch(err) { + console.warn("Failed to normalizeSourceURL: ", err); + } fetch(url) .then((response) => { From f0f6130272217d38db873142060973bea63113f0 Mon Sep 17 00:00:00 2001 From: orangemug Date: Thu, 25 Jan 2018 19:58:01 +0000 Subject: [PATCH 4/4] Fixed typo. --- config/webpack.loaders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/webpack.loaders.js b/config/webpack.loaders.js index f4004e9..fa6c4cc 100644 --- a/config/webpack.loaders.js +++ b/config/webpack.loaders.js @@ -8,7 +8,7 @@ module.exports = [ // We have to include this for access to `normalizeSourceURL`. We should // remove this ASAP, see { - test: /.*node_modules[\/\\]mapbox-gl[\/\\]src[\///]util[\/\\].*\.js/, + test: /.*node_modules[\/\\]mapbox-gl[\/\\]src[\/\\]util[\/\\].*\.js/, loader: 'babel-loader', query: { presets: ['env', 'react', 'flow'],