@@ -19,19 +19,15 @@ import {
19
19
setValidationError ,
20
20
getMarkerIcon ,
21
21
DEFAULT_TILE_SERVER ,
22
- DEFAULT_ATTRIBUTION , DEFAULT_TILE_SUBDOMAINS
22
+ DEFAULT_ATTRIBUTION ,
23
+ DEFAULT_TILE_SUBDOMAINS
23
24
} from "src/utils" ;
24
25
import { IconSuggestionModal } from "src/modals" ;
25
26
26
- import type {
27
- MapMarkerData ,
28
- Icon ,
29
- SavedMarkerProperties ,
30
- TooltipDisplay ,
31
- } from "../types" ;
32
27
import { FolderSuggestionModal } from "src/modals/path" ;
33
28
import type ObsidianLeaflet from "src/main" ;
34
29
import t from "src/l10n/locale" ;
30
+ import { TooltipDisplay , SavedMarkerProperties , MapMarkerData } from "types" ;
35
31
36
32
export class ObsidianLeafletSettingTab extends PluginSettingTab {
37
33
plugin : ObsidianLeaflet ;
@@ -292,12 +288,12 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
292
288
let markers = additionalMarkers . createDiv ( {
293
289
cls : "additional-markers"
294
290
} ) ;
295
- this . data . markerIcons . forEach ( ( marker ) => {
291
+ this . plugin . markerIcons . slice ( 1 ) . forEach ( ( marker ) => {
296
292
let setting = new Setting ( markers )
297
293
. addExtraButton ( ( b ) =>
298
294
b . onClick ( async ( ) => {
299
295
const edit = await this . plugin . createNewMarkerType ( {
300
- original : marker
296
+ original : marker . markerIcon
301
297
} ) ;
302
298
if ( ! edit || ! edit . type || ! edit . iconName ) {
303
299
return ;
@@ -328,27 +324,15 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
328
324
} )
329
325
) ;
330
326
331
- const params =
332
- marker . layer && ! this . data . defaultMarker . isImage
333
- ? {
334
- transform : marker . transform ,
335
- mask : getIcon ( this . data . defaultMarker . iconName )
336
- }
337
- : { } ;
338
- let iconNode = getMarkerIcon ( marker , params ) . node ;
339
-
340
327
let markerIconDiv = createDiv ( {
341
- cls : "marker-icon-display" ,
342
- attr : {
343
- style : `color: ${ marker . color } ;`
344
- }
328
+ cls : "marker-icon-display"
345
329
} ) ;
346
- markerIconDiv . appendChild ( iconNode ) ;
330
+ markerIconDiv . innerHTML = marker . html ;
347
331
let name = setting . nameEl . createDiv ( "marker-type-display" ) ;
348
332
name . appendChild ( markerIconDiv ) ;
349
333
name . appendText ( marker . type ) ;
350
- if ( marker . tags && marker . tags . length ) {
351
- setting . setDesc ( marker . tags . join ( ", " ) ) ;
334
+ if ( marker . markerIcon . tags && marker . markerIcon . tags . length ) {
335
+ setting . setDesc ( marker . markerIcon . tags . join ( ", " ) ) ;
352
336
}
353
337
} ) ;
354
338
}
@@ -418,7 +402,9 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
418
402
new Setting ( containerEl )
419
403
. setName ( t ( "Default Tile Server" ) )
420
404
. setDesc (
421
- t ( "It is up to you to ensure you have proper access to this tile server." )
405
+ t (
406
+ "It is up to you to ensure you have proper access to this tile server."
407
+ )
422
408
)
423
409
. addText ( ( t ) => {
424
410
t . setValue ( this . plugin . data . defaultTile ) . onChange ( ( v ) => {
@@ -440,20 +426,25 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
440
426
new Setting ( containerEl )
441
427
. setName ( t ( "Default Tile Server Subdomains" ) )
442
428
. setDesc (
443
- t ( "Available subdomains for this tile server concurrent requests." )
429
+ t (
430
+ "Available subdomains for this tile server concurrent requests."
431
+ )
444
432
)
445
433
. addText ( ( t ) => {
446
- t . setValue ( this . plugin . data . defaultTileSubdomains ) . onChange ( ( v ) => {
447
- this . plugin . data . defaultTileSubdomains = v ;
448
- this . plugin . saveSettings ( ) ;
449
- } ) ;
434
+ t . setValue ( this . plugin . data . defaultTileSubdomains ) . onChange (
435
+ ( v ) => {
436
+ this . plugin . data . defaultTileSubdomains = v ;
437
+ this . plugin . saveSettings ( ) ;
438
+ }
439
+ ) ;
450
440
} )
451
441
. addExtraButton ( ( b ) =>
452
442
b
453
443
. setIcon ( "reset" )
454
444
. setTooltip ( t ( "Reset" ) )
455
445
. onClick ( ( ) => {
456
- this . plugin . data . defaultTileSubdomains = DEFAULT_TILE_SUBDOMAINS ;
446
+ this . plugin . data . defaultTileSubdomains =
447
+ DEFAULT_TILE_SUBDOMAINS ;
457
448
458
449
this . createMapSettings ( containerEl ) ;
459
450
this . plugin . saveSettings ( ) ;
@@ -462,7 +453,9 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
462
453
new Setting ( containerEl )
463
454
. setName ( t ( "Default Tile Server Attribution" ) )
464
455
. setDesc (
465
- t ( "Please ensure your attribution meets all requirements set by the tile server." )
456
+ t (
457
+ "Please ensure your attribution meets all requirements set by the tile server."
458
+ )
466
459
)
467
460
. addTextArea ( ( t ) => {
468
461
t . setValue ( this . plugin . data . defaultAttribution ) . onChange (
@@ -487,7 +480,9 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
487
480
new Setting ( containerEl )
488
481
. setName ( t ( "Default Tile Server (Dark Mode)" ) )
489
482
. setDesc (
490
- t ( "It is up to you to ensure you have proper access to this tile server." )
483
+ t (
484
+ "It is up to you to ensure you have proper access to this tile server."
485
+ )
491
486
)
492
487
. addText ( ( t ) => {
493
488
t . setValue ( this . plugin . data . defaultTileDark ) . onChange ( ( v ) => {
@@ -784,7 +779,8 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
784
779
lastAccessed : Date . now ( ) ,
785
780
markers : [ ] ,
786
781
overlays : [ ] ,
787
- shapes : [ ]
782
+ shapes : [ ] ,
783
+ locked : false
788
784
} ;
789
785
this . data . mapMarkers . push ( map ) ;
790
786
}
@@ -823,7 +819,8 @@ export class ObsidianLeafletSettingTab extends PluginSettingTab {
823
819
}
824
820
} catch ( e ) {
825
821
new Notice (
826
- t ( "There was an error while importing %1" , files [ 0 ] . name ) ) ;
822
+ t ( "There was an error while importing %1" , files [ 0 ] . name )
823
+ ) ;
827
824
console . error ( e ) ;
828
825
}
829
826
0 commit comments