Merge pull request #185 from Chrissi2812/inputrule-hr

added markdown rule for horizontal line
This commit is contained in:
Philipp Kühn
2019-02-01 17:55:11 +01:00
committed by GitHub
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),
]
}
}