add markInputRule function

This commit is contained in:
Philipp Kühn
2018-08-24 23:53:49 +02:00
parent 6f25288e47
commit b61f95a2a7
5 changed files with 43 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import { Mark } from 'tiptap'
import { toggleMark } from 'tiptap-commands'
import { toggleMark, markInputRule } from 'tiptap-commands'
export default class ItalicMark extends Mark {
@@ -28,4 +28,10 @@ export default class ItalicMark extends Mark {
return toggleMark(type)
}
inputRules({ type }) {
return [
markInputRule(/(?:^|[^\*_])(?:\*|_)([^\*_]+)(?:\*|_)$/, type),
]
}
}