Skip to content

API > @blocksuite/blocks > CodeBlockSchema

Variable: CodeBlockSchema ​

const CodeBlockSchema: object

Type declaration ​

model ​

model: {flavour: "affine:code"; props: PropsGetter< {language: string; text: Text;} >; role: "root" | "hub" | "content";} & {children: never[]; parent: string[]; role: "content"; version: number;}

model.flavour ​

flavour: "affine:code"

model.props ​

props: PropsGetter< {language: string; text: Text;} >

model.role ​

role: "root" | "hub" | "content"

model.children ​

children: never[] = []

model.parent ​

parent: string[]

model.role ​

role: "content" = 'content'

model.version ​

version: number = 1


onUpgrade ​

optional onUpgrade: function

Parameters ​

ParameterType
dataobject
data.languagestring
data.textText
previousVersionnumber
latestVersionnumber

Returns ​

void


transformer ​

optional transformer: function

Returns ​

BaseBlockTransformer< {language: string; text: Text;} >


version ​

version: number

Defined In ​

packages/blocks/src/code-block/code-model.ts:6