Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore: 🤖 remove leaflet css from library_loader
Jinaccf24517914
diff --git a/src/public/app/services/library_loader.ts b/src/public/app/services/library_loader.tsindex 3f8d95c886..04cfa4ff6e 100644--- a/src/public/app/services/library_loader.ts+++ b/src/public/app/services/library_loader.ts@@ -77,10 +77,6 @@ const HIGHLIGHT_JS: Library = {}};-const LEAFLET: Library = {- css: ["node_modules/leaflet/dist/leaflet.css"]-};-async function requireLibrary(library: Library) {if (library.css) {library.css.map((cssUrl) => requireCss(cssUrl));@@ -168,6 +164,5 @@ export default {CODE_MIRROR,CALENDAR_WIDGET,KATEX,- HIGHLIGHT_JS,- LEAFLET+ HIGHLIGHT_JS};diff --git a/src/public/app/widgets/geo_map.ts b/src/public/app/widgets/geo_map.tsindex fabefcdc9f..699d71a511 100644--- a/src/public/app/widgets/geo_map.ts+++ b/src/public/app/widgets/geo_map.ts@@ -1,5 +1,6 @@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";const TPL = `\@@ -21,7 +22,7 @@ const TPL = `\<div class="geo-map-container"></div></div>`;-export type Leaflet = typeof import("leaflet");+export type Leaflet = typeof L;export type InitCallback = (L: Leaflet) => void;export default class GeoMapWidget extends NoteContextAwareWidget {@@ -40,23 +41,18 @@ export default class GeoMapWidget extends NoteContextAwareWidget {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], {- worldCopyJump: true- });+ const map = L.map(this.$container[0], {+ worldCopyJump: true+ });- this.map = map;- if (this.initCallback) {- this.initCallback(L);- }+ this.map = map;+ if (this.initCallback) {+ this.initCallback(L);+ }- L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {- attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',- detectRetina: true- }).addTo(map);- });+ L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {+ attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',+ detectRetina: true+ }).addTo(map);}-}