diff --git a/src/UI/InputElement/Helpers/TranslationInput.svelte b/src/UI/InputElement/Helpers/TranslationInput.svelte index 5acca6172..5dd19df48 100644 --- a/src/UI/InputElement/Helpers/TranslationInput.svelte +++ b/src/UI/InputElement/Helpers/TranslationInput.svelte @@ -35,7 +35,6 @@ onDestroy( currentLang.addCallbackAndRunD((currentLang) => { - console.log("Applying current lang:", currentLang) if (!translations.data) { translations.data = {} } diff --git a/src/UI/Popup/TagRendering/TagRenderingEditable.svelte b/src/UI/Popup/TagRendering/TagRenderingEditable.svelte index 4f02228a0..0539bc462 100644 --- a/src/UI/Popup/TagRendering/TagRenderingEditable.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingEditable.svelte @@ -63,7 +63,6 @@ if (config.id === highlighted) { htmlElem.classList.add("glowing-shadow") htmlElem.tabIndex = -1 - console.log("Scrolling to", htmlElem) htmlElem.scrollIntoView({ behavior: "smooth" }) Utils.focusOnFocusableChild(htmlElem) } else { diff --git a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte index 1d6503523..303c0e7c5 100644 --- a/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte +++ b/src/UI/Popup/TagRendering/TagRenderingQuestion.svelte @@ -128,7 +128,6 @@ } freeformInput.addCallbackAndRun((freeformValue) => { - console.log("FreeformValue:", freeformValue) if (!mappings || mappings?.length == 0 || config.freeform?.key === undefined) { return } diff --git a/src/UI/Studio/SchemaBasedField.svelte b/src/UI/Studio/SchemaBasedField.svelte index a32ae76f3..fb094021b 100644 --- a/src/UI/Studio/SchemaBasedField.svelte +++ b/src/UI/Studio/SchemaBasedField.svelte @@ -15,7 +15,24 @@ export let path: (string | number)[] = [] export let schema: ConfigMeta export let startInEditModeIfUnset: boolean = schema.hints && !schema.hints.ifunset - + + function mightBeBoolean(type: undefined | JsonSchemaType): boolean { + if (type === undefined) { + return false + } + if (type["type"]) { + type = type["type"] + } + if (type === "boolean") { + return true + } + if (!Array.isArray(type)) { + return false + } + + return type.some((t) => mightBeBoolean(t)) + } + const isTranslation = schema.hints?.typehint === "translation" || schema.hints?.typehint === "rendered" || @@ -66,6 +83,7 @@ helperArgs, }, } + if (schema.hints.default) { configJson.mappings = [ @@ -77,6 +95,7 @@ schema.hints.default + " will be used. " + (schema.hints.ifunset ?? ""), + hideInAnswer: mightBeBoolean(schema.type) }, ] } else if (!schema.required) { @@ -88,23 +107,7 @@ ] } - function mightBeBoolean(type: undefined | JsonSchemaType): boolean { - if (type === undefined) { - return false - } - if (type["type"]) { - type = type["type"] - } - if (type === "boolean") { - return true - } - if (!Array.isArray(type)) { - return false - } - - return type.some((t) => mightBeBoolean(t)) - } - + if (mightBeBoolean(schema.type)) { configJson.mappings = configJson.mappings ?? [] configJson.mappings.push( @@ -135,7 +138,7 @@ err = path.join(".") + " " + e } let startValue = state.getCurrentValueFor(path) - let startInEditMode = !startValue && startInEditModeIfUnset + let startInEditMode = startValue === undefined && startInEditModeIfUnset const tags = new UIEventSource>({ value: startValue }) try { onDestroy( @@ -156,7 +159,7 @@ if (v === "true" || v === "yes" || v === "1") { return true } - if (v === "false" || v === "no" || v === "0") { + if (v === "false" || v === "no" || v === "0" || ( v) === false) { return false } }