mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-05 23:21:54 +08:00
chore: 🤖 remove leaflet css from library_loader
This commit is contained in:
parent
b30035834a
commit
accf245179
@ -77,10 +77,6 @@ const HIGHLIGHT_JS: Library = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const LEAFLET: Library = {
|
|
||||||
css: ["node_modules/leaflet/dist/leaflet.css"]
|
|
||||||
};
|
|
||||||
|
|
||||||
async function requireLibrary(library: Library) {
|
async function requireLibrary(library: Library) {
|
||||||
if (library.css) {
|
if (library.css) {
|
||||||
library.css.map((cssUrl) => requireCss(cssUrl));
|
library.css.map((cssUrl) => requireCss(cssUrl));
|
||||||
@ -168,6 +164,5 @@ export default {
|
|||||||
CODE_MIRROR,
|
CODE_MIRROR,
|
||||||
CALENDAR_WIDGET,
|
CALENDAR_WIDGET,
|
||||||
KATEX,
|
KATEX,
|
||||||
HIGHLIGHT_JS,
|
HIGHLIGHT_JS
|
||||||
LEAFLET
|
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type { Map } from "leaflet";
|
import type { Map } from "leaflet";
|
||||||
import library_loader from "../services/library_loader.js";
|
import L from "leaflet";
|
||||||
|
import "leaflet/dist/leaflet.css";
|
||||||
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
import NoteContextAwareWidget from "./note_context_aware_widget.js";
|
||||||
|
|
||||||
const TPL = `\
|
const TPL = `\
|
||||||
@ -21,7 +22,7 @@ const TPL = `\
|
|||||||
<div class="geo-map-container"></div>
|
<div class="geo-map-container"></div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
export type Leaflet = typeof import("leaflet");
|
export type Leaflet = typeof L;
|
||||||
export type InitCallback = (L: Leaflet) => void;
|
export type InitCallback = (L: Leaflet) => void;
|
||||||
|
|
||||||
export default class GeoMapWidget extends NoteContextAwareWidget {
|
export default class GeoMapWidget extends NoteContextAwareWidget {
|
||||||
@ -40,9 +41,6 @@ export default class GeoMapWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
this.$container = this.$widget.find(".geo-map-container");
|
this.$container = this.$widget.find(".geo-map-container");
|
||||||
|
|
||||||
library_loader.requireLibrary(library_loader.LEAFLET).then(async () => {
|
|
||||||
const L = (await import("leaflet")).default;
|
|
||||||
|
|
||||||
const map = L.map(this.$container[0], {
|
const map = L.map(this.$container[0], {
|
||||||
worldCopyJump: true
|
worldCopyJump: true
|
||||||
});
|
});
|
||||||
@ -56,7 +54,5 @@ export default class GeoMapWidget extends NoteContextAwareWidget {
|
|||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||||
detectRetina: true
|
detectRetina: true
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user