NotePlan / NotePlan/plugins

field-level validation in settings

Abierto
#212 1 comentario 0 reacciones 1 asignado Ver en GitHub

@EduardMe ya está trabajando en esto.

Desde el 25/1/2022.

enhancement
Lenguaje dominante
JavaScript
Estrellas
204
Forks
82
Merge medio
22 h 27 min
PR fusionados (30 d)
3

Descripción

in plugin.json > settings, define an (optional) validation function that will get called for each field in the settings, with a signature like:

onConfigFieldValidate(fieldName: string, fieldValue: string | number | ... ): string

The validation function will return an empty string '' if validation passes, or an error message to be displayed (e.g. in red under the field) if it does not pass.

The only tricky bit is when to call the validation function. Feels like the ideal is to do all of:
a) on settings load (when the settings window is brought up)
b) on blur (when someone has entered and left a field)
c) on "Save and close" click (errors would cancel the close)

More discussion here:
https://discord.com/channels/@me/928678751808671865/935560749823164486

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.