improve fn node
This commit is contained in:
@@ -57,7 +57,11 @@ const DEFAULT_DATA: Record<string, any> = {
|
||||
config: { plantuml: '@startuml\n\n@enduml\n', title: '' },
|
||||
render: {},
|
||||
variable: { value: '', valueType: 'string' },
|
||||
function: { body: '// args[0], args[1], ...\nreturn args[0];' },
|
||||
function: {
|
||||
body: `function(num, kwargs) {
|
||||
return num + (kwargs.bar || 0);
|
||||
}`,
|
||||
},
|
||||
}
|
||||
|
||||
export function getDefaultDataForType(type: string, newId?: string): any {
|
||||
|
||||
@@ -61,7 +61,7 @@ export function nunjucksCompletionSource(
|
||||
}
|
||||
for (const id of functionIds ?? []) {
|
||||
if (!word || id.toLowerCase().startsWith(word.toLowerCase())) {
|
||||
options.push({ label: id, type: 'function', info: 'Function (e.g. ' + id + '(var, 4))' })
|
||||
options.push({ label: id, type: 'function', info: "Filter: {{ '' | " + id + " }}" })
|
||||
}
|
||||
}
|
||||
for (const kw of NUNJUCKS_KEYWORDS) {
|
||||
|
||||
Reference in New Issue
Block a user