Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 2.31.6

- `Fix` - Widen `sanitize` type on `BlockTool` and `BaseToolConstructable` to accept per-field `SanitizerConfig`

### 2.31.5

- `Fix` - Handle __Ctrl + click__ on links with inline styles applied (e.g., bold, italic)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.31.5",
"version": "2.31.6",
"description": "Editor.js — open source block-style WYSIWYG editor with JSON output",
"main": "dist/editorjs.umd.js",
"module": "dist/editorjs.mjs",
Expand Down
10 changes: 8 additions & 2 deletions types/tools/block-tool.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@ import { MenuConfig } from './menu-config';
*/
export interface BlockTool extends BaseTool {
/**
* Sanitizer rules description
* Sanitizer rules description.
*
* @example Flat config (tag-level rules applied to all output)
* { b: true, a: { href: true } }
*
* @example Per-field config
* { text: { br: true, b: true }, caption: { b: true, i: true } }
*/
sanitize?: SanitizerConfig;
sanitize?: SanitizerConfig | Record<string, SanitizerConfig>;

/**
* Process Tool's element in DOM and return raw data
Expand Down
7 changes: 5 additions & 2 deletions types/tools/tool.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ export interface BaseToolConstructable {
isInline?: boolean;

/**
* Tool`s sanitizer configuration
* Tool`s sanitizer configuration.
*
* For Block Tools, can be a Record mapping data field names to their SanitizerConfig.
* For Inline Tools, should be a flat SanitizerConfig with tag names as keys.
*/
sanitize?: SanitizerConfig;
sanitize?: SanitizerConfig | Record<string, SanitizerConfig>;

/**
* Title of Inline Tool.
Expand Down