editor.js/types
John Costa 0ae8075f61
Fix sanitize type to accept per-field SanitizerConfig
The sanitize property on BlockTool and BaseToolConstructable was typed
as SanitizerConfig, which only allows tag-name keys with SanitizerRule
values. In practice, Block Tools return an object mapping data field
names to their own SanitizerConfig (as documented and used by official
plugins like Paragraph and Quote).

This caused TypeScript errors when using functions as sanitizer rules
within per-field configs, since the type system tried to match the
function against TagConfig's { [attr: string]: boolean | string }.

Widen the type to SanitizerConfig | Record<string, SanitizerConfig>
to match the runtime behavior already handled by cleanObject() in
src/components/utils/sanitizer.ts.

Fixes #2957
2026-03-11 19:56:18 -07:00
..
api fix(types): FIx incorrect imports (#2811) 2024-08-13 21:41:08 +03:00
block-tunes fix(types): tools export types added (#2802) 2024-08-09 18:04:57 +03:00
configs Feat (Conversion-config): pass target tool config to the conversionConfig.import method (#2848) 2024-10-17 19:38:02 +03:00
data-formats chore(onChange): bugfix, batching, improvements of ModificationsObserver (#2349) 2023-05-12 20:50:48 +03:00
events/block Fix import in types/events/block/index.ts (#2739) 2024-07-06 20:10:32 +03:00
tools Fix sanitize type to accept per-field SanitizerConfig 2026-03-11 19:56:18 -07:00
utils/popover fix(types): tools export types added (#2802) 2024-08-09 18:04:57 +03:00
index.d.ts fix(types): tools export types added (#2802) 2024-08-09 18:04:57 +03:00