More work on OpeningHours picker

This commit is contained in:
Pieter Vander Vennet 2020-09-30 22:22:58 +02:00
parent 4cce18f818
commit 0714327d66
11 changed files with 397 additions and 25 deletions

View file

@ -1,4 +1,5 @@
import * as $ from "jquery"
import {Utils} from "../../Utils";
export abstract class OsmObject {
@ -40,16 +41,6 @@ export abstract class OsmObject {
abstract SaveExtraData(element);
/**
* Replaces all '"' (double quotes) by '"'
* Bugfix where names containing '"' were not uploaded, such as '"Het Zwin" nature reserve'
* @param string
* @constructor
*/
private static Escape(string: string) {
return string.replace(/"/g, '"')
.replace(/&/g, "&");
}
/**
* Generates the changeset-XML for tags
@ -60,7 +51,7 @@ export abstract class OsmObject {
for (const key in this.tags) {
const v = this.tags[key];
if (v !== "") {
tags += ' <tag k="' + OsmObject.Escape(key) + '" v="' + OsmObject.Escape(this.tags[key]) + '"/>\n'
tags += ' <tag k="' + Utils.EncodeXmlValue(key) + '" v="' + Utils.EncodeXmlValue(this.tags[key]) + '"/>\n'
}
}
return tags;