Plate
PlateEditorsTemplates
GitHub16kGitHub
DiscordDiscord
    • Overview
    • Why This Fork
    • Examples
    • Installing Plite
    • Adding Event Handlers
    • Defining Custom Elements
    • Applying Custom Formatting
    • Executing Commands
    • Saving to a Database
    • Canonical Change Substrate
    • Improving Performance
    • Interfaces
    • Nodes
    • Locations
    • Transforms
    • Document Changes
    • Commands
    • Editor
    • Plugins
    • Rendering
    • Serializing
    • Normalizing
    • Using TypeScript
    • Roots
    • Document State
    • Editing Behavior
    • Selection And DOM
    • Clipboard And Paste
    • Decorations, annotations, and widgets
    • Schema
    • Anchor API
    • Location API
    • Path API
    • PointEntry API
    • Point API
    • Range API
    • Selection API
    • Location Types APIs
    • Span API
    • Editor
    • Element API
    • NodeEntry API
    • Node API
    • Node Types APIs
    • Text API
    • Debug Value Scrubbing
    • Transforms API
    • Plite DOM
    • History Editor API
    • History Plugin Setup
    • History
    • Plite History
    • Plite Hyperscript
    • Plite PaginationExperimental
    • Annotations
    • DOM Coverage Boundaries
    • Editable Component
    • External Text Views
    • Plite React Event Handling
    • Virtualized Rendering
    • Plite React Hooks
    • React Editor Setup
    • React Editor
    • Plite React
    • Plite Component
    • Plite Yjs
    • Plite
    • Migration
    • Contributing
    • FAQ
    • Resources

Debug Value Scrubbing

PreviousNext

Debug scrubber API for redacting values in thrown Plite errors.

Plite formats some thrown error details with document values and nodes. Text fields are redacted by default. Apps that need stricter diagnostics can install a scrubber for additional fields.

Install a scrubber

import { setDebugValueScrubber } from "plitejs";
 
setDebugValueScrubber((key, value) => {
  if (key === "text" || key === "src") return "[redacted]";
  return value;
});
import { setDebugValueScrubber } from "plitejs";
 
setDebugValueScrubber((key, value) => {
  if (key === "text" || key === "src") return "[redacted]";
  return value;
});

Pass null or undefined to restore the default scrubber.

setDebugValueScrubber(null);
setDebugValueScrubber(null);

API

setDebugValueScrubber

declare function setDebugValueScrubber(
  scrubber: DebugValueScrubber | null | undefined
): void;
declare function setDebugValueScrubber(
  scrubber: DebugValueScrubber | null | undefined
): void;

Set the function used before Plite formats debug values.

DebugValueScrubber

type DebugValueScrubber = (key: string, value: unknown) => unknown;
type DebugValueScrubber = (key: string, value: unknown) => unknown;

The custom scrubber runs before Plite's default text redaction. Return the original value to let the default scrubber handle it.

Text APITransforms API

On This Page

Install a scrubberAPIsetDebugValueScrubberDebugValueScrubber
Build your editor
Production-ready AI template and reusable components.
Get all-access