mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
refactor(geomap): use webpack for importing marker icon (closes #1628)
This commit is contained in:
parent
4c05c8ab5e
commit
ab0213fc3f
4
src/public/app/types-assets.d.ts
vendored
Normal file
4
src/public/app/types-assets.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module "*.png" {
|
||||||
|
var path: string;
|
||||||
|
export default path;
|
||||||
|
}
|
@ -8,12 +8,14 @@ import dialogService from "../../services/dialog.js";
|
|||||||
import type { EventData } from "../../components/app_context.js";
|
import type { EventData } from "../../components/app_context.js";
|
||||||
import { t } from "../../services/i18n.js";
|
import { t } from "../../services/i18n.js";
|
||||||
import attributes from "../../services/attributes.js";
|
import attributes from "../../services/attributes.js";
|
||||||
import asset_path from "../../../../services/asset_path.js";
|
|
||||||
import openContextMenu from "./geo_map_context_menu.js";
|
import openContextMenu from "./geo_map_context_menu.js";
|
||||||
import link from "../../services/link.js";
|
import link from "../../services/link.js";
|
||||||
import note_tooltip from "../../services/note_tooltip.js";
|
import note_tooltip from "../../services/note_tooltip.js";
|
||||||
import appContext from "../../components/app_context.js";
|
import appContext from "../../components/app_context.js";
|
||||||
|
|
||||||
|
import markerIcon from "leaflet/dist/images/marker-icon.png";
|
||||||
|
import markerIconShadow from "leaflet/dist/images/marker-shadow.png";
|
||||||
|
|
||||||
const TPL = /*html*/`\
|
const TPL = /*html*/`\
|
||||||
<div class="note-detail-geo-map note-detail-printable">
|
<div class="note-detail-geo-map note-detail-printable">
|
||||||
<style>
|
<style>
|
||||||
@ -259,9 +261,9 @@ export default class GeoMapTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
#buildIcon(bxIconClass: string, colorClass: string, title: string) {
|
#buildIcon(bxIconClass: string, colorClass: string, title: string) {
|
||||||
return this.L.divIcon({
|
return this.L.divIcon({
|
||||||
html: `\
|
html: /*html*/`\
|
||||||
<img class="icon" src="${asset_path}/app-dist/leaflet/images/marker-icon.png" />
|
<img class="icon" src="${markerIcon}" />
|
||||||
<img class="icon-shadow" src="${asset_path}/app-dist/leaflet/images/marker-shadow.png" />
|
<img class="icon-shadow" src="${markerIconShadow}" />
|
||||||
<span class="bx ${bxIconClass} ${colorClass}"></span>
|
<span class="bx ${bxIconClass} ${colorClass}"></span>
|
||||||
<span class="title-label">${title}</span>`,
|
<span class="title-label">${title}</span>`,
|
||||||
iconSize: [25, 41],
|
iconSize: [25, 41],
|
||||||
|
@ -34,11 +34,6 @@ const config: Configuration = {
|
|||||||
context: "node_modules/@excalidraw/excalidraw/dist/prod/fonts/",
|
context: "node_modules/@excalidraw/excalidraw/dist/prod/fonts/",
|
||||||
from: "**/*",
|
from: "**/*",
|
||||||
to: "excalidraw/fonts/"
|
to: "excalidraw/fonts/"
|
||||||
},
|
|
||||||
{
|
|
||||||
context: "node_modules/leaflet/dist/images/",
|
|
||||||
from: "**/*",
|
|
||||||
to: "leaflet/images/"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@ -108,6 +103,10 @@ const config: Configuration = {
|
|||||||
loader: "sass-loader"
|
loader: "sass-loader"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(png)$/i,
|
||||||
|
type: 'asset/resource'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user