Skip to content

Commit

Permalink
Load leaflet from local scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Jul 15, 2021
1 parent 5d44b57 commit 70f5a75
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
6 changes: 6 additions & 0 deletions frontend/app-config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ module.exports = function calculateConfig(env) {
{ from: './node_modules/ace-builds/src-min/snippets', to: 'dependencies/ace/snippets' },
{ from: './node_modules/ace-builds/src-min/worker-*.js', to: 'dependencies/ace/[name][ext]' },

{ from: './node_modules/leaflet-control-geocoder/dist/Control.Geocoder.css', to: 'dependencies/leaflet' },
{ from: './node_modules/leaflet-control-geocoder/dist/Control.Geocoder.min.js', to: 'dependencies/leaflet' },
{ from: './node_modules/leaflet/dist/leaflet.js', to: 'dependencies/leaflet' },
{ from: './node_modules/leaflet/dist/leaflet.css', to: 'dependencies/leaflet' },
{ from: './node_modules/leaflet/dist/images', to: 'dependencies/leaflet/images' },

{ from: './node_modules/video.js/dist/video.min.js', to: 'dependencies/videojs' },
{ from: './node_modules/video.js/dist/video-js.min.css', to: 'dependencies/videojs' },

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="editor-container" [class.compact]="snapshot.isCompact" (sqxResizeCondition)="setCompact($event)" [sqxResizeMinWidth]="600" [sqxResizeMaxWidth]="0">

<div class="editor-container" [class.compact]="snapshot.isCompact"
(sqxResizeCondition)="setCompact($event)"
[sqxResizeMinWidth]="600"
[sqxResizeMaxWidth]="0">
<form [class.hidden]="snapshot.isMapHidden">
<div class="editor" #editor></div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ export class GeolocationEditorComponent extends StatefulControlComponent<State,
this.searchBoxInput.nativeElement.remove();

Promise.all([
this.resourceLoader.loadStyle('https://cdnjs.cloudflare.com/ajax/libs/perliedman-leaflet-control-geocoder/1.9.0/Control.Geocoder.min.css'),
this.resourceLoader.loadStyle('https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.3/leaflet.css'),
this.resourceLoader.loadScript('https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.3/leaflet.js'),
this.resourceLoader.loadLocalStyle('dependencies/leaflet/Control.Geocoder.css'),
this.resourceLoader.loadLocalStyle('dependencies/leaflet/leaflet.css'),
this.resourceLoader.loadLocalScript('dependencies/leaflet/leaflet.js'),
]).then(() => {
this.map = L.map(this.editor.nativeElement).fitWorld();

Expand All @@ -188,7 +188,7 @@ export class GeolocationEditorComponent extends StatefulControlComponent<State,
attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors',
}).addTo(this.map);

this.resourceLoader.loadScript('https://cdnjs.cloudflare.com/ajax/libs/perliedman-leaflet-control-geocoder/1.9.0/Control.Geocoder.min.js')
this.resourceLoader.loadLocalScript('dependencies/leaflet/Control.Geocoder.min.js')
.then(() => {
L.Control.geocoder({
defaultMarkGeocode: false,
Expand Down
19 changes: 19 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"graphql": "15.5.0",
"image-focus": "1.2.0",
"keycharm": "0.4.0",
"leaflet": "^1.7.1",
"leaflet-control-geocoder": "^2.3.0",
"marked": "2.0.6",
"mersenne-twister": "1.1.0",
"mousetrap": "1.6.5",
Expand Down

0 comments on commit 70f5a75

Please sign in to comment.