mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 18:50:41 +01:00
feat(geomap): load leaflet
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
import library_loader from "../services/library_loader.js";
|
||||
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
||||
|
||||
const TPL = `\
|
||||
<div class="geo-map-widget">
|
||||
Map goes here.
|
||||
</div>`
|
||||
<style>
|
||||
.note-detail-geo-map,
|
||||
.geo-map-widget,
|
||||
.geo-map-container {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="geo-map-container"></div>
|
||||
</div>
|
||||
|
||||
`
|
||||
|
||||
export default class GeoMapWidget extends NoteContextAwareWidget {
|
||||
|
||||
@@ -12,7 +24,17 @@ export default class GeoMapWidget extends NoteContextAwareWidget {
|
||||
}
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL)
|
||||
this.$widget = $(TPL);
|
||||
|
||||
const $container = this.$widget.find(".geo-map-container");
|
||||
|
||||
library_loader.requireLibrary(library_loader.LEAFLET)
|
||||
.then(() => {
|
||||
//@ts-ignore
|
||||
L.map($container[0], {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user