inputrule for horizonal-line

This commit is contained in:
Chrissi2812
2019-01-31 16:08:14 +01:00
parent 8d44a4c6fc
commit e27d65390b
3 changed files with 23 additions and 0 deletions

View File

@@ -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),
]
}
}