Skip to content

Commit aba62e2

Browse files
authored
Merge branch 'next' into proposal/clear-link-tool-state
2 parents 9eb5f54 + 4ea9eb3 commit aba62e2

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 2.31.6
4+
5+
- `Fix` - Widen `sanitize` type on `BlockTool` and `BaseToolConstructable` to accept per-field `SanitizerConfig`
6+
37
### 2.31.5
48

59
- `Fix` - Handle __Ctrl + click__ on links with inline styles applied (e.g., bold, italic)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@editorjs/editorjs",
3-
"version": "2.31.5",
3+
"version": "2.31.6",
44
"description": "Editor.js — open source block-style WYSIWYG editor with JSON output",
55
"main": "dist/editorjs.umd.js",
66
"module": "dist/editorjs.mjs",

types/tools/block-tool.d.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ import { MenuConfig } from './menu-config';
1313
*/
1414
export interface BlockTool extends BaseTool {
1515
/**
16-
* Sanitizer rules description
16+
* Sanitizer rules description.
17+
*
18+
* @example Flat config (tag-level rules applied to all output)
19+
* { b: true, a: { href: true } }
20+
*
21+
* @example Per-field config
22+
* { text: { br: true, b: true }, caption: { b: true, i: true } }
1723
*/
18-
sanitize?: SanitizerConfig;
24+
sanitize?: SanitizerConfig | Record<string, SanitizerConfig>;
1925

2026
/**
2127
* Process Tool's element in DOM and return raw data

types/tools/tool.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,12 @@ export interface BaseToolConstructable {
3737
isInline?: boolean;
3838

3939
/**
40-
* Tool`s sanitizer configuration
40+
* Tool`s sanitizer configuration.
41+
*
42+
* For Block Tools, can be a Record mapping data field names to their SanitizerConfig.
43+
* For Inline Tools, should be a flat SanitizerConfig with tag names as keys.
4144
*/
42-
sanitize?: SanitizerConfig;
45+
sanitize?: SanitizerConfig | Record<string, SanitizerConfig>;
4346

4447
/**
4548
* Title of Inline Tool.

0 commit comments

Comments
 (0)