Studio: automatically detect possible tag values, fix #2103
This commit is contained in:
parent
5a9ae3f104
commit
c176091863
1 changed files with 12 additions and 1 deletions
|
@ -32,12 +32,23 @@
|
||||||
return type.some((t) => mightBeBoolean(t))
|
return type.some((t) => mightBeBoolean(t))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mightBeTag(){
|
||||||
|
const t = schema.type
|
||||||
|
if(!Array.isArray(t)){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const hasAnd = t.some(obj => obj["$ref"] === "#/definitions/{and:TagConfigJson[];}")
|
||||||
|
const hasOr = t.some(obj => obj["$ref"] === "#/definitions/{or:TagConfigJson[];}")
|
||||||
|
const hasString = t.some(obj => obj["type"] === "string")
|
||||||
|
return hasAnd && hasOr && hasString
|
||||||
|
}
|
||||||
|
|
||||||
const isTranslation =
|
const isTranslation =
|
||||||
schema.hints?.typehint === "translation" ||
|
schema.hints?.typehint === "translation" ||
|
||||||
schema.hints?.typehint === "rendered" ||
|
schema.hints?.typehint === "rendered" ||
|
||||||
ConfigMetaUtils.isTranslation(schema)
|
ConfigMetaUtils.isTranslation(schema)
|
||||||
let type = schema.hints.typehint ?? "string"
|
|
||||||
|
|
||||||
|
let type = schema.hints.typehint ?? (mightBeTag() ? "tag" : "string")
|
||||||
let rendervalue =
|
let rendervalue =
|
||||||
(schema.hints.inline ?? schema.path.join(".")) +
|
(schema.hints.inline ?? schema.path.join(".")) +
|
||||||
(isTranslation ? " <b>{translated(value)}</b>" : " <b>{value}</b>")
|
(isTranslation ? " <b>{translated(value)}</b>" : " <b>{value}</b>")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue