forked from MapComplete/MapComplete
Refactoring: simplify fixQuestionsScript
This commit is contained in:
parent
872464202a
commit
dc62db7dcf
1 changed files with 2 additions and 3 deletions
|
@ -4,7 +4,6 @@ import { LayerConfigJson } from "../src/Models/ThemeConfig/Json/LayerConfigJson"
|
|||
import { QuestionableTagRenderingConfigJson } from "../src/Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
|
||||
import * as fakedom from "fake-dom"
|
||||
import Script from "./Script"
|
||||
import { FixedUiElement } from "../src/UI/Base/FixedUiElement"
|
||||
import { ConversionContext } from "../src/Models/ThemeConfig/Conversion/ConversionContext"
|
||||
|
||||
class ExtractQuestionHint extends DesugaringStep<QuestionableTagRenderingConfigJson> {
|
||||
|
@ -29,7 +28,7 @@ class ExtractQuestionHint extends DesugaringStep<QuestionableTagRenderingConfigJ
|
|||
const parts = q.split(/<br ?\/>/i)
|
||||
if (parts.length == 2) {
|
||||
json.question[language] = parts[0]
|
||||
const txt = new FixedUiElement(parts[1]).ConstructElement().textContent
|
||||
const txt = parts[1]
|
||||
if (txt.length > 0) {
|
||||
hint[language] = txt
|
||||
}
|
||||
|
@ -41,7 +40,7 @@ class ExtractQuestionHint extends DesugaringStep<QuestionableTagRenderingConfigJ
|
|||
) // note: > 0, not >= : we are not interested in a span starting right away!
|
||||
if (divStart > 0) {
|
||||
json.question[language] = q.substring(0, divStart)
|
||||
const txt = new FixedUiElement(q.substring(divStart)).ConstructElement().textContent
|
||||
const txt = q.substring(divStart)
|
||||
if (txt !== "") {
|
||||
hint[language] = txt
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue