Commit 0ae8075
committed
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 #29571 parent 530ec56 commit 0ae8075
2 files changed
+13
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | | - | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | | - | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
0 commit comments