-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathconversion-config.ts
More file actions
26 lines (24 loc) · 880 Bytes
/
conversion-config.ts
File metadata and controls
26 lines (24 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import type { BlockToolData, ToolConfig } from '../tools';
/**
* Config allows Tool to specify how it can be converted into/from another Tool
*/
export interface ConversionConfig {
/**
* How to import data to this Tool.
*
* Can be a String or Function:
*
* 1. String — the key of Tool data object to fill it with imported string on render.
* 2. Function — method that accepts importing string and composes Tool data to render.
*/
import?: ((data: string | object, config: ToolConfig) => BlockToolData) | string;
/**
* How to export this Tool to make other Block.
*
* Can be a String or Function:
*
* 1. String — which property of saved Tool data should be used as exported string.
* 2. Function — accepts saved Tool data and create a string to export
*/
export?: ((data: BlockToolData) => string | object) | string;
}