add global attributes

This commit is contained in:
Philipp Kühn
2020-10-21 23:55:14 +02:00
parent 9fad9cd476
commit 5dcbdebbb7
7 changed files with 77 additions and 11 deletions

View File

@@ -65,12 +65,31 @@ export default createNode({
content: 'inline*',
createGlobalAttributes() {
return [
{
types: ['paragraph'],
attributes: {
align: {
default: 'right',
renderHTML: attributes => ({
style: `text-align: ${attributes.align}`,
}),
},
},
},
]
},
createAttributes() {
return {
id: {
default: '123',
rendered: true,
renderHTML: attributes => ({ class: `foo-${attributes.id}`, id: 'foo' }),
renderHTML: attributes => ({
class: `foo-${attributes.id}`,
id: 'foo',
}),
},
}
},