is there a filament-ish intuitive way to listen to paste events on text fields?

i have some dynamic section which generates text fields on the fly.. is there a way i can attach an 'on paste' event to each of them to constantly check if a list of urls was pasted there, and if so - separate those with commas?

Forms\Components\Section::make('Fields')
                    ->icon('heroicon-c-list-bullet')
                    ->visible(function (callable $get) {
                        return (bool) $get('content_type_variation_id');
                    })
                    ->schema(function (callable $get) {
                        $variationId = $get('content_type_variation_id');
                        if (! $variationId) {
                            return [];
                        }
                        $variation = ContentTypeVariation::with('fields')->find($variationId);
                        if (! $variation) {
                            return [];
                        }

                        return $variation->fields->map(function ($field) {
                            $fieldComponent = $field->type == '1'
                                ? Forms\Components\TextInput::make("dynamic_fields.{$field->name}")->numeric()
                                : Forms\Components\TextInput::make("dynamic_fields.{$field->name}");
                            $fieldComponent->label($field->name);
                            $fieldComponent->default(fn ($get) => $get('dynamic_fields')[$field->name] ?? null);
                            if ($field->description) {
                                return Forms\Components\Section::make($field->name)
                                    ->description($field->description)
                                    ->schema([$fieldComponent]);
                            }

                            return $fieldComponent;
                        })->toArray();
                    }),
Was this page helpful?