add horizontal rule, fix #170
This commit is contained in:
@@ -4,6 +4,7 @@ export { default as CodeBlock } from './nodes/CodeBlock'
|
||||
export { default as CodeBlockHighlight } from './nodes/CodeBlockHighlight'
|
||||
export { default as HardBreak } from './nodes/HardBreak'
|
||||
export { default as Heading } from './nodes/Heading'
|
||||
export { default as HorizontalRule } from './nodes/HorizontalRule'
|
||||
export { default as Image } from './nodes/Image'
|
||||
export { default as ListItem } from './nodes/ListItem'
|
||||
export { default as Mention } from './nodes/Mention'
|
||||
|
||||
19
packages/tiptap-extensions/src/nodes/HorizontalRule.js
Normal file
19
packages/tiptap-extensions/src/nodes/HorizontalRule.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Node } from 'tiptap'
|
||||
|
||||
export default class HorizontalRule extends Node {
|
||||
get name() {
|
||||
return 'horizontal_rule'
|
||||
}
|
||||
|
||||
get schema() {
|
||||
return {
|
||||
group: 'block',
|
||||
parseDOM: [{ tag: 'hr' }],
|
||||
toDOM: () => ['hr'],
|
||||
}
|
||||
}
|
||||
|
||||
commands({ type }) {
|
||||
return () => (state, dispatch) => dispatch(state.tr.replaceSelectionWith(type.create()))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user