improve extending nodes and marks

This commit is contained in:
Philipp Kühn
2021-02-19 10:54:47 +01:00
parent 4a58978ffb
commit ba69a0d8f9
8 changed files with 60 additions and 106 deletions

View File

@@ -66,7 +66,7 @@ declare module '@tiptap/core' {
}
}
interface NodeSchemaFields<Options> {
interface NodeConfig<Options> {
/**
* Table Role
*/
@@ -89,14 +89,6 @@ export const Table = Node.create<TableOptions>({
allowTableNodeSelection: false,
},
extendNodeSchema(extension) {
const context = { options: extension.options }
return {
tableRole: callOrReturn(extension.config.tableRole, context),
}
},
content: 'tableRow+',
tableRole: 'table',
@@ -265,4 +257,12 @@ export const Table = Node.create<TableOptions>({
}),
]
},
extendNodeSchema(extension) {
const context = { options: extension.options }
return {
tableRole: callOrReturn(extension.config.tableRole, context),
}
},
})