@@ -39,7 +39,8 @@ import {
39
39
UNIT_SYSTEM ,
40
40
DEFAULT_TILE_SERVER ,
41
41
getId ,
42
- OBSIDIAN_LEAFLET_POPOVER_SOURCE
42
+ OBSIDIAN_LEAFLET_POPOVER_SOURCE ,
43
+ DEFAULT_ATTRIBUTION
43
44
} from "./utils" ;
44
45
import {
45
46
MapInterface ,
@@ -332,7 +333,7 @@ export default class ObsidianLeaflet extends Plugin {
332
333
params ,
333
334
source
334
335
) ;
335
-
336
+
336
337
const map = await renderer . getMap ( ) ;
337
338
this . registerMapEvents ( map ) ;
338
339
@@ -392,8 +393,42 @@ export default class ObsidianLeaflet extends Plugin {
392
393
if (
393
394
this . data . version ?. major != null &&
394
395
this . data . version ?. major < 5 &&
395
- ( this . data . defaultTile . contains ( "openstreetmap" ) ||
396
- this . data . defaultTileDark . contains ( "openstreetmap" ) )
396
+ ( this . data . defaultTile . contains ( "stamen-tiles" ) ||
397
+ this . data . defaultTileDark . contains ( "stamen-tiles" ) )
398
+ ) {
399
+ new Notice (
400
+ createFragment ( ( e ) => {
401
+ e . createSpan ( {
402
+ text : "Obsidian Leaflet: Stamen has removed its map tile servers."
403
+ } ) ;
404
+ e . createEl ( "br" ) ;
405
+ e . createEl ( "br" ) ;
406
+ e . createSpan ( {
407
+ text : "Going forward, the default tile server will be "
408
+ } ) ;
409
+ e . createEl ( "a" , {
410
+ href : "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png" ,
411
+ text : "CartoDB"
412
+ } ) ;
413
+ e . createSpan ( { text : "." } ) ;
414
+ } ) ,
415
+ 0
416
+ ) ;
417
+ if ( this . data . defaultTile . contains ( "stamen-tiles" ) ) {
418
+ this . data . defaultTile = DEFAULT_TILE_SERVER ;
419
+ }
420
+ if ( this . data . defaultTileDark . contains ( "stamen-tiles" ) ) {
421
+ this . data . defaultTileDark = DEFAULT_TILE_SERVER ;
422
+ }
423
+ if ( this . data . defaultAttribution . contains ( "Stamen Design" ) ) {
424
+ this . data . defaultAttribution = DEFAULT_ATTRIBUTION ;
425
+ }
426
+ }
427
+ if (
428
+ this . data . version ?. major != null &&
429
+ this . data . version ?. major < 6 &&
430
+ ( this . data . defaultTile . contains ( "stamen" ) ||
431
+ this . data . defaultTileDark . contains ( "stamen" ) )
397
432
) {
398
433
new Notice (
399
434
createFragment ( ( e ) => {
@@ -664,7 +699,10 @@ export default class ObsidianLeaflet extends Plugin {
664
699
return ret ;
665
700
}
666
701
667
- public async getLocalFileMarkers ( file : TFile , markerFileName = "markers.json" ) : Promise < MarkerIcon [ ] > {
702
+ public async getLocalFileMarkers (
703
+ file : TFile ,
704
+ markerFileName = "markers.json"
705
+ ) : Promise < MarkerIcon [ ] > {
668
706
if ( ! file ) return [ ] ;
669
707
const markerFilePath = `${ file . parent . path } /${ markerFileName } ` ;
670
708
const markerFile = this . app . vault . getAbstractFileByPath ( markerFilePath ) ;
@@ -673,7 +711,7 @@ export default class ObsidianLeaflet extends Plugin {
673
711
const markerJson = await this . app . vault . read ( markerFile ) ;
674
712
try {
675
713
const icons = JSON . parse ( markerJson ) ;
676
- markers . push ( ...icons . map ( ( i : Icon ) => this . parseIcon ( i ) ) )
714
+ markers . push ( ...icons . map ( ( i : Icon ) => this . parseIcon ( i ) ) ) ;
677
715
} catch {
678
716
console . error ( `Badly formatted marker file ${ markerFilePath } ` ) ;
679
717
}
0 commit comments