Add options to mask texts (#540)

* feat: add options to mask texts

* feat: add the default mask function

* refactor: rename options to identify the difference between  mask text and mask input

* test: add tests about masking

* doc: add options about masking

* chore: bump up rrweb-snapshot version
This commit is contained in:
re-fort
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 861fac54ea
commit b1b25447ff
12 changed files with 895 additions and 10 deletions

View File

@@ -43,11 +43,14 @@ function record<T = eventWithTime>(
blockClass = 'rr-block',
blockSelector = null,
ignoreClass = 'rr-ignore',
maskTextClass = 'rr-mask',
maskTextSelector = null,
inlineStylesheet = true,
maskAllInputs,
maskInputOptions: _maskInputOptions,
slimDOMOptions: _slimDOMOptions,
maskInputFn,
maskTextFn,
hooks,
packFn,
sampling = {},
@@ -203,8 +206,11 @@ function record<T = eventWithTime>(
bypassOptions: {
blockClass,
blockSelector,
maskTextClass,
maskTextSelector,
inlineStylesheet,
maskInputOptions,
maskTextFn,
recordCanvas,
slimDOMOptions,
iframeManager,
@@ -228,8 +234,11 @@ function record<T = eventWithTime>(
const [node, idNodeMap] = snapshot(document, {
blockClass,
blockSelector,
maskTextClass,
maskTextSelector,
inlineStylesheet,
maskAllInputs: maskInputOptions,
maskTextFn,
slimDOM: slimDOMOptions,
recordCanvas,
onSerialize: (n) => {
@@ -396,6 +405,8 @@ function record<T = eventWithTime>(
),
blockClass,
ignoreClass,
maskTextClass,
maskTextSelector,
maskInputOptions,
inlineStylesheet,
sampling,
@@ -403,6 +414,7 @@ function record<T = eventWithTime>(
collectFonts,
doc,
maskInputFn,
maskTextFn,
logOptions,
blockSelector,
slimDOMOptions,