2025-01-20 19:18:29 +02:00
|
|
|
import library_loader from "../services/library_loader.js";
|
2025-01-20 18:45:56 +02:00
|
|
|
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
|
|
|
|
|
|
|
const TPL = `\
|
|
|
|
<div class="geo-map-widget">
|
2025-01-20 19:18:29 +02:00
|
|
|
<style>
|
|
|
|
.note-detail-geo-map,
|
|
|
|
.geo-map-widget,
|
|
|
|
.geo-map-container {
|
|
|
|
height: 100%;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<div class="geo-map-container"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
`
|
2025-01-20 18:45:56 +02:00
|
|
|
|
|
|
|
export default class GeoMapWidget extends NoteContextAwareWidget {
|
|
|
|
|
|
|
|
constructor(widgetMode: "type") {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
doRender() {
|
2025-01-20 19:18:29 +02:00
|
|
|
this.$widget = $(TPL);
|
|
|
|
|
|
|
|
const $container = this.$widget.find(".geo-map-container");
|
|
|
|
|
|
|
|
library_loader.requireLibrary(library_loader.LEAFLET)
|
|
|
|
.then(() => {
|
|
|
|
//@ts-ignore
|
|
|
|
L.map($container[0], {
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
2025-01-20 18:45:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|