mirror of
https://github.com/codex-team/editor.js
synced 2024-05-19 23:06:49 +02:00
Add generics to OutputBlockData (#1326)
* Add generics to OutputBlockData * Fix typo * Update CHANGELOG.md * Add @template description Co-authored-by: Peter Savchenko <specc.dev@gmail.com> Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
This commit is contained in:
parent
e5fe93eeb5
commit
3bf30f0c1e
|
@ -8,6 +8,7 @@
|
|||
- `Improvements` - Remove bundles from the repo [#1541](https://github.com/codex-team/editor.js/pull/1541).
|
||||
- `Improvements` - Document will be scrolled when blocks are selected with `SHIFT+UP` or `SHIFT+DOWN` [#1447](https://github.com/codex-team/editor.js/issues/1447)
|
||||
- `Improvements` - The caret will be set on editor copy/paste [#1470](https://github.com/codex-team/editor.js/pull/1470)
|
||||
- `Improvements` - Added generic types to OutputBlockData [#1551](https://github.com/codex-team/editor.js/issues/1551).
|
||||
- `Fix` - Fix BlockManager.setCurrentBlockByChildNode() with multiple Editor.js instances [#1503](https://github.com/codex-team/editor.js/issues/1503).
|
||||
- `Fix` - Fix an unstable block cut process [#1489](https://github.com/codex-team/editor.js/issues/1489).
|
||||
- `Fix` - Type definition of the Sanitizer config: the sanitize function now contains param definition [#1491](https://github.com/codex-team/editor.js/pull/1491).
|
||||
|
|
11
types/data-formats/output-data.d.ts
vendored
11
types/data-formats/output-data.d.ts
vendored
|
@ -2,16 +2,19 @@ import {BlockToolData} from '../tools';
|
|||
|
||||
/**
|
||||
* Output of one Tool
|
||||
*
|
||||
* @template Type - the string literal describing a tool type
|
||||
* @template Data - the structure describing a data object supported by the tool
|
||||
*/
|
||||
export interface OutputBlockData {
|
||||
export interface OutputBlockData<Type extends string = string, Data extends object = any> {
|
||||
/**
|
||||
* Too type
|
||||
* Tool type
|
||||
*/
|
||||
type: string;
|
||||
type: Type;
|
||||
/**
|
||||
* Saved Block data
|
||||
*/
|
||||
data: BlockToolData;
|
||||
data: BlockToolData<Data>;
|
||||
}
|
||||
|
||||
export interface OutputData {
|
||||
|
|
Loading…
Reference in a new issue