release: v0.19.0
Release v0.19.0. See the `## [0.19.0] — 2026-09-29` section of [CHANGELOG.md](https://github.com/ralksta/immich-folio/blob/dev/CHANGELOG.md) for the full list. Highlights: client proofing links (#683), custom content pages (#738), asset picker search (#740), concurrent-edit detection (#742), env-locked settings (#739), an accessibility baseline (#741), three security fixes with advisories (#737, #755, #759), and a pre-release quality pass (#780–#797). --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: ralksta <ralksta@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Ralf <rohlenbo79@gmail.com> Co-authored-by: Paul Thies <110185070+ImScheinox@users.noreply.github.com> Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com> Co-authored-by: Lance Martin <lancetaylor95@gmail.com>
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
|
||||
import { useEffect, useRef } from 'react';
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import { useDictionary } from './I18nProvider';
|
||||
import { escapeHtml } from '@/lib/escapeHtml';
|
||||
|
||||
export interface LeafletMarker {
|
||||
lat: number;
|
||||
@@ -33,14 +35,14 @@ interface LeafletMapProps {
|
||||
onError?: (err: unknown) => void;
|
||||
}
|
||||
|
||||
/** Escapes special HTML characters for Leaflet's string-based popups and icons. */
|
||||
export function escapeHtml(str: string): string {
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
export { escapeHtml } from '@/lib/escapeHtml';
|
||||
|
||||
/**
|
||||
* Leaflet's attribution prefix with its English link title swapped for
|
||||
* `title`. The rest — link, flag, name — is Leaflet's own markup, kept as is.
|
||||
*/
|
||||
export function localizedLeafletPrefix(prefix: string, title: string): string {
|
||||
return prefix.replace(/title="[^"]*"/, `title="${escapeHtml(title)}"`);
|
||||
}
|
||||
|
||||
export function LeafletMap({
|
||||
@@ -53,6 +55,11 @@ export function LeafletMap({
|
||||
}: LeafletMapProps) {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const mapRef = useRef<L.Map | null>(null);
|
||||
// Read inside the effect through a ref: the locale never changes on a
|
||||
// mounted page, and a new dictionary object must not rebuild the map.
|
||||
const t = useDictionary();
|
||||
const labelsRef = useRef(t.map);
|
||||
labelsRef.current = t.map;
|
||||
|
||||
// Callers rebuild the markers array on every render; the map is only
|
||||
// rebuilt when its content changes.
|
||||
@@ -71,8 +78,17 @@ export function LeafletMap({
|
||||
const L = (await import('leaflet')).default;
|
||||
if (cancelled || !containerRef.current || mapRef.current) return;
|
||||
|
||||
const map = L.map(containerRef.current, { zoomControl: true, attributionControl: true });
|
||||
// The zoom buttons' titles (which Leaflet also uses as their aria-label)
|
||||
// and the credit's link title are English in Leaflet; the site's
|
||||
// dictionary supplies them instead.
|
||||
const labels = labelsRef.current;
|
||||
const map = L.map(containerRef.current, { zoomControl: false, attributionControl: true });
|
||||
mapRef.current = map;
|
||||
L.control.zoom({ zoomInTitle: labels.zoomIn, zoomOutTitle: labels.zoomOut }).addTo(map);
|
||||
const prefix = map.attributionControl.options.prefix;
|
||||
if (typeof prefix === 'string') {
|
||||
map.attributionControl.setPrefix(localizedLeafletPrefix(prefix, labels.leafletTitle));
|
||||
}
|
||||
|
||||
// OpenStreetMap's own tiles: free to use with attribution and a Referer,
|
||||
// which the Referrer-Policy sends. CARTO's Dark Matter, used before,
|
||||
|
||||
Reference in New Issue
Block a user