mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-20 06:37:49 +08:00
28 lines
528 B
TypeScript
28 lines
528 B
TypeScript
import { createExtension } from '@tiptap/core'
|
|
|
|
const TextAlign = createExtension({
|
|
addGlobalAttributes() {
|
|
return [
|
|
{
|
|
types: ['paragraph'],
|
|
attributes: {
|
|
align: {
|
|
default: 'left',
|
|
renderHTML: attributes => ({
|
|
style: `text-align: ${attributes.align}`,
|
|
}),
|
|
},
|
|
},
|
|
},
|
|
]
|
|
},
|
|
})
|
|
|
|
export default TextAlign
|
|
|
|
declare module '@tiptap/core/src/Editor' {
|
|
interface AllExtensions {
|
|
TextAlign: typeof TextAlign,
|
|
}
|
|
}
|