Commit c324607d authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

text passage selection now has a default value if there is only 1 citation level

parent b74bbd53
......@@ -41,6 +41,9 @@ export class CorpusDetailPage {
if (Object.keys(this.corpusProvider.currentCorpus.citations).length === 0) {
this.addReferences(this.corpusProvider.currentCorpus.citation_level_1);
}
else {
this.initReffDisplay();
}
this.translateService.get("INVALID_TEXT_RANGE").subscribe((value) => {
this.invalidTextRangeString = value;
});
......@@ -178,6 +181,9 @@ export class CorpusDetailPage {
this.corpusProvider.currentCorpus.citations[relevantCitationIndices[0]].subcitations[relevantCitationIndices[1]].subcitations[citation.value] = citation;
}
});
if (targetCitationLevel === this.corpusProvider.currentCorpus.citation_level_1) {
this.initReffDisplay();
}
});
// , (error: HttpErrorResponse) => {
// // no further references available, go to text display
......@@ -203,4 +209,15 @@ export class CorpusDetailPage {
await new Promise(resolve => setTimeout(resolve, 50));
this.areReffEditable = true;
}
private initReffDisplay() {
if (this.corpusProvider.currentCorpus.citation_level_2 === CitationLevel[CitationLevel.default] && !(this.corpusProvider.currentTextRange.start[0] || this.corpusProvider.currentTextRange.end[0])) {
let availableCitationValues: number[] = Object.keys(this.corpusProvider.currentCorpus.citations).map(Number);
let lowestValue: number = Math.min.apply(Math, availableCitationValues);
if (this.corpusProvider.currentCorpus.citations[lowestValue]) {
this.corpusProvider.currentTextRange.start[0] = this.corpusProvider.currentCorpus.citations[lowestValue].value;
this.corpusProvider.currentTextRange.end[0] = this.corpusProvider.currentCorpus.citations[lowestValue].value;
}
}
}
}
......@@ -22,7 +22,7 @@ import {HelperProvider} from "../../providers/helper/helper";
templateUrl: 'preview.html',
})
export class PreviewPage {
private instructionsFillTheGapString: string;
public instructionsFillTheGapString: string;
FileType = FileType;
FeedBackPage = FeedbackPage;
ExerciseTypeTranslation = ExerciseTypeTranslation;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment