Store plain text version of HTML marker tooltip content
This commit is contained in:
parent
4e8780b3a4
commit
234b2d0a6b
@ -34,7 +34,7 @@ export class GenericMarker extends Marker {
|
|||||||
icon: options.icon,
|
icon: options.icon,
|
||||||
label: options.tooltip,
|
label: options.tooltip,
|
||||||
iconSize: options.dimensions,
|
iconSize: options.dimensions,
|
||||||
isHtml: options.isTooltipHTML,
|
isHtml: !!options.tooltipHTML,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.options.maxZoom = options.maxZoom;
|
this.options.maxZoom = options.maxZoom;
|
||||||
|
@ -34,7 +34,7 @@ import LiveAtlasMapDefinition from "@/model/LiveAtlasMapDefinition";
|
|||||||
import {MutationTypes} from "@/store/mutation-types";
|
import {MutationTypes} from "@/store/mutation-types";
|
||||||
import MapProvider from "@/providers/MapProvider";
|
import MapProvider from "@/providers/MapProvider";
|
||||||
import {ActionTypes} from "@/store/action-types";
|
import {ActionTypes} from "@/store/action-types";
|
||||||
import {titleColoursRegex} from "@/util";
|
import {stripHTML, titleColoursRegex} from "@/util";
|
||||||
|
|
||||||
export default class Pl3xmapMapProvider extends MapProvider {
|
export default class Pl3xmapMapProvider extends MapProvider {
|
||||||
private configurationAbort?: AbortController = undefined;
|
private configurationAbort?: AbortController = undefined;
|
||||||
@ -300,8 +300,8 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
|||||||
dimensions: marker.size ? [marker.size.x || 16, marker.size.z || 16] : [16, 16],
|
dimensions: marker.size ? [marker.size.x || 16, marker.size.z || 16] : [16, 16],
|
||||||
icon: marker.icon || "default",
|
icon: marker.icon || "default",
|
||||||
|
|
||||||
tooltip: (marker.tooltip || '').trim(),
|
tooltip: stripHTML(marker.tooltip),
|
||||||
isTooltipHTML: true,
|
tooltipHTML: marker.tooltip,
|
||||||
popup: marker.popup,
|
popup: marker.popup,
|
||||||
isPopupHTML: true,
|
isPopupHTML: true,
|
||||||
};
|
};
|
||||||
@ -327,8 +327,8 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
|||||||
],
|
],
|
||||||
outline: false,
|
outline: false,
|
||||||
|
|
||||||
tooltip: area.tooltip,
|
tooltip: stripHTML(area.tooltip),
|
||||||
isTooltipHTML: true,
|
tooltipHTML: area.tooltip,
|
||||||
popup: area.popup,
|
popup: area.popup,
|
||||||
isPopupHTML: true,
|
isPopupHTML: true,
|
||||||
};
|
};
|
||||||
@ -349,8 +349,8 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
|||||||
points: area.points,
|
points: area.points,
|
||||||
outline: false,
|
outline: false,
|
||||||
|
|
||||||
tooltip: area.tooltip,
|
tooltip: stripHTML(area.tooltip),
|
||||||
isTooltipHTML: true,
|
tooltipHTML: area.tooltip,
|
||||||
popup: area.popup,
|
popup: area.popup,
|
||||||
isPopupHTML: true,
|
isPopupHTML: true,
|
||||||
};
|
};
|
||||||
@ -366,8 +366,8 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
|||||||
},
|
},
|
||||||
points: line.points,
|
points: line.points,
|
||||||
|
|
||||||
tooltip: line.tooltip,
|
tooltip: stripHTML(line.tooltip),
|
||||||
isTooltipHTML: true,
|
tooltipHTML: line.tooltip,
|
||||||
popup: line.popup,
|
popup: line.popup,
|
||||||
isPopupHTML: true,
|
isPopupHTML: true,
|
||||||
};
|
};
|
||||||
@ -392,10 +392,10 @@ export default class Pl3xmapMapProvider extends MapProvider {
|
|||||||
fillRule: circle.fillRule,
|
fillRule: circle.fillRule,
|
||||||
},
|
},
|
||||||
|
|
||||||
tooltip: circle.tooltip,
|
tooltip: stripHTML(circle.tooltip),
|
||||||
isTooltipHTML: true,
|
tooltipHTML: circle.tooltip,
|
||||||
popup: circle.popup,
|
popup: circle.popup,
|
||||||
isPopupHTML: true
|
isPopupHTML: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import {
|
|||||||
LiveAtlasWorldDefinition
|
LiveAtlasWorldDefinition
|
||||||
} from "@/index";
|
} from "@/index";
|
||||||
import {getPoints} from "@/util/areas";
|
import {getPoints} from "@/util/areas";
|
||||||
import {decodeHTMLEntities, endWorldNameRegex, netherWorldNameRegex, titleColoursRegex} from "@/util";
|
import {decodeHTMLEntities, endWorldNameRegex, netherWorldNameRegex, stripHTML, titleColoursRegex} from "@/util";
|
||||||
import {getLinePoints} from "@/util/lines";
|
import {getLinePoints} from "@/util/lines";
|
||||||
import LiveAtlasMapDefinition from "@/model/LiveAtlasMapDefinition";
|
import LiveAtlasMapDefinition from "@/model/LiveAtlasMapDefinition";
|
||||||
import {
|
import {
|
||||||
@ -302,14 +302,14 @@ export function buildMarker(data: Marker): LiveAtlasPointMarker {
|
|||||||
icon: data.icon || "default",
|
icon: data.icon || "default",
|
||||||
minZoom: typeof data.minzoom !== 'undefined' && data.minzoom > -1 ? data.minzoom : undefined,
|
minZoom: typeof data.minzoom !== 'undefined' && data.minzoom > -1 ? data.minzoom : undefined,
|
||||||
maxZoom: typeof data.maxzoom !== 'undefined' && data.maxzoom > -1 ? data.maxzoom : undefined,
|
maxZoom: typeof data.maxzoom !== 'undefined' && data.maxzoom > -1 ? data.maxzoom : undefined,
|
||||||
tooltip: data.label || '',
|
tooltip: data.markup ? stripHTML(data.label) : data.label,
|
||||||
isTooltipHTML: data.markup || false,
|
tooltipHTML: data.markup ? data.label : undefined,
|
||||||
popup: data.desc || undefined,
|
popup: data.desc || undefined,
|
||||||
isPopupHTML: true,
|
isPopupHTML: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
//Fix double escaping on non-HTML labels
|
//Fix double escaping on non-HTML labels
|
||||||
if(!marker.isTooltipHTML) {
|
if(!marker.tooltipHTML) {
|
||||||
marker.tooltip = decodeHTMLEntities(marker.tooltip);
|
marker.tooltip = decodeHTMLEntities(marker.tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,8 +348,8 @@ export function buildArea(area: MarkerArea): LiveAtlasAreaMarker {
|
|||||||
minZoom: typeof area.minzoom !== 'undefined' && area.minzoom > -1 ? area.minzoom : undefined,
|
minZoom: typeof area.minzoom !== 'undefined' && area.minzoom > -1 ? area.minzoom : undefined,
|
||||||
maxZoom: typeof area.maxzoom !== 'undefined' && area.maxzoom > -1 ? area.maxzoom : undefined,
|
maxZoom: typeof area.maxzoom !== 'undefined' && area.maxzoom > -1 ? area.maxzoom : undefined,
|
||||||
|
|
||||||
tooltip: area.label,
|
tooltip: area.markup ? stripHTML(area.label) : area.label,
|
||||||
isTooltipHTML: area.markup || false,
|
tooltipHTML: area.markup ? area.label : undefined,
|
||||||
popup: area.desc || area.label || undefined,
|
popup: area.desc || area.label || undefined,
|
||||||
isPopupHTML: area.desc ? true : area.markup || false,
|
isPopupHTML: area.desc ? true : area.markup || false,
|
||||||
};
|
};
|
||||||
@ -380,8 +380,8 @@ export function buildLine(line: MarkerLine): LiveAtlasLineMarker {
|
|||||||
minZoom: typeof line.minzoom !== 'undefined' && line.minzoom > -1 ? line.minzoom : undefined,
|
minZoom: typeof line.minzoom !== 'undefined' && line.minzoom > -1 ? line.minzoom : undefined,
|
||||||
maxZoom: typeof line.maxzoom !== 'undefined' && line.maxzoom > -1 ? line.maxzoom : undefined,
|
maxZoom: typeof line.maxzoom !== 'undefined' && line.maxzoom > -1 ? line.maxzoom : undefined,
|
||||||
|
|
||||||
tooltip: line.label,
|
tooltip: line.markup ? stripHTML(line.label) : line.label,
|
||||||
isTooltipHTML: line.markup || false,
|
tooltipHTML: line.markup ? line.label : undefined,
|
||||||
popup: line.desc || line.label || undefined,
|
popup: line.desc || line.label || undefined,
|
||||||
isPopupHTML: line.desc ? true : line.markup || false,
|
isPopupHTML: line.desc ? true : line.markup || false,
|
||||||
};
|
};
|
||||||
@ -419,8 +419,8 @@ export function buildCircle(circle: MarkerCircle): LiveAtlasCircleMarker {
|
|||||||
minZoom: typeof circle.minzoom !== 'undefined' && circle.minzoom > -1 ? circle.minzoom : undefined,
|
minZoom: typeof circle.minzoom !== 'undefined' && circle.minzoom > -1 ? circle.minzoom : undefined,
|
||||||
maxZoom: typeof circle.maxzoom !== 'undefined' && circle.maxzoom > -1 ? circle.maxzoom : undefined,
|
maxZoom: typeof circle.maxzoom !== 'undefined' && circle.maxzoom > -1 ? circle.maxzoom : undefined,
|
||||||
|
|
||||||
tooltip: circle.label,
|
tooltip: circle.markup ? stripHTML(circle.label) : circle.label,
|
||||||
isTooltipHTML: circle.markup || false,
|
tooltipHTML: circle.markup ? circle.label : undefined,
|
||||||
popup: circle.desc || circle.label || undefined,
|
popup: circle.desc || circle.label || undefined,
|
||||||
isPopupHTML: circle.desc ? true : circle.markup || false,
|
isPopupHTML: circle.desc ? true : circle.markup || false,
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ export const updateMarker = (marker: Marker | undefined, options: LiveAtlasPoint
|
|||||||
icon: options.icon,
|
icon: options.icon,
|
||||||
label: options.tooltip,
|
label: options.tooltip,
|
||||||
iconSize: options.dimensions,
|
iconSize: options.dimensions,
|
||||||
isHtml: options.isTooltipHTML,
|
isHtml: !!options.tooltipHTML,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user