/
block.ts
58 lines (50 loc) · 1.43 KB
/
block.ts
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import {ComponentType, ReactNode} from 'react'
import {RuleDef, ValidationBuilder} from '../../ruleBuilder'
import {InitialValueProperty} from '../../types'
import {ArrayOfType} from './array'
import {BaseSchemaDefinition} from './common'
import {ObjectDefinition} from './object'
/** @public */
export interface BlockOptions {
spellCheck?: boolean
}
/** @public */
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BlockRule extends RuleDef<BlockRule, any[]> {}
/** @public */
export interface BlockDecoratorDefinition {
title: string
value: string
icon?: ReactNode | ComponentType
}
/** @public */
export interface BlockStyleDefinition {
title: string
value: string
}
/** @public */
export interface BlockListDefinition {
title: string
value: string
icon?: ReactNode | ComponentType
}
/** @public */
export interface BlockAnnotationDefinition extends ObjectDefinition {
icon?: ReactNode | ComponentType
}
/** @public */
export interface BlockMarksDefinition {
decorators?: BlockDecoratorDefinition[]
annotations?: ArrayOfType<'object' | 'reference'>[]
}
/** @public */
export interface BlockDefinition extends BaseSchemaDefinition {
type: 'block'
styles?: BlockStyleDefinition[]
lists?: BlockListDefinition[]
marks?: BlockMarksDefinition
of?: ArrayOfType[]
initialValue?: InitialValueProperty<any, any[]>
options?: BlockOptions
validation?: ValidationBuilder<BlockRule, any[]>
}