mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-26 11:21:16 +01:00
Fix deadlock on getting the focused window
This commit is contained in:
@@ -56,15 +56,14 @@ export function TemplateFunctionDialog({ templateFunction, hide, initialTokens,
|
||||
}, []);
|
||||
|
||||
const tokens: Tokens = useMemo(() => {
|
||||
console.log('HELLO', argValues);
|
||||
const argTokens: FnArg[] = Object.keys(argValues).map((name) => ({
|
||||
name,
|
||||
value:
|
||||
argValues[name] === NULL_ARG
|
||||
? { type: 'null' }
|
||||
: typeof argValues[name] === 'boolean'
|
||||
? { type: 'bool', value: argValues[name] }
|
||||
: { type: 'str', text: argValues[name] ?? '' },
|
||||
? { type: 'bool', value: argValues[name] === true }
|
||||
: { type: 'str', text: String(argValues[name] ?? '') },
|
||||
}));
|
||||
|
||||
return {
|
||||
|
||||
@@ -39,11 +39,12 @@ export function twig({
|
||||
|
||||
const functionOptions: TwigCompletionOption[] =
|
||||
templateFunctions.map((fn) => {
|
||||
const NUM_ARGS = 2;
|
||||
const shortArgs =
|
||||
fn.args
|
||||
.slice(0, 1)
|
||||
.slice(0, NUM_ARGS)
|
||||
.map((a) => a.name)
|
||||
.join(', ') + (fn.args.length > 1 ? ', …' : '');
|
||||
.join(', ') + (fn.args.length > NUM_ARGS ? ', …' : '');
|
||||
return {
|
||||
name: fn.name,
|
||||
type: 'function',
|
||||
|
||||
@@ -37,7 +37,10 @@ class TemplateTagWidget extends WidgetType {
|
||||
}`;
|
||||
elt.title = this.option.invalid ? 'Not Found' : this.option.value ?? '';
|
||||
elt.setAttribute('data-tag-type', this.option.type);
|
||||
elt.textContent = this.option.label;
|
||||
elt.textContent =
|
||||
this.option.type === 'variable'
|
||||
? this.option.name
|
||||
: `${this.option.name}(${this.option.args.length ? '…' : ''})`;
|
||||
elt.addEventListener('click', this.#clickListenerCallback);
|
||||
return elt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user