fix build for now
This commit is contained in:
41
packages/extension-horizontal-rule/src/index.ts
Normal file
41
packages/extension-horizontal-rule/src/index.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Command, createNode, nodeInputRule } from '@tiptap/core'
|
||||
|
||||
const HorizontalRule = createNode({
|
||||
name: 'horizontalRule',
|
||||
|
||||
group: 'block',
|
||||
|
||||
parseHTML() {
|
||||
return [
|
||||
{ tag: 'hr' },
|
||||
]
|
||||
},
|
||||
|
||||
renderHTML({ attributes }) {
|
||||
return ['hr', attributes]
|
||||
},
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
horizontalRule: (): Command => ({ tr }) => {
|
||||
tr.replaceSelectionWith(this.type.create())
|
||||
|
||||
return true
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
addInputRules() {
|
||||
return [
|
||||
nodeInputRule(/^(?:---|___\s|\*\*\*\s)$/, this.type),
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
export default HorizontalRule
|
||||
|
||||
declare module '@tiptap/core/src/Editor' {
|
||||
interface AllExtensions {
|
||||
HorizontalRule: typeof HorizontalRule,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user