tracker: better documentation for sanitizer properties

This commit is contained in:
nick-delirium 2024-10-16 11:27:56 +02:00
parent 4a97094c0e
commit 1efe57797c
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 38 additions and 1 deletions

View file

@ -9,8 +9,28 @@ export enum SanitizeLevel {
}
export interface Options {
/**
* Sanitize emails in text DOM nodes
*
* (for inputs, look for obscureInputEmails)
* */
obscureTextEmails: boolean
/**
* Sanitize emails in text DOM nodes
*
* (for inputs, look for obscureInputNumbers)
* */
obscureTextNumbers: boolean
/**
* Sanitize the DOM node based on the returned level
* (Plain = 0, Obscured = 1, Hidden = 2)
*
* higher security levels will override other settings or data-params.
*
* @param node - the DOM node to sanitize
* @returns the level of sanitization to apply
*
* */
domSanitizer?: (node: Element) => SanitizeLevel
}

View file

@ -91,10 +91,27 @@ export const InputMode = {
export type InputModeT = (typeof InputMode)[keyof typeof InputMode]
export interface Options {
/**
* Sanitize numbers from DOM input nodes.
*
* (for plain text nodes, look for obscureTextNumbers)
* */
obscureInputNumbers: boolean
/**
* Sanitize emails from DOM input nodes.
*
* (for plain text nodes, look for obscureTextEmails)
* */
obscureInputEmails: boolean
defaultInputMode: InputModeT
/**
* Sanitize dates from DOM input nodes.
* */
obscureInputDates: boolean
/**
* Default input mode for all input nodes. Higher security level
* will override other settings.
* */
defaultInputMode: InputModeT
}
export default function (app: App, opts: Partial<Options>): void {