From 84e72fe62224807ba6c40fac03118c658c141199 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 16 Feb 2022 02:24:15 +0100 Subject: [PATCH] Add 'title()' builtin, which can be used as stopgap for some reused questions --- UI/SpecialVisualizations.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/UI/SpecialVisualizations.ts b/UI/SpecialVisualizations.ts index 1feb23b6b..8a4d6a2cb 100644 --- a/UI/SpecialVisualizations.ts +++ b/UI/SpecialVisualizations.ts @@ -859,6 +859,20 @@ export default class SpecialVisualizations { isUploading), t.loginToAddPicture, state) } + }, + { + funcName:"title", + args: [], + docs:"Shows the title of the popup. Useful for some cases, e.g. 'What is phone number of {title()}?'", + example:"`What is the phone number of {title()}`, which might automatically become `What is the phone number of XYZ`.", + constr: (state, tags, args, guistate) => + new VariableUiElement(tags.map(tags => { + const layer = state.layoutToUse.getMatchingLayer(tags) + console.log("Layer for tags", tags,"is", layer.id) + const title = layer?.title?.GetRenderValue(tags) + console.log("Title became: ", title) + return title + })) } ]