allow HTML in wpt desc, and handle link field

This commit is contained in:
vcoppe
2024-08-09 16:22:32 +02:00
parent 646b77dbb7
commit 143dd71f4a
7 changed files with 184 additions and 11 deletions

View File

@@ -216,7 +216,7 @@ export class GPXFile extends GPXTreeNode<Track>{
let file: GPXFileType = {
attributes: cloneJSON(this.attributes),
metadata: {},
wpt: this.wpt,
wpt: this.wpt.map((wpt) => wpt.toWaypointType(exclude)),
trk: this.trk.map((track) => track.toTrackType(exclude)),
rte: [],
};
@@ -1107,6 +1107,23 @@ export class Waypoint {
return this.attributes.lon;
}
toWaypointType(exclude: string[] = []): WaypointType {
let wpt: WaypointType = {
attributes: this.attributes,
ele: this.ele,
name: this.name,
cmt: this.cmt,
desc: this.desc,
link: this.link,
sym: this.sym,
type: this.type,
};
if (!exclude.includes('time')) {
wpt = { ...wpt, time: this.time };
}
return wpt;
}
clone(): Waypoint {
return new Waypoint({
attributes: cloneJSON(this.attributes),