mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 10:50:23 +02:00
de364175eb
* feat: Add unique ids for each block * fix: Improve code based on code review * feat(block ids): Use nanoid library for block id generation * Remove unused files * Add tests * Fix lint & test * fix: Remove unnecessary id generation, use nanoid(10) to shorten the id, add changelog and some documentation Also improved some documentation along the lines and fixed linting * Update copy-paste.spec.ts * fix id generation, add api method * Update blocks.spec.ts * update tests Co-authored-by: cobb <kebincheng@yeah.net> Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com> Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com> Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
46 lines
828 B
TypeScript
46 lines
828 B
TypeScript
import {BlockToolData} from '../tools';
|
|
import {BlockTuneData} from '../block-tunes/block-tune-data';
|
|
|
|
/**
|
|
* 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<Type extends string = string, Data extends object = any> {
|
|
/**
|
|
* Unique Id of the block
|
|
*/
|
|
id?: string;
|
|
/**
|
|
* Tool type
|
|
*/
|
|
type: Type;
|
|
/**
|
|
* Saved Block data
|
|
*/
|
|
data: BlockToolData<Data>;
|
|
|
|
/**
|
|
* Block Tunes data
|
|
*/
|
|
tunes?: {[name: string]: BlockTuneData};
|
|
}
|
|
|
|
export interface OutputData {
|
|
/**
|
|
* Editor's version
|
|
*/
|
|
version?: string;
|
|
|
|
/**
|
|
* Timestamp of saving in milliseconds
|
|
*/
|
|
time?: number;
|
|
|
|
/**
|
|
* Saved Blocks
|
|
*/
|
|
blocks: OutputBlockData[];
|
|
}
|