forked from MapComplete/MapComplete
Add more checks on parsing from JSON, fix of those issues on the builtin themes
This commit is contained in:
parent
8da0893c05
commit
97ec893479
9 changed files with 117 additions and 29 deletions
|
@ -19,7 +19,7 @@ export default class SharePanel extends UIElement {
|
|||
const proposedNameEnc = encodeURIComponent(`wiki:User:${userDetails.name}/${config.data.id}`)
|
||||
|
||||
this._panel = new Combine([
|
||||
"<h2>share</h2>",
|
||||
"<h2>Share</h2>",
|
||||
"Share the following link with friends:<br/>",
|
||||
new VariableUiElement(liveUrl.map(url => `<a href='${url}' target="_blank">${url}</a>`)),
|
||||
"<h2>Publish on OSM Wiki</h2>",
|
||||
|
|
|
@ -14,6 +14,8 @@ import {AndOrTagConfigJson} from "../../Customizations/JSON/TagConfigJson";
|
|||
import {TagRenderingConfigJson} from "../../Customizations/JSON/TagRenderingConfigJson";
|
||||
import {UserDetails} from "../../Logic/Osm/OsmConnection";
|
||||
import {State} from "../../State";
|
||||
import {VariableUiElement} from "../Base/VariableUIElement";
|
||||
import {FromJSON} from "../../Customizations/JSON/FromJSON";
|
||||
|
||||
export default class TagRenderingPanel extends InputElement<TagRenderingConfigJson> {
|
||||
|
||||
|
@ -24,6 +26,8 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
|
|||
private readonly _value: UIEventSource<TagRenderingConfigJson>;
|
||||
public options: { title?: string; description?: string; disableQuestions?: boolean; isImage?: boolean; };
|
||||
|
||||
public readonly validText : UIElement;
|
||||
|
||||
constructor(languages: UIEventSource<string[]>,
|
||||
currentlySelected: UIEventSource<SingleSetting<any>>,
|
||||
userDetails: UserDetails,
|
||||
|
@ -95,12 +99,24 @@ export default class TagRenderingPanel extends InputElement<TagRenderingConfigJs
|
|||
];
|
||||
|
||||
this.settingsTable = new SettingsTable(settings, currentlySelected);
|
||||
|
||||
|
||||
this.validText = new VariableUiElement(value.map((json: TagRenderingConfigJson) => {
|
||||
try{
|
||||
FromJSON.TagRendering(json, options?.title ?? "");
|
||||
return "";
|
||||
}catch(e){
|
||||
return "<span class='alert'>"+e+"</span>"
|
||||
}
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
InnerRender(): string {
|
||||
return new Combine([
|
||||
this.intro,
|
||||
this.settingsTable]).Render();
|
||||
this.settingsTable,
|
||||
this.validText]).Render();
|
||||
}
|
||||
|
||||
GetValue(): UIEventSource<TagRenderingConfigJson> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue