mirror of
https://github.com/maputnik/editor.git
synced 2025-12-25 15:40:00 +00:00
Switch to using object urls so we don't need ajax for mapbox-gl-rtl-text plugin (issue #126)
This commit is contained in:
@@ -12,8 +12,7 @@ import Color from 'color'
|
||||
import { colorHighlightedLayer } from '../../libs/highlight'
|
||||
import 'mapbox-gl/dist/mapbox-gl.css'
|
||||
import '../../mapboxgl.css'
|
||||
|
||||
MapboxGl.setRTLTextPlugin("/mapbox-gl/plugins/mapbox-gl-rtl-text.js");
|
||||
import '../../libs/mapbox-rtl'
|
||||
|
||||
function renderLayerPopup(features) {
|
||||
var mountNode = document.createElement('div');
|
||||
|
||||
11
src/libs/mapbox-rtl.js
Normal file
11
src/libs/mapbox-rtl.js
Normal file
@@ -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);
|
||||
Reference in New Issue
Block a user