NotePlan / NotePlan/plugins

field-level validation in settings

Aperta
#212 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@EduardMe ci sta già lavorando.

Dal 25/1/2022.

enhancement
Lingua principale
JavaScript
Stelle
204
Fork
82
Merge medio
22h 27m
PR unite (30g)
3

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.