Add previewArgs support for template functions and enhance validation logic for form inputs

This commit is contained in:
Gregory Schier
2025-11-27 12:55:39 -08:00
parent 0c7034eefc
commit 8d1b17cac1
24 changed files with 340 additions and 92 deletions

View File

@@ -24,6 +24,7 @@ export const plugin: PluginDefinition = {
name: 'regex.match',
description: 'Extract text using a regular expression',
args: [inputArg, regexArg],
previewArgs: [regexArg.name],
async onRender(_ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null> {
const input = String(args.values.input ?? '');
const regex = new RegExp(String(args.values.regex ?? ''));
@@ -37,6 +38,7 @@ export const plugin: PluginDefinition = {
{
name: 'regex.replace',
description: 'Replace text using a regular expression',
previewArgs: [regexArg.name],
args: [
inputArg,
regexArg,