Add import from notes functionality

This commit is contained in:
Pieter Vander Vennet 2022-01-12 02:31:51 +01:00
parent 2697feebe0
commit 6999a73d44
41 changed files with 545 additions and 1043 deletions

View file

@ -3,13 +3,14 @@ import {UIEventSource} from "../../Logic/UIEventSource";
import BaseUIElement from "../BaseUIElement";
import {Translation} from "../i18n/Translation";
import {SubstitutedTranslation} from "../SubstitutedTranslation";
import FeaturePipelineState from "../../Logic/State/FeaturePipelineState";
export default class InputElementWrapper<T> extends InputElement<T> {
public readonly IsSelected: UIEventSource<boolean>;
private readonly _inputElement: InputElement<T>;
private readonly _renderElement: BaseUIElement
constructor(inputElement: InputElement<T>, translation: Translation, key: string, tags: UIEventSource<any>) {
constructor(inputElement: InputElement<T>, translation: Translation, key: string, tags: UIEventSource<any>, state: FeaturePipelineState) {
super()
this._inputElement = inputElement;
this.IsSelected = inputElement.IsSelected
@ -17,7 +18,12 @@ export default class InputElementWrapper<T> extends InputElement<T> {
mapping.set(key, inputElement)
this._renderElement = new SubstitutedTranslation(translation, tags, mapping)
// Bit of a hack: the SubstitutedTranslation expects a special rendering, but those are formatted '{key()}' instead of '{key}', so we substitute it first
const newTranslations ={}
for (const lang in translation.translations) {
newTranslations[lang] = translation.translations[lang].replace("{"+key+"}", "{"+key+"()}")
}
this._renderElement = new SubstitutedTranslation(new Translation(newTranslations), tags, state, mapping)
}
GetValue(): UIEventSource<T> {