diff --git a/config/webpack.config.js b/config/webpack.config.js index 1e9da5a..a50402a 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -16,7 +16,7 @@ module.exports = { ], devtool: process.env.WEBPACK_DEVTOOL || 'cheap-module-source-map', output: { - path: path.join(__dirname, 'public'), + path: path.join(__dirname, '..', 'public'), filename: 'bundle.js' }, resolve: { @@ -49,6 +49,6 @@ module.exports = { new HtmlWebpackPlugin({ title: 'Maputnik', template: './src/template.html' - }), + }) ] }; diff --git a/config/webpack.production.config.js b/config/webpack.production.config.js index 0ad9410..f13e307 100644 --- a/config/webpack.production.config.js +++ b/config/webpack.production.config.js @@ -30,7 +30,7 @@ module.exports = { ] }, output: { - path: path.join(__dirname, 'public'), + path: path.join(__dirname, '..', 'public'), filename: '[name].[chunkhash].js', chunkFilename: '[chunkhash].js' }, diff --git a/package.json b/package.json index 65dccd8..933c54b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "homepage": "https://github.com/maputnik/editor#readme", "dependencies": { "@mapbox/mapbox-gl-style-spec": "^9.0.0", + "@mapbox/mapbox-gl-rtl-text": "^0.1.0", "classnames": "^2.2.5", "codemirror": "^5.18.2", "color": "^1.0.3", @@ -103,11 +104,12 @@ "babel-preset-es2015": "6.18.0", "babel-preset-react": "6.16.0", "babel-runtime": "^6.11.6", + "base64-loader": "^1.0.0", "css-loader": "0.26.1", "eslint": "^3.5.0", "eslint-plugin-react": "^6.2.0", "extract-text-webpack-plugin": "^1.0.1", - "file-loader": "0.9.0", + "file-loader": "^0.11.1", "html-webpack-plugin": "^2.22.0", "json-loader": "^0.5.4", "karma": "^1.3.0", @@ -124,7 +126,6 @@ "stylelint": "^7.7.1", "stylelint-config-standard": "^15.0.1", "transform-loader": "^0.2.3", - "url-loader": "0.5.7", "wdio-mocha-framework": "^0.5.9", "wdio-phantomjs-service": "^0.2.2", "wdio-spec-reporter": "^0.1.0", diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index bc2950e..11b5019 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -11,6 +11,7 @@ import Color from 'color' import { colorHighlightedLayer } from '../../libs/highlight' import 'mapbox-gl/dist/mapbox-gl.css' import '../../mapboxgl.css' +import '../../libs/mapbox-rtl' function renderLayerPopup(features) { var mountNode = document.createElement('div'); diff --git a/src/libs/mapbox-rtl.js b/src/libs/mapbox-rtl.js new file mode 100644 index 0000000..558bea2 --- /dev/null +++ b/src/libs/mapbox-rtl.js @@ -0,0 +1,11 @@ +import MapboxGl from 'mapbox-gl/dist/mapbox-gl.js' + +// Load mapbox-gl-rtl-text using object urls without needing http://localhost for AJAX. +const data = require("base64?mimetype=text/javascript!@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.js"); + +const blob = new window.Blob([window.atob(data)]); +const objectUrl = window.URL.createObjectURL(blob, { + type: "text/javascript" +}); + +MapboxGl.setRTLTextPlugin(objectUrl);