Adding Table Support
This commit is contained in:
20
packages/tiptap-extensions/src/nodes/TableNodes.js
Normal file
20
packages/tiptap-extensions/src/nodes/TableNodes.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { tableNodes } from 'prosemirror-tables'
|
||||
|
||||
export default tableNodes({
|
||||
tableGroup: 'block',
|
||||
cellContent: 'block+',
|
||||
cellAttributes: {
|
||||
background: {
|
||||
default: null,
|
||||
getFromDOM(dom) {
|
||||
return dom.style.backgroundColor || null
|
||||
},
|
||||
setDOMAttr(value, attrs) {
|
||||
if (value) {
|
||||
const style = { style: `${(attrs.style || '')}background-color: ${value};` }
|
||||
Object.assign(attrs, style)
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user