manually merge HTMLAttributes
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
import { Command, Node } from '@tiptap/core'
|
||||
import { Command, Node, mergeAttributes } from '@tiptap/core'
|
||||
import { exitCode } from 'prosemirror-commands'
|
||||
|
||||
export interface HardBreakOptions {
|
||||
HTMLAttributes: {
|
||||
[key: string]: any
|
||||
},
|
||||
}
|
||||
|
||||
const HardBreak = Node.create({
|
||||
name: 'hardBreak',
|
||||
|
||||
defaultOptions: <HardBreakOptions>{
|
||||
languageClassPrefix: 'language-',
|
||||
HTMLAttributes: {},
|
||||
},
|
||||
|
||||
inline: true,
|
||||
|
||||
group: 'inline',
|
||||
@@ -17,7 +28,7 @@ const HardBreak = Node.create({
|
||||
},
|
||||
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return ['br', HTMLAttributes]
|
||||
return ['br', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]
|
||||
},
|
||||
|
||||
addCommands() {
|
||||
|
||||
Reference in New Issue
Block a user