Skip to content

Commit 1355327

Browse files
committed
0.2.1
Fixes issue with loading the plugin if the data.json file is not present (fixes #10)
1 parent 1ca00d1 commit 1355327

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "obsidian-leaflet-plugin",
33
"name": "Obsidian Leaflet",
44
"description": "Leaflet integration for Obsidian.md",
5-
"version": "0.2.0",
5+
"version": "0.2.1",
66
"minAppVersion": "0.11.0",
77
"author": "Jeremy Valentine",
88
"repo": "valentine195/obsidian-leaflet-plugin",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-leaflet-plugin",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Leaflet integration for Obsidian.md",
55
"main": "main.js",
66
"scripts": {

src/main.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ export default class ObsidianLeaflet extends Plugin {
7979
console.log("loading leaflet plugin");
8080

8181
await this.loadSettings();
82-
82+
if (!this.AppData.mapMarkers?.every(map => map.file)) {
83+
this.AppData.mapMarkers = this.AppData.mapMarkers.map(map => {
84+
if (!map.file) map.file = map.path.slice(0, map.path.indexOf('.md') + 3);
85+
return map;
86+
})
87+
}
8388
this.markerIcons = this.generateMarkerMarkup(this.AppData.markerIcons);
8489

8590
this.registerMarkdownCodeBlockProcessor(
@@ -214,19 +219,10 @@ export default class ObsidianLeaflet extends Plugin {
214219
}
215220

216221
async loadSettings() {
217-
let data: ObsidianAppData = await this.loadData();
218-
219-
if (!data.mapMarkers.every(map => map.file)) {
220-
data.mapMarkers = data.mapMarkers.map(map => {
221-
if (!map.file) map.file = map.path.slice(0, map.path.indexOf('.md') + 3);
222-
return map;
223-
})
224-
}
225-
226222
this.AppData = Object.assign(
227223
{},
228224
DEFAULT_SETTINGS,
229-
data
225+
await this.loadData()
230226
);
231227
}
232228
async saveSettings() {

versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"0.2.0": "0.11.0"
2+
"0.2.1": "0.11.0"
33
}

0 commit comments

Comments
 (0)