Merge pull request #185 from Chrissi2812/inputrule-hr
added markdown rule for horizontal line
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Node } from 'tiptap'
|
||||
import { nodeInputRule } from 'tiptap-commands'
|
||||
|
||||
export default class HorizontalRule extends Node {
|
||||
get name() {
|
||||
@@ -16,4 +17,10 @@ export default class HorizontalRule extends Node {
|
||||
commands({ type }) {
|
||||
return () => (state, dispatch) => dispatch(state.tr.replaceSelectionWith(type.create()))
|
||||
}
|
||||
|
||||
inputRules({ type }) {
|
||||
return [
|
||||
nodeInputRule(/^(?:---|___\s|\*\*\*\s)$/, type),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user